Skip to content

Fixes unit test failures by deriving nbit inference cache associativity from device warp size#161

Closed
aryaman-gupta wants to merge 1 commit into
jeff_5804from
aryaman/fix-nbit-uvm-cache-wave32
Closed

Fixes unit test failures by deriving nbit inference cache associativity from device warp size#161
aryaman-gupta wants to merge 1 commit into
jeff_5804from
aryaman/fix-nbit-uvm-cache-wave32

Conversation

@aryaman-gupta

Copy link
Copy Markdown

The nbit inference cache hardcoded associativity to 64 on ROCm, but the cache kernels scan one way per warp lane, so on wave32 (RDNA) half the ways were unreachable, corrupting UVM cache stats and codegen lookups.

This led to failures in the following unit tests:

  • FBGEMM_TEST_WITH_ROCM=1 HIP_LAUNCH_BLOCKING=1 FBGEMM_TBE_ROCM_INFERENCE_PACKED_BAGS=1 pytest fbgemm_gpu/test/tbe/inference/nbit_cache_test.py::test_nbit_uvm_cache_stats
  • FBGEMM_TEST_WITH_ROCM=1 HIP_LAUNCH_BLOCKING=1 FBGEMM_TBE_ROCM_INFERENCE_PACKED_BAGS=1 pytest fbgemm_gpu/test/tbe/inference/nbit_split_embeddings_test.py::test_int_nbit_split_embedding_uvm_caching_codegen_lookup_function

This PR derives cache_assoc from the device warp size instead, and make DEFAULT_ASSOC an unconditional 32 fallback.

The nbit inference cache hardcoded associativity to 64 on ROCm, but the
cache kernels scan one way per warp lane, so on wave32 (RDNA) half the
ways were unreachable, corrupting UVM cache stats and codegen lookups.
Derive cache_assoc from the device warp size instead, and make
DEFAULT_ASSOC an unconditional 32 fallback.

Co-Authored-By: Claude <noreply@anthropic.com>
@aryaman-gupta

Copy link
Copy Markdown
Author

Merged into PR (pytorch#5804) branch in pytorch@bccfd22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant