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/apirest/pfhost-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 / apirest / pfhost-mutants.py` 29 lines · 1694 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 source=(root/'om/apirest/pfhost.om').read_text() 5 entry=(root/'om/apirest/pfreg.om').read_text() 6 env=dict(os.environ,OMEGA_SEEDED_OMC=os.environ['OMEGA_OMC']) 7 cc=os.environ.get('CC','cc'); bridge=pathlib.Path(os.environ['OMEGA_BRIDGE']) 8 mutants=[('limit','65536','65535'),('warp','ulong 32','ulong 31'),('compare','if gt mul','if ge mul'),('poison','-999.0f32','-998.0f32'),('count','add n 1','add n 2'),('skip','len x','0')] 9 with tempfile.TemporaryDirectory() as td: 10 d=pathlib.Path(td) 11 def build(src,name): 12 files=[] 13 for unit,suffix in [('count',''),('reg',entry)]: 14 om=d/(unit+'.om');om.write_text(src+'\n'+suffix) 15 c=d/(unit+'.c') 16 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) 17 files.append(str(c)) 18 exe=d/name 19 subprocess.run([cc,'-O2','-ffp-contract=off','-I'+str(root/'src'),str(root/'tests/test_prefill_host_rest.c'),*files,'-o',str(exe)],check=True) 20 return subprocess.run([str(exe)]).returncode 21 if build(source,'green'): raise SystemExit('FAIL original') 22 p=subprocess.run([cc,'-I'+str(root/'src'),str(root/'tests/test_prefill_host_rest.c'),'-o',str(d/'missing')],capture_output=True) 23 if p.returncode==0: raise SystemExit('FAIL missing binding accepted') 24 print('PASS strong binding negative control') 25 for name,old,new in mutants: 26 assert source.count(old)==1 27 if build(source.replace(old,new),name)==0: raise SystemExit('FAIL survived '+name) 28 print('KILLED '+name) 29 print('PASS prefill host red control and six mutants')