MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / Next

Method Next

oneflow/core/embedding/persistent_table.cpp:165–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163 ~ChunkIteratorImpl() override = default;
164
165 void Next(uint32_t num_keys, uint32_t* return_keys, void* keys, void* values) override {
166 uint32_t count = 0;
167 while (count < num_keys && pos_ != n_) {
168 const uint64_t index_in_chunk = chunk_indices_[pos_] - chunk_index_offset_;
169 static_cast<Key*>(keys)[count] = chunk_keys_[index_in_chunk];
170 const uint64_t block_in_chunk = index_in_chunk / num_values_per_block_;
171 const uint32_t index_in_block = index_in_chunk - block_in_chunk * num_values_per_block_;
172 const uint32_t value_offset =
173 block_in_chunk * logical_block_size_ + index_in_block * value_size_;
174 std::memcpy(static_cast<char*>(values) + count * value_size_,
175 static_cast<const char*>(chunk_values_) + value_offset, value_size_);
176 count++;
177 pos_++;
178 }
179 *return_keys = count;
180 }
181
182 void Reset() override { pos_ = 0; }
183

Callers 1

NextMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected