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
| 1 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | CARRIED_HOST_TESTS += test-core-util test-core-mutants test-core-cubin-message test-core-residue test-core-residue-mutants |
| 3 | .PHONY: test-core-util test-core-algorithms test-core-mutants test-core-sha-state |
| 4 | $(OUT_DIR)/core-util-sha-ref.o: src/sha256.c | $(OUT_DIR) |
| 5 | $(CC) $(CFLAGS) -DCUDAPP_MIGRATION_PENDING_C_CORE -Dsha256_init=ref_sha256_init -Dsha256_update=ref_sha256_update -Dsha256_final=ref_sha256_final -Dsha256_hash=ref_sha256_hash -c $< -o $@ |
| 6 | $(OUT_DIR)/test-core-util: tests/test_core_util.c src/sha256.c $(OUT_DIR)/core-util-sha-ref.o src/cudapp_om_core_sha.c src/omega_core_binding.h src/cudapp_native.h | $(OUT_DIR) |
| 7 | $(CC) $(CFLAGS) -o $@ $(filter %.c %.o,$^) -lpthread |
| 8 | test-core-util: $(OUT_DIR)/test-core-util $(OUT_DIR)/test-core-algorithms $(OUT_DIR)/test-core-sha-state |
| 9 | ./$(OUT_DIR)/test-core-util |
| 10 | ./$(OUT_DIR)/test-core-sha-state |
| 11 | @if ./$(OUT_DIR)/test-core-util --flip; then echo 'FAIL record flip survived'; exit 1; else echo 'CORE-UTIL negative control caught'; fi |
| 12 | ./$(OUT_DIR)/test-core-algorithms |
| 13 | |
| 14 | CORE_UTIL_ORACLES := omega_core omega_canonical omega_vector omega_gpu_fmt omega_gpu_hostmath |
| 15 | CORE_UTIL_REFS := $(addprefix $(OUT_DIR)/core-util-ref-,$(addsuffix .o,$(CORE_UTIL_ORACLES))) |
| 16 | CORE_UTIL_SOURCES := $(addprefix src/,$(addsuffix .c,$(CORE_UTIL_ORACLES))) src/sha256.c |
| 17 | CORE_UTIL_GENERATED := $(wildcard src/cudapp_om_core_*.c) |
| 18 | $(OUT_DIR)/core-util-ref-%.o: src/%.c tests/core_util_rename.h | $(OUT_DIR) |
| 19 | $(CC) $(CFLAGS) -ffp-contract=off -DCUDAPP_MIGRATION_PENDING_C_CORE -include tests/core_util_rename.h -c $< -o $@ |
| 20 | $(OUT_DIR)/test-core-algorithms: tests/test_core_algorithms.c $(CORE_UTIL_SOURCES) $(CORE_UTIL_REFS) $(OUT_DIR)/core-util-sha-ref.o $(CORE_UTIL_GENERATED) src/cudapp_freest_f16.c src/omega_core_binding.h src/omega_core_om.inc src/cudapp_native.h tests/core_util_refs.h | $(OUT_DIR) |
| 21 | $(CC) $(CFLAGS) -ffp-contract=off -o $@ $(filter %.c %.o,$^) -lpthread |
| 22 | test-core-algorithms: $(OUT_DIR)/test-core-algorithms |
| 23 | ./$(OUT_DIR)/test-core-algorithms |
| 24 | |
| 25 | # Converts .om through the bridge's seeded converter, which executes the pinned AArch64 omc. |
| 26 | CUDAPP_TARGET_ONLY_TESTS += $(if $(CUDAPP_OMC_HOST),,test-core-mutants) |
| 27 | test-core-mutants: $(OUT_DIR)/test-core-util |
| 28 | @$(CUDAPP_REQUIRE_OMC) |
| 29 | python3 tests/test_core_mutants.py --out-dir $(OUT_DIR) --receipt $(OUT_DIR)/core-util-mutants |
| 30 | |
| 31 | $(OUT_DIR)/test-core-sha-state: tests/test_core_sha_state.c src/sha256.c $(OUT_DIR)/core-util-sha-ref.o src/cudapp_om_core_sha.c src/omega_core_binding.h src/cudapp_native.h | $(OUT_DIR) |
| 32 | $(CC) $(CFLAGS) -o $@ $(filter %.c %.o,$^) -lpthread |
| 33 | test-core-sha-state: $(OUT_DIR)/test-core-sha-state |
| 34 | ./$(OUT_DIR)/test-core-sha-state |
| 35 | |
| 36 | $(OUT_DIR)/test-core-cubin-message: tests/test_core_cubin_message.c tests/core_cubin_refusal_ref.inc src/cudapp_freest_core_cubinmsg.c src/cudapp_native.h | $(OUT_DIR) |
| 37 | $(CC) $(CFLAGS) -o $@ $(filter %.c,$^) -lpthread |
| 38 | .PHONY: test-core-cubin-message |
| 39 | test-core-cubin-message: $(OUT_DIR)/test-core-cubin-message |
| 40 | ./$(OUT_DIR)/test-core-cubin-message |
| 41 | @if ./$(OUT_DIR)/test-core-cubin-message --flip; then echo 'FAIL cubin message flip survived'; exit 1; else echo 'CORE-UTIL cubin message negative control caught'; fi |
| 42 | |
| 43 | $(OUT_DIR)/test-core-residue: tests/test_core_residue.c src/omega_cubin.c src/cudapp_om_cubin_elf.c \ |
| 44 | src/cudapp_freest_core_cubinmsg.c src/cudapp_freest_core_cubadmit.c src/cudapp_om_core_ampack.c \ |
| 45 | src/cudapp_om_core_fmtnum.c src/cudapp_native.h | $(OUT_DIR) |
| 46 | $(CC) $(CFLAGS) -o $@ $(filter %.c,$^) -lpthread |
| 47 | $(OUT_DIR)/test-core-residue-diff: tests/test_core_residue.c src/omega_cubin.c src/cudapp_om_cubin_elf.c \ |
| 48 | src/cudapp_freest_core_cubinmsg.c src/cudapp_freest_core_cubadmit.c src/cudapp_om_core_ampack.c \ |
| 49 | src/cudapp_om_core_fmtnum.c src/cudapp_native.h | $(OUT_DIR) |
| 50 | $(CC) $(CFLAGS) -DCUDAPP_MIGRATION_PENDING_CUBIN_DIFF -o $@ $(filter %.c,$^) -lpthread |
| 51 | $(OUT_DIR)/test-core-residue-red: tests/test_core_residue.c src/omega_cubin.c src/cudapp_om_cubin_elf.c \ |
| 52 | src/cudapp_freest_core_cubinmsg.c src/cudapp_freest_core_cubadmit.c src/cudapp_om_core_ampack.c \ |
| 53 | src/cudapp_om_core_fmtnum.c src/cudapp_native.h | $(OUT_DIR) |
| 54 | $(CC) $(CFLAGS) -DCUDAPP_MIGRATION_PENDING_CUBIN_DIFF -DCUDAPP_CUBIN_DIFF_SELFTEST -o $@ $(filter %.c,$^) -lpthread |
| 55 | .PHONY: test-core-residue test-core-residue-mutants |
| 56 | test-core-residue: $(OUT_DIR)/test-core-residue $(OUT_DIR)/test-core-residue-diff $(OUT_DIR)/test-core-residue-red |
| 57 | ./$(OUT_DIR)/test-core-residue |
| 58 | ./$(OUT_DIR)/test-core-residue-diff |
| 59 | @if ./$(OUT_DIR)/test-core-residue --flip >/dev/null; then echo 'FAIL ampack flip survived'; exit 1; else echo 'CORE-RESIDUE ampack negative control caught'; fi |
| 60 | @if ./$(OUT_DIR)/test-core-residue-red >/dev/null 2>&1; then echo 'RED CHECK BROKEN: flipped cubin bit passed'; exit 1; else echo 'CORE-RESIDUE red check: one flipped image bit aborts'; fi |
| 61 | # The residue mutants regenerate units through om/units.sh (pinned AArch64 omc). |
| 62 | CUDAPP_TARGET_ONLY_TESTS += $(if $(CUDAPP_OMC_HOST),,test-core-residue-mutants) |
| 63 | ifeq ($(CUDAPP_OMC_HOST),1) |
| 64 | test-core-residue-mutants: $(OUT_DIR)/test-core-residue |
| 65 | OMEGA_OMC="$(or $(OMEGA_OMC),$(HOME)/work/cudastack/omega-mv/seed/out/omc)" OMEGA_BRIDGE="$(or $(OMEGA_BRIDGE),$(HOME)/work/cudastack/omega-bridge)" python3 tests/test_core_residue_mutants.py |
| 66 | else |
| 67 | test-core-residue-mutants: |
| 68 | @echo "$@: NOT_RUN (requires the pinned AArch64 omc; set OMEGA_OMC to a pin that executes on this host; not part of the portable host suite)" |
| 69 | @exit 2 |
| 70 | endif |