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 / omega-gpu-code-alloc.mk
| 1 | # GPU code buffer sizing (src/omega_gpu_code_alloc.h): the 2 KB instruction prefetch tail after every |
| 2 | # kernel (omega#323). Host only: no device, no physics headers. Three parts: the size rule, a NO_TAIL |
| 3 | # mutant that must fail it, and a source scan that refuses the page-only code sizing idioms the six |
| 4 | # variable-size upload sites and five fixed-size sites used before. |
| 5 | CODE_ALLOC_SCAN_SRC := src/*.c src/runtime/*.c |
| 6 | CODE_ALLOC_SCAN_RE := code_size \+ 0x[fF]{3}|session_alloc\([^,]*code_size|alloc[a-z_]*\([^,]*, *(0x[0-9a-fA-F]+|OMEGA_DS_MAX_CODE_BYTES), *&[a-z_>.-]*code_mem\) |
| 7 | .PHONY: test-gpu-code-alloc |
| 8 | build/test_omega_gpu_code_alloc: tests/test_omega_gpu_code_alloc.c src/omega_gpu_code_alloc.h |
| 9 | @mkdir -p build |
| 10 | gcc -std=gnu11 -O2 -Wall -Wextra -Werror -Isrc -o $@ tests/test_omega_gpu_code_alloc.c |
| 11 | test-gpu-code-alloc: build/test_omega_gpu_code_alloc |
| 12 | ./build/test_omega_gpu_code_alloc |
| 13 | @gcc -std=gnu11 -O2 -Wall -Wextra -Werror -DOMEGA_GPU_CODE_ALLOC_MUTANT_NO_TAIL -Isrc -o build/test_omega_gpu_code_alloc_no_tail tests/test_omega_gpu_code_alloc.c |
| 14 | @if ./build/test_omega_gpu_code_alloc_no_tail >build/test_omega_gpu_code_alloc_no_tail.log 2>&1; then echo "MUTANT SURVIVED: NO_TAIL"; exit 1; fi |
| 15 | @echo "NO_TAIL mutant: killed ($$(grep -c '^FAIL:' build/test_omega_gpu_code_alloc_no_tail.log) failing checks)" |
| 16 | @if grep -nE '$(CODE_ALLOC_SCAN_RE)' $(CODE_ALLOC_SCAN_SRC); then echo "code buffer sized without the prefetch tail (use omega_gpu_code_alloc_bytes)"; exit 1; fi |
| 17 | @echo "source scan: no page-only code sizing" |
| 18 | @echo "OMEGA_GPU_CODE_ALLOC_GATE PASS" |