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/tree/main/om/codegen # 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 / om / codegen` `29d7915` Merge worker controls and reject unknown mutation filters Drake Stapleton committed 2026-11-18 ``` .. .crumb 800 CHIP.md 3245 DEC-CHIP.md 1275 GDN.md 4227 README.md 7393 REGALLOC.md 7187 TERN.md 5253 bw_hazard.om 14981 bw_hazard_dec.om 235 cg_attn.om 116312 cg_attn256.om 118031 cg_attn_emit.om 9794 cg_bf16.om 63586 cg_bind.om 3335 cg_budget.om 408 cg_dec.om 27750 cg_dec_emit.om 7529 cg_em.om 1968 cg_fields.om 1151 cg_gdn.om 41354 cg_gdn_common.om 11788 cg_gdn_policy.om 257 cg_gdn_shape.om 1028 cg_gemm.om 77010 cg_invar.om 1442 cg_life.om 1293 cg_matmul.om 1157 cg_matmul_block.om 39387 cg_matmul_frag.om 37559 cg_matmul_i32.om 17780 cg_matmul_loop.om 45747 cg_matmul_params.om 423 cg_matmul_tensor.om 39939 cg_moe.om 17987 cg_moe2.om 1923 cg_moe_core.om 25039 cg_moe_emit.om 3270 cg_moe_sched.om 3171 cg_mrow.om 640 cg_pack_h.om 4161 cg_pack_len.om 1041 cg_pattn.om 90942 cg_pattn256.om 80118 cg_pattn_emit.om 10662 cg_pf.om 3190 cg_pfhost.om 1404 cg_pfhost_emit.om 3274 cg_pfhost_mc.om 2147 cg_pfhost_rl.om 3360 cg_qg.om 137791 cg_qmma.om 6717 cg_qmma_patch.om 1186 cg_reconv.om 1398 cg_replay.om 1170 cg_rest_emit.om 2735 cg_router.om 84997 cg_sentin.om 1228 cg_tc.om 110076 cg_tc_emit.om 1916 cg_tern.om 58715 cg_tern_common.om 878 cg_tern_policy.om 1088 cg_tern_sched.om 4368 cg_tgemm.om 10537 cg_tgemm_emit.om 2773 cg_tgemm_spec.om 1419 cg_vecadd.om 2979 fixture_verify.om 1496 gdn_mutants.py 3871 moe_mutants.py 3738 moe_ragged_mutants.py 7954 pf_admit.om 663 qm_host.om 918 qm_self.om 1550 regalloc.om 3468 regalloc_ir.om 662 regalloc_live.om 437 tc_host.om 1896 tern_mutants.py 3316 ``` README.md # Seeded Blackwell codegen: remaining families The default implementations of the attn256, pattn256, router, FP8 GEMM, BF16 GEMV, activation quantizer (pq), and grouped quantized GEMM (qg) builders are the `cg_*.om` units in this directory. The public C signatures are unchanged. The original builders remain differential oracles behind `CUDAPP_MIGRATION_PENDING_C_CODEGEN_=1`, default off, where FAMILY is ATTN256, PATTN256, ROUTER, GEMM, BF16, or QG. ## Ownership and data flow `src/omega_codegen_rest_wire.h` only widens public structure fields and copies query results. It contains no configuration validation, instruction selection, scheduling, geometry calculation, register assignment, or encoding policy. Each root copies its configuration prefix before replacing the buffer with IR records. The builder's memory shell calls `omega_gpu_om_ir_replay` with that root callback; the common CUDApp replay path owns IR decoding, loop-aware liveness, one register-allocation solve, and seeded encoding. The roots share `cg_rest_emit.om`. Its instruction scheduling is the existing non-256 attention lane's emitter convention, reused without changing that lane's files. Qg additionally composes the existing `om/prefill-shape/admit.om` and `order.om` policies through `om/units.sh`. There is no host-language interpreter or source converter in the production path. The committed `.om` is compiled by the pinned seeded compiler through the existing Omega Bridge exporter. Function-local state is explicitly indexed in a bounded array to respect the seeded function-mode parameter and live-name limits. Input/output slot maps follow each helper declaration; local declarations carry their C name, type, and state slot. Instruction values occupy separate state records: initializing an instruction before an intervening helper emits another instruction must not lose the first instruction's value. Conditional calls and conditional allocations retain C's short-circuit and lazy-branch semantics. Array initializer elements are emitted sequentially: allocating a conditional second scale register must not move it ahead of the first initializer. The qg SwiGLU 32-row, four-warp, 256-column configuration is a focused regression for that ordering, as well as part of the output-span corpus. ## Root ABI Each `cg_` root takes four scalars (`kind`, reserved `a`, `b`, `c`), an edit array of 8192 words, and an edit metadata array of 512 words. The memory shell places each spec's fields, in declaration order, in words 0 onward. Signed `mutant` fields are sign-extended. Word 15 indicates a non-null spec and word 16 a non-null query-output structure. Invalid kinds are refused. Query roots place their scalar result in metadata word 48 and structure fields, in declaration order, in words 32 onward. Unit Query kinds Builder kind attn256 0 shape 1 decode attention pattn256 0 shape, 1 spec admission 2 prefill attention router 0 shared-memory layout 1 router gemm 0 steps, 1 shared bytes 2 FP8 GEMM bf16 0 steps, 1 shared bytes 2 BF16 GEMV qg 0 pq admission, 2 qg admission, 3 shared bytes, 4 span 1 pq, 5 qg Successful builders return the existing eight-word IR-record ABI documented in `src/omega_gpu_om_ir.h`. Metadata word 6 is the opt-in physical GPR limit: zero preserves the historical `omega_bw_ir_init` default; a nonzero value must be greater than `BW_PHYS_GPR_MAX` and no greater than `BW_PHYS_GPR_HW_LIMIT`. Replay validates the full-width value before changing the destination program. The qg rt=8 geometry requests the existing hardware limit; the other geometries retain zero. The metadata word 7 scheduler scratch is cleared by the terminal unconditional EXIT before the root returns; this lane does not define any exact-last-use-override schema. ## Admission repair The legacy FP8 GEMM admission check multiplied full-width `mt` before checking the shared-memory bound. A large power-of-two `mt` could wrap the product to zero and admit a geometry that overruns fixed accumulator arrays. Both the C oracle and Omega now compare `mt` against the shared-memory bound divided by the already validated lane-byte factor, before any multiplication. The boundary corpus includes the high-bit `mt` counterexample. Ordinary admitted geometries are unchanged. For multi-token attention, a valid head ratio can still have a non-power-of-two virtual-row count above the high bit. The old logarithm shifted a 32-bit value by 32 before reaching its refusal. UBSan reproduced this with equal `UINT32_MAX` query/KV head counts and one query per CTA. C and Omega now reject non-powers before the logarithm. The corpus includes the high-bit boundary on both sides, the maximum, and a small non-power; valid power-of-two rows retain the same instruction stream. ## Reproduction Use omega-mv `e5b32567` and seeded omc SHA256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`. Set `OMEGA_MV`, `OMEGA_OMC`, and `OMEGA_BRIDGE` to the checked sibling trees. All host tests, simulations, differentials and mutants must run with a minimal `/dev`; none of these commands authorize hardware access: ``` bwrap --dev-bind / / --dev /dev --proc /proc -- \ taskset -c 10-14 nice -n 10 make -j3 test-codegen-rest bwrap --dev-bind / / --dev /dev --proc /proc -- \ taskset -c 10-14 nice -n 10 make -j3 test-codegen-rest-sim bwrap --dev-bind / / --dev /dev --proc /proc -- \ taskset -c 10-14 nice -n 10 make -j3 test-om-ir-limit bwrap --dev-bind / / --dev /dev --proc /proc -- \ taskset -c 10-14 nice -n 10 sh om/units.sh --check ``` The make target supplies `CODEGEN_REST_BINDING` from the shared `BW_CODEGEN_BINDING` provider list plus `src/sha256.c`. The differential uses the portable encoder ABI, with explicit retained C allocator/matmul/packing prerequisites; it does not select the separate native NO_POSIX encoder ABI. Hosted BF16 allocation wrappers are renamed in the C oracle as well. `tests/codegen_rest_check.py` independently compiles the C oracle with renamed symbols and the default Omega path. It checks IR fields, the complete allocator state, encoded bytes, public geometry queries, and refusals, including null builder inputs. The grids cover every admitted K step, discrete geometry axes, all pq group counts through 32, BF16 mask/batch/stride/mutant interactions, and qg output-span/group interactions. Attention includes full-width valid head-count pairs, not only individually invalid field perturbations. Every family also receives zero and `UINT32_MAX` for every scalar input, each branch-threshold center and its immediate neighbours, and deterministic generated single-field perturbations. The domain is a **partition plus boundaries derived from the C branch conditions**; it is not an enumeration of the uint32 Cartesian product. The carried target builds the retained builders with `-O0 --coverage` and writes per-source line/branch counts and uncovered arc locations to `coverage.json` in its build directory. The dated receipt records branch coverage X/Y and accounts for every uncovered arc. The runner flips an IR record and recompiles semantic scheduler mutants for every unit, plus the required ignore-meta[6] qg mutant. Hardware qualification is separate. See CHIP.md and the dated receipt under `evidence/codegen-rest/2026-11-06/`.