Skip to content

epic: realize low-precision / quantized performance on the OpenXLA (IREE) backend #570

Closed

Description

@inureyes

Context

The OpenXLA / StableHLO backend (crate src/lib/mlxcel-xla, ADR docs/adr/0004-compute-backend-session-seam-and-stablehlo-family.md) runs the same portable graph on any IREE target (CPU, CUDA, Metal, and future NPUs via IREE HAL drivers). It is a portability / parity path, not a hand-tuned engine; MLX stays the primary Apple-Silicon backend.

Epic #513 landed the transferable low-precision arc up to f16 / bf16. Building on that:

The measured fusion gate (GB10, Grace-Blackwell, CUDA)

On GB10 with a source-built IREE CUDA runtime (Llama-3.2-1B 4-bit, greedy, warm vmfb) the packed path is token-exact with the f16 path but ~4.3x slower (~1.6 vs ~6.7 tok/s), GPU util 84% -> 96%.

Root cause: IREE's CUDA codegen does not fuse the in-graph unpack + dequant into the matmul. The decode step is ~678 dispatches and the reconstructed f32 weight is materialized to DRAM every step, so the packed path pays MORE bandwidth and compute than f16. iree-compile fusion flags (--iree-dispatch-creation-enable-aggressive-fusion, --iree-opt-generalize-matmul, --iree-dispatch-creation-enable-early-trunc-fusion) leave the dispatch count essentially unchanged (678 -> 677).

Conclusion: the memory-bandwidth payoff of quantization is not realized by authoring the dequant in the portable graph alone. It requires the TARGET to fuse dequant -> matmul (a quantized-matmul op / int8 dot_general lowering). ADR 0004 already scopes per-backend fused kernel codegen as upstream IREE's job; this epic operates exactly at that boundary.

Thesis

Land the low-precision performance that IS achievable on the IREE targets today, and de-risk the part that is not:

  1. Fusion-free win. Upload the resident (non-quantized) weights as f16 instead of f32, halving the per-step weight DRAM read with no dequant and no fusion required. This is enabled directly by the per-dtype weight ABI from feat: int8/int4 packed weight quantization on the OpenXLA path (#516) #568.
  2. Reproducible toolchain. Wrap the source-built IREE runtime (CUDA / Metal) in make targets so the measurement environment is reproducible rather than a local uncommitted artifact.
  3. De-risk fusion with a spike that separates what is in-tree-achievable from what is upstream IREE work, then implement the fused quantized-matmul if in-tree-achievable, reversing the feat: int8/int4 packed weight quantization on the OpenXLA path (#516) #568 regression.

Non-goals

  • Chasing MLX on Apple Silicon. MLX stays the default and primary Apple-Silicon backend; this is the portability path.
  • Hand-writing Metal / CUDA kernels outside IREE, or tuning IREE's per-backend codegen (upstream work).
  • New model families (use the existing config-driven emitter coverage).

Epic acceptance (functionally integrated deliverable)

By epic close, on a GPU IREE target:

Each piece must be wired into the real generation path and the default behavior, not left as a standalone module. References: ADR 0004, #513, #516 / #568.

Sub-issues

Phase 0

Phase 1

Phase 2

Phase 3

Activity

  1. added
    type:enhancementNew features, capabilities, or significant additions
    area:inferenceGeneration, sampling, decoding (incl. speculative, DRY)
    on Jul 1, 2026
  2. inureyes commented on Jul 2, 2026

    @inureyes
    MemberAuthor

    Epic status: core acceptance met; the fused path characterized as upstream

    Implemented sequentially on GB10 (this epic is hardware-in-the-loop and spike-driven, so autonomous parallel worktrees were not a good fit). Three of the four sub-issues are landed on main; the fourth is characterized as upstream per the spike.

    Landed

    Characterized as upstream

    Deferred

    Against the epic acceptance:

  3. added and removed on Jul 2, 2026
  4. self-assigned this
    on Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:inferenceGeneration, sampling, decoding (incl. speculative, DRY)priority:highHigh prioritystatus:doneCompletedtype:enhancementNew features, capabilities, or significant additions

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions