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
CUDApp / evidence / amd-speed-20261114 / raw / amd-kernel-speed / card / GpuBenchSync-20261113T232737Z / card-measure-fixed.sh
| 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 | args=$(cut -d" " -f4- plan/real2.plan.cmd | sed "s#[$]AMDSERVE_WEIGHTS#$AMDSERVE_WEIGHTS#g") |
| 22 | run() { # NAME PLANFILE |
| 23 | echo "RUN $1 start $(date +%s.%N)" |
| 24 | (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)" |
| 25 | } |
| 26 | 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; } |
| 27 | # 1. Identity gate: the base plan, full 256 generated tokens, must print the published ids (checked in analyze.py). |
| 28 | run full-a real2.plan |
| 29 | # 2. Per-class insertion at 64 generated tokens, with the unamplified 64-token base at start, middle and end for drift. |
| 30 | amp base 64 base-1 |
| 31 | 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"))') |
| 32 | i=0 |
| 33 | for c in empty:1 empty:17408 $CLASSES; do |
| 34 | amp "$c" 64 "$(echo "$c" | tr ':' '_')" |
| 35 | i=$((i+1)); [ "$i" = 14 ] && amp base 64 base-2 |
| 36 | done |
| 37 | amp base 64 base-3 |
| 38 | # 3. Control: altered-weights plan (published controls) must not print the golden ids. |
| 39 | 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=$?" |
| 40 | python3 amplify-plan.py write plan/real2-controls.plan plan/c.plan base 64 > runs/control.variant && run control c.plan |
| 41 | run full-b real2.plan |
| 42 | # 4. Plan-level candidate, no kernel change: attention part grid sized for the 286 positions this request uses instead of |
| 43 | # 131072 (2048x24 -> 5x24 workgroups per layer). Output identity is checked on all 256 ids (analyze.py, run cap286). |
| 44 | 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=$?" |
| 45 | run cap286 cap286.plan |
| 46 | # 5. Kernel candidate rmsnorm5120 v2 (same operations, loads issued before one wait; CPU gate byte-identical): |
| 47 | # swap the code object file only, on the full plan and on the capacity-286 plan. All 256 ids are checked. |
| 48 | V2=e7d75a038b5c7dd9c72540e72607805dd63d70c27cc22708b518c7e0cfbca062 |
| 49 | [ "$(sha256sum < rmsnorm5120-v2.hsaco | cut -d' ' -f1)" = "$V2" ] || { echo V2_DIGEST_MISMATCH; echo MEASURE_DONE; exit 69; } |
| 50 | cp plan/code/rmsnorm5120.hsaco rmsnorm5120-v1.hsaco && cp rmsnorm5120-v2.hsaco plan/code/rmsnorm5120.hsaco |
| 51 | run v2rms real2.plan |
| 52 | run v1all cap286.plan |
| 53 | cp rmsnorm5120-v1.hsaco plan/code/rmsnorm5120.hsaco |
| 54 | sha256sum launch-x86 plan/real2.plan plan/real2-controls.plan plan/cap286.plan amplify-plan.py card-measure.sh |
| 55 | echo MEASURE_DONE |