fix ssd cache assoc wave32#162
Open
aryaman-gupta wants to merge 5 commits into
Open
Conversation
The SSD 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. Derive cache_assoc from the device warp size in SSDIntNBitTableBatchedEmbeddingBags and the Turbo SSD serving sizing math instead, and make the module-level ASSOC an unconditional 32 fallback. Co-Authored-By: Claude <noreply@anthropic.com>
…esolver Add a shared device_cache_assoc() resolver in tbe/ssd/common.py (the single source of truth: device warp size, ASSOC fallback when no device) and use it from both inference and serving. The inference module now validates an explicit cache_assoc against the resolved warp size and raises on a mismatch, so callers cannot silently request a broken cache geometry. Tests patch the resolver to exercise the 64-way path on any device. Co-Authored-By: Claude <noreply@anthropic.com>
Keeps the sets x ways formulation, reading the per-instance cache_assoc rather than total element count. Co-Authored-By: Claude <noreply@anthropic.com>
Restore the simulated_assoc64 test names, sim_assoc variable, and baseline docstrings/comments, changing only the patch target to device_cache_assoc. Reword "way" to "slot" in cache-associativity comments for clarity. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The SSD inference cache (
SSDIntNBitTableBatchedEmbeddingBagsand the Turbo SSD serving path) hardcoded associativity to 64 on ROCm. The cache kernels scan one slot per warp lane, so on wave32 (RDNA, e.g. gfx1201) the hostallocated 64-way sets that the kernel only half-scanned — slots 32–63 were unreachable, producing incorrect lookups.
This derives the associativity from the device warp size instead (32 on NVIDIA, either 32 or64 on AMD) via a shared
device_cache_assoc()resolver intbe/ssd/common.py, used by both inference and serving sizing math. An explicitcache_assocargument is validated against the resolved warp size and raises on mismatch, so callers cannot silently request a broken geometry. The module-levelASSOCis now an unconditional 32 fallback for the no-device path.Test plan
SSDInferenceAssocWarpSizeTest(runs in OSS, no RocksDB) — passes on gfx1201, asserts associativity == device warp size.SSDInferenceAMDSupportTestto assert againstcache_assoc; the simulated-ASSOC=64 tests now patchdevice_cache_assocto exercise the 64-way path on any device.