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 / FLASH-NEXT-MOE-SHAPES-20261118 / run-receipts.sh

41 lines · 8994 bytes Raw Blame History
1#!/bin/sh
2# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3# Reruns the short checks of the Flash-Next MoE slice at the checked-out head and saves, per step, the command (.cmd), exit code (.rc) and
4# complete output (.out) under receipts/. Host only: every command runs through the device-free wrapper (the namespace hides /dev/nvidia*);
5# nothing opens a device, takes the chip lock or touches a service. Chip status is NOT_RUN. The long runs (the exhaustive C-oracle
6# differential, the whole host suite, the mutant runners) have their own logs next to this file.
7# STEPS='02-base-legacy-run 13-real-expert' reruns only the named steps.
8# Needs: OMEGA_OMC / OMEGA_BRIDGE = the om/units.sh pins (see receipts/01-toolchain.out), build/libomega_gpu.a built at this head.
9set -u
10ROOT=${ROOT:-$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd)} # ROOT may name a separate clone at the head under test
11cd "$ROOT"
12OUT=${RECEIPTS_OUT:-$ROOT/evidence/FLASH-NEXT-MOE-SHAPES-20261118/receipts}
13mkdir -p "$OUT"
14CORES=${CORES:-15-19}
15W="bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c $CORES nice -n 10"
16# bash -o pipefail: the recorded exit code is the first failing stage of a pipeline, not the last stage's (tail and grep would hide a failure)
17rec() { [ -z "${STEPS:-}" ] || case " $STEPS " in *" $1 "*) ;; *) return 0 ;; esac; n=$1; shift; printf '%s\n' "$*" > "$OUT/$n.cmd"; bash -o pipefail -c "$*" > "$OUT/$n.out" 2>&1; echo $? > "$OUT/$n.rc"; printf '%s rc=%s\n' "$n" "$(cat "$OUT/$n.rc")"; }
18BASE=997e105086353120d6e41805ae4973cefec7fb74
19ROOTS="QUANT_ROOT=$ROOT CACHE_ROOT=$ROOT COMPOSE_ROOT=$ROOT PIPELINE_ROOT=$ROOT"
20PINOMC=${PINOMC:-$HOME/work/lanes/flash-next/moe-tools/omc-64d6}
21
22rec 00-head "git rev-parse HEAD; git log -1 --format='%H %s'; git status --short | grep -v '^?? evidence/' ; date -u +%FT%TZ; uname -m; hostname"
23rec 01-toolchain "echo OMEGA_OMC=\$OMEGA_OMC; sha256sum \$OMEGA_OMC; echo OMEGA_BRIDGE=\$OMEGA_BRIDGE; git -C \$OMEGA_BRIDGE rev-parse HEAD; sha256sum \$OMEGA_BRIDGE/src/toc.om \$OMEGA_BRIDGE/tools/bridge-seeded \$OMEGA_BRIDGE/src/freest.om \$OMEGA_BRIDGE/tools/bridge-freest; echo '--- om/units.sh pins'; grep -n '^OMC_PIN\|^CONVERTER_PIN\|^FRONTEND_PIN\|^FREEST_' om/units.sh; echo '--- PIN file (scope: backend/amd/kfd/launch only, REPIN)'; cat PIN; sha256sum $PINOMC; echo '--- the bridge frontend refuses the PIN compiler'; OMEGA_SEEDED_OMC=$PINOMC sh \$OMEGA_BRIDGE/tools/bridge-seeded c om/moe/moe_plan_wide.om >/dev/null; echo bridge-seeded-with-PIN-omc rc=\$?"
24rec 02-base-legacy-run "d=\$(mktemp -d); git archive $BASE | tar -x -C \$d; cd \$d; $W env $ROOTS sh tests/moe/run.sh > \$d/out 2>&1; rc=\$?; grep -v '^generating' \$d/out | tail -12; echo \"base-run-exit=\$rc (expected non-zero: the baseline run.sh does not link, omega_mg_group; the one-line unit-list fix is in this branch)\"; exit \$rc"
25rec 03-before-after-probe "d=/tmp/flash-moe-base; [ -d \$d/build ] || { mkdir -p \$d; git archive $BASE | tar -x -C \$d; (cd \$d && $W make -j4 build/libomega_gpu.a >/dev/null 2>&1); }; echo '=== BEFORE: base $BASE (legacy units only)'; (cd \$d && cc -std=gnu11 -DBASE -Isrc -o /tmp/shape_probe_base $ROOT/evidence/FLASH-NEXT-MOE-SHAPES-20261118/shape_probe.c src/cudapp_om_moe_*.c build/libomega_gpu.a -lpthread -lm && $W /tmp/shape_probe_base); echo '=== AFTER: this head'; cc -std=gnu11 -Isrc -o /tmp/shape_probe_head evidence/FLASH-NEXT-MOE-SHAPES-20261118/shape_probe.c src/cudapp_om_moe_*.c build/libomega_gpu.a -lpthread -lm && $W /tmp/shape_probe_head"
26rec 04-generated-code-identity "d=/tmp/flash-moe-base; cc -std=gnu11 -O1 -Isrc -o /tmp/identity_head evidence/FLASH-NEXT-MOE-SHAPES-20261118/identity_probe.c build/libomega_gpu.a -lpthread -lm && (cd \$d && cc -std=gnu11 -O1 -Isrc -o /tmp/identity_base $ROOT/evidence/FLASH-NEXT-MOE-SHAPES-20261118/identity_probe.c build/libomega_gpu.a -lpthread -lm) && $W /tmp/identity_base > /tmp/identity_base.txt && $W /tmp/identity_head > /tmp/identity_head.txt; sha256sum /tmp/identity_base.txt /tmp/identity_head.txt; wc -l /tmp/identity_head.txt; cmp /tmp/identity_base.txt /tmp/identity_head.txt && echo IDENTICAL: base and head give the same return code, instruction count, encoded-SASS hash, steps and shared bytes for every spec of the grid"
27rec 05-legacy-untouched "git diff --stat $BASE HEAD -- om/moe/moe_plan.om om/moe/moe_group.om om/moe/moe_ids32.om om/moe/moe_maps32.om om/moe/moe_segs32.om om/moe/moe_windows.om om/moe/moe_admit.om src/cudapp_om_moe_plan.c src/cudapp_om_moe_group.c src/cudapp_om_moe_ids32.c src/cudapp_om_moe_maps32.c src/cudapp_om_moe_segs32.c src/cudapp_om_moe_windows.c src/cudapp_om_moe_admission.c tests/moe/caller.c tests/moe/moe_verify.om tests/moe/admit-caller.om tests/moe/incumbent.c tests/codegen_moe_diff_test.c tests/codegen_moe_sim_test.c tests/codegen_moe_oracle.c tests/codegen_moe2_oracle.c tests/gpu_fp8_api_test.c tests/api_hostrest_test.c tests/api_hostrest_check.py; echo 'legacy and existing-test files changed: (empty list above = none)'; git diff --exit-code --quiet $BASE HEAD -- om/moe/moe_plan.om om/moe/moe_group.om om/moe/moe_ids32.om om/moe/moe_maps32.om om/moe/moe_segs32.om om/moe/moe_windows.om om/moe/moe_admit.om src/cudapp_om_moe_plan.c src/cudapp_om_moe_group.c src/cudapp_om_moe_ids32.c src/cudapp_om_moe_maps32.c src/cudapp_om_moe_segs32.c src/cudapp_om_moe_windows.c src/cudapp_om_moe_admission.c tests/moe/caller.c tests/moe/moe_verify.om tests/moe/admit-caller.om tests/moe/incumbent.c tests/codegen_moe_diff_test.c tests/codegen_moe_sim_test.c tests/codegen_moe_oracle.c tests/codegen_moe2_oracle.c tests/gpu_fp8_api_test.c tests/api_hostrest_test.c tests/api_hostrest_check.py && echo UNTOUCHED; echo '--- every existing test file this branch changed:'; git diff --name-status $BASE HEAD -- tests | grep -v '^A'"
28rec 06-moe-legacy "$W env $ROOTS sh tests/moe/run.sh | grep -v '^generating\|^[0-9a-f]\{64\} '"
29rec 07-moe-wide "$W env $ROOTS sh tests/moe/run_wide.sh | grep -v '^generating\|^[0-9a-f]\{64\} '"
30rec 08-moe-wide-mutants "$W env $ROOTS python3 tests/moe/wide_mutants.py"
31rec 09-ragged-builder-sim "$W make -j4 build/codegen_moe_ragged_test >/dev/null 2>&1; $W ./build/codegen_moe_ragged_test"
32rec 10-ragged-api-op25 "$W make -j4 build/fp8_ragged_api_test >/dev/null 2>&1; $W ./build/fp8_ragged_api_test"
33rec 11-group-sim "$W make -j4 build/codegen_dec_group_sim_test >/dev/null 2>&1; $W ./build/codegen_dec_group_sim_test"
34rec 12-existing-moe-sim "$W make -j4 build/codegen_moe_sim_test >/dev/null 2>&1; $W ./build/codegen_moe_sim_test"
35rec 13-real-expert "$W make -j4 build/flash_expert_real_test >/dev/null 2>&1; FLASH_EXPERT_OUT=\$(mktemp -d); export FLASH_EXPERT_OUT; $W sh tests/flash_expert/run.sh; t=\$?; echo '--- independent read of the same bytes with dd (not Python):'; M=\$HOME/models/qwen3.8-flash-next-fp8-7fb48d70; for spec in 'model-00002-of-00131.safetensors 731214008 1638400 gate_proj.weight' 'model-00002-of-00131.safetensors 732852408 1638400 up_proj.weight' 'model-00003-of-00131.safetensors 520403536 1638400 down_proj.weight' 'model-00002-of-00131.safetensors 372008 200 gate_proj.weight_scale_inv' 'model-00002-of-00131.safetensors 372208 200 up_proj.weight_scale_inv' 'model-00003-of-00131.safetensors 189128 200 down_proj.weight_scale_inv'; do set -- \$spec; printf '%s ' \$4; dd if=\$M/\$1 bs=1 skip=\$2 count=\$3 2>/dev/null | sha256sum | cut -c1-64; done; ls \$M/*.aria2 2>/dev/null || echo 'no .aria2 file beside any shard'; sha256sum \$M/config.json; exit \$t"
36rec 14-units-check "OMEGA_OMC=\${OMEGA_OMC_GIT:-\$HOME/workspace/omega-review/seed/out/omc} $W sh om/units.sh --check | tail -3"
37rec 15-gates "$W make test-runtime-api test-drift test-pin-sync 2>&1 | grep -E 'RESULT|PASS|FAIL|Error'"
38rec 16-gpu-fp8-host-and-sim "$W make test-gpu-fp8 2>&1 | tail -4"
39rec 17-pin-compiler-programs "d=\$(mktemp -d); cat om/quant/quant.om om/components/realize.om om/cache/digest.om om/cache/residency.om om/pipeline/select.om om/pipeline/graph.om om/moe/moe_group_wide.om om/moe/moe_admit_wide.om tests/pipeline/fixture.om tests/moe/admit-caller-wide.om > \$d/admit_wide.om; cat om/codegen/cg_moe_emit.om om/codegen/cg_moe_core.om om/codegen/cg_moe.om tests/moe/ragged_pin_driver.om > \$d/driver.om; sed 's/rp_check view a 119/rp_check view a 120/' \$d/driver.om > \$d/driver_broken.om; bad=0; for omc in \$OMEGA_OMC $PINOMC; do n=\$(sha256sum \$omc | cut -c1-8); for f in admit_wide driver driver_broken; do \$omc < \$d/\$f.om > \$d/\$f.\$n 2>\$d/err; c=\$?; chmod +x \$d/\$f.\$n 2>/dev/null; if [ \$c = 0 ]; then $W \$d/\$f.\$n; r=\$?; echo \"omc \$n \$f: compile rc=0 run rc=\$r\"; want=0; [ \$f = driver_broken ] && want=11; [ \$r = \$want ] || bad=1; else echo \"omc \$n \$f: compile rc=\$c\"; bad=1; fi; done; done; echo 'expected: admit_wide and driver run rc=0 under both compilers; driver_broken (expected count 120 instead of 119) run rc=11 under both: the driver sees a changed count'; exit \$bad"
40cd "$OUT" && sha256sum *.cmd *.rc *.out > SHA256SUMS
41echo done