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 / api-kgen.mk

30 lines · 1498 bytes Raw Blame History
1# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2# CPU-only; invoke every target under the lane's bwrap device isolation.
3API_KGEN_DIR ?= build/api-kgen
4API_KGEN_CORE = omega_blackwell_codegen omega_gpu_om_ir omega_cubin sha256
5API_KGEN_OBJS = $(addprefix $(API_KGEN_DIR)/,$(addsuffix .o,$(API_KGEN_CORE))) \
6 $(patsubst src/%.c,$(API_KGEN_DIR)/%.o,$(CUDAPP_BINDING_SRCS))
7API_KGEN_CC = $(CC) $(CFLAGS) -ffunction-sections -fdata-sections
8
9include tests/attention_kgen.mk
10
11$(API_KGEN_DIR)/%.o: src/%.c src/cudapp_native.h
12 @mkdir -p $(API_KGEN_DIR)
13 $(API_KGEN_CC) -c $< -o $@
14$(API_KGEN_DIR)/ew_diff.o: tests/api_kgen_ew_diff_test.c src/omega_gpu_elementwise_api.c
15 @mkdir -p $(API_KGEN_DIR)
16 $(API_KGEN_CC) -c $< -o $@
17$(API_KGEN_DIR)/ew_red.o: tests/api_kgen_ew_diff_test.c src/omega_gpu_elementwise_api.c
18 @mkdir -p $(API_KGEN_DIR)
19 $(API_KGEN_CC) -DCUDAPP_API_KGEN_RED -c $< -o $@
20$(API_KGEN_DIR)/ew_diff: $(API_KGEN_DIR)/ew_diff.o $(API_KGEN_OBJS)
21 $(CC) -Wl,--gc-sections -o $@ $^ -lpthread -lm
22$(API_KGEN_DIR)/ew_red: $(API_KGEN_DIR)/ew_red.o $(API_KGEN_OBJS)
23 $(CC) -Wl,--gc-sections -o $@ $^ -lpthread -lm
24.PHONY: test-api-kgen-ew test-api-kgen-ew-mutants
25test-api-kgen-ew: $(API_KGEN_DIR)/ew_diff $(API_KGEN_DIR)/ew_red
26 $(API_KGEN_DIR)/ew_diff
27 @set +e; $(API_KGEN_DIR)/ew_red; rc=$$?; set -e; test "$$rc" = 1 && echo 'PASS API EW red control detected an altered IR word'
28
29test-api-kgen-ew-mutants: $(API_KGEN_DIR)/ew_diff
30 python3 tests/api_kgen_ew_mutants.py $(API_KGEN_DIR)