Files
leleka/scripts/decode-sm120/reset_pin.py
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

16 lines
739 B
Python

#!/usr/bin/env python3
"""Put one sm120 asset back to its unsealed placeholder state: reset_pin.py sm120_attn_daily (seal_pins.py refuses to overwrite a pinned PTX)."""
import re
import sys
name = sys.argv[1]
ptx = f"crates/cuda-driver/src/{name}.ptx"
rs = "crates/cuda-driver/src/original_verify_window_sm120.rs"
with open(ptx, "w", newline="\n") as f:
f.write(f"// UNSEALED placeholder: {name}.ptx (compile_assets.py / seal_pins.py install the real PTX)\n")
s = open(rs, newline="").read()
s2, n = re.subn(r'(name: "%s\.ptx",\n ptx: [^\n]*\n sha: )\[[^\]]*\]' % re.escape(name), lambda m: m.group(1) + "[0; 32]", s, count=1)
if n != 1:
sys.exit("reset_pin: sha of %s not found" % name)
open(rs, "w", newline="").write(s2)