omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / sm121dis / corpus.sh
| 1 | #!/bin/sh |
| 2 | # corpus.sh <build-out-dir> <kernel-dir>: collects every kernel the library builds, without a GPU, into <kernel-dir>. |
| 3 | # Each GPU test runs in its host-only (and simulator) modes with OMEGA_KERNEL_DUMP_DIR set, so every program the |
| 4 | # library encodes lands as <sha16>.bin (src/omega_blackwell_codegen.c omega_kernel_dump); the numeric kernels (DIV, SQRT, |
| 5 | # transcendentals, load/store, reductions) have their own encoder and their own --dump. Run from the repo root after |
| 6 | # `make OUT_DIR=<build-out-dir> sm121dis-corpus-bins` (mk/sm121dis.mk). Any failed producer invalidates the corpus. |
| 7 | set -u |
| 8 | OUT=$1; K=$2 |
| 9 | mkdir -p "$K"; K=$(cd "$K" && pwd) |
| 10 | export OMEGA_KERNEL_DUMP_DIR="$K" |
| 11 | run() { |
| 12 | printf '%s' "$*: " |
| 13 | "$@" > "$K/producer.log" 2>&1; rc=$? |
| 14 | echo "exit $rc, $(ls "$K"/*.bin 2>/dev/null | wc -l) kernels so far" |
| 15 | if [ "$rc" -ne 0 ]; then |
| 16 | cat "$K/producer.log" >&2 |
| 17 | echo "VERDICT FAIL: corpus producer failed: $*" >&2 |
| 18 | exit "$rc" |
| 19 | fi |
| 20 | # src/omega_blackwell_codegen.c omega_kernel_dump: a kernel that could not be written whole is missing from the corpus |
| 21 | if grep -q '^omega_kernel_dump: ' "$K/producer.log"; then |
| 22 | grep '^omega_kernel_dump: ' "$K/producer.log" >&2 |
| 23 | echo "VERDICT FAIL: kernels not captured whole: $*" >&2 |
| 24 | exit 1 |
| 25 | fi |
| 26 | rm -f "$K/producer.log" |
| 27 | } |
| 28 | for t in gpu_matmul_api_test gpu_elementwise_test gpu_reconv_test gpu_attention_test gpu_moe_window_test gpu_fp8_api_test \ |
| 29 | gpu_decode_attn_test gpu_router_test gpu_bf16_gemv_test gpu_tern_test gpu_fp8gemm_test gpu_tc_probe_test \ |
| 30 | gpu_tc_peak_test gpu_pf_mem_test gpu_qmma_probe_test gpu_cmdlist_test gpu_decode_graph_test; do |
| 31 | run "$OUT/$t" --host-only |
| 32 | done |
| 33 | run "$OUT/gpu_attention_test" --hd 128 --host-only |
| 34 | for t in gpu_tcgemm_test gpu_prefill_attn_test gpu_pfgemm_test gpu_qgemm_test gpu_pfhost_test gpu_cmdlist_test; do |
| 35 | run "$OUT/$t" --host-only; run "$OUT/$t" --sim |
| 36 | done |
| 37 | run "$OUT/gpu_gpr_boundary_test" |
| 38 | for t in gpu_scan_test gpu_gemm_test gpu_streams_test; do |
| 39 | run "$OUT/$t" --host-only; run "$OUT/$t" --sim |
| 40 | done |
| 41 | run "$OUT/gpu_isolation_test" --host-only |
| 42 | # the hazard checker's sweep (every generator over its accepted shapes, patched as the launchers do): bw_hazard_test |
| 43 | # --disasm reads each of these kernels through our disassembler, so each is compared with nvdisasm here |
| 44 | run "$OUT/bw_hazard_test" |
| 45 | mkdir -p "$K/numeric" |
| 46 | run build/test_omega_divsqrt_gb10_cpu --dump "$K/numeric" |
| 47 | run build/test_omega_ldst_gb10_cpu --dump "$K/numeric" |
| 48 | for f in "$K"/numeric/*.bin; do [ -f "$f" ] && mv "$f" "$K/num_$(basename "$f")"; done; rmdir "$K/numeric" 2>/dev/null |
| 49 | echo "corpus: $(ls "$K"/*.bin | wc -l) kernels in $K" |