Skip to content

improve read/write performance by 100% #4150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions fbgemm_gpu/src/dram_kv_embedding_cache/dram_kv_embedding_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ class DramKVEmbeddingCache : public kv_db::EmbeddingKVDB {
CHECK_EQ(indices.size(0), weights.size(0));
{
auto wlmap = kv_store_.by(shard_id).wlock();

auto indices_data_ptr = indices.data_ptr<index_t>();
for (auto index_iter = indexes.begin();
index_iter != indexes.end();
index_iter++) {
const auto& id_index = *index_iter;
auto id = indices[id_index].template item<index_t>();
auto id = int64_t(indices_data_ptr[id_index]);
wlmap->try_emplace(
id,
StoreValue<weight_type>(std::vector<weight_type>(
Expand Down Expand Up @@ -255,16 +255,16 @@ class DramKVEmbeddingCache : public kv_db::EmbeddingKVDB {
") types mismatch");
auto row_storage_data_ptr =
init_storage.template data_ptr<weight_type>();

auto wlmap = kv_store_.by(shard_id).wlock();
auto indices_data_ptr = indices.data_ptr<index_t>();
{
for (auto index_iter = indexes.begin();
index_iter != indexes.end();
index_iter++) {
const auto id_index = *index_iter;
auto weights_data_ptr =
weights.data_ptr<weight_type>();
auto id = indices[id_index].template item<index_t>();
auto wlmap = kv_store_.by(shard_id).wlock();
auto id = int64_t(indices_data_ptr[id_index]);
const auto cached_iter = wlmap->find(id);
if (cached_iter == wlmap->end()) {
fill_from_row_storage(
Expand Down
Loading