interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / evidence / guard-pred-20261107

140f398 evidence: guard predicates (DRA-483, C1b) Drake Stapleton committed 2026-11-07
..
README.md5424
c-oracle-guard-proposal.diff786
corpus-after.txt917
gate-after.log1871
gate-before-f29378d0.log3565
guard_words.bin2160
guard_words_before.bin2160
nvdisasm-after.txt35814
nvdisasm-before.txt34464
rows-before.txt3268
spec-before.txt2560

README.md

sm_121 guard predicates: the seeded encoders ignored them on most ops (DRA-483, C1b, 2026-11-07)

Status: HOST_TESTED. GB10 device NOT_RUN (no chip run of a predicated MOV or STG in this change).

Defect

At main f1b50cbf, om/encoder/bw_enc_sm121.om built the 4-bit guard field (fn pred: 7 always, 0 @P0, 8 @!P0) only for STG.E.STRONG.SYS (op 22), BRA (46), BSSY (54) and BSYNC (55). EXIT (45) read only predicate_p0, so @!P0 EXIT encoded @P0. Every other op wrote guard 7, so a predicated IR instruction ran unconditionally. The spec encoder om/encoder/bw_spec_sm121.om (sp_enc, used by om/components/encode.om bc_encode on the q38 and validate paths) had the same gap and refused @!P0 EXIT (its guard bound was 7). The C oracle src/omega_blackwell_codegen.c bw_c_encode_insn has the same gap (its only predicate reads are at lines 520, 748, 763, 770, 790 and 804), so the .om-vs-C corpus diff could not see it.

Exposure (who sets predicate_p0 / predicate_not, and on which ops)

ProducerOps predicatedGuard honoured before?
CUDApp src/* Em emitters (omega_bw_em.h, _gemm, _tern, _bf16, _moe, _moe2, _attn, _attn256, _pattn, _pattn256, _dec, _gdn, _router), omega_blackwell_codegen.c matmul loops, omega_gpu_elementwise_api.c / omega_gpu_attention_api.c region exitsBRA @P0 and @!P0yes
omega_gpu_elementwise_api.c exit_if_p0, omega_gpu_gemm.c:155, omega_blackwell_codegen_pf.c:16, examples/hello_gpuEXIT @P0yes
om/components/bw_effect.om bc_branchBRA @P0yes
om/mathlibs/mathlibs_ir.om exitp, bfwd, bbackEXIT @P0, BRA @P0 / @!P0yes
tests (gpu_reconv_test.c, bw_hazard_test.c, gpu_latmeas_test.c, bw_encode_control_test.c)BRA, BSSY, BSYNCyes
omega-mv #1044 seed/oscgpu/gpuir.om (bw_movi, bw_mov, bw_shl, bw_bool, bw_trap, bw_branch) and its C twin src/omega_osc_gpu.c (Movi, Mov, Shl, Bool, Trap, branch), branch head e70ccc1f, not on mainMOV_IMM (op 2), STG.E (12), LOP3.LUT as MOV (51), SHF.L.U32 (52) @P0 and @!P0; BRAno: MOV, STG.E, LOP3, SHF ran unconditionally (the ng-gpu finding)

No CUDApp producer predicates an op whose guard changed, so the fix changes no byte of the CUDApp corpus. Measured on the 3191 corpus kernels after the fix (od + awk over build/om-encoder/k-om/*.bin, a measuring instrument, not shipped): 1237248 instruction slots (padding NOPs included), 17489 with a guard other than 7, all of them BRA (opcode 0x947: 15066 @P0, 2373 @!P0) or EXIT (0x94d: 50 @P0); sum by Wolfram.

Oracles (independent, never shipped)

  • NVIDIA nvdisasm 13.0.85 -b SM121 -hex on our own words. guard_words.bin (sha256 e8484aeb...) decodes as nvdisasm-after.txt: @P0 / @!P0 on all 126 forms of the 63 P-guarded ops, @UP0 / @!UP0 on the LDCU and LDCU.64 probes (why those two refuse a P0 guard), and MOV R4, 0x0 / @P0 MOV R4, 0x1 / `@!P0 STG.E desc[UR4][R8.64], R12/@!P0 MOV R5, 0x1/@!P0 MOV R4, 0x0for the #1044 rows.guard_words_before.bin` decodes as nvdisasm-before.txt: 121 of the 135 guards wrong.
  • make test-om-encoder-guard reruns the oracle on every run.

Change

  • bw_enc_sm121.om enc1: after the op's words, a predicated instruction gets pred o in w0 bits 12..15 (put w 0 or sub x and x 61440 shl pred o 12); LDCU / LDCU.64 with a P0 guard are refused.
  • bw_spec_sm121.om sp_enc: the same step (sp_val R_PRED) and refusal; the EXIT form's guard bound 7 -> 8.
  • Bindings regenerated by om/units.sh (omc e5b32567 sha256 2c824805..., omega-bridge bc11b30b bootstrapped from its audited source rungs): bw_enc_sm121, encode, validate, q38_emit, cudapp_om_units.ident.
  • om/encoder/guard_pred_test.om, om/encoder/guard_spec_test.om, make test-om-encoder-guard (CI step next to the LDG and ATOMG gates).

Results (Linux AArch64, DGX Spark, cores 8-9 under pool-8-9)

CheckBeforeAfter
test-om-encoder-guard rows (enc1)red commit f29378d0: 125 failing forms, exit 1 (gate-before-f29378d0.log, rows-before.txt)0 failures
nvdisasm guards121 of 135 wrong135 of 135 (gate-after.log)
sp_enc vs enc1 (180 forms)111 differ against the fixed enc1 (spec-before.txt)0
red checksn/aguard ignored 121, forced to 7 130, @!P0 as @P0 66, enc1 LDCU refusal removed 4, sp_enc guard removed 106, sp_enc LDCU refusal removed 4; oracle text without @!UP0 exits 4
test-om-encoder-ldgPASS at the base encoderPASS
test-om-units, test-om-encoder-atomg, test-om-spec-encoder (461 cases), test-driftn/aPASS
test-om-encodern/a145 golden instructions, 14 fixture programs SAME; red check aborts
test-om-encoder-mutantsn/a3/3 red
test-om-encoder-corpusnot run at the base3191 distinct kernels identical .om vs C; 4495 program and 399 single-instruction encodes SAME, 0 DIFFER

C oracle (proposed, not applied)

bw_c_encode_insn needs the same step after its switch (c-oracle-guard-proposal.diff, applies with git apply): refuse LDCU / LDCU64 with predicate_p0, then w[0] = (w[0] & ~0xF000u) | ((predicate_not ? 0x8u : 0x0u) << 12). Exercised in a scratch worktree only: test-om-encoder stays SAME on 145 instructions and 14 programs. Until it lands, the corpus diff cannot catch a guard regression; test-om-encoder-guard does.