Conversation
FP8 weight storage does not imply that kv_b_proj accepts FP8 activations. Use the layer's model dtype when projecting FP8 prefill context, preserving the explicit ModelOpt weight-only override and other packed-weight paths. Cover the activation passed to kv_b_proj by DCP context attention and tighten the existing Kimi-K3 fused/generic prefill regression contract. Co-authored-by: Roger Wang <hey@rogerw.io> Co-authored-by: Codex <noreply@openai.com> Signed-off-by: Summer Yang <girasoleyang@gmail.com>
GirasoleY
requested review from
AndreasKaratzas,
DarkLight1337,
LucasWilkinson,
MatthewBonanni and
ywang96
as code owners
September 14, 2026 23:42
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.
Purpose
Fix MLA context attention passing FP8 activations into an MXFP8
kv_b_projthat requires FP16/BF16 inputs. With FP8 prefill and FP8 KV cache, the gathered latent can remaintorch.float8_e4m3fn; selecting the projection input dtype from its stored weight causesInput dtype must be float16 or bfloat16, got torch.float8_e4m3fn.Use
kv_b_proj.params_dtypefor this FP8-prefill case. Both generic and DCP context paths already share the helper. Preserve the explicit ModelOpt FP8 block weight-onlyinput_dtypeoverride and the existing packed-weight / non-FP8-prefill behavior. Weight and KV-cache storage formats are unchanged.Add one CPU regression that checks the activation actually passed to
kv_b_projafter DCP gather/reorganization. Tighten the existing Kimi-K3 fused-versus-generic test fixture to enforce the MXFP8 activation contract without adding another test matrix.Duplicate check: searched open PRs/issues for MLA dtype, MXFP8 prefill, and DCP. #37245 addresses INT8 weight casts, not this MXFP8 activation contract. The ModelOpt-specific handling from #49381 is retained. No open PR addressing this fix was found. The NIXL symmetric hybrid-DCP work is already upstream in #55531 and is outside this PR.
AI assistance: Codex assisted with the upstream port, regression coverage, validation, and this description.
Test Plan
Run the existing context suites:
Check that
test_dcp_context_projects_mxfp8_latent_from_bf16fails with the original helper from public baseba2ae9f23961ac67bc5c055da8c26fbd660989c6, and passes with the fix. The negative control restores only the original helper in memory; the test and call path are identical.Run the repository's pre-commit hooks on the three changed files, plus
pre-commit run mypy-3.12 --hook-stage manual --files <changed files>.Test Result
torch.float8_e4m3fn != torch.bfloat16at the assertion on the projection input.PYTHONPATHand test-process-only overrides:vllm.utils.torch_utils.PIN_MEMORY = Falseandtorch.accelerator.empty_host_cache = lambda: None. These avoid macOS allocator/cleanup crashes; no attention or dtype implementation was replaced in the passing run. The initial unmodified pytest invocation completed the focused assertion but crashed in PyTorch host-cache cleanup.git diff --checkpassed.Essential Elements of an Effective PR Description Checklist