Skip to content

Commit

Permalink
added check to avoid div 0 errors in cache report (#1645)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1645

as in title

Reviewed By: jianyuh

Differential Revision: D44096435

fbshipit-source-id: efe1b8149c3301feac7fd9c8ac2e7ea03fcb2df7
  • Loading branch information
Xiao Sun authored and facebook-github-bot committed Mar 18, 2023
1 parent 54eeae2 commit be4931d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions fbgemm_gpu/fbgemm_gpu/split_table_batched_embeddings_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,10 +979,11 @@ def print_uvm_cache_stats(self) -> None:
f"N_conflict_unique_misses: {uvm_cache_stats[4]}\n"
f"N_conflict_misses: {uvm_cache_stats[5]}\n"
)
logging.info(
f"unique indices / requested indices: {uvm_cache_stats[2]/uvm_cache_stats[1]}\n"
f"unique misses / requested indices: {uvm_cache_stats[3]/uvm_cache_stats[1]}\n"
)
if uvm_cache_stats[1]:
logging.info(
f"unique indices / requested indices: {uvm_cache_stats[2]/uvm_cache_stats[1]}\n"
f"unique misses / requested indices: {uvm_cache_stats[3]/uvm_cache_stats[1]}\n"
)

def prefetch(self, indices: Tensor, offsets: Tensor) -> None:
self.timestep += 1
Expand Down Expand Up @@ -2347,10 +2348,11 @@ def print_uvm_cache_stats(self) -> None:
f"N_conflict_unique_misses: {uvm_cache_stats[4]}\n"
f"N_conflict_misses: {uvm_cache_stats[5]}\n"
)
logging.info(
f"unique indices / requested indices: {uvm_cache_stats[2]/uvm_cache_stats[1]}\n"
f"unique misses / requested indices: {uvm_cache_stats[3]/uvm_cache_stats[1]}\n"
)
if uvm_cache_stats[1]:
logging.info(
f"unique indices / requested indices: {uvm_cache_stats[2]/uvm_cache_stats[1]}\n"
f"unique misses / requested indices: {uvm_cache_stats[3]/uvm_cache_stats[1]}\n"
)

@torch.jit.export
def prefetch(self, indices: Tensor, offsets: Tensor) -> None:
Expand Down

0 comments on commit be4931d

Please sign in to comment.