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/prefill-shape/workspace-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 / prefill-shape / workspace-mutants.py` 33 lines · 1943 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 # External source-mutant verification, not a production dependency. 3 import hashlib,os,subprocess,tempfile 4 from pathlib import Path 5 root=Path(__file__).resolve().parents[2] 6 source=(root/'om/prefill-shape/workspace.om').read_text() 7 mutants={ 8 'drop_row_capacity':('if gt rows capacity','if lt rows capacity'), 9 'drop_padding':('if gt add rows bm padded','if lt add rows bm padded'), 10 'drop_tile_capacity':('if gt needed tiles','if lt needed tiles'), 11 'lose_guard_tile':('needed = add div add rows sub bm 1 bm 1','needed = div add rows sub bm 1 bm'), 12 'admit_zero_rows':('if or eq rows 0 gt rows `4294967295`','if or eq rows 1 gt rows `4294967295`'), 13 } 14 15 ident=(root/'src/cudapp_om_prefill_workspace.ident').read_text().strip() 16 pins=dict(part.split('=',1) for part in ident.split() if '=' in part) 17 assert hashlib.sha256(Path(os.environ['OMEGA_OMC']).read_bytes()).hexdigest()==pins['omc'] 18 env=dict(os.environ,OMEGA_SEEDED_OMC=os.environ['OMEGA_OMC']) 19 bridge=Path(os.environ['OMEGA_BRIDGE'])/'tools/bridge-seeded' 20 assert hashlib.sha256(bridge.read_bytes()).hexdigest()==pins['frontend'] 21 assert hashlib.sha256((bridge.parent.parent/'src/toc.om').read_bytes()).hexdigest()==pins['converter'] 22 with tempfile.TemporaryDirectory(prefix='prefill-shape-mutants-') as t: 23 t=Path(t) 24 for name,(old,new) in mutants.items(): 25 assert source.count(old)==1 26 om=t/(name+'.om');om.write_text(source.replace(old,new)) 27 c=t/(name+'.c');so=t/(name+'.so') 28 with c.open('w') as f:subprocess.run(['sh',str(bridge),'c',str(om)],env=env,stdout=f,check=True) 29 subprocess.run([os.environ.get('CC','cc'),'-O2','-shared','-fPIC',str(c),'-o',str(so)],check=True) 30 p=subprocess.run(['python3',str(root/'om/prefill-shape/workspace-check.py'),str(so)],capture_output=True,text=True) 31 assert p.returncode!=0,name+' escaped oracle' 32 assert 'AssertionError' in p.stderr,(name,p.stderr) 33 print(name+': caught',flush=True)