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/evidence/guard-pred-20261107/README.md # 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 / evidence / guard-pred-20261107 / README.md` 63 lines · 5424 bytes Raw Blame History Source # 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) Producer Ops predicated Guard 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 exits BRA @P0 and @!P0 yes `omega_gpu_elementwise_api.c` exit_if_p0, `omega_gpu_gemm.c:155`, `omega_blackwell_codegen_pf.c:16`, `examples/hello_gpu` EXIT @P0 yes `om/components/bw_effect.om` bc_branch BRA @P0 yes `om/mathlibs/mathlibs_ir.om` exitp, bfwd, bback EXIT @P0, BRA @P0 / @!P0 yes tests (`gpu_reconv_test.c`, `bw_hazard_test.c`, `gpu_latmeas_test.c`, `bw_encode_control_test.c`) BRA, BSSY, BSYNC yes 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 main MOV_IMM (op 2), STG.E (12), LOP3.LUT as MOV (51), SHF.L.U32 (52) @P0 and @!P0; BRA no: 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, 0x0`for 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) Check Before After `test-om-encoder-guard` rows (enc1) red commit `f29378d0`: 125 failing forms, exit 1 (`gate-before-f29378d0.log`, `rows-before.txt`) 0 failures nvdisasm guards 121 of 135 wrong 135 of 135 (`gate-after.log`) sp_enc vs enc1 (180 forms) 111 differ against the fixed enc1 (`spec-before.txt`) 0 red checks n/a guard 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-ldg` PASS at the base encoder PASS `test-om-units`, `test-om-encoder-atomg`, `test-om-spec-encoder` (461 cases), `test-drift` n/a PASS `test-om-encoder` n/a 145 golden instructions, 14 fixture programs SAME; red check aborts `test-om-encoder-mutants` n/a 3/3 red `test-om-encoder-corpus` not run at the base 3191 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.