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 / tests / codegen_base / README.md

122 lines · 11237 bytes Raw Blame History Source

Base codegen and common IR replay migration

Source baseline: CUDApp #309, 63d18a2cc92cb05f800d17e46b35f0cd6237b3b0. The seeded compiler is omega-mv e5b32567, SHA-256 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f. Registration was committed before caller cutover (79de6f9).

The production entry remains omega_gpu_om_ir_replay. No opcode was added. The baseline ends at BW_IR_ATOMG_ADD_F32_STRONG_GPU; #312's separately stacked f64 extension ends at 78, leaving 79 unused. When combining #312, the replay admission call must receive its BW_IR_LAST rather than the baseline enum maximum. This branch does not silently import that other PR.

Every function in the two target files

Names in each row are exhaustive, including guarded alternate definitions. “Already ported” refers to the default hosted path, not a claim that the existing freestanding migration oracle has been removed. Verification oracles remain independent C; they are not production implementations.

FunctionsClassificationImplementation / reason
omega_bw_ir_alloc_vreg, omega_bw_ir_alloc_vreg64, omega_bw_ir_alloc_vreg128, omega_bw_ir_alloc_uvreg, omega_bw_ir_alloc_uvreg64, omega_bw_ir_append, bw_ra_decide, bw_ra_alloc, bw_ra_touchAlready ported, #309regalloc_ir.om; C selects ABI fields, copies instructions and writes intervals. Guarded C alternatives remain the #309 oracle.
omega_bw_regalloc_c_oracle, omega_bw_regalloc_solveAlready ported, #309regalloc.om; default solve serializes/deserializes the fixed wire arrays.
omega_bw_gpr_declared, omega_bw_gpr_declared_ok, omega_bw_ir_set_gpr_limitAlready ported, #309regalloc_ir.om; existing oracle alternatives are unchanged.
bw_c_encode_insnAlready ported, #79 and encoder extensions #301/#307bw_enc_sm121.om owns instruction packing, control/scheduling arithmetic, operand checks, branch deltas and padding. C is the independently selectable encoder oracle.
bw_om_encodeComputation moved herecg_fields.om packs instruction fields; C routes physical-register arrays, invokes the checked binding and copies output.
encode_single_insnComputation moved herecg_fields.om assembles the four little-endian words. Its C-primary alternative remains the existing encoder oracle.
omega_bw_encode_programComputation moved here / existing #309 bindingcg_bind.om kind 6 now admits capacity and computes required bytes together; C checks pointers and dispatches the encoder.
bw_encode_program_bytesAlready ported, #79/#309Omega encoder produces bytes; C copies the result or runs the explicitly enabled differential oracle.
bw_om_matprog, omega_blackwell_codegen_matmul_i32_prog, omega_blackwell_codegen_matmul_tensor_prog, omega_blackwell_codegen_matmul_tensor_loop_prog, omega_blackwell_codegen_matmul_frag_prog, omega_blackwell_codegen_matmul_frag_block_progAlready ported, #309; matmul excluded from this lanecg_matmul_params.om, cg_matmul_i32.om, cg_matmul_tensor.om, cg_matmul_loop.om, cg_matmul_frag.om, cg_matmul_block.om; C packs scalar ABI arguments and calls the common replay entry.
bw_keep_alive, bw_live_until, frag_block_store_fitsAlready ported, #309Only in the existing guarded matmul oracle; corresponding lifetime/store-offset policies are Omega.
bw_mat_decide, omega_matmul_frag_block_shape, omega_matmul_frag_block_unroll, omega_matmul_frag_unrollAlready ported, #309cg_matmul.om; pointer-output unpacking remains ABI glue.
frag_a_tab_init, frag_f32_to_bf16, omega_matmul_frag_pack_a, omega_matmul_frag_pack_a_f32, omega_matmul_frag_pack_a_row0, omega_matmul_frag_pack_a_row0_f32, omega_matmul_frag_pack_b, omega_matmul_result_sentinelsOutside owned scope, #323ApiViewsElem owns these A/B packers and sentinel traversal. No competing edits.
omega_bw_ir_init, omega_blackwell_encode_oneARCH-0042 ABI shellObject clearing, identity-map initialization, pointer checks and invocation. No encoding policy.
omega_bw_program_code_bytes, omega_blackwell_kernel_encode_intoAlready ported, #309 / ARCH-0042 shellcg_bind.om makes size/count decisions; C routes caller-owned buffers, hashes bytes and populates the public descriptor.
bw_kernel_alloc_encode, omega_blackwell_codegen_matmul_i32, omega_blackwell_codegen_matmul_tensor, omega_blackwell_codegen_matmul_tensor_loop, omega_blackwell_codegen_matmul_frag, omega_blackwell_codegen_matmul_frag_blockARCH-0042 allocation shellPointer checks, stack object selection, malloc/free and existing program-generator dispatch.
omega_kernel_dumpARCH-0042 file shellOptional environment-selected file writing and content hashing; no instruction computation.
bw_enc_diff_noteVerification shellWrites differential receipts and aborts on a disagreement; production encoder selection is unchanged.
omega_blackwell_verify_codegen_fixtures, omega_blackwell_verify_codegen_fixtures_intops, omega_blackwell_verify_codegen_fixtures_fragmm, omega_blackwell_verify_codegen_fixtures_reconv, omega_blackwell_verify_codegen_fixtures_bfly_f2fp, omega_blackwell_verify_codegen_fixtures_atomf32, omega_blackwell_verify_codegen_fixtures_fb1cut4, omega_blackwell_test_regalloc_bounds, omega_blackwell_test_codegen_variationIndependent verification oraclesGolden-word comparisons, fixture construction, assertions and reporting intentionally remain C, not an adoption of a production C implementation.
field (omega_gpu_om_ir.c)Computation moved herecg_replay.om admits each register field; cg_fields.om decodes it. Old helper is default-OFF CUDAPP_MIGRATION_PENDING_C_CODEGEN_BASE.
extend_loopComputation moved herecg_life.om extends signed live-in intervals to loop closure.
loop_invariant_okComputation moved herecg_invar.om checks each source, nonuniform redefinition and post-loop use.
omega_gpu_om_ir_replayComputation moved here; entry retained as ARCH-0042 shellcg_replay.om checks record/metadata/width/operand/closure admission; cg_fields.om decodes; cg_life.om extends loops and validates exact hints; cg_invar.om checks invariants. C invokes the emitter, marshals objects and dispatches already-ported allocation.
omega_gpu_om_ir_buildComputation moved here; buffer shell retainedcg_budget.om owns the declaration floor, declaration/peak constraint and CTA register budget. C retains pointer/zero-thread entry guards and encode dispatch.
call_unit, omega_gpu_om_ir_data, omega_gpu_om_ir_rc_nameARCH-0042 ABI/replay dispatch shellCalls the selected bridge entry, checks its status/result, clears caller memory and returns the stable diagnostic string.

The prior family codegen PRs #274–#278 and #313–#316 implement separate translation units and are not duplicated or modified here. #312's f64 IR extension is likewise not overwritten. Cubin assembly remains in the existing omega_cubin path; this lane compares its exact output rather than adopting a different writer.

Default and oracle selection

The newly removed C wire packing, word decoding, IR argument validation, lifetime extension/invariant checking and build-budget arithmetic are behind CUDAPP_MIGRATION_PENDING_C_CODEGEN_BASE, undefined by default. The guard preserves the original computation for the differential build. There is no fallback from an Omega refusal to C.

This does not rename or enable #309's separate CUDAPP_MIGRATION_PENDING_C_REGALLOC, CUDAPP_MIGRATION_PENDING_C_CODEGEN_MATMUL, CUDAPP_MIGRATION_PENDING_C_BIND, or the existing encoder oracle. The inherited OMEGA_GPU_NO_POSIX path selects those older C oracles because the pinned scalar-only freestanding bridge cannot convert their array views. This existing limitation is not evidence of a freestanding Omega cutover. No new host binary/library/runtime dependency is adopted by this lane; generated bindings use the repository's pinned bridge.

Source-derived partition and negative controls

differential.c derives the partition from each admission predicate in the original common replay and from the field widths in its record layout:

Each accepted encodable program compares the entire padded SASS byte stream against the original C encoder and packs both streams with identical cubin metadata, comparing the entire resulting cubin. No cubin, PTX or disassembly is written to evidence or committed. The red build flips one SASS bit before comparison and must fail. Five independent seeded-source mutants change field shift, opcode bound, loop extension, loop rejection and the budget boundary; all must be killed by the same executable.

Reproduction and tiers

Run from the repository root. Every command below is host-only and must run inside the device-hidden wrapper, even the mutant and simulator paths:

export OMEGA_OMC=$HOME/work/cudastack/omega-mv/seed/out/omc
export OMEGA_BRIDGE=$HOME/work/cudastack/omega-bridge
export OMEGA_BRIDGE_DIR=$OMEGA_BRIDGE
bwrap --dev-bind / / --dev /dev --proc /proc -- taskset -c 10-14 nice -n 10 \
  make -j1 test-codegen-base-om-mutants test-regalloc-om test-om-encoder test-codegen-freestanding

tests/codegen_base/run.sh emits source coverage of the preserved C oracle in build/codegen-base-om/; generated mutant copies remain only in that ignored build directory. CODEGEN_BASE_OUT selects a separate build directory. See dated evidence for exercised results, coverage dispositions and exact commands. The full make test belongs to the integration owner, not this lane. Chip/live-RM/VFIO are NOT_RUN; see CHIP.md.

The change adds no language, compiler, pin, bridge profile, public API or repository ownership rule. Existing omega-harness skill descriptions therefore remain applicable; there is no skill example to refresh.