interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / bench / prime_race / tests / encoding_oracle.md

38 lines · 2477 bytes Raw Blame History Rendered
1# Encoding oracle for BW_IR_LOP3_LUT, BW_IR_SHF_L_U32, BW_IR_IMAD_HI_U32
2
3Offline oracle only (nothing here is linked into AIEN). Recorded 2026-10-05 on the Spark with
4`Cuda compilation tools, release 13.0, V13.0.88`:
5
6```sh
7nvcc -arch=sm_121 -cubin -O3 -o ops.cubin ops.cu
8cuobjdump -sass ops.cubin
9```
10
11Source (`ops.cu`, scratch dir outside omega):
12
13```cuda
14// Offline encoding oracle for omega BW_IR_LOP3_LUT / SHF_L_U32 / IMAD_HI_U32. Never linked into AIEN.
15extern "C" __global__ void k_or(unsigned *o, const unsigned *a) { unsigned x=a[threadIdx.x], y=a[threadIdx.x+64], z=a[threadIdx.x+128]; o[threadIdx.x] = x | y; o[threadIdx.x+64] = ~(x | y); o[threadIdx.x+128] = (x & y) ^ z; o[threadIdx.x+192] = ~(x|y) & z; }
16extern "C" __global__ void k_shl(unsigned *o, const unsigned *a) { unsigned x=a[threadIdx.x], n=a[threadIdx.x+64]; o[threadIdx.x] = x << n; }
17extern "C" __global__ void k_shl1(unsigned *o, const unsigned *a) { unsigned n=a[threadIdx.x]; o[threadIdx.x] = 1u << n; }
18extern "C" __global__ void k_hi(unsigned *o, const unsigned *a) { unsigned x=a[threadIdx.x], y=a[threadIdx.x+64]; o[threadIdx.x] = __umulhi(x, y); }
19extern "C" __global__ void k_hi2(unsigned *o, const unsigned *a) { unsigned x=a[threadIdx.x], y=a[threadIdx.x+64], z=a[threadIdx.x+128]; o[threadIdx.x] = __umulhi(x, y) + z; }
20```
21
22Instructions used as golden words in `omega_blackwell_verify_codegen_fixtures_intops`
23(src/omega_blackwell_codegen.c). Low word, then high word; the high word's top 23 bits are
24the control word, which the Omega scheduler writes and the fixtures do not compare.
25
26```
27/*00b0*/ IMAD.HI.U32 R9, R9, R0, R6 ; /* 0x0000000009097227 */ /* 0x008fca00078e0006 */
28/*0090*/ IMAD.HI.U32 R7, R0, R7, RZ ; /* 0x0000000700077227 */ /* 0x008fca00078e00ff */
29/*0090*/ SHF.L.U32 R7, R9, R2, RZ ; /* 0x0000000209077219 */ /* 0x008fca00000006ff */
30/*0090*/ SHF.L.U32 R7, R0, R7, RZ ; /* 0x0000000700077219 */ /* 0x008fca00000006ff */
31/*00a0*/ LOP3.LUT R9, R7, R0, RZ, 0xfc, !PT ; /* 0x0000000007097212 */ /* 0x008fc400078efcff */
32/*00b0*/ LOP3.LUT R11, R6, R7, R0, 0x78, !PT ; /* 0x00000007060b7212 */ /* 0x010fc600078e7800 */
33/*00d0*/ LOP3.LUT R13, R6, R7, R0, 0x10, !PT ; /* 0x00000007060d7212 */ /* 0x000fe400078e1000 */
34/*00e0*/ LOP3.LUT R7, RZ, R9, RZ, 0x33, !PT ; /* 0x00000009ff077212 */ /* 0x000fe200078e33ff */
35```
36
37The whole sieve kernel is also decoded by `nvdisasm -b SM121` in gb10_sieve_host_test
38(every word decodes; every BRA target equals the IR target).