omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / mk / prime_race_gb10.mk
| 1 | # AIEN Prime Drag Race: native GB10 implementation (bench/prime_race/gb10_native.c) on Omega's |
| 2 | # own Blackwell codegen + session (libomega_gpu.a, no CUDA). Picked up by `-include mk/*.mk`; |
| 3 | # not part of `all` or `test`. Needs PHYSICS_DIR at the physics.lock commit (libomega_gpu). |
| 4 | # |
| 5 | # prime-race-gb10 build bench/prime_race/build/gb10_native (+ _mutant, the chip test's |
| 6 | # negative control) and refuse them if nm finds a CUDA symbol |
| 7 | # prime-race-gb10-host-test golden words, nvdisasm listing, host IR simulator sweep (no device) |
| 8 | # The chip test is bench/prime_race/tests/run_gb10_chip.sh (holds /tmp/aien-gb10.lock). |
| 9 | # prime-race-gb10-launch-cost build the DIAGNOSTIC per-launch cost tool (tests/gb10_launch_cost.c; |
| 10 | # chip launches need GB10_CHIP_RUN=1 and the GPU lock) |
| 11 | ifndef PRIME_RACE_GB10_MK |
| 12 | PRIME_RACE_GB10_MK := 1 |
| 13 | .PHONY: prime-race-gb10 prime-race-gb10-host-test prime-race-gb10-launch-cost PRIME_RACE_FORCE |
| 14 | PRIME_RACE_FORCE: |
| 15 | GB_DIR = bench/prime_race |
| 16 | GB_BUILD = $(GB_DIR)/build |
| 17 | GB_OPT = -O3 -mcpu=native |
| 18 | # The label carries +dirty when code that goes into the binary has uncommitted changes, and the |
| 19 | # stamp below changes whenever the label does, so a binary never carries a stale commit. |
| 20 | GB_SRC_COMMIT := $(shell git rev-parse HEAD 2>/dev/null || echo unknown)$(shell git status --porcelain -- src bench/prime_race mk 2>/dev/null | head -c1 | sed 's/.\+/+dirty/') |
| 21 | GB_LABEL_STAMP = $(GB_BUILD)/.gb_source_label |
| 22 | GB_DEFS = -DPR_SOURCE_COMMIT='"$(GB_SRC_COMMIT)"' -DPR_CC='"$(CC)"' \ |
| 23 | -DPR_CFLAGS='"$(GB_OPT) -I$(GB_DIR) + omega CFLAGS; libomega_gpu.a built with omega CFLAGS"' |
| 24 | GB_DEPS = $(GB_DIR)/gb10_native.c $(GB_LABEL_STAMP) $(GB_DIR)/prime_race_impl.c $(GB_DIR)/prime_race_impl.h \ |
| 25 | src/omega_gpu_elementwise_api.h src/omega_gpu_session.h $(OUT_DIR)/libomega_gpu.a |
| 26 | # Same pattern as tools/chip_run.sh REFUSAL:cuda |
| 27 | GB_NM_CHECK = if nm -u $@ | grep -Eiq 'cuda|cuInit|cuLaunch|nvrtc|cublas'; then echo "CUDA symbols in $@"; rm -f $@; exit 1; fi |
| 28 | |
| 29 | $(GB_BUILD)/gb10_native: $(GB_DEPS) |
| 30 | @mkdir -p $(GB_BUILD) |
| 31 | $(CC) $(CFLAGS) $(GB_OPT) -I$(GB_DIR) $(GB_DEFS) -o $@ $(GB_DIR)/gb10_native.c $(GB_DIR)/prime_race_impl.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm |
| 32 | @$(GB_NM_CHECK) |
| 33 | $(GB_BUILD)/gb10_native_mutant: $(GB_DEPS) |
| 34 | @mkdir -p $(GB_BUILD) |
| 35 | $(CC) $(CFLAGS) $(GB_OPT) -I$(GB_DIR) $(GB_DEFS) -DPR_GB10_MUTANT=1 -o $@ $(GB_DIR)/gb10_native.c $(GB_DIR)/prime_race_impl.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm |
| 36 | @$(GB_NM_CHECK) |
| 37 | prime-race-gb10: $(GB_BUILD)/gb10_native $(GB_BUILD)/gb10_native_mutant |
| 38 | $(GB_LABEL_STAMP): PRIME_RACE_FORCE |
| 39 | @mkdir -p $(GB_BUILD) |
| 40 | @echo '$(GB_SRC_COMMIT)' > $@.tmp; cmp -s $@.tmp $@ && rm $@.tmp || mv $@.tmp $@ |
| 41 | |
| 42 | $(GB_BUILD)/gb10_sieve_host_test: $(GB_DIR)/tests/gb10_sieve_host_test.c $(GB_DIR)/prime_race_impl.h src/omega_blackwell_codegen.h src/omega_gpu_elementwise_api.h tests/bw_warp_sim.h $(OUT_DIR)/libomega_gpu.a |
| 43 | @mkdir -p $(GB_BUILD) |
| 44 | $(CC) $(CFLAGS) -I$(GB_DIR) -Itests -o $@ $(GB_DIR)/tests/gb10_sieve_host_test.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm |
| 45 | prime-race-gb10-host-test: $(GB_BUILD)/gb10_sieve_host_test |
| 46 | ./$(GB_BUILD)/gb10_sieve_host_test |
| 47 | $(GB_BUILD)/gb10_launch_cost: $(GB_DIR)/tests/gb10_launch_cost.c src/omega_blackwell_codegen.h src/omega_gpu_elementwise_api.h src/omega_gpu_session.h $(OUT_DIR)/libomega_gpu.a |
| 48 | @mkdir -p $(GB_BUILD) |
| 49 | $(CC) $(CFLAGS) $(GB_OPT) -o $@ $(GB_DIR)/tests/gb10_launch_cost.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm |
| 50 | @$(GB_NM_CHECK) |
| 51 | prime-race-gb10-launch-cost: $(GB_BUILD)/gb10_launch_cost |
| 52 | endif |