Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/attention_kgen_gate.py # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / attention_kgen_gate.py` 54 lines · 2766 bytes Raw Blame History 1 #!/usr/bin/env python3 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 """Serialize the attention migration host gates and capture exact receipts. 4 Invoke only inside bwrap with private /dev and CPU affinity 10-14. Production 5 code is seeded Omega; this Python program is a read-only verification oracle. 6 """ 7 import os 8 from pathlib import Path 9 import shlex 10 import subprocess 11 import sys 12 13 root = Path(__file__).resolve().parents[1] 14 out = root / 'evidence/api-kernel-gen-attn/2026-11-06' 15 out.mkdir(parents=True, exist_ok=True) 16 if Path('/dev/nvidiactl').exists() or Path('/dev/nvidia0').exists(): 17 raise SystemExit('FAIL attention gates require bwrap private /dev') 18 commands = [ 19 ('differential', ['make', '-j3', '-f', 'Makefile', '-f', 'tests/attention_kgen.mk', 'test-api-kgen-attention']), 20 ('mutants', ['make', '-j3', '-f', 'Makefile', '-f', 'tests/attention_kgen.mk', 'test-api-kgen-attention-mutants']), 21 ('attention', ['make', '-j3', 'test-gpu-attention']), 22 ('decode', ['make', '-j3', 'test-gpu-decode-attn']), 23 ('maxpos', ['make', '-j3', 'test-gpu-decode-attn-maxpos']), 24 ('decode256', ['make', '-j3', 'test-gpu-decode-attn256']), 25 ('prefill', ['make', '-j3', 'test-gpu-prefill-host']), 26 ('units', ['sh', 'om/units.sh', '--check']), 27 ('crumb-compile', ['crumb', 'compile', '.']), 28 ('crumb-verify', ['crumb', 'verify', '.']), 29 ] 30 selected = set(sys.argv[1:]) 31 if selected - {name for name, _ in commands}: 32 raise SystemExit('unknown attention gate selection') 33 if not selected or 'differential' in selected: 34 (root / 'build/api-kgen/attention_diff.gcda').unlink(missing_ok=True) 35 receipt = out / 'rc.tsv' 36 rows = {} 37 if selected and receipt.exists(): 38 rows = {line.split('\t', 1)[0]: line for line in receipt.read_text().splitlines()[1:]} 39 for name, command in commands: 40 if selected and name not in selected: 41 continue 42 print('RUN ' + name + ': ' + shlex.join(command), flush=True) 43 result = subprocess.run(command, cwd=root, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 44 text = result.stdout.replace(str(Path.home()), '~') 45 (out / (name + '.log')).write_text(text) 46 final = next((line for line in reversed(text.splitlines()) if line.strip()), '(no output)') 47 row = f'{name}\t{result.returncode}\t{shlex.join(command)}\t{final}' 48 rows[name] = row 49 print(row, flush=True) 50 if result.returncode: 51 receipt.write_text('name\trc\tcommand\tfinal line\n' + '\n'.join(rows[key] for key, _ in commands if key in rows) + '\n') 52 raise SystemExit(result.returncode) 53 receipt.write_text('name\trc\tcommand\tfinal line\n' + '\n'.join(rows[key] for key, _ in commands if key in rows) + '\n') 54 print('PASS attention migration host acceptance; chip NOT_RUN', flush=True)