[GG] Fuse MXFP8 and BF16 MLA query assembly#174
Merged
Conversation
📝 WalkthroughWalkthroughChangesFused BF16 and MXFP8 MLA query kernels are added through Sparkinfer-backed custom ops, integrated into MLA decode with workspace and fallback handling, and included in CUDA-graph-aware warmup. B12X sparse attention gains compatible workspace views and extensive CPU test coverage. Fused MLA query support
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant MLAAttention
participant B12xMLASparseImpl
participant FusedMLAQueryRunner
participant Sparkinfer
MLAAttention->>B12xMLASparseImpl: request compatible output workspace
B12xMLASparseImpl-->>MLAAttention: return workspace view or None
MLAAttention->>FusedMLAQueryRunner: run BF16 or MXFP8 fused query
FusedMLAQueryRunner->>Sparkinfer: call mla_query.run
Sparkinfer-->>MLAAttention: produce fused query tensor
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
voipmonitor
marked this pull request as draft
July 23, 2026 16:14
voipmonitor
marked this pull request as ready for review
July 23, 2026 16:42
This was referenced Jul 23, 2026
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
Integrates SparkInfer's fused MLA query projection into the GLM MLA path for
both native MXFP8 and materialized BF16
W_UK_Tweights.local-inference-lab/sparkinfer#74.local-inference-lab/sparkinfer#75.[M,H,576]directly and appendsq_pewithout aseparate concat kernel.
_q_scale.staged path.
The integration imports the final public API,
sparkinfer.gemm.mla_query_projection; the obsoletesparkinfer.attention.mla_querypath is not restored.Layout and topology behavior
confirms an unpadded BF16 layout.
continue through their established gather/copy path.
qualified; UV warmup is unchanged.
allocations.
supports_quant_query_input; the fused BF16 query remains valid for DCP.Safety scope and PR 173
This PR removes the query-side
torch.bmmfrom qualified H=8/11/16,M=1..32 execution, but it does not supersede #173. Unsupported shapes,
missing SparkInfer support, or failed capability checks still use the staged
query BMM. #173 remains the no-copy cuBLAS read-ahead fix for that fallback.
Merge #173 first, then refresh this PR so its safe operation is retained only
behind the fused-path fallback.
The downstream V up-projection is a separate issue already fixed by #147 and
local-inference-lab/sparkinfer#54.Performance evidence
Exact paired TP8/DCP1/MTP0 profiling, averaged over eight ranks:
No extra hot-path synchronization appeared. Final TP8/DCP1/MTP0 duration
validation on GPUs 0-7 produced aggregate 87.658/87.610 tok/s (mean 87.634)
and active per-user 88.359/88.313 tok/s (mean 88.336), with zero errors.
E2E topology matrix
All values are aggregate CC1 output tok/s. Every 64k case includes the full
prefill-to-decode transition. Models were fully loaded before benchmarks, and
parallel instances were measured sequentially.
All workers logged fused-query warmup. The final log audit found no traceback,
Xid, illegal-memory-access,
CUBLAS_STATUS,FAULT_PDE, invalid-layout, orengine-initialization failure.
Validation
tests: 14 passed.
prefill-to-decode transitions passed.
compileall, andgit diff --checkpassed.Dependencies
local-inference-lab/sparkinfer#74local-inference-lab/sparkinfer#75