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 / tests / regalloc_om / run.sh
| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | set -eu |
| 4 | ROOT=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) |
| 5 | cd "$ROOT" |
| 6 | : "${CC:=cc}" |
| 7 | : "${REGALLOC_OUT:=$ROOT/build/regalloc-om}" |
| 8 | mkdir -p "$REGALLOC_OUT" |
| 9 | # The successor links the portable generated C of om/codegen (om/units.sh; src/cudapp_om_<unit>.c). The pinned |
| 10 | # compiler regenerates it byte for byte first, so these sources are the checked lowering of the .om under test. |
| 11 | if [ -n "${OMEGA_OMC:-}" ]; then sh om/units.sh --check |
| 12 | else echo "NOT_RUN om/units.sh --check (requires the pinned AArch64 omc; the differential below still runs)"; fi |
| 13 | UNITS="src/cudapp_freest_regalloc.c src/cudapp_om_regalloc_ir.c src/cudapp_om_regalloc_live.c src/cudapp_om_cg_matmul.c |
| 14 | src/cudapp_om_cg_matmul_params.c src/cudapp_om_cg_matmul_i32.c src/cudapp_om_cg_matmul_tensor.c |
| 15 | src/cudapp_om_cg_matmul_loop.c src/cudapp_om_cg_matmul_frag.c src/cudapp_om_cg_matmul_block.c |
| 16 | src/cudapp_om_cg_vecadd.c src/cudapp_om_bw_enc_sm121.c src/cudapp_freest_f16.c src/cudapp_om_core_sha.c src/cudapp_om_cg_bind.c src/cudapp_freest_leftovers.c" |
| 17 | UNITS="$UNITS src/cudapp_freest_cg_fields.c src/cudapp_freest_cg_replay.c src/cudapp_freest_cg_life.c |
| 18 | src/cudapp_freest_cg_invar.c src/cudapp_om_cg_budget.c" |
| 19 | UNITS="$UNITS src/cudapp_om_bw_identity.c src/cudapp_freest_bw_scalar.c src/cudapp_freest_fixture_verify.c src/cudapp_om_bw_cpui.c |
| 20 | src/cudapp_om_bw_cpuf16.c src/cudapp_om_bw_cpubf16.c src/cudapp_om_bw_shape.c src/cudapp_om_bw_name.c |
| 21 | src/cudapp_om_cg_pack_len.c src/cudapp_om_cg_pack_h.c src/cudapp_om_cg_sentin.c |
| 22 | src/cudapp_om_cg_em.c src/cudapp_om_cg_reconv.c" |
| 23 | UNITS="$UNITS src/cudapp_freest_pathcopy.c" |
| 24 | HAZARD="src/cudapp_om_bw_hazard.c src/cudapp_om_bw_hazard_dec.c" |
| 25 | python3 - "$REGALLOC_OUT/oracle_names.h" <<'PY' |
| 26 | import pathlib,re,sys |
| 27 | source=pathlib.Path('src/omega_blackwell_codegen.c').read_text() |
| 28 | names=sorted(set(re.findall(r'^(?:int|void|size_t|uint32_t|uint16_t) (omega_\w+)\(',source,re.M))) |
| 29 | pathlib.Path(sys.argv[1]).write_text(''.join('#define '+n+' legacy_'+n+'\n' for n in names)) |
| 30 | for f in ('matmul','realize'): |
| 31 | s=pathlib.Path('src/omega_blackwell_'+f+'.c').read_text() |
| 32 | ns=sorted(set(re.findall(r'^(?:int|void|size_t|float|double|uint16_t|uint32_t) (omega_\w+)\(',s,re.M))) |
| 33 | pathlib.Path(sys.argv[1]).with_name(f+'_names.h').write_text(''.join('#define '+n+' legacy_'+n+'\n' for n in ns)) |
| 34 | PY |
| 35 | FLAGS="-std=gnu11 -O2 -Wall -Wextra -Werror -ffunction-sections -fdata-sections -Isrc" |
| 36 | $CC $FLAGS -DCUDAPP_MIGRATION_PENDING_C_REGALLOC -DCUDAPP_MIGRATION_PENDING_C_CODEGEN_MATMUL -DCUDAPP_MIGRATION_PENDING_C_ENCODER -DCUDAPP_MIGRATION_PENDING_C_BIND -include "$REGALLOC_OUT/oracle_names.h" -c src/omega_blackwell_codegen.c -o "$REGALLOC_OUT/oracle.o" |
| 37 | $CC $FLAGS -c src/omega_blackwell_codegen.c -o "$REGALLOC_OUT/successor.o" |
| 38 | $CC $FLAGS tests/regalloc_om/liveness.c "$REGALLOC_OUT/successor.o" src/omega_gpu_om_ir.c $UNITS \ |
| 39 | -Wl,--gc-sections -o "$REGALLOC_OUT/liveness" |
| 40 | "$REGALLOC_OUT/liveness" |
| 41 | $CC $FLAGS tests/regalloc_om/differential.c "$REGALLOC_OUT/oracle.o" "$REGALLOC_OUT/successor.o" \ |
| 42 | src/omega_gpu_om_ir.c src/omega_blackwell_matmul.c src/sha256.c $UNITS \ |
| 43 | -Wl,--gc-sections -o "$REGALLOC_OUT/differential" |
| 44 | "$REGALLOC_OUT/differential" "$@" |
| 45 | $CC $FLAGS -Wno-unused-function -ffp-contract=off -Itests tests/regalloc_om/sim.c "$REGALLOC_OUT/successor.o" \ |
| 46 | src/omega_gpu_om_ir.c src/omega_blackwell_matmul.c src/omega_blackwell_encoder.c src/sha256.c $UNITS \ |
| 47 | -Wl,--gc-sections -lm -o "$REGALLOC_OUT/sim" |
| 48 | "$REGALLOC_OUT/sim" |
| 49 | HZ_LEGACY="-Domega_bw_decode=legacy_omega_bw_decode -Domega_bw_hazard_check=legacy_omega_bw_hazard_check |
| 50 | -Domega_bw_hazard_kind=legacy_omega_bw_hazard_kind" |
| 51 | $CC $FLAGS -DCUDAPP_MIGRATION_PENDING_C_HAZARD $HZ_LEGACY -c src/omega_bw_hazard.c -o "$REGALLOC_OUT/hz_oracle.o" |
| 52 | $CC $FLAGS tests/regalloc_om/hazard_diff.c "$REGALLOC_OUT/hz_oracle.o" src/omega_bw_hazard.c $HAZARD \ |
| 53 | -Wl,--gc-sections -o "$REGALLOC_OUT/hazard_diff" |
| 54 | "$REGALLOC_OUT/hazard_diff" |
| 55 | for f in matmul realize; do |
| 56 | $CC $FLAGS -DCUDAPP_MIGRATION_PENDING_C_BIND -include "$REGALLOC_OUT/${f}_names.h" -c src/omega_blackwell_$f.c \ |
| 57 | -o "$REGALLOC_OUT/bind_oracle_$f.o" |
| 58 | done |
| 59 | $CC $FLAGS tests/regalloc_om/bind_diff.c "$REGALLOC_OUT/bind_oracle_matmul.o" "$REGALLOC_OUT/bind_oracle_realize.o" \ |
| 60 | "$REGALLOC_OUT/oracle.o" "$REGALLOC_OUT/successor.o" src/omega_blackwell_matmul.c src/omega_blackwell_realize.c \ |
| 61 | src/omega_blackwell_encoder.c src/omega_gpu_om_ir.c src/sha256.c $UNITS -Wl,--gc-sections -o "$REGALLOC_OUT/bind_diff" |
| 62 | "$REGALLOC_OUT/bind_diff" |