interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / evidence / amd-speed-20261114 / raw / amd-kernel-speed / card / GpuBenchSync-20261113T232737Z / card-measure-fixed.sh

55 lines · 4112 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.
7cd /workspace/aks || exit 74
8exec > measure.log 2>&1
9while ! grep -q PRE_DONE pre.log; do sleep 5; done
10grep -q 'PREPARE_RC=0' pre.log || { echo PREPARE_FAILED; echo MEASURE_DONE; exit 1; }
11set -x
12LAUNCH_SHA=08a504911ec6e87a9746632a14d22245155597e3a8ed384c93c0e5260bb691e1
13PLAN_SHA=2a292dadc236f224005ed4e2d8ac2ba8b33dc71d79dabcc8497d177561f9c012
14export 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; }
16E=CUDApp/evidence/amd-qwen38-native-20261113
17mkdir -p plan runs
18python3 $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; }
20cp launch-x86 plan/omega-launch; chmod 755 plan/omega-launch
21args=$(cut -d" " -f4- plan/real2.plan.cmd | sed "s#[$]AMDSERVE_WEIGHTS#$AMDSERVE_WEIGHTS#g")
22run() { # 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}
26amp() { 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).
28run 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.
30amp base 64 base-1
31CLASSES=$(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"))')
32i=0
33for 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
36done
37amp base 64 base-3
38# 3. Control: altered-weights plan (published controls) must not print the golden ids.
39python3 $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=$?"
40python3 amplify-plan.py write plan/real2-controls.plan plan/c.plan base 64 > runs/control.variant && run control c.plan
41run 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).
44python3 $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=$?"
45run 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.
48V2=e7d75a038b5c7dd9c72540e72607805dd63d70c27cc22708b518c7e0cfbca062
49[ "$(sha256sum < rmsnorm5120-v2.hsaco | cut -d' ' -f1)" = "$V2" ] || { echo V2_DIGEST_MISMATCH; echo MEASURE_DONE; exit 69; }
50cp plan/code/rmsnorm5120.hsaco rmsnorm5120-v1.hsaco && cp rmsnorm5120-v2.hsaco plan/code/rmsnorm5120.hsaco
51run v2rms real2.plan
52run v1all cap286.plan
53cp rmsnorm5120-v1.hsaco plan/code/rmsnorm5120.hsaco
54sha256sum launch-x86 plan/real2.plan plan/real2-controls.plan plan/cap286.plan amplify-plan.py card-measure.sh
55echo MEASURE_DONE