Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions changelog.d/214-kernel-limits-records-match-what-nvcc-bu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Kernel contract: CUDA limits records match nvcc 13.0 on GB10 again

- 41 launches across 12 families had stale records. They now carry the resources nvcc 13.0 compiled on TOP
(job `top-57fa0d391dec`), in `measurements/main_130.zig`. The reasons per family are in
`docs/kernel-contract/limits-receipt.md`.
- `docs/kernel-contract/limits-job.sh` runs the full five-SM limits audit as a TOP job and prints each stale launch's
`RECORD` line.
- The EXL3 prompt launches use their measured 13.0 receipt and remain pending on other releases.
34 changes: 34 additions & 0 deletions docs/kernel-contract/limits-job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh
# kernel-contract-limits over every image of the five release SMs, as a TOP job:
# swarm gpu-run plotarmordev/TensorFold SHA docs/kernel-contract/limits-job.sh
# nvcc builds the images with -Xptxas -v (one thread per SASS target), the build stopping at 600 s. Prints each stale
# or failing check and the RECORD line of its launch (the values its record is replaced with), the router's measured
# lines, then ptxas's registers and static shared bytes per SM for the router and the 41 launches main_130.zig records.
set -u
here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
symbols="tf_nemo_router_tiles d3_cfg_mix d3_router_compact dfl_topk dfl_walk fn_hcn_down2 fn_hcn_down3 fn_hcn_up3
fn_row_topk muse_argmax muse_expert_sum muse_linear2_k2_w4 muse_linear2_k2_w8 muse_linear2_k3_w8 muse_linear2_k4_w4
muse_linear2_k4_w8 muse_linear2_k5_w4 muse_linear2_k5_w8 muse_linear2_k6_w4 muse_linear2_k6_w8 muse_linear2_k8_w4
muse_linear_multi_k2 muse_linear_multi_k3 muse_linear_multi_k4 muse_linear_multi_k5 muse_linear_multi_k6
muse_linear_multi_k8 muse_rms muse_rot_multi muse_softcap tf_exl3_prompt_down tf_exl3_prompt_down_k6 tf_exl3_prompt_gu
tf_exl3_prompt_gu_k6 tf_glm_dsel_merge tf_nemo_attn64 tf_nemo_preds tf_q35_gdn_slots_1 tf_q35_gdn_slots_2
tf_q35_gdn_slots_4 tf_qmm_prefill_many _ZN7tf_qmmf11qmmf_kernelILi4ELi16ELi64ELi1ELi4ELi4ELb1ELb0ELb1EEEvPK13__nv_bfloat16PKhS5_fPvPfiiiiiii"
status=0
NVCC_APPEND_FLAGS="-Xptxas -v --threads 0" H3_BUILD=limits LIMITS_IMAGES= timeout 600 \
sh "$here/../recipes/minimax-h3-cuda/cuda-build.sh" >/work/out/build.log 2>&1 || status=$?
[ "$status" = 124 ] && echo "limits job stopped at its 600 s limit"
tail -n 4 /work/out/build.log
log=/work/out/limits.log
grep -E '^(INFO|SUMMARY|MISSED|RED )' "$log"
awk '/^(PASS|FAIL) limits sm_[0-9]+ .*\(record stale\)|^FAIL limits/ { sub(/^(PASS|FAIL) limits sm_[0-9]+ /, ""); sub(/: [0-9]+ registers,.*/, ""); stale[$0] = 1; print "STALE " $0 }
/^RECORD / { name = substr($0, 8); sub(/: \.usage = .*/, "", name); if (name in stale) print }' "$log" | sort -u
grep -E '^(PASS|FAIL) limits sm_[0-9]+ router tf_nemo_router_tiles:' "$log"
symbols=$symbols awk -F"'" 'BEGIN { n = split(ENVIRON["symbols"], s, /[ \n]+/); for (i = 1; i <= n; i++) want[s[i]] = 1 }
/Compiling entry function/ { fn = $2; sm = $4; next }
fn != "" && /ptxas info *: Used / { if (fn in want) {
regs = $0; sub(/.*Used /, "", regs); sub(/ registers.*/, "", regs)
smem = "0"; if (match($0, /[0-9]+ bytes smem/)) smem = substr($0, RSTART, RLENGTH - 11)
use[fn] = use[fn] " " sm "=" regs "r/" smem "s" }
fn = "" }
END { for (f in use) print "PTXAS " f ":" use[f] }' /work/out/build.log | sort
exit "$status"
40 changes: 40 additions & 0 deletions docs/kernel-contract/limits-receipt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Limits refresh receipt, 23 Nov

Job `top-57fa0d391dec` ran [`limits-job.sh`](limits-job.sh) on TOP at `4db907f60104076f8e12f4c4840c7f1ecfa9b8b4`
(main `2945c7d29` plus that script). nvcc 13.0 built the images. The audit reads each launch's registers, static
shared bytes and launch bounds from the cubin ELF's `.nv.info` and `.nv.shared` sections (`cubin.zig`). Its output
is [`limits-top-57fa0d391dec.txt`](limits-top-57fa0d391dec.txt). It found 41 stale launches across 12 families, and
its 10 planted control checks went RED. Each `RECORD` line was copied unedited into
`zig/src/core/contract/measurements/main_130.zig`, except `qmm_prefill`'s four unaudited slots, taken from the
second job's `PTXAS` line below.

Job `top-e6855ec197a2` reran the script on 24 Nov at `f8674bfaa164131e2a195e50b0529996f171bfcc`, which is current
main (`b29b19824`, with #146's `qwen35.cu`) plus this card's commits. This time nvcc ran with `-Xptxas -v` under a
600 s limit. Its output, [`limits-top-e6855ec197a2.txt`](limits-top-e6855ec197a2.txt), has no stale launch, all 10
control checks RED and exit 0. The router `tf_nemo_router_tiles` measures 184 registers on sm_86, as recorded; the
237 seen in an earlier run did not recur. Its `PTXAS` lines give ptxas's own registers and static shared bytes for
the router and the 41 refreshed launches on all five SMs, and every record equals them on every SM. The 1 KiB that
sm_120 and sm_121 reserve is subtracted only when `cubin.zig` parses the cubin's `.nv.shared` section; ptxas's
figures leave it out. `qmm_prefill` launches on sm_121 only, so the audit checks just that slot; its other four
slots hold the same job's ptxas figures (173 registers on sm_80 to sm_89, 130 on sm_120). `qmmf`'s line is listed
under its mangled symbol.

Why each family moved:

| Family | Launches | Reason |
| --- | --- | --- |
| drama3 | 2 | merged change: #33 and #32 added `d3_router_compact` and `d3_cfg_mix` pending, never measured |
| exl3_experts | 4 | merged change: #52 left `tf_exl3_prompt_gu` and `tf_exl3_prompt_down` pending and #115 added their two k6 launches unmeasured |
| flashnext_hcn | 3 | toolchain: #108 recorded nvcc 13.3's values, and nvcc 13.0 builds these three launches differently |
| flashnext_mtp | 1 | merged change: #57 folded the non-finite checks into `fn_row_topk` after its record |
| glm_glue | 1 | merged change: #87 and #122 edited `tf_glm_dsel_merge` in `glm_index_decode.cuh` after #57 recorded it |
| muse_dflash2 | 2 | merged change: #87 recorded only nvcc 13.3's sm_121 values |
| muse_glue | 4 | merged change: #87 recorded only nvcc 13.3's sm_121 values |
| muse_linear | 17 | merged change: #87 recorded only nvcc 13.3's sm_121 values |
| nemo_audio | 2 | toolchain: #74 recorded nvcc 13.2's values, and nvcc 13.0 builds these two launches differently |
| qmm_prefill | 1 | merged change: `83bc87103`, merged through #87, rewrote `tf_qmm_prefill_many`'s copy addressing after the record |
| qmmf | 1 | unknown: recorded in #141, source unchanged since |
| qwen35 | 3 | merged change: #53 edited the one-row rollback in `q35_slots` (`qwen35_slots.cuh`) after #11 recorded it |

The four EXL3 prompt launches were reported as pending at every release (`exl3_prompt_pending.zig`), so their 13.0
receipt only applies because `usageFor` now checks 13.0's receipts first. Other releases keep them pending.
Loading