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
CUDApp / tests / attention_kgen.mk
| 1 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | # Included after mk/api-kgen.mk; all executions require the documented bwrap wrapper. |
| 3 | ifndef CUDAPP_ATTN_KGEN_INCLUDED |
| 4 | CUDAPP_ATTN_KGEN_INCLUDED := 1 |
| 5 | ATTN_KGEN_UNIT ?= src/cudapp_freest_attention_ir.c |
| 6 | $(API_KGEN_DIR)/attention_unit.o: $(ATTN_KGEN_UNIT) |
| 7 | @mkdir -p $(API_KGEN_DIR) |
| 8 | $(API_KGEN_CC) -c $< -o $@ |
| 9 | $(API_KGEN_DIR)/attention_diff.o: tests/api_kernel_gen_attention.c src/omega_gpu_attention_api.c tests/attention_kgen.mk |
| 10 | @mkdir -p $(API_KGEN_DIR) |
| 11 | @rm -f $(API_KGEN_DIR)/attention_diff.gcda |
| 12 | $(API_KGEN_CC) -O0 --coverage -ffp-contract=off -c $< -o $@ |
| 13 | # Simply expanded: the same list the attention_diff rule's prerequisites expand to here, before later |
| 14 | # includes append to CUDAPP_FS_BINDING. |
| 15 | ATTN_KGEN_LINK_OBJS := $(API_KGEN_DIR)/attention_diff.o $(filter-out $(API_KGEN_DIR)/cudapp_freest_attention_ir.o,$(API_KGEN_OBJS)) |
| 16 | $(API_KGEN_DIR)/attention_diff: $(ATTN_KGEN_LINK_OBJS) $(API_KGEN_DIR)/attention_unit.o |
| 17 | $(CC) --coverage -Wl,--gc-sections -o $@ $^ -lpthread -lm |
| 18 | .PHONY: test-api-kgen-attention test-api-kgen-attention-mutants |
| 19 | test-api-kgen-attention: $(API_KGEN_DIR)/attention_diff |
| 20 | $(API_KGEN_DIR)/attention_diff |
| 21 | @set +e; $(API_KGEN_DIR)/attention_diff --perturb; rc=$$?; set -e; test "$$rc" = 1 && echo 'PASS attention red control detected perturbed IR record' |
| 22 | @set +e; $(API_KGEN_DIR)/attention_diff --cubin-red; rc=$$?; set -e; test "$$rc" = 1 && echo 'PASS attention red control detected perturbed final cubin' |
| 23 | test-api-kgen-attention-mutants: $(API_KGEN_DIR)/attention_diff |
| 24 | python3 tests/attention_kgen_mutants.py $(API_KGEN_DIR) $(ATTN_KGEN_LINK_OBJS) |
| 25 | endif |