Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/evidence/amd-speed-20261114/raw/amd-kernel-speed/card/261114001549-e787e65d/out/card-measure.sh # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / evidence / amd-speed-20261114 / raw / amd-kernel-speed / card / 261114001549-e787e65d / out / card-measure.sh` 67 lines · 5219 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 # Card side of the per-kernel measurement (measuring instrument; the launcher and kernels are the unmodified seeded-Omega 4 # objects of CUDApp `dc536882`). Runs on the AMD One-Click MI300X notebook, cwd /workspace/aks, after pre.sh printed PRE_DONE. 5 # Every launcher process is the published x86 launcher (sha256 below) on a plan derived byte-for-byte from the card's own 6 # emitted real2.plan, which must equal the published sha256 before anything runs. 7 cd /workspace/aks || exit 74 8 exec > measure.log 2>&1 9 while ! grep -q PRE_DONE pre.log; do sleep 5; done 10 grep -q 'PREPARE_RC=0' pre.log || { echo PREPARE_FAILED; echo MEASURE_DONE; exit 1; } 11 set -x 12 LAUNCH_SHA=`08a504911ec6e87a9746632a14d22245155597e3a8ed384c93c0e5260bb691e1` 13 PLAN_SHA=`2a292dadc236f224005ed4e2d8ac2ba8b33dc71d79dabcc8497d177561f9c012` 14 export AMDSERVE_WEIGHTS=/tmp/qwen3.8-27b-fp8 15 [ "$(sha256sum < launch-x86 | cut -d' ' -f1)" = "$LAUNCH_SHA" ] || { echo LAUNCHER_DIGEST_MISMATCH; echo MEASURE_DONE; exit 69; } 16 E=CUDApp/evidence/amd-qwen38-native-`20261113` 17 mkdir -p plan runs 18 python3 $E/oracle/emit-plan.py $E/oracle/driver-real2.py "$AMDSERVE_WEIGHTS" plan/real2.plan --capacity=131072 --fixture-json=$E/oracle/lighthouse256.json; echo "EMIT_RC=$?" 19 [ "$(sha256sum < plan/real2.plan | cut -d' ' -f1)" = "$PLAN_SHA" ] || { echo PLAN_DIGEST_MISMATCH; echo MEASURE_DONE; exit 1; } 20 cp launch-x86 plan/omega-launch; chmod 755 plan/omega-launch 21 # The .cmd names weight files as $AMDSERVE_WEIGHTS/...; expand it here (attempt 1 passed the text unexpanded: errno 2). 22 args=$(tr ' ' '\n' < plan/real2.plan.cmd | tail -n +4 | sed "s#^\$AMDSERVE_WEIGHTS/#$AMDSERVE_WEIGHTS/#" | tr '\n' ' ') 23 for f in $args; do [ -e "plan/$f" ] || [ -e "$f" ] || { echo "MISSING_INPUT $f"; echo MEASURE_DONE; exit 74; }; done 24 run() { # NAME PLANFILE 25 echo "RUN $1 start $(date +%s.%N)" 26 (cd plan && PATH="$PWD:$PATH" omega-launch plan "$2" $args > ../runs/$1.txt 2> ../runs/$1.err); echo "RUN $1 rc=$? end $(date +%s.%N)" 27 } 28 amp() { python3 amplify-plan.py write plan/real2.plan plan/v.plan "$1" "$2" > runs/$3.variant && run "$3" v.plan; rm -f plan/v.plan; } 29 # 1. Identity gate: the base plan, full 256 generated tokens, must print the published ids (checked in analyze.py). 30 run full-a real2.plan 31 # 2a. Plan-level candidate, no kernel change: attention part grid sized for the 286 positions this request uses instead of 32 # 131072 (2048x24 -> 5x24 workgroups per layer). Output identity is checked on all 256 ids (analyze.py, run cap286). 33 python3 $E/oracle/emit-plan.py $E/oracle/driver-real2.py "$AMDSERVE_WEIGHTS" plan/cap286.plan --capacity=286 --fixture-json=$E/oracle/lighthouse256.json; echo "EMIT286_RC=$?" 34 run cap286 cap286.plan 35 # 2b. Kernel candidates (same operations as v1, loads issued ahead of one wait; each passed a CPU gate with 36 # byte-identical memory images): swap the code object file only. Each alone on the full plan, then all of them on 37 # the capacity-286 plan. All 256 ids are checked for every run (analyze.py). 38 # Object list: NAME SHA256 (generated by build-cell.py from kernels/*/v2/*.hsaco). 39 CANDIDATES="gdnstate_step `c689890dcfd54bd782870866de9a381f9a120d9dfa90ac0f2da747661fdbb937` 40 rmsnorm5120 `7d63972f57c6211a77036665a2482ee58526cbc7cd79796544cb57137f69384a`" 41 cp -r plan/code plan/code-v1 42 echo "$CANDIDATES" | while read -r k sha; do 43 [ -n "$k" ] || continue 44 [ "$(sha256sum < "$k-v2.hsaco" | cut -d' ' -f1)" = "$sha" ] || { echo "V2_DIGEST_MISMATCH $k"; continue; } 45 cp "$k-v2.hsaco" plan/code/$k.hsaco; run "v2-$k" real2.plan; cp plan/code-v1/$k.hsaco plan/code/$k.hsaco 46 done 47 echo "$CANDIDATES" | while read -r k sha; do [ -n "$k" ] && [ "$(sha256sum < "$k-v2.hsaco" | cut -d' ' -f1)" = "$sha" ] && cp "$k-v2.hsaco" plan/code/$k.hsaco; done 48 run v1all cap286.plan 49 rm -rf plan/code && mv plan/code-v1 plan/code 50 # 2. Per-class insertion at 64 generated tokens, with the unamplified 64-token base at start, middle and end for drift. 51 # Order: controls and the classes most likely to matter first, so a short session still yields them. 52 amp base 64 base-1 53 CLASSES=$(python3 amplify-plan.py list plan/real2.plan | python3 -c 'import json,sys;print(" ".join(c for c in json.load(sys.stdin)["classes"] if c!="step_advance"))') 54 FIRST="empty:1 empty:17408 gdnstate_step rmsnorm5120 attn256_part_step attn256_merge_step fp8gemv_b128f:17408x5120 fp8gemv_b128f:5120x17408 bf16gemv2:248320x5120" 55 i=0 56 REST=$(for c in $CLASSES; do echo "$FIRST" | tr ' ' '\n' | grep -qxF "$c" || echo "$c"; done) 57 for c in $FIRST $REST; do 58 amp "$c" 64 "$(echo "$c" | tr ':' '_')" 59 i=$((i+1)); [ "$i" = 9 ] && amp base 64 base-2 60 done 61 amp base 64 base-3 62 # 3. Control: altered-weights plan (published controls) must not print the golden ids. 63 python3 $E/oracle/emit-plan.py $E/oracle/driver-real2.py "$AMDSERVE_WEIGHTS" plan/real2-controls.plan --controls --capacity=131072 --fixture-json=$E/oracle/lighthouse256.json; echo "EMITC_RC=$?" 64 python3 amplify-plan.py write plan/real2-controls.plan plan/c.plan base 64 > runs/control.variant && run control c.plan 65 run full-b real2.plan 66 sha256sum launch-x86 plan/real2.plan plan/real2-controls.plan plan/cap286.plan amplify-plan.py card-measure.sh 67 echo MEASURE_DONE