Support padded K for a8w8 bpreshuffle GEMM#3611
Open
ThomasNing wants to merge 1 commit into
Open
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
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.
What
Add an opt-in K-padding path for a8w8 bpreshuffle GEMM:
shuffle_weight(..., pad_k_to=...)pads the weight tensor's last dimension before preshuffle.gemm_a8w8_bpreshuffleaccepts padded preshuffled weights by zero-paddingXQtoWQ.shape[-1]before config lookup and kernel dispatch.gemm_a8w8_bpreshufflerejectsWQ.shape[-1] < XQ.shape[-1]with a clear error.The default behavior is unchanged because
pad_k_to=0.Why
SGLang compressed-tensors FP8 loading can produce valid a8w8 GEMM shapes whose K dimension is not aligned for bpreshuffle/tuned CKTile dispatch. One real GLM-4.5-Air FP8 shape on MI300X is
K=10944; padding it to11008allows the preshuffled path to run, but the dynamic activation must be padded consistently at GEMM dispatch time.Downstream can work around this in SGLang, but the robust behavior belongs in AITER because AITER owns both
shuffle_weightandgemm_a8w8_bpreshuffle.Tests
Added
op_tests/test_gemm_a8w8_bpreshuffle_pad_k.pycovering:shuffle_weight(..., pad_k_to=128)pads the last dim and records original/padded K metadata.gemm_a8w8_bpreshufflepadsXQbefore backend dispatch whenWQis wider.gemm_a8w8_bpreshufflerejects a shorterWQ.Local syntax check:
Related
Mixed-dtype GQA attention support request for CK Tile: ROCm/composable_kernel#3744