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/aien-sovereign-core-mv/blob/main/crates/aien-omega-q38/om/check.py # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. 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 `aien-sovereign-core-mv / crates / aien-omega-q38 / om / check.py` 48 lines ยท 2332 bytes Raw Blame History 1 # SPDX-License-Identifier: Apache-2.0 2 # Independent external oracle: enumerate all possible cuts and count actual chunks. 3 import ctypes,json,random,sys 4 M=(1<<64)-1 5 f=ctypes.CDLL(sys.argv[1]).omega_native_pfcut 6 f.argtypes=[ctypes.POINTER(ctypes.c_uint64)]+[ctypes.c_uint64]*5;f.restype=ctypes.c_uint32 7 cases=0 8 def actual(n,c,m): 9 if n=minimum) and n-k>=minimum) 27 for offset in [0,37,M-200]: 28 got=call(offset,offset+header,offset+n,chunk,minimum) 29 assert got==offset+want,(offset,header,n,chunk,minimum,got,offset+want) 30 # Wider contexts, independently enumerate all cut candidates. 31 rng=random.Random(710) 32 for _ in range(160): 33 n=rng.randrange(3,9000);c=rng.choice([6,31,64,128,512,1024,32768]);h=rng.randrange(n) 34 costs=[actual(k,c,3) for k in range(n+1)] 35 want=h if 0=3) and n-k>=3 and costs[k]+costs[n-k]<=costs[n]) 36 assert call(0,h,n,c,3)==want,(h,n,c,want) 37 # Unbounded Python integer arithmetic checks the u64 overflow boundaries. 38 for n in [M-1,M,M-512,M-513]: 39 for c in [6,512,32768]: 40 for h in [0,1,n//2,n-2,n-1]: 41 got=call(0,h,n,c,3) 42 cost=lambda k:k if k<3 else (k+c-1)//c 43 assert (got==h if 0=3) and n-got>=3 and cost(got)+cost(n-got)<=cost(n)),(n,c,h,got) 44 assert call(M-1,M-1,M,512,3)==M-1 45 for args in [(1,0,5,512,3),(0,5,5,512,3),(0,6,5,512,3),(0,0,0,512,3),(0,3,5,5,3),(0,3,5,32769,3),(0,3,5,512,0),(0,3,5,32768,16385),(0,3,5,512,M)]: 46 assert call(*args)==M,args 47 assert f(None,0,23,30,512,3)==32 48 print(json.dumps({'pass':True,'cases':cases,'oracle':'preserve scalar pieces; enumerate latest batch-only cut with no additional chunks','large_integer_boundaries':True}))