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/graph/table-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 / graph / table-mutants.py` 20 lines · 1342 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 import os,pathlib,subprocess,tempfile 3 root=pathlib.Path(__file__).resolve().parents[2] 4 src=(root/'om/graph/table.om').read_text(); bridge=pathlib.Path(os.environ['OMEGA_BRIDGE']);cc=os.environ.get('CC','cc') 5 env=dict(os.environ,OMEGA_SEEDED_OMC=os.environ['OMEGA_OMC']) 6 old='end\nret i\nend\nfn grpslot' 7 mutants=[('original-tail',old,'end\nret add r sub add 128 j p\nend\nfn grpslot'),('tail-zero',old,'end\nret 0\nend\nfn grpslot'),('tail-plus-one',old,'end\nret add i 1\nend\nfn grpslot'),('pair-boundary','if lt j p','if le j p'),('rotary-half','p = div r 2','p = div r 4')] 8 with tempfile.TemporaryDirectory() as td: 9 d=pathlib.Path(td) 10 def run(s,name): 11 om=d/'table.om';om.write_text(s);c=d/'table.c' 12 with c.open('w') as out:subprocess.run(['sh',str(bridge/'tools/bridge-seeded'),'--runtime-views','c',str(om)],env=env,stdout=out,check=True) 13 subprocess.run([cc,'-O2','-I'+str(root/'src'),str(root/'tests/test_graph_table_perm.c'),str(c),'-o',str(d/'test')],check=True) 14 return subprocess.run([str(d/'test')]).returncode 15 if run(src,'green'):raise SystemExit('FAIL original') 16 for name,a,b in mutants: 17 assert src.count(a)==1 18 if run(src.replace(a,b),name)==0:raise SystemExit('FAIL survived '+name) 19 print('KILLED '+name) 20 print('PASS graph table five compiled mutants')