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/order-check.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 / order-check.py` 63 lines · 2675 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 # Independent external oracle. Not a production dependency. 3 import ctypes,itertools,sys 4 lib=ctypes.CDLL(sys.argv[1]);fn=lib.omega_native_qgorder 5 fn.argtypes=[ctypes.POINTER(ctypes.c_uint64),ctypes.c_void_p]+[ctypes.c_uint64]*5 6 fn.restype=ctypes.c_uint32 7 8 def plan(group,cols,tiles,guard=1): 9 out=(ctypes.c_uint64*64)();result=ctypes.c_uint64(99) 10 rc=fn(ctypes.byref(result),out,64,group,cols,tiles,guard) 11 assert rc==0,rc 12 return result.value,list(out) 13 14 def execute(p,x,y): 15 r=[x,y,0,0];pred=False 16 for i in range(p[2]): 17 op,d,a,b,imm=p[3+5*i:8+5*i] 18 assert max(d,a,b)<4 19 if op==1:r[d]=r[a]&imm 20 elif op==2:r[d]=r[a]>>imm 21 elif op==3:r[d]=r[a]*imm+r[b] 22 elif op==4: 23 assert imm==896+11*4 24 r[d]=execute.tiles 25 elif op==5:pred=r[a]>=r[b] 26 elif op==6: 27 if pred:return None 28 else:raise AssertionError('unknown opcode') 29 return (r[0],r[1]) 30 31 def cover(p,cols,tiles): 32 execute.tiles=tiles;seen=set() 33 for x,y in itertools.product(range(p[0]),range(p[1])): 34 mapped=execute(p,x,y) 35 if mapped is None:continue 36 if mapped in seen or not (0<=mapped[0]