cuda: give the token-tile ldmatrix its shared state space - #748
Open
pmasala wants to merge 1 commit into
Open
Conversation
The PTX carried no state space qualifier, so ptxas assumed generic addressing and emitted a shared-window base subtraction ahead of every LDSM, corrupting an address tt_smem_addr had already converted; any prefill of 128 tokens or more died on it. Closes antirez#734
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.
Fixes #734.
The three ldmatrix wrappers carried no state space qualifier, so the PTX asks
for generic addressing, while the operand comes from tt_smem_addr(), that is
__cvta_generic_to_shared(). ptxas then subtracts the shared window base from an
address that is already relative. SASS on sm_89, the same kernel twice:
That killed every batch prefill of 128 tokens or more under --ssd-streaming,
which is where the token-tile gate engages. Whether ptxas emits the conversion
is a toolchain decision, so the same source can be fine on CUDA 12 and fatal on
CUDA 13.
Verified with DS4_CUDA_MMQ=0 and no other workaround: 128 / 512 / 2048 / 8192
tokens in one chunk, plus 2048 with --prefill-chunk 256 and 512, all clean and
coherent. The 8192-token prefill used to die even with
DS4_CUDA_NO_WINDOW_ATTENTION=1, so that was the same defect. At 2048 tokens the
token-tile path now gives 9.60 t/s against 7.91 for the generic fallback.
RTX 3500 Ada 12 GB (sm_89), CUDA 13.0, WSL2, DeepSeek-V4-Flash IQ2_XXS 80.8 GB.