@@ -777,6 +777,10 @@ class DramKVEmbeddingCache : public kv_db::EmbeddingKVDB {
777
777
const at::Tensor& count,
778
778
int64_t width_offset = 0 ,
779
779
std::optional<int64_t > width_length = std::nullopt ) {
780
+ auto read_count = count.scalar_type () == at::ScalarType::Long
781
+ ? *(count.data_ptr <int64_t >())
782
+ : *(count.data_ptr <int32_t >());
783
+ read_num_counts_ += read_count;
780
784
// assuming get is called once each iteration and only by train
781
785
// iteration(excluding state_dict)
782
786
auto start_ts = facebook::WallClockUtil::NowInUsecFast ();
@@ -1330,7 +1334,7 @@ class DramKVEmbeddingCache : public kv_db::EmbeddingKVDB {
1330
1334
std::vector<double > get_dram_kv_perf (
1331
1335
const int64_t step,
1332
1336
const int64_t interval) {
1333
- std::vector<double > ret (23 , 0 ); // num metrics
1337
+ std::vector<double > ret (24 , 0 ); // num metrics
1334
1338
if (step > 0 && step % interval == 0 ) {
1335
1339
int reset_val = 0 ;
1336
1340
@@ -1377,6 +1381,8 @@ class DramKVEmbeddingCache : public kv_db::EmbeddingKVDB {
1377
1381
auto dram_bwd_l1_cnflct_miss_write_missing_load_ =
1378
1382
bwd_l1_cnflct_miss_write_missing_load_avg_.exchange (reset_val);
1379
1383
1384
+ auto read_num_counts = read_num_counts_.exchange (reset_val);
1385
+
1380
1386
ret[0 ] = dram_read_total_duration / interval;
1381
1387
ret[1 ] = dram_read_sharding_total_duration / interval;
1382
1388
ret[2 ] = dram_read_cache_hit_copy_duration / interval;
@@ -1404,6 +1410,7 @@ class DramKVEmbeddingCache : public kv_db::EmbeddingKVDB {
1404
1410
ret[21 ] = get_map_actual_used_chunk_in_bytes ();
1405
1411
1406
1412
ret[22 ] = get_num_rows ();
1413
+ ret[23 ] = read_num_counts / interval;
1407
1414
}
1408
1415
return ret;
1409
1416
}
@@ -1659,6 +1666,8 @@ class DramKVEmbeddingCache : public kv_db::EmbeddingKVDB {
1659
1666
std::atomic<int64_t > inplace_update_hit_cnt_{0 };
1660
1667
std::atomic<int64_t > inplace_update_miss_cnt_{0 };
1661
1668
1669
+ std::atomic<int64_t > read_num_counts_{0 };
1670
+
1662
1671
bool disable_random_init_;
1663
1672
}; // class DramKVEmbeddingCache
1664
1673
0 commit comments