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 / mk / om-qmd.mk

90 lines · 6243 bytes Raw Blame History
1# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2# Blackwell QMD packing in seeded Omega (om/qmd/bw_qmd.om).
3# make test-om-qmd cited constants, field boundaries, 10000 random cases, source-derived partition
4# make test-om-qmd-diff same calls packed by .om and by the C oracle; abort on any difference
5# make test-om-qmd-red one flipped output word must abort
6# make test-om-qmd-cov gcov line and branch report of the C oracle under the differential sweep
7# make test-om-qmd-mutants recompiled bw_qmd.om mutants must fail the sweep (needs OMEGA_OMC, OMEGA_BRIDGE)
8# Host only. No device.
9OM_QMD_DIR = $(OUT_DIR)/om-qmd
10OM_QMD_BUILD = gcc -std=gnu11 -O2 -Wall -Wextra -Werror -Isrc
11OM_QMD_DEPS = src/omega_blackwell_qmd.c src/omega_blackwell_qmd.h src/cudapp_om_bw_qmd.c src/cudapp_native.h
12OM_QMD_DIFF = -DCUDAPP_MIGRATION_PENDING_QMD_DIFF
13
14.PHONY: test-om-qmd test-om-qmd-diff test-om-qmd-red
15$(OM_QMD_DIR)/sweep: tests/om_qmd_sweep_test.c $(OM_QMD_DEPS)
16 @mkdir -p $(OM_QMD_DIR)
17 $(OM_QMD_BUILD) -o $@ tests/om_qmd_sweep_test.c src/omega_blackwell_qmd.c src/cudapp_om_bw_qmd.c
18$(OM_QMD_DIR)/sweep_diff: tests/om_qmd_sweep_test.c $(OM_QMD_DEPS)
19 @mkdir -p $(OM_QMD_DIR)
20 $(OM_QMD_BUILD) $(OM_QMD_DIFF) -o $@ tests/om_qmd_sweep_test.c src/omega_blackwell_qmd.c src/cudapp_om_bw_qmd.c
21$(OM_QMD_DIR)/sweep_red: tests/om_qmd_sweep_test.c $(OM_QMD_DEPS)
22 @mkdir -p $(OM_QMD_DIR)
23 $(OM_QMD_BUILD) $(OM_QMD_DIFF) -DQMD_DIFF_FLIP -o $@ tests/om_qmd_sweep_test.c src/omega_blackwell_qmd.c src/cudapp_om_bw_qmd.c
24test-om-qmd: $(OM_QMD_DIR)/sweep
25 $(OM_QMD_DIR)/sweep
26test-om-qmd-diff: $(OM_QMD_DIR)/sweep_diff
27 $(OM_QMD_DIR)/sweep_diff
28test-om-qmd-red: $(OM_QMD_DIR)/sweep_red
29 @rc=0; $(OM_QMD_DIR)/sweep_red >/dev/null 2>$(OM_QMD_DIR)/red.log || rc=$$?; \
30 if [ "$$rc" = 0 ]; then echo "FAIL red sweep exited 0"; exit 1; fi; \
31 grep -q "QMD DIFF" $(OM_QMD_DIR)/red.log; echo "PASS red sweep aborted rc=$$rc"
32
33# Engine decisions in seeded Omega (om/engine/eng.om), differential against the C oracles.
34# make test-om-eng-diff om build and C build (every CUDAPP_MIGRATION_PENDING_C_<PART>) give identical transcripts
35# make test-om-eng-red one flipped unit answer must make the transcripts differ
36# make test-om-eng-mutants recompiled eng.om mutants must fail the differential or the backend test
37# (needs OMEGA_OMC, OMEGA_BRIDGE and the eng_c transcript of test-om-eng-diff)
38OM_ENG_C_PARTS = $(foreach p,ENGINE WAIT MEMRESV MEMCACHE SERVING M16NATIVE M16WAIT PLATFORM SUBMIT BWENGINE REQUALIFY CONCURRENT VISIBILITY LIFECYCLE ENGINE_FIXTURE_REST CLOCK_SCALARS,-DCUDAPP_MIGRATION_PENDING_C_$(p))
39OM_ENG_SRCS = tests/om_eng_diff_test.c src/omega_gpu_engine.c src/omega_gpu_wait.c src/omega_gpu_platform.c \
40 src/omega_gpu_mem_reserve.c src/omega_gpu_mem_cached.c src/omega_gpu_serving.c src/omega_gpu_platform_linux.c \
41 src/omega_gpu_fmt.c src/omega_ampere_qmd.c src/cudapp_om_amp_runtime.c m16/m16_gpu_wait.c m16/m16_native.c nvrm/nvrm.c
42OM_ENG_UNIT ?= src/cudapp_om_eng.c
43OM_ENG_BINDING = $(filter-out src/cudapp_om_nvrm_transport.c $(OM_ENG_UNIT) src/cudapp_om_eng.c src/cudapp_om_amp_runtime.c,$(GPU_AIEN_BINDING))
44OM_ENG_PLATFORM = src/omega_gpu_chip.c om/platform-linux/gen/link/plat_fx_effects.c om/platform-linux/gen/link/plat_fx_wait.c
45OM_ENG_BUILD = gcc -std=gnu11 -O2 -Wall -Wextra -Werror -D_GNU_SOURCE -DCUDAPP_NVRM_TEST_TRANSPORT=1 -Isrc $(GPU_ENGINE_PHYS_INC) -Wl,--wrap=omega_eng
46OM_ENG_DEPS = $(OM_ENG_SRCS) $(OM_ENG_UNIT) $(OM_ENG_BINDING) $(OM_ENG_PLATFORM) src/omega_eng_dec.h src/omega_eng_gates.h src/omega_fixture_rest.h
47
48.PHONY: test-om-eng-diff test-om-eng-red
49$(OM_QMD_DIR)/eng_om: $(OM_ENG_DEPS)
50 @mkdir -p $(OM_QMD_DIR)
51 $(OM_ENG_BUILD) -o $@ $(OM_ENG_SRCS) $(OM_ENG_UNIT) $(OM_ENG_BINDING) $(OM_ENG_PLATFORM)
52$(OM_QMD_DIR)/eng_c: $(OM_ENG_DEPS)
53 @mkdir -p $(OM_QMD_DIR)
54 $(OM_ENG_BUILD) $(OM_ENG_C_PARTS) -DENG_EXPECT_C -o $@ $(OM_ENG_SRCS) $(OM_ENG_UNIT) $(OM_ENG_BINDING) $(OM_ENG_PLATFORM)
55$(OM_QMD_DIR)/eng_flip: $(OM_ENG_DEPS)
56 @mkdir -p $(OM_QMD_DIR)
57 $(OM_ENG_BUILD) -DENG_TRACE_FLIP=5000 -o $@ $(OM_ENG_SRCS) $(OM_ENG_UNIT) $(OM_ENG_BINDING) $(OM_ENG_PLATFORM)
58test-om-eng-diff: $(OM_QMD_DIR)/eng_om $(OM_QMD_DIR)/eng_c
59 $(OM_QMD_DIR)/eng_om $(OM_QMD_DIR)/eng_om.txt 2>$(OM_QMD_DIR)/eng_om.ops
60 $(OM_QMD_DIR)/eng_c $(OM_QMD_DIR)/eng_c.txt 2>$(OM_QMD_DIR)/eng_c.ops
61 $(OM_QMD_DIR)/eng_om --compare $(OM_QMD_DIR)/eng_om.txt $(OM_QMD_DIR)/eng_c.txt
62test-om-eng-red: $(OM_QMD_DIR)/eng_flip $(OM_QMD_DIR)/eng_c
63 $(OM_QMD_DIR)/eng_flip $(OM_QMD_DIR)/eng_flip.txt 2>/dev/null
64 $(OM_QMD_DIR)/eng_c $(OM_QMD_DIR)/eng_c.txt 2>/dev/null
65 @rc=0; $(OM_QMD_DIR)/eng_om --compare $(OM_QMD_DIR)/eng_flip.txt $(OM_QMD_DIR)/eng_c.txt || rc=$$?; \
66 if [ "$$rc" != 1 ]; then echo "FAIL flipped unit answer was not detected (rc=$$rc)"; exit 1; fi; \
67 echo "PASS red: flipped unit answer detected"
68
69.PHONY: test-om-eng-mutants test-om-qmd-mutants
70test-om-eng-mutants: $(OM_QMD_DIR)/eng_c
71 $(OM_QMD_DIR)/eng_c $(OM_QMD_DIR)/eng_c.txt 2>/dev/null
72 OM_ENG_BUILD_LINE='$(OM_ENG_BUILD) $(OM_ENG_SRCS) $(OM_ENG_BINDING) $(OM_ENG_PLATFORM)' OM_ENG_BE_BINDING='$(filter-out src/cudapp_om_eng.c src/cudapp_om_nvrm_transport.c,$(CUDAPP_BINDING_SRCS))' sh tests/om_eng_mutants.sh
73test-om-qmd-mutants:
74 sh tests/om_qmd_mutants.sh
75
76# gcov of the C QMD oracle (src/omega_blackwell_qmd.c) under the differential sweep.
77.PHONY: test-om-qmd-cov
78test-om-qmd-cov: tests/om_qmd_sweep_test.c $(OM_QMD_DEPS)
79 @rm -rf $(OM_QMD_DIR)/cov && mkdir -p $(OM_QMD_DIR)/cov
80 cd $(OM_QMD_DIR)/cov && gcc -std=gnu11 -O0 --coverage -Wall -Wextra -Werror -I$(CURDIR)/src $(OM_QMD_DIFF) -o sweep_cov \
81 $(CURDIR)/tests/om_qmd_sweep_test.c $(CURDIR)/src/omega_blackwell_qmd.c $(CURDIR)/src/cudapp_om_bw_qmd.c
82 cd $(OM_QMD_DIR)/cov && ./sweep_cov && gcov -b -o . $$(ls *omega_blackwell_qmd.gcno) | tee gcov.txt | grep -A4 "omega_blackwell_qmd.c'"
83
84CARRIED_HOST_TESTS += test-engine-fixture-rest
85.PHONY: test-engine-fixture-rest
86# Converts .om through the bridge's seeded converter, which executes the pinned AArch64 omc.
87CUDAPP_TARGET_ONLY_TESTS += $(if $(CUDAPP_OMC_HOST),,test-engine-fixture-rest)
88test-engine-fixture-rest:
89 @$(CUDAPP_REQUIRE_OMC)
90 python3 tests/om_fixture_rest_test.py