name: omega-gpu-om description: >- Migrate or write Blackwell GPU planners, schedulers, QMD packers, and SM121 codegen emitters in pure seeded OM-2 under om/gpu/, bound through om/units.sh. Use when touching omega-mv GPU codegen, om/gpu/*.om, omega_bw_om_ir.h, or regenerating src/omega_om_units.c.
Pure OM-2 Blackwell GPU Migration & Verification
Placement & Binding
- Put new pure OM-2 GPU units in
om/gpu/(do not edit pinnedgpu/nvidia/om/*, whichgpu/runtime/INVENTORY.tsvhashes against CUDApp). - Add each new unit to
UNITSinom/units.sh; add toFS_UNITSonly if a consumer is inGPU_FS_SRCS(mk/omega-gpu-engine.mk). src/omega_om_units.cemits Linux ELF AArch64 inline asm and cannot compile on macOS. Always runom/units.sh,om/units.sh --check, and host/simulator tests on Spark (aarch64Linux).- Monitor
src/omega_om_units.csize as units grow (omega-bridgenative.omhas 4 MiB input / 16 MiB output pool caps).
OM-2 + omega-bridge (src/native.om) Rules
export fnreturn types must beulong,long,int,bool, orvoid(to uintfails with exit 110).- Place
export fndefinitions after internal helperfns (calling anexport fninternally failserror 16). - Generated C ABI v2 signature puts
uint64_t *resultfirst, followed by(ptr, len)pairs for everyview/editarray. - Avoid OM-2 reserved keywords as identifiers (
out,ops,at→error 16;layout→error 29); usereminstead ofmod(error 3); declarenew T N vonly at function top scope (error 9). - Avoid
error 12(16-register pool) in large emitters: keep helper signatures ≤ 4–5 params, store vreg handles inmeta[384..511]and scratch inmeta[16..63], readsp/metaon demand, split chainedif or ...conditions into separateifs, and split nestedforloops or 6-arg emitter calls into small helpers. - Preserve the exact C vreg allocation order (including scalars initialized on declaration lines before
forloops) soomega_bw_regalloc_solveproduces bit-identical SM121 SASS SHA-256 against the C emitter. - Verify
BlackwellIROpcodeinteger values againstsrc/omega_blackwell_codegen.hbefore encoding (IMAD=8,IMAD_WIDE=9,FFMA=33,LDG_E_64=56,LDG_E_128=57,LDS128=58).
Wire Format & Fail-Closed Boundary Rules
- Standard codegen wire format:
ins[8192](up to 1,024 insns × 8ulongs) +meta[512](0=n, 1=nv, 2=nu, 3=nl, 4=pending, 5=err, 64..319=vreg widths, 320..351=loop pairs, 352..383=uvreg widths), unpacked bysrc/omega_bw_om_ir.h. - Guard every forward-branch patcher in
.omwithif ge pos 1024: retso buffer overflow setsmeta[5]=1and returns cleanly instead of trapping. - In C wrappers (
omega_blackwell_codegen_*.c):memsetinsandmetato 0 before callingomega2_cg_*_emit, and callomega_bw_ir_init(prog)on any error path so callers never observe a partialBlackwellIRProgram. - Chain
omega2_bw_sched_stallsdirectly onins[8192]afteromega_bw_ir_from_omwithout re-packing.
SM121 (GB10) Direct SASS Emitter Hazards & Proven Patterns
When writing direct SM121 emitters (e.g. om/gpu/q36/emit_{fast,prefill}.om using bw_enc_sm121.om):
LDS.32/STS.32address-register clobber hazard (silent corruption /NaN, 0 Xid):LDS(op 49) andSTS(op 50) read their address register asynchronously on scoreboard 1 (rbar=1). Never modify an address register (e.g.IADD addr, addr, 4) or load into a register that was an address source of an in-flightLDSbeforeqW1/qW0. Compute disjoint address registers first, issue batchedLDS/STS, then emit oneqW0/qW1.- SM121 fixed ALU latency is 6 cycles (
qAlu4 = qcw 6 7 7 0 0): Direct dependentSHF/SHR/LOP3/I2F/FMUL/FFMA/F2FPpairs need>= 6cycles of total stall separation;stall 4on a direct dependency silently reads stale values (NaN). For two independent chains,qAlu3(3) +qAlu3(3) gives6cycles of separation; keepqAlu4(6) on the final producer before a joint consumer. - Never nest
qBssy/qBsync(B0hardcoded): Nesting twoqBssypairs deadlocks the warp silently with zero Xid. Use predicated instructions (@P0/@!P0viaq36Guard = 2/1) or sequential flatqBssyblocks. - Encoder operand & alignment traps:
op 52(SHF.L.U32) computeso[2] << o[3](noto[4] << o[3]).op 57(LDG.E.128) requires a 4-aligned destination (reg % 4 == 0);op 56(LDG.E.64) requires 2-aligned (reg % 2 == 0); unaligned destinations hang the GPU.op 3(S2R) requires scoreboard 0 (qcw 4 0 7 0 1) +qW0before reading the destination.
- Verified GB10 throughput patterns:
- Use
HMMA.16816.F32.BF16(op 16) +F2FP.BF16.F32.PACK_AB(op 61) for dense W4/BF16 GEMMs, hot-first deduplicated MoE (EXP_ORDERwithcnt > 32first to eliminate tail-straggler waves), and full Flash-Attention-2 (Q@K^T+P@Vwith half-warpSHFL.BFLYonline softmax). - For
D = 128recurrent reductions (e.g. GDN), assign 1 warp (32lanes ×4dims/lane viaLDG.E.128) and reduce withqWarpBflySum(0BAR.SYNC, 0 SMEM). - Avoid high-SMEM / high-register scalar GQA-8 fusion when KV fits GB10's 24 MiB L2; occupancy + L2 hits beat scalar fusion, and
HMMA.16816Flash-Attention beats both.
- Use
Mandatory 4-Stage Verification Before Landing
Spark Scratch & Pinned Dependencies
- Do not rely on
~/workspace/physicsor~/workspace/omega-bridgebeing at the pinned commits: materializenative.omatom/omega-bridge.lock(git -C ~/workspace/omega-bridge show <sha>:src/native.om > /tmp/omega-bridge-pin/src/native.om) and clone~/git/physics-mv.gitatphysics.lockinto/tmp/physics-pin. - Run baseline diff,
om/units.sh, and host/sim/hazard tests in a scratch clone (/tmp/bw-mig-*) so~/canon/omega-mvstays clean.
- Regeneration:
om/units.sh --checkPASS on Spark. - Correctness & Hazards: Run the target's host + warp-simulator suite (
test-gpu-bf16-gemv,test-gpu-fp8gemm,test-gpu-fp8,gpu_pfhost_test --sim, etc.) ANDmake test-bw-hazard(0 new findings). - Boundary & Error Paths: Run
test_bw_om_codegen_bounds(hostilemeta/insrejection + invalid spec error-path preservation). - Compiled Kernel Diff vs Parent: Compare
insns, peak/declared GPRs, SM121 occupancy, avg stall cycles, and encoded SM121 SASS SHA-256 against the pre-migration parent commit. For live GB10 silicon validation, build--chiptest binaries before openingspark-window(--gb10 exclusive --quiet exclusivewith anEXITtrap that closes the window and postsRELEASEto~/handoffs/BOARD.md), then run one binary at a time with a brief pause (sleep 2) between processes.