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/om/q38-head/envelope-mutants.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 / om / q38-head / envelope-mutants.py` 30 lines · 1443 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 # External verification of the Omega source, never a runtime dependency. 3 import pathlib 4 import subprocess 5 import sys 6 import tempfile 7 8 here = pathlib.Path(__file__).resolve().parent 9 source = (here / 'envelope.om').read_text() 10 driver = (here / 'envelope-driver.om').read_text() 11 mutants = { 12 'omit_tail': ('for i ulong 5120', 'for i ulong 5119'), 13 'round_down': ('div add sig 1 2', 'div sig 2'), 14 'accept_nonfinite': ('if ge v `2139095040`\nret 0', 'if ge v `2139095040`\nret `1065353216`'), 15 'omit_margin': ('mul sig 73800', 'mul sig 73728'), 16 'keep_sign_bit': ('and ulong get bits i `2147483647`', 'ulong get bits i'), 17 } 18 with tempfile.TemporaryDirectory(prefix='q38-envelope-') as tmp: 19 for name, (old, new) in mutants.items(): 20 assert source.count(old) == 1 21 binary = pathlib.Path(tmp) / name 22 result = subprocess.run([sys.argv[1]], input=(source.replace(old, new) + driver).encode(), 23 capture_output=True, check=True) 24 binary.write_bytes(result.stdout) 25 binary.chmod(0o700) 26 result = subprocess.run([sys.executable, str(here / 'envelope-check.py'), str(binary)], 27 capture_output=True) 28 assert result.returncode != 0, f'{name}: survived' 29 assert b'AssertionError' in result.stderr, (name, result.stderr) 30 print(f'{name}: caught by numerical oracle')