Repository navigation
tools: check every PTX shape table for missing entries and filtered pins - #709
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: The filtered comparison and per-table checks preserve the pinning contract.
Checked
Duplicates: 0 new functions, types or constants. The existing comparison loop now owns all tables. No dryer pairs were available.
Complexity: No Rust files changed.
Silent failure: Three sites followed: two empty-row defaults and the missing-module-owner branch. Missing required rows reach named unpinned errors.
Tests: Python parsing and shell syntax checks pass. The PR reports both self-tests and the full-tree name check passing. At tools/ptx-spill-check.sh:741, removing filtering would fail the filtered-scan assertions; rejecting an empty filter would break the unfiltered assertion. Dropping the stale or unpinned comparison would break its new assertion. At tools/check-ptx-names.py:683, skipping secondary tables would break the missing-row, filtered-row and explicit-path assertions. Requiring or omitting conditional entries at line 688 would break the target assertions. Additional cases reject a missing default row, an unrecognized binary and a source guard that does not match the table.
Gates: 87 rows added, none removed. Three spill pins lowered; each has a dated PIN with measurement conditions. The PR records failure before the fixes and success afterward.
Escape catalog: No changed code matches C1–C4. No inference hot path changed.
Notes
Dryer and crapper did not run because no Rust file changed.
GPU evidence is incomplete: the PR includes the GB10/driver identification and scan summaries, but lacks the paired commit hashes and exact just gate-* commands with output.
🔨 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. |
PTX 기준표의 누락을 모든 표에서 검사하고, 범위를 좁힌 검사가 범위 밖 pin을 오판하지 않게 고칩니다.
Part of #565. Tracked in #699.
What and why
Two checks guard the per-kernel PTX resource tables in
tools/ref/ptx-shapes/, and both had a gap.tools/ptx-spill-check.shbuilds the expected pin set for a binary from every row of its table, but the scan it compares against only covers entries that match the binary's name filter (for examplegate_qwen3vl_tower:vis_). A valid pin outside the filter was reported asstale. This came in with0a3ff0259466.tools/check-ptx-names.pycompared only the first table against the declared kernels in both directions. The tables beside it were checked for stale rows only, so a kernel could lose its row there and the static check said nothing. This came in with84f77b01bef2(tools: gate-ptx-spill reads a table per PTX arch and card capability, with cc 12.1 tables for sm_86 and sm_121 #170). Kernel additions in3ee9c8af7d01ande53cabebbb9b(gpu: normalize independent BF16 output heads to MXFP8 #665),8c8b5e7cdb50(gpu: HC prompt projections use the shared BF16 tensor-core dispatch #693) and5b302b32abb6(qwen38: load the checkpoint folder MTP draft in its stored formats #682) left rows out of the cc 12.1 tables, ande4364b6cb65d(gpu: run routed NVFP4 prompt GEMM on FP4 tensor cores #687) added an incomplete native table. On a cc 12.1 card the spill gate then reportsunpinnedentries.Changes:
tools/ptx-spill-check.shapplies the scan's substring filter to the expected pins too. Stale, unpinned and spill differences inside the filter still fail.tools/check-ptx-names.pyruns one comparison for every table. Each table must hold the unconditional entries, and a target-only module's entries are required in the tables whose# cfg:line matches the module's guard. A row in another table no longer excuses a missing one. The# cfg:guards are read once per source file.tools/ref/ptx-shapes/sm_86-cc12.1.tsvgets 42 rows,sm_121-cc12.1.tsvgets 42 rows andsm_121a-cc12.1.tsvgets three rows, taken from a scan on a DGX Spark.sm_121spill pins fords41_expert_gate_up_tiles(716 to 680),kq_gate_up_act_q4k_tiles(756 to 752) andkq_gate_up_act_q5k_tiles(836 to 832) are lowered to the measured values. The JIT local values are unchanged, and the earlier PIN history stays in the table.docs/contrib/dgx-spark.mdand the header comments describe what the checks do now.No kernel, inference code or public Rust item changes.
Release notes: internal: the PTX resource gates now catch a kernel row missing from any table and no longer flag valid pins under a name filter.
Code shape
tools/check-ptx-names.pyis the one path for the first table and the tables beside it; the old separate stale-only loop is gone.unpinnederror.sm_121pins carry the measured values and keep theirPIN(...)history.cargo fmtandcargo clippy: no Rust files change.Duplication found or removed (
path:line): the table loop intools/check-ptx-names.py::checkwas written twice, once for the first table and once for the tables beside it. It is now one loop.What I ran
Run against the unchanged checks, the new self-test cases and the tree without the rows give:
With the fix, both self-tests report ok, and the fixed name check refuses the tree that lacks the 87 rows:
On the DGX Spark I built the
generate_ds41(gpu,deepseek41),gate_qwen3vl_towerandoxart_jit(vision) binaries forsm_86,sm_121andsm_121aand rantools/ptx-scan.shon each. Against the original tables the comparison returns 1 on every target, because of the missing rows and the three old spill values:With the corrected tables, the same scans compare clean on all three targets, and the name check reports ok:
The corrected-table comparison reused the saved scans and ran with
PTX_SPILL_CACHE=off, so it did not repeat the driver JIT. A later commit only moved one existing pin row next to its comment; entry names and values are the same.Not run: the JIT on a cc 8.6 card, the runtime arithmetic gates and any speed comparison. This change touches the cc 12.1 tables and the checkers; the default cc 8.6 values and all inference code are as before.
Reproduce the static part with:
The scan needs a cc 12.1 card: build each binary for the target, then run
bash tools/ptx-scan.sh <bin> [vis_]and compare against the table withtools/ptx-spill-check.sh.Hardware
DGX Spark, one GB10 card, cc 12.1:
ptxasversion 13.3.73. The self-tests and the name check ran on a Linux CPU host.What I ran into
This does not block the PR. The new rows were measured on the Spark only, and the existing
sm_86rows of the cc 12.1 table all matched that measurement. The cc 8.6 tables are untouched.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.