Skip to content

[KK] NVFP4-CSF: expand the next layer's scales during its attention - #979

Closed
voipmonitor wants to merge 2 commits into
feat/kk-fp4-csffrom
perf/b12x-csf-scale-prefetch-kk
Closed

voipmonitor wants to merge 2 commits into
feat/kk-fp4-csffrom
perf/b12x-csf-scale-prefetch-kk

Conversation

@voipmonitor

Copy link
Copy Markdown

Canonical twin of #978 (merged into the Karmic beta as ff292a9c), on feat/kk-fp4-csf. It needs b12x expand_scales / bind(scales_expanded=...): local-inference-lab/b12x#478 on master's CSF chain (twin of b12x#477).

After a layer's MoE, Nvfp4CsfMoEMethod expands the following layer's scales on a side stream, ordered after that MoE. The following layer waits for it and skips its own expansion, so the expansion overlaps the following layer's attention. A prefetch is used only by the next layer of the same forward pass; any pending expansion is waited for before the shared scratch is used; CUDA graph capture is untouched. VLLM_B12X_CSF_SCALE_PREFETCH=0 turns it off.

Differences from the beta commit: this base has no A4 prefill (#970/#977 are in #972), so a step prefetches when its call is above b12x's stage-read limit (A16 calls of more than 1,536 tokens). The A4 prefill-row case comes with #972. The test is adapted to match. The release fragment is byte-identical to the beta one.

Evidence (beta, glm53-tp2, two RTX PRO 6000 Max-Q): A16 8K/32K prefill 7,672/7,925 → 7,763/8,058 tok/s; with A4 (beta only) 10,032/10,312 → 10,254/10,620. Decode unchanged; needle-checksum A16 498/495/497, A4 495/490/492.

Tests: tests/quantization/test_nvfp4_csf.py 10 passed (one RTX PRO 6000, this branch's files over the beta image). ruff check / ruff format --check: clean.

AI-assisted (Claude Code); reviewed and run by the submitter.

🤖 Generated with Claude Code

voipmonitor and others added 2 commits October 4, 2026 16:48
Layers of an NVFP4-CSF model share one scale scratch, and every eager prefill
call expanded its experts' scales into it serially before its MoE (4% of a
GLM-5.3 glm53-tp2 A4 prefill, with nothing overlapping). After a layer's MoE
the method now expands the following layer's scales on a side stream, ordered
after that MoE, and the following layer waits for it and binds with
scales_expanded=True (b12x expand_scales). Only eager steps that expand -
A4 prefill rows or A16 calls above the stage-read limit - prefetch; CUDA graph
capture, decode-only steps and other forward passes are untouched, and any
pending expansion is waited for before the scratch is used.
VLLM_B12X_CSF_SCALE_PREFETCH=0 turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 53c7474)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit fcad04e)
@voipmonitor
voipmonitor requested a review from mgoin as a code owner October 4, 2026 16:48
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • dev/*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a4f6bd1a-dac2-44b5-b7c8-cacff395808b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@voipmonitor

Copy link
Copy Markdown
Author

Closing: superseded by Luke's reworked NVFP4-CSF scale prefetch in dev/karmic-kraken (a13af3f).

@voipmonitor voipmonitor closed this Oct 8, 2026
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