Repository navigation
gpu: select native FP4 prompt builds on GB10 - #758
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: GB10 target selection makes the static test suites fail.
Must fix
1. Give the card fixtures a synthetic compute capability
tools/ref/card-tests/run.sh:895 expects the unset target to be sm_86, but box() clears BLOOMERY_ARCH and exposes the real nvidia-smi. On GB10 the selector returns sm_121a: this diagnostic differs, and the accepted sm_86 case at line 898 returns 64. The gate.sh fixture at line 1354 likewise clears the target and expects sm_86.
These failures prevent contributors on the target card from completing just check-recipes. Fixing the fixtures with the selector change keeps the static checks usable.
After creating $tmp/stub at line 734, add:
printf '%s\n' '#!/bin/sh' 'printf "%s\n" 8.6' > "$tmp/stub/nvidia-smi"
chmod +x "$tmp/stub/nvidia-smi"After creating $GS/stub at line 1347, reuse that fixture:
cp "$tmp/stub/nvidia-smi" "$GS/stub/"2. Change the target explicitly when checking the freeze mutant
tools/nightly/selftest.sh:179 inherits the caller's environment, while snapshot evaluation at line 168 forces sm_121a. With BLOOMERY_ARCH=sm_121a, the arch-freeze mutant still produces the expected commands. valid remains true, so line 184 fails a healthy tree. An unset target on GB10 has the same result.
Set a different target for the execution phase now so the mutation test checks freezing on every machine.
Replace line 179 with:
actual = subprocess.run(["env", "BLOOMERY_ARCH=sm_86", "just", "gate-probe"], cwd=work / arm, capture_output=True, text=True)Non-blocking
⚠ Complete the timing evidence: justfile:13 changes the default used by the speed comparison. The body gives summaries and an upstream base hash, but no tested head hash or exact timing commands with their output. Add those so the measurements meet CONTRIBUTING.md's evidence contract.
Checked
Complexity: no Rust functions changed.
Silent failure: the architecture-query error returns 64, and the box and gate callers propagate it.
Tests: in-memory checks reproduced the GB10 box refusals and gate target mismatch. The replay freeze mutant was traced through snapshot selection, execution and the final assertion. The inline suggestion replaces an added line and parses as Python.
Gates: the ownership rewrite has PIN(2026-10-24); no numeric pins moved.
Escape catalog: neither finding matches C1–C4. No ledger lessons are in force.
Notes
Full suites were not rerun: just is unavailable. The timing-evidence question remains non-blocking under the review contract.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
| box = work / arm / "tools/box.sh" | ||
| box.write_text('#!/bin/sh\nprintf "%s\\n" "$*"\n') | ||
| box.chmod(0o755) | ||
| actual = subprocess.run(["just", "gate-probe"], cwd=work / arm, capture_output=True, text=True) |
There was a problem hiding this comment.
Use a target different from snapshot evaluation so the freeze mutant is rejected when the caller selects sm_121a.
| actual = subprocess.run(["just", "gate-probe"], cwd=work / arm, capture_output=True, text=True) | |
| actual = subprocess.run(["env", "BLOOMERY_ARCH=sm_86", "just", "gate-probe"], cwd=work / arm, capture_output=True, text=True) |
857af62 to
ff85f25
Compare
There was a problem hiding this comment.
Since the last review:
- Card fixtures: fixed at tools/ref/card-tests/run.sh:735; both fixture paths use the synthetic card.
- Replay freeze check: fixed at tools/nightly/selftest.sh:179; execution explicitly switches to
sm_86. - Timing evidence: still open at justfile:13, as detailed below.
Verdict: CLEAN: Both earlier blocking defects are fixed; no must-fix finding remains.
Non-blocking
⚠ Complete the timing evidence: justfile:13 changes the default used by the comparison. The body still omits the tested head hash and exact timing commands with their output. Add these to meet CONTRIBUTING.md's evidence list. This evidence request is non-blocking under the review rules.
Checked
Duplicates: no new functions, types or constants in the interdiff; the gate fixture reuses the synthetic card.
Complexity: no Rust functions changed.
Silent failure: the selector's query failure returns 64; the interdiff adds no fallback or discarded result.
Tests: static tracing confirms that execution at sm_86 differs from snapshot selection at sm_121a when the freeze at tools/batch-replay.sh:92 is removed. The PTX self-test clears the caller's target before its child processes run.
Gates: no pins or tolerances moved in the interdiff.
Escape catalog: no C1–C4 match. No ledger lessons are in force.
Notes
No Rust file changed; dryer and crapper did not run.
Validation used static inspection; test suites were not rerun.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
GB10에서 빌드가 기본으로 sm_121a를 골라, NVFP4와 FP4-Local routed prompt가 이미 있는 네이티브 FP4 경로로 돌게 해 prefill과 첫 토큰 시간을 줄이는 속도 PR입니다.
Part of #565. Tracked in #699.
What and why
On a GB10 the recipes built for
sm_86unlessBLOOMERY_ARCHwas set, so the routed prompt GEMM for NVFP4 and FP4-Local weights never used the FP4 tensor-core path that the tree already has forsm_121a. A user had to know the target and give it by hand.This PR makes the build target selection live in one place,
tools/arch.sh, and lets the justfile and every tool that inspects a build read it:BLOOMERY_ARCHunset,arch.shreads the compute capability fromnvidia-smi. One card at capability 12.1, or several cards that all report 12.1, selectsm_121a. Any other card, a mixed set, or a machine withoutnvidia-smikeepssm_86. Annvidia-smiquery that errors is itself an error that asks for an explicitBLOOMERY_ARCH. An explicit value is kept as given, and an empty or malformed one is refused by name.archfrombash tools/arch.shand exports it, so recipes build with--arch {{arch}}and the gate, LDS, SASS and PTX scanners see the same target the build used.tools/check-recipes.shholds the new owner shape (onearchdefinition, one export, no second default) and runs the selection against a fakenvidia-smifor card sets, overrides and refusals, through the script and through the sourced function.tools/lds-scan.shandtools/ptx-spill-check.shfix their fixture target tosm_86so their self-tests do not depend on the visible card.lds-scan.shalso gets a case for an LDS entry-count read that errors, which the scanner already refused but no test covered.tools/box.shreads whether the caller setBLOOMERY_ARCHbefore it runs the selection, so a remote command exports the target once, and its refusal names thetools/arch.shselection as the default. Thetools/gpu-gate.shself-test clearsBLOOMERY_ARCHfor its stub tree, as the card tests already do.tools/ptx-compare.shrefuses aBLOOMERY_ARCHother thansm_86, the target its scan builds at, with a named error (rc 64), astools/ptx-scan.shandtools/narrow-scan.shalready do; on a GB10 the comparison runs withBLOOMERY_ARCH=sm_86set explicitly.tools/batch-replay.shcopiestools/arch.shinto each snapshot and fixes the snapshot'sarchto its evaluated value before it builds the command table, so the replay runs recipes and matches their keys as before. A base without anarchvariable keeps its own commands.tools/nightly/selftest.shchecks both cases.sm_86and let the host driver answer depend on the machine they run on. The fixtures now supply their own card (results under Tests and FAIL-first). The card tests' box and gate fixtures put a stubnvidia-smithat reports capability 8.6 on their privatePATH, so they expectsm_86on any machine, and the replay self-test runs its freeze check with an explicitBLOOMERY_ARCH=sm_86. Theptx-compareself-test's concurrent children clearBLOOMERY_ARCHlike its other cases.sdoverride that overflows to infinity:card.py checkrefuses it as malformed (rc 65).docs/contrib/dgx-spark.mdshows thesm_121abuild command and describes the default.With this change a GB10 build runs the routed prompt GEMM for NVFP4 and FP4-Local with both weights and activations in FP4. Other routed formats keep their activation format, and decode is unchanged. The kernels are not touched. The change reaches the rank count only through the build target, which does not depend on it.
Release notes: Changed: GB10 builds select
sm_121aby default, which speeds up NVFP4 and FP4-Local prompt processing.Code shape
bloomery_archintools/arch.sh, and the justfile, the recipes and the scanners read that one function. The old default in the justfile is gone, andcheck-recipes.shrejects a second definition.sm_86default and the document text that described it are removed.BLOOMERY_ARCHand a malformed one are named errors.check-recipes.shwas rewritten for the new owner shape and carries a datedPIN, with a case that rejects the old per-recipe default.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up. No Rust file changed.Duplication found or removed (
path:line), or "none": none.What I ran
Hardware: one DGX Spark (GB10) for the timed run and the gate.
The build container reports CUDA 13.3 for the toolchain; the line above is the driver's.
Speed
Both trees were built on the same machine, main for
sm_121and the head forsm_121a. Models are the FP4-Local foldernvidia/Qwen3.8-Flash-Next-FP4-Localat revisionb9ce18a6887e18c089fdea8509a33e63429a3300and the NVFP4 foldernvidia/Qwen3.8-Flash-Next-NVFP4at revisionfc694b54fb0174e0913e6adf86691ef85a4ead47. Each arm loaded the server once with the draft off, then ran three rounds of two greedy requests with 4,096 prompt tokens and 128 output tokens, one request at a time. Main and head alternated in one lease, and the order was reversed between the two checkpoints. Each checkpoint's first warm load was discarded, and load time is kept out of the numbers. A cell is the median of the three rounds, and TTFT is the p95 over each round's two requests. The GPU clock cap was lifted for each arm and restored after it.FP4-Local: Prefill +4.43%, TTFT -3.91%, Decode +0.43%; NVFP4: Prefill +5.36%, TTFT -5.74%, Decode +0.75%
Each head round beats every main round on prefill and TTFT for both checkpoints (FP4-Local prefill: main rounds 1306.6 to 1309.5, head rounds 1331.4 to 1368.5; NVFP4 prefill: main rounds 1286.6 to 1326.3, head rounds 1373.7 to 1381.3; FP4-Local TTFT: main rounds 3160.6 to 3164.1, head rounds 3026.7 to 3136.7; NVFP4 TTFT: main rounds 3104.1 to 3221.9, head rounds 2983.5 to 3002.9). That is three rounds per arm, not a significance test. The decode differences are inside the rounds' own spread (FP4-Local decode: main rounds 30.14 to 30.43, head rounds 30.31 to 30.70), and I do not claim a decode gain. The prompt path is the one the change affects.
A kernel profile of one extra 4,096-token request with two output tokens on FP4-Local, taken in the third round and left out of the medians, shows the routed GEMM switching from
gemm_nvfp4ptogemm_nvfp4_mma:That is 16.41% less routed GEMM GPU time on the same request. I did not profile the NVFP4 checkpoint.
The read probe of each arm stayed between 232.872 and 238.990 GB/s, against a 236.625 GB/s read ceiling measured at the end of the same session, and no arm's decode rate stands out from its tree.
The timed head had the same
justfile,tools/arch.shand documentation change as this PR's head; the commits after it change only tool scripts and their self-tests, which the build and the server do not run. The timings were taken on upstream main501db04fand are not a fresh measurement of the current main.Output parity
All 24 regular requests returned 128 tokens with no error. Both checkpoints were run on two windows of the corpus, three rounds each. On the first window the head's 128 greedy tokens equal main's in all three rounds on both checkpoints. On the second window they differ in all three rounds, first at token 22 (counting from 0) for FP4-Local and at token 102 for NVFP4, with the same text in every round of a tree. The tokens continue Python code in both trees. FP4-Local's head continues with
super().__instancecheck__(instance)where main continues with_abc_instancecheck(cls, instance). I saw no nonsense tokens, endless repetition or device fault, but I did not judge the code's correctness against an oracle. The difference is expected: the routed prompt now rounds its activations to FP4. A user who wants more activation precision can setBLOOMERY_ARCHto the old target or pick a higher precision checkpoint format. KL was not measured, because the client does not collect log probabilities.Tests and FAIL-first
The native FP4 GEMM gate, built on each tree, on the card above:
On main's
sm_121build the native case refuses to run by name. On the head the same case succeeds, including the two refused-alignment checks and the product cases withwrong=0andeager_graph_eq=true. No gate band, tolerance or eager/graph contract changed.The selection is checked by
bash tools/check-recipes.sh --block archowner(15 ownership fixtures and 22 selection cases),bash tools/lds-scan.sh --self-test(11 cases) andbash tools/ptx-spill-check.sh --self-test, which all pass. FAIL-first: thearchownerfixtures include the old per-recipe default (env_var_or_default) and fail on it, and the LDS case fails when the entry-count guard is removed fromlds-scan.sh.FAIL-first for the fixtures: on a GB10 (card, driver and CUDA lines above),
env -u BLOOMERY_ARCH just check-recipeson the tree before the fixture fixes failed withcard-tests: 903 tests, 5 failed. The five failures are thebox.shunset-target refusal, its accepted default entry, its two export assertions and thegate.shdefault build target, which built forsm_121awhere the test expectedsm_86. Theptx-compareself-test also failed (slow rc 64, fast rc 64): its two concurrent children call the script directly and inherited the caller's target, which the new refusal rejects. The self-test now clears the caller's target once at entry, which covers every child.After the fixes, on the same GB10,
env -u BLOOMERY_ARCH just check-recipesandBLOOMERY_ARCH=sm_121a just check-recipesboth end withcard-tests: 903 tests, 0 failed,ptx-compare: self-test ok (37 cases, 0 failed)andcheck-recipes: 145 blocks ran, 0 skipped by a green input key.The replay self-test did not fail on its own before the change:
BLOOMERY_ARCH=sm_121a bash tools/nightly/selftest.sh --self-test --output-onlypassed (28/28) on the earlier tree. Its freeze check now selectssm_86explicitly so that it does not depend on the caller's target.just check-recipespasses on this head on an x86 Linux machine and on a GB10, there both withBLOOMERY_ARCHunset and withBLOOMERY_ARCH=sm_121a, each withcard-tests: 903 tests, 0 failed,gpu-gate self-test: 169 of 169 okandptx-compare: self-test ok (37 cases, 0 failed). The newptx-comparerefusal case fails when the refusal is removed. FAIL-first for the new card case: with the finite check incard.pyremoved, the same card is accepted as under margin (rc 71) instead of refused.just gate-gpu-qwen38-serveand the other model gates were not run: they need the maintainers' workstation.Reproduction
For the timing, build the head and upstream main from their own trees, with
BLOOMERY_ARCHunset on the head (sm_121a) andsm_121on main, serve each checkpoint withBLOOMERY_DRAFT=off, and send greedy requests with 4,096 prompt tokens and 128 output tokens on fresh corpus windows.What I ran into
This does not block the PR.
BLOOMERY_ARCH=sm_121from an outer launcher overrides the new default. To get the native FP4 path, leave it unset or namesm_121a.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.