Repository navigation
docs: fusion spike findings for the packed int8 path (#573) - #578
Merged
Merged
Conversation
Measure whether IREE's CUDA codegen fuses the packed int4/int8 dequant into the matmul, so the reconstructed weight is not materialized to DRAM every decode step. Adds scripts/xla/fusion_spike.sh (reproducible: static decode dispatch count via `iree-compile --compile-to=flow`, an 11-config flag sweep, and dequant / f16 / int8 matmul microtests) and records the result in the mlxcel-xla README. Finding (GB10, IREE 3.11.0rc @ e4a3b04): no in-tree lever fuses it. The flag sweep stays at 677-678 dispatches; the dequant is always a separate elementwise dispatch (the one-matmul microtest is 2 dispatches under every flag); data-tiling encodings and ukernels (the facilities that carry a fused quantized matmul) are gated to hip / rocm / llvm-cpu, not cuda; and a bare int8 dot_general lowers but upcasts i8 -> i32 with no int8 tensor cores. The fused kernel is upstream IREE work; the realized in-tree bandwidth win is f16-resident weights (#572). #574 ships the minimal in-tree packed representation (bf16 scales) and tracks upstream. Part of #570
This was referenced Jul 2, 2026
be-free-snowboy
pushed a commit
to freestylejs/snowbrain-mlxcel
that referenced
this pull request
Oct 27, 2026
…blup#578) Measure whether IREE's CUDA codegen fuses the packed int4/int8 dequant into the matmul, so the reconstructed weight is not materialized to DRAM every decode step. Adds scripts/xla/fusion_spike.sh (reproducible: static decode dispatch count via `iree-compile --compile-to=flow`, an 11-config flag sweep, and dequant / f16 / int8 matmul microtests) and records the result in the mlxcel-xla README. Finding (GB10, IREE 3.11.0rc @ e4a3b04): no in-tree lever fuses it. The flag sweep stays at 677-678 dispatches; the dequant is always a separate elementwise dispatch (the one-matmul microtest is 2 dispatches under every flag); data-tiling encodings and ukernels (the facilities that carry a fused quantized matmul) are gated to hip / rocm / llvm-cpu, not cuda; and a bare int8 dot_general lowers but upcasts i8 -> i32 with no int8 tensor cores. The fused kernel is upstream IREE work; the realized in-tree bandwidth win is f16-resident weights (lablup#572). lablup#574 ships the minimal in-tree packed representation (bf16 scales) and tracks upstream. Part of lablup#570
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
Part of #570. The #573 spike measures whether IREE's CUDA codegen can fuse the packed int4/int8 dequant into the matmul, so the reconstructed weight is not materialized to DRAM every decode step. Deliverable: a reproducible measurement harness (
scripts/xla/fusion_spike.sh) and a findings section in themlxcel-xlaREADME.Method
The fusion signal is the static decode dispatch count:
iree-compile --compile-to=flowon the real packed decode graph, countingflow.dispatch. tok/s is end-to-end through the mlxcel binary.scripts/xla/fusion_spike.shreproduces the baseline, an 11-config flag sweep, and three one-matmul microtests (dequant then matmul, bare f16, bare int8).Findings (GB10, IREE 3.11.0rc @ e4a3b04, Llama-3.2-1B 4-bit)
linalg.quantized_matmul/ ukernels are CUDA-unavailable. Data-tiling encodings and ukernels, the facilities that carry a fused quantized matmul, are gated to hip/rocm/llvm-cpu, not cuda.dot_generallowers, but upcasts. A barei8 x i8 -> i32matmul compiles to one CUDA kernel (like f16), but the codegen upcasts i8 -> i32 (17sext, zerodp4a/mma.*.s8): no int8 tensor cores, so int8 would not beat f16 here.Split and recommendation for #574
MLXCEL_XLA_QUANT=packed, and fold in the bf16 scales/biases limitation (extend the packed emitter + loader to accept bf16 scales, matching fix(xla): load bf16 affine quant scales in the OpenXLA weight loader #569's dequant-at-load broadening: the emitter declares the.scales/.biasesargs, currently f16, as bf16 when the checkpoint stores them bf16, and the loader uploads the raw bf16 bytes with a bf16 dtype code). It does not attempt an int8-beats-f16 fusion win in-tree (not achievable per the measurements above).Closes #573
Part of #570