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 / ampere-encoder.mk

51 lines · 3136 bytes Raw Blame History
1# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2# Offline-only tests; never a device qualification. The parent Makefile adds
3# $(AMPERE_CORPUS_SRCS) to SRCS. Use a distinct OUT_DIR when enabling capture.
4AMPERE_ENCODER_TEST = $(OUT_DIR)/ampere_encoder_test
5AMPERE_ORACLE_CORPUS = $(OUT_DIR)/ampere-oracle-corpus
6CUDAPP_AMPERE_CORPUS ?= 0
7ifeq ($(CUDAPP_AMPERE_CORPUS),1)
8CFLAGS += -DCUDAPP_AMPERE_CORPUS
9AMPERE_CORPUS_SRCS = tools/ampere_corpus.c
10vpath ampere_corpus.c tools
11endif
12# The capture's decisions are seeded Omega (om/tools/ampcorp.om, src/cudapp_om_ampcorp.c in the library).
13# CUDAPP_MIGRATION_PENDING_C_TOOLS_AMPCORP=1 builds the former C instead: the oracle of tests/tools-om/ampcorp.sh.
14CUDAPP_MIGRATION_PENDING_C_TOOLS_AMPCORP ?= 0
15ifeq ($(CUDAPP_MIGRATION_PENDING_C_TOOLS_AMPCORP),1)
16CFLAGS += -DCUDAPP_MIGRATION_PENDING_C_TOOLS_AMPCORP
17endif
18# tools/ampere_families.c: steps, specifications and verdicts are om/tools/ampfam.om (src/cudapp_om_ampfam.c in
19# the library). CUDAPP_MIGRATION_PENDING_C_TOOLS_AMPFAM=1 builds the former C: the oracle of tests/tools-om/ampfam.sh.
20CUDAPP_MIGRATION_PENDING_C_TOOLS_AMPFAM ?= 0
21ifeq ($(CUDAPP_MIGRATION_PENDING_C_TOOLS_AMPFAM),1)
22CFLAGS += -DCUDAPP_MIGRATION_PENDING_C_TOOLS_AMPFAM
23endif
24
25$(AMPERE_ENCODER_TEST): tests/test_omega_ampere_encoder.c src/omega_ampere_codegen.h $(OUT_DIR)/libomega_gpu.a
26 $(CC) $(CFLAGS) -o $@ tests/test_omega_ampere_encoder.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm
27
28$(OUT_DIR)/ampere_families: tools/ampere_families.c $(OUT_DIR)/libomega_gpu.a
29 $(CC) $(CFLAGS) -o $@ tools/ampere_families.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm
30
31$(OUT_DIR)/ampere_matmul_families: tests/test_omega_codegen_freestanding.c $(OUT_DIR)/libomega_gpu.a
32 $(CC) $(CFLAGS) -o $@ tests/test_omega_codegen_freestanding.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm
33
34.PHONY: test-ampere-encoder test-ampere-encoder-oracle
35test-ampere-encoder: $(AMPERE_ENCODER_TEST)
36 ./$(AMPERE_ENCODER_TEST)
37
38# No recursive make/test. Existing producers execute serially in their documented
39# host-only/simulator modes; raw-patched FP8 markers must be explicitly refused.
40# make OUT_DIR=build-ampere-oracle CUDAPP_AMPERE_CORPUS=1 test-ampere-encoder-oracle
41test-ampere-encoder-oracle: $(AMPERE_ENCODER_TEST) $(OUT_DIR)/ampere_math_device \
42 $(OUT_DIR)/ampere_families $(OUT_DIR)/ampere_matmul_families sm121dis-corpus-bins
43 @test "$(CUDAPP_AMPERE_CORPUS)" = 1 || { echo 'use CUDAPP_AMPERE_CORPUS=1 and a fresh OUT_DIR' >&2; exit 1; }
44 @rm -rf -- $(AMPERE_ORACLE_CORPUS)
45 @mkdir -p $(AMPERE_ORACLE_CORPUS)/sm121
46 OMEGA_AMPERE_CORPUS_DIR=$(abspath $(AMPERE_ORACLE_CORPUS)) ./$(AMPERE_ENCODER_TEST)
47 OMEGA_AMPERE_CORPUS_DIR=$(abspath $(AMPERE_ORACLE_CORPUS)) ./$(OUT_DIR)/ampere_families
48 OMEGA_AMPERE_CORPUS_DIR=$(abspath $(AMPERE_ORACLE_CORPUS)) ./$(OUT_DIR)/ampere_matmul_families --dump
49 OMEGA_AMPERE_CORPUS_DIR=$(abspath $(AMPERE_ORACLE_CORPUS)) sh tools/sm121dis/corpus.sh $(OUT_DIR) $(AMPERE_ORACLE_CORPUS)/sm121
50 OMEGA_AMPERE_CORPUS_DIR=$(abspath $(AMPERE_ORACLE_CORPUS)) ./$(OUT_DIR)/ampere_math_device --emit-only
51 python3 tools/ampere_nvdisasm.py $(AMPERE_ORACLE_CORPUS)