Files
leleka/scripts/decode-sm120/seal.sh
T
Pavlo RatushnyiandClaude Sonnet 5.5 0ca709cad1 sm120 decode switch ATTN_DAILY: upstream pre75 attention chunk + merge v2 in the verify window (default on for cc 12.0)
Ports engine/strata qsa_decode_attn.cu attn_chunk_kernel_pre75<mode 1, NC 2> and attn_merge_v2_kernel<16> as sm120_attn_daily.cu (new sealed asset,
group sm120-decode) and selects them in QsaWindow::decode_attention when policy.qsa.attn_daily is set. The policy bit is resolved at window recording
from the card (cc 12.0), LELEKA_SM120_PERF=0 (whole set off) and LELEKA_SM120_ATTN_DAILY=0|1 (wins in both directions, any card).

Model-free probe tools/decode-sm120/sm120_probe.cpp on the RTX 5090: chunk partials, merge(old) of both partial sets and merge_v2 are byte-identical to
the sealed Original kernels on 66 cases (T 1,2,4,5,6,8 x n_ids 2051..0, masked pages, two score ranges). Per call at T=4: chunk 29.8 -> 20.3 us,
merge 6.5 -> 2.9 us (warm L2, graph-timed); 12 QSA layers per window. Not yet measured end to end.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 01:07:31 +01:00

20 lines
1.1 KiB
Bash

#!/usr/bin/env bash
# Compile and seal one sm120-decode asset with the project tooling (WSL; the tree is patched in place).
# scripts/decode-sm120/seal.sh sm120_attn_daily (run from Git Bash in the worktree)
# The asset must be in scripts/gpu-bringup/extra-seal-plan.json (group sm120-decode); its PTX in the tree must be the unsealed placeholder
# (seal_pins.py refuses to overwrite a pinned PTX: run `scripts/decode-sm120/seal.sh NAME --reset` first when re-sealing).
set -euo pipefail
name=${1:?asset name, e.g. sm120_attn_daily}
reset=${2:-}
root=$(git rev-parse --show-toplevel)
wsl -d Ubuntu -e bash -lc "
set -e
cd \$(wslpath -a '$root')
TK=\$HOME/cuda-toolkits/13.2.2
OUT=\$HOME/sm120-seal/$name
rm -rf \$OUT && mkdir -p \$OUT
if [ '$reset' = --reset ]; then python3 scripts/decode-sm120/reset_pin.py $name; fi
python3 scripts/gpu-bringup/compile_assets.py --toolkit \$TK --only $name --no-rope --out \$OUT 2>&1 | tail -4
python3 scripts/gpu-bringup/seal_pins.py --ptx-dir \$OUT --only $name --write --manifest-out \$OUT/SEALED-MANIFEST.json 2>&1 | grep -E 'REFUSED|touched|sm120|written|Error|error' | head
"