Repository navigation
Conversation
computeCopyPerThread greedily set copyKPerThread = gcd(maxVlen, copyPerThread). For narrow types (int4: maxVlen = 128/4 = 32) this can exceed kPerBlock (e.g. 16), so a thread would copy more K elements than the block tile holds, tripping "gemmA per thread copy smaller than per block copy, incoherent tuning parameters" and failing to legalize rock.gridwise_gemm_accel. This is exactly the int4 decode GEMV (M=1, kPerBlock=16) case on gfx1151/RDNA3.5 WMMA; f16 (maxVlen=8) and int4 prefill (kPerBlock=32 configs) were unaffected. Cap the K-vectorization at kPerBlock: copyKPerThread = gcd(gcd(maxVlen, copyPerThread), kPerBlock). Still divides copyPerThread and maxVlen, and thread tiling is unchanged (copyKPerThread*copyDPerThread == copyPerThread). Unblocks in-kernel int4 decode; f16/prefill paths unchanged.
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
In
computeCopyPerThread(thekpack != 1/ K-vectorization branch), the LDS-copy K-vectorization width ismaxVlen = 128 / elem_bits. For int4 that is 32, so the greedycopyKPerThread = gcd(maxVlen, copyPerThread)can exceed the tile'skPerBlock(e.g. 16 for the M=1 decode GEMV configs). A thread then tries to copy 32 K-elements from a 16-deep block tile → "gemmA per thread copy smaller than per block copy, incoherent tuning parameters" →rock.gridwise_gemm_accelfails to legalize, so the int4 M=1 GEMV has no valid kernel.Fix — cap the K-copy vectorization at
kPerBlock:copyKPerThread = gcd(gcd(maxVlen, copyPerThread), kPerBlock);copyKPerThreadstill divides bothcopyPerThreadandmaxVlen, and the thread tiling is unchanged (copyK*copyD == copyPerThread, so(kPerBlock/copyK)*(dPerBlock/copyD) == blockSizestill holds). FP16 (maxVlen = 8) and int4 prefill (configs withkPerBlock = 32) are unaffected; only the narrow-type case wheremaxVlen > kPerBlockchanges.This makes the in-kernel int4 M=1 decode GEMV compile on gfx1151 (RDNA3.5, WMMA), unblocking int4 (W4A16) LLM decode.
Test plan