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
| 1 | # C6 of docs/OMEGA.md: Omega's own sm_121 disassembler (gpu/nvidia/om/disasm/sm121_dis.om, tools/sm121dis/sm121dis.om). |
| 2 | # make test-sm121dis collect every kernel the library builds (no GPU), compare our text with nvdisasm's, word by word; |
| 3 | # then the red check: a decoder built with one deliberate fault must FAIL the same comparison. |
| 4 | # Picked up by the `-include mk/*.mk` line of the Makefile. The test binaries are named as files, not through the |
| 5 | # GPU_*_TEST variables: this file is read before the Makefile defines them. |
| 6 | SM121DIS = $(OUT_DIR)/sm121dis |
| 7 | SM121DIS_RED = $(OUT_DIR)/sm121dis_red |
| 8 | SM121DIS_K = $(OUT_DIR)/sm121dis-kernels |
| 9 | |
| 10 | $(SM121DIS): gpu/nvidia/om/disasm/sm121_dis.om tools/sm121dis/sm121dis.om seed/out/omc |
| 11 | @mkdir -p $(OUT_DIR) |
| 12 | cat gpu/nvidia/om/disasm/sm121_dis.om tools/sm121dis/sm121dis.om | seed/out/omc > $@.tmp.$$$$ && chmod +x $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@ |
| 13 | $(SM121DIS_RED): gpu/nvidia/om/disasm/sm121_dis.om tools/sm121dis/sm121dis.om seed/out/omc |
| 14 | @mkdir -p $(OUT_DIR) |
| 15 | { cat gpu/nvidia/om/disasm/sm121_dis.om; sed 's/cli_oc get tbuf i/cli_oc xor get tbuf i 1/' tools/sm121dis/sm121dis.om; } | seed/out/omc > $@.tmp.$$$$ && chmod +x $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@ |
| 16 | |
| 17 | sm121dis-corpus-bins: $(addprefix $(OUT_DIR)/,gpu_matmul_api_test gpu_elementwise_test gpu_reconv_test gpu_attention_test \ |
| 18 | gpu_moe_window_test gpu_fp8_api_test gpu_decode_attn_test gpu_router_test gpu_bf16_gemv_test gpu_tern_test gpu_fp8gemm_test \ |
| 19 | gpu_tc_probe_test gpu_tc_peak_test gpu_pf_mem_test gpu_qmma_probe_test gpu_cmdlist_test gpu_decode_graph_test gpu_tcgemm_test \ |
| 20 | gpu_prefill_attn_test gpu_pfgemm_test gpu_qgemm_test gpu_pfhost_test gpu_gpr_boundary_test \ |
| 21 | gpu_scan_test gpu_gemm_test gpu_streams_test gpu_isolation_test bw_hazard_test) \ |
| 22 | build/test_omega_divsqrt_gb10_cpu build/test_omega_ldst_gb10_cpu |
| 23 | |
| 24 | .PHONY: test-sm121dis sm121dis-corpus-bins test-sm121dis-corpus-controls test-sm121dis-check-controls |
| 25 | test-sm121dis-corpus-controls: |
| 26 | sh tools/sm121dis/corpus_selftest.sh |
| 27 | |
| 28 | test-sm121dis-check-controls: |
| 29 | sh tools/sm121dis/check_selftest.sh |
| 30 | |
| 31 | test-sm121dis: $(SM121DIS) $(SM121DIS_RED) sm121dis-corpus-bins test-sm121dis-corpus-controls test-sm121dis-check-controls |
| 32 | rm -rf $(SM121DIS_K) && sh tools/sm121dis/corpus.sh $(OUT_DIR) $(SM121DIS_K) |
| 33 | sh tools/sm121dis/check.sh $(SM121DIS) $(SM121DIS_K) $(OUT_DIR)/sm121dis-work |
| 34 | @if sh tools/sm121dis/check.sh $(SM121DIS_RED) $(SM121DIS_K) $(OUT_DIR)/sm121dis-red > $(OUT_DIR)/sm121dis-red.log 2>&1; then \ |
| 35 | echo "RED CHECK BROKEN: the faulty decoder passed"; exit 1; \ |
| 36 | elif ! grep -q '^VERDICT FAIL' $(OUT_DIR)/sm121dis-red.log; then \ |
| 37 | echo "RED CHECK BROKEN: the faulty decoder's run did not reach a verdict"; tail -3 $(OUT_DIR)/sm121dis-red.log; exit 1; \ |
| 38 | else echo "red check: the faulty decoder FAILS the comparison, as it must ($$(grep -c '^\[FAIL\]' $(OUT_DIR)/sm121dis-red.log) kernels)"; fi |
| 39 | |
| 40 | # The provenance checks (tools/divsqrt_nvdisasm_check.sh, tools/ldst_nvdisasm_check.sh, test-numeric-reduce-nvdisasm) |
| 41 | # call build/sm121dis by that name, whatever OUT_DIR is. |
| 42 | ifneq ($(OUT_DIR),build) |
| 43 | build/sm121dis: gpu/nvidia/om/disasm/sm121_dis.om tools/sm121dis/sm121dis.om seed/out/omc |
| 44 | @mkdir -p build |
| 45 | cat gpu/nvidia/om/disasm/sm121_dis.om tools/sm121dis/sm121dis.om | seed/out/omc > $@.tmp.$$$$ && chmod +x $@.tmp.$$$$ && mv -f $@.tmp.$$$$ $@ |
| 46 | endif |
| 47 | |
| 48 | # ZERO-NVDISASM (bar C6, second half: nothing calls nvdisasm). tools/sm121dis/zero_nvdisasm.sh runs every listing and |
| 49 | # provenance check with a decoy nvdisasm first on PATH, the CUDA directories removed from PATH, and strace on execve; |
| 50 | # then its own red check plants two calls to nvdisasm and must see the gate FAIL. |
| 51 | .PHONY: test-zero-nvdisasm |
| 52 | test-zero-nvdisasm: $(SM121DIS) build/sm121dis build/test_omega_reduce_cpu $(addprefix $(OUT_DIR)/,gpu_attention_test gpu_elementwise_test gpu_fp8_api_test gpu_reconv_test bw_hazard_test) |
| 53 | PHYSICS_DIR="$(PHYSICS_DIR)" sh tools/sm121dis/zero_nvdisasm.sh $(OUT_DIR) |
| 54 | @if PHYSICS_DIR="$(PHYSICS_DIR)" sh tools/sm121dis/zero_nvdisasm.sh $(OUT_DIR) --red > $(OUT_DIR)/zero-nvdisasm-red.log 2>&1; then \ |
| 55 | echo "RED CHECK BROKEN: the planted nvdisasm calls passed the gate"; exit 1; \ |
| 56 | else echo "red check: the planted nvdisasm calls FAIL the gate, as they must ($$(grep -c 'FAIL$$' $(OUT_DIR)/zero-nvdisasm-red.log) lines)"; fi |