Skip to content

perf(mla): fuse expanded K/V packing and FP8 quantization - #105

Open
Stone749990226 wants to merge 1 commit into
infrawaves_ppu/prod/v0.5.21from
feat/expand-mha-fp8-pack
Open

Stone749990226 wants to merge 1 commit into
infrawaves_ppu/prod/v0.5.21from
feat/expand-mha-fp8-pack

Conversation

@Stone749990226

Copy link
Copy Markdown

perf(mla): fuse expanded K/V packing and FP8 quantization

Base: Infrawaves/sglang:infrawaves_ppu/prod/v0.5.21
Head: feat/expand-mha-fp8-pack

Motivation

TRTLLM FP8 expanded-MHA prefill materializes K in BF16/FP16 before converting K/V to FP8. Fuse these steps to reduce intermediate allocations and memory traffic for both the current chunk and cached prefix chunks.

Modifications

  • Add pack_mla_kv_fp8: concatenate KNope and broadcast positional K, copy V, optionally gather token rows, and quantize K/V in one Triton launch.
  • Connect current-chunk and prefix-chunk preparation to the native TRTLLM FP8 backend. Preserve the existing paths for backend subclasses and other dtypes.
  • Preserve per-tensor K/V scales and skip repeated quantization of packed FP8 tensors. Match PyTorch's unit-scale overflow behavior and use direct FP32-to-FP8 conversion to avoid extra rounding on SM89.

Port pack_mla_kv_fp8 from feat/mlacp into TRTLLM FP8 prefill for both the current chunk and cached prefix chunks. Preserve per-tensor scales and avoid repeated quantization of packed K/V. Include core dispatch and quantization regressions plus CUDA numerical cases.
@Stone749990226
Stone749990226 marked this pull request as ready for review November 5, 2026 14:36
Nozom1ff added a commit that referenced this pull request Nov 7, 2026
The per-node MLA host tests (ported with the #99-#105 net diff) still
passed v0.5.23's mamba_layer_mapping/use_mla and unpacked two values;
the day-0 assembler takes start_layer and returns (group, controller,
config). The pool-host mocks are unchanged and still need a run on GPU.

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant