Files
leleka/tools/decode-sm120/build_waitrows.sh
T
Pavlo RatushnyiandClaude Sonnet 5.5 3362615444 D3 WAIT_M_ROWS: wait on flag M folded into the CPU-rows copy (sm120_wait_copy_rows), sealed asset, probe
LELEKA_SM120_WAIT_M_ROWS (off by default): wait_cpu defers the ring, copy_cpu_rows records one
leleka_verify_wait_copy_rows launch (grid tokens x k, 128 threads) instead of verify_wait_flag_ge +
the rows copy. Thread 0 of each block polls, fences, block barrier, then the copy of
chain_copy_rows_from_mapped_kernel. PTX built with nvcc 13.2.86 and pinned (extra-seal-plan,
ptx-sm86 MANIFEST note). Model-free probe tools/decode-sm120/sm120_probe_waitrows.cpp (late flag,
T 1-8) built, not run (no GPU).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 01:01:49 +01:00

22 lines
1.2 KiB
Bash

#!/usr/bin/env bash
# Build the WAIT_M_ROWS probe in WSL (never on the server GPU queue by its author) and collect the PTX it compares.
# tools/decode-sm120/build_waitrows.sh [OUTDIR] default OUTDIR=<repo>/target/waitrows-bin (inside the work folder)
# then (GPU job, under timeout): timeout 300 OUTDIR/sm120_probe_waitrows OUTDIR/ptx
# It also rebuilds sm120_wait_copy_rows.cu with the recipe of extra-seal-plan.json and refuses to go on when the result
# differs from the checked-in (sealed) PTX.
set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)"
root="$(cd "$here/../.." && pwd)"
out="${1:-$root/target/waitrows-bin}"
nvcc="${NVCC:-$HOME/cuda-toolkits/13.2.2/bin/nvcc}"
src="$root/crates/cuda-driver/src"
mkdir -p "$out/ptx"
"$nvcc" -O2 -std=c++17 "$here/sm120_probe_waitrows.cpp" -lcuda -o "$out/sm120_probe_waitrows"
"$nvcc" -ptx -O3 -arch=sm_120 -std=c++17 --fmad=true --ftz=false "$src/sm120_wait_copy_rows.cu" -o "$out/sm120_wait_copy_rows.rebuilt.ptx"
cmp "$out/sm120_wait_copy_rows.rebuilt.ptx" "$src/sm120_wait_copy_rows.ptx"
for f in original_verify chain_window sm120_wait_copy_rows; do
cp "$src/$f.ptx" "$out/ptx/$f.ptx"
done
sha256sum "$out"/sm120_probe_waitrows "$out"/ptx/* > "$out/SHA256SUMS"
ls -la "$out" "$out/ptx"