Skip to content

Commit fd38c25

Browse files
PerfAICT Botfacebook-github-bot
authored andcommitted
Reserve temp_kv bucket space by miss count to avoid rehashing (#5912)
Summary: X-link: facebookresearch/FBGEMM#2831 Reviewed By: kunalspathak Differential Revision: D108763406
1 parent 93221e9 commit fd38c25

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fbgemm_gpu/src/dram_kv_embedding_cache/dram_kv_inference_embedding.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ class DramKVInferenceEmbedding
303303
// the blocking time for inference read
304304

305305
std::unordered_map<int64_t, weight_type*> temp_kv;
306+
temp_kv.reserve(miss_info.size());
306307
auto* pool = kv_store_.pool_by(shard_id);
307308
auto mem_pool_lock = pool->acquire_lock();
308309
for (auto& [id, tensor_offset] : miss_info) {

0 commit comments

Comments
 (0)