interplane.Get Omega
Read in your language

physics-mv

FORGE: request-bound machine realization, providers and verification for AienOS. Host, simulated and GB10 hardware paths have separate evidence.

Brought by drakestapleton

branch main Branches Tags History

physics-mv / Makefile

51 lines · 2355 bytes Raw Blame History
1# Host-only test targets for the m16 wait primitive and the nvrm buddy-table
2# reader. No GPU, no chip.
3CC ?= gcc
4CFLAGS ?= -O2 -Wall -Wextra -Werror
5BUILD := build/m16_gpu_wait
6
7.PHONY: test-m16-gpu-wait mutants-m16-gpu-wait host-tests-m16 test-nvrm-buddy
8
9host-tests-m16: test-m16-gpu-wait mutants-m16-gpu-wait
10
11$(BUILD)/test_real: tests/test_m16_gpu_wait.c m16/m16_gpu_wait.c m16/m16_gpu_wait.h
12 @mkdir -p $(BUILD)
13 $(CC) $(CFLAGS) -I m16 tests/test_m16_gpu_wait.c m16/m16_gpu_wait.c -o $@
14
15test-m16-gpu-wait: $(BUILD)/test_real
16 $(BUILD)/test_real
17
18NVRM_INC := -I nvrm -I m16 \
19 -I third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc \
20 -I third_party/nvidia-open-580.173.02/kernel-open/common/inc \
21 -I third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm \
22 -I third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include
23
24# DRA-351: the 2 MiB-block count in the NV_ERR_NO_MEMORY report, per zone.
25build/nvrm_buddy/test: tests/test_nvrm_buddy.c nvrm/nvrm.c nvrm/nvrm.h m16/m16_native.c m16/m16_native.h
26 @mkdir -p build/nvrm_buddy
27 $(CC) $(CFLAGS) $(NVRM_INC) tests/test_nvrm_buddy.c nvrm/nvrm.c m16/m16_native.c -o $@
28
29test-nvrm-buddy: build/nvrm_buddy/test
30 build/nvrm_buddy/test
31
32# Three one-line compile-flag mutants of the REAL primitive. Each must make the
33# host test fail, and fail in the scenario named for it. A surviving mutant
34# fails this target.
35# STALL_NEVER_RESETS killed by progress_resets_idle
36# PROGRESS_EXTENDS_HARD killed by hard_deadline_with_progress
37# NO_BARRIER killed by barrier_before_read
38MUTANTS := STALL_NEVER_RESETS:progress_resets_idle \
39 PROGRESS_EXTENDS_HARD:hard_deadline_with_progress \
40 NO_BARRIER:barrier_before_read
41
42mutants-m16-gpu-wait:
43 @mkdir -p $(BUILD)
44 @set -e; for m in $(MUTANTS); do \
45 flag=$${m%%:*}; scen=$${m##*:}; \
46 $(CC) $(CFLAGS) -DM16_GPU_WAIT_MUT_$$flag -I m16 tests/test_m16_gpu_wait.c m16/m16_gpu_wait.c -o $(BUILD)/mut_$$flag; \
47 if $(BUILD)/mut_$$flag > $(BUILD)/mut_$$flag.log 2>&1; then echo "MUTANT $$flag SURVIVED (test passed)"; exit 1; fi; \
48 if ! grep -Eq "^real +$$scen +FAIL" $(BUILD)/mut_$$flag.log; then echo "MUTANT $$flag died but not in $$scen"; cat $(BUILD)/mut_$$flag.log; exit 1; fi; \
49 echo "MUTANT $$flag killed by $$scen"; \
50 done
51 @echo "M16_GPU_WAIT_MUTANTS PASS (3/3 killed)"