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 / MAX-INTEROP / G2 / README.md

220 lines · 14451 bytes Raw Blame History Source

MAX interop Gate 2: does a CUDApp cubin load and run?

Goal: get the smallest Omega kernel (matmul 16x16x8, sm_121) to load and run through MAX's DeviceExternalFunction path, with a known-good control and the C/libcuda probe as an independent oracle.

Status: Gate 2 EXERCISED on GB10 (three shared value-only windows under ledger L881, results below). The current main writer's image is refused with 200 by both loaders. The fixed writer in this change (tkinfo note plus declared registers) loads and runs through libcuda and through MAX DeviceExternalFunction, exact against the fp32 oracle. Not QUALIFIED: one shape, one chip, no timing.

Earlier device runs (2026-10-24, transcript only, no receipt)

These runs exist only in an omp session transcript (~/.omp/agent/sessions/-tmp/2026-10-24T03-09-36-465Z_01a16be2-*.jsonl). No receipt was written and no cubin sha256 was recorded. Driver 580.173.02, CUDA 13.0, old cubin_probe (cuModuleLoadData, no JIT log).

windowimageoutputtranscript line
20261024T043818Z-aa5c86 (shared)68/matmul-16x16x8.cubin (no program headers)cuModuleLoadData -> 200 device kernel image is invalid, rc=42268
same/tmp/refcubin/k.cubin (ptxas, a different kernel)loaded; worst_abs=3.25 bad=127. The logged ref_rc=0 is the exit code of tail, not of the probe2324
20261024T044814Z-4dc098/tmp/phdr-mat.cubin (built 04:47:56Z from the uncommitted program-header change; PHDR at 0xd60, the same layout as main)cuModuleLoadData -> 200, rc=42370

Consequences:

Load matrix (fixtures outside this repo)

tools/cubin_variants.py (copy of ~/handoffs/max-g2/cubin_variants.py) derives every image from two inputs. The first is the current writer's output: artifact-export at main b5746b94, artifact acfba3aa…3b1e. The second is a ptxas 13.0.88 control built from control.cu (same symbol and argument ABI, -fmad=false). The ptxas images, E2, F and G contain NVIDIA-tool bytes, so they stay out of this repo (PROVENANCE.md). Only their sha256 values are recorded here. The generator is deterministic: two runs give identical images.

namefnexpectsha256isolates
A-ctlomega_matmul_bf16PASSd95a489211830f58b93f092bab94ed4174c56cc4ae49779da3091aea2bf581d2probe+driver+ABI known-good
B-ctl-nomercomega_matmul_bf16PASS if capmerc not required2d2516305d8bcba5273af73e72e135473ec20f73ef83dd12f74d832406cb414acapmerc/merc sections
C-omega-stale-nophdromega_matmul_bf16REJECT 200 (seen 10-24, no receipt)7d1306933b67fa24a20dba59d39bf48fbd4aa5cec37e046e3b664e5e0c4b34ebprogram headers absent
D-omega-mainomega_matmul_bf16REJECT 200 expected (10-24 phdr-mat)c4de09ece9f92d762c91eac0ca7af635618538697f90654dc76da2497e492e48current CUDApp writer
E1-omega-symfixomega_matmul_bf16UNKNOWN7721f9566b8246437b3dc3f55c8ada057a49f3cc9b16fc6d395faa73bee5caedsymtab sh_info
E2-omega-tkinfo-ptxasomega_matmul_bf16UNKNOWN62acfe37b66a7f58db311b5ba3dcf2ccdd42220b56386a8bbcfc8e4178a992a2.note.nv.tkinfo (ptxas bytes)
E3-omega-tkinfo-ownomega_matmul_bf16UNKNOWN67bd97401061daf1d798dfc1032066c3ef9f3579c9bc49883200a1d48f16a99e.note.nv.tkinfo (own strings)
E4-omega-tkinfo-cg-symfixomega_matmul_bf16UNKNOWNe4dad818f5fa68452e90a9a6807cf02ae055c6c2284889fd803c645789778c3eall three metadata gaps
E5-omega-allmetaomega_matmul_bf16UNKNOWN6cb0c73d96b995e05560ab94370c7c66883ef888064d804aaeda40abb21d2e2bE4 + EXIT_INSTR_OFFSETS [0x400], CRS_STACK_SIZE 0, the two reserved-smem symbols, .nv.constant0 link 0 / align 4
F-ctlcontainer-omega-sassomega_matmul_bf16UNKNOWN: load => Omega SASS accepted83b133fd53fb1df50c427ae1f8f62b84f3bc0fdb9a2392bd69d9ab2f5ac6a773B's container with Omega's 0x480-byte text (section, segment, symbol size and EXIT offsets follow)
G-omegacontainer-ctl-sassomega_matmul_bf16UNKNOWN: load => CUDApp container accepted25f162490ac9b2b138d88be53a292f254ab06d3412bc85f8f0267730a83c30a5D's container with the control's 0x880-byte text at EOF (segment, symbol size, REGCOUNT 40, MAXREG 0xff follow; old text zeroed)
N1-ctl-truncatedomega_matmul_bf16REJECTe059683df43d9a2a6e8fc5fbcc831378dbd5d7d75d2e32e4accf9ca79d43387dtruncated image
N2-ctl-wrong-entryomega_matmul_bf16_missingREJECT (500 NOT_FOUND)d95a489211830f58b93f092bab94ed4174c56cc4ae49779da3091aea2bf581d2entry name
N3-ctl-eflags-sm80omega_matmul_bf16REJECT194a48dce16bcef34faadb233a46b9d9370a80d43326d62c2cdfd9819e5f84bee_flags arch field
N4-max-vecadd-sm80vec_addREJECT (209 NO_BINARY_FOR_GPU)b0a171991dc9a2c456b70d3221b6353d2e671159f94e5eca292986ff5bcf21e8wrong-arch real cubin

Bisection images for the 715 (window 2, tools/MATRIX-g2b.tsv), each one field changed from E5, E3 or D:

namefnexpectsha256isolates
H1-e5-reg40omega_matmul_bf16PASS if register count629803d0f3643b7a9b92b38abc843bc8dac6395c5579ddcb4f174e3ad72e7c77REGCOUNT+MAXREG 40 (peak+2 rounded to 8)
H2-e5-regcount40omega_matmul_bf16UNKNOWNa849a4ace4acc113a0dd716dc61e5d5077328b2ae2352f43dfbc0e52c2a07f5cREGCOUNT 0x2f only
H3-e5-maxreg40omega_matmul_bf16UNKNOWNb4bc06565bfa0ff5b446dabf15001b514cdcf2ddbb2ae1827591c8b02943d655MAXREG 0x1b only
H4-e5-reg34omega_matmul_bf16UNKNOWN88531f937c017be0c7df7733ac50d30786b5c7abcd9b6e0cf34bf781969cf3e8REGCOUNT+MAXREG 34 (peak+2, ptxas rule)
H5-e5-isa1omega_matmul_bf16715 if register count6211cb1320905e117ee6ea000e2c42b16f87b30373d9171205e84e0ef29c2d44nv.compat ISA_CLASS 1 (ptxas value)
H6-e3-reg40omega_matmul_bf16PASS if tkinfo+regs sufficef8ea88ef3ce51f6f57738da5bae1957dc59c4344ef3213fe4b4c42a8442083d7minimal writer fix: own tkinfo + regs 40
H7-d-reg40omega_matmul_bf16REJECT 200 (no tkinfo)62d11f4ff521a5fb55350ca7fa986ed52530b63505f7497b8cffc60304dc5c5fregs alone do not fix the load

Writer-output images (window 3, tools/MATRIX-g2c.tsv), no edits after export. W1 and W2 come from build/artifact-export on this change's tree (manifests in 20261031T003009Z-0b0fa9/); X is the attention artifact the main writer produced (68/attention-hd128-gqa8.cubin). Window 3 reruns A, D and N1-N4 from the table above as controls.

namefnexpectsha256isolates
W1-writer-matmulomega_matmul_bf16PASS1dac563e82ff3523681261d9fb79d89db74f4081ca0a6328049940fc1c4c007bfixed writer, matmul 16x16x8, REGCOUNT 40
W2-writer-attentionomega_gqa_attention_causalLOAD90b5c752f793d1187485f7dcec0921001443498584075d13cfb47bf9236d2169fixed writer, attention hq=8 hkv=1 hd=128, REGCOUNT 80
X-attn-mainomega_gqa_attention_causalREJECT 2004d8ab7ae60f3550ab90710b2bc87af71e9ffeec91ad0190eb72f004b9d997ab7main writer, no tkinfo

W1 differs from H6 only in file layout (section and header offsets) and in the tkinfo tool string (Build omega_cubin instead of Build b5746b94): readelf -x of sections 1-10 and 12 is identical, section 11 is the note.

The tables are tools/MATRIX-g2b.tsv and tools/MATRIX-g2c.tsv (copies of ~/handoffs/max-g2/variants/). All images pass readelf. All except N1 pass cuobjdump -elf. nvdisasm -c rejects N1 ("invalid ELF file"), reports illegal instructions for N3 and an old-format warning for N4, and disassembles every Omega image (C, D, E1-E5, F, G) without a message. F holds 72 instructions (Omega), G 136 (control).

Reading the matrix

Each image holds exactly one kernel's code, and both kernels compute the same product, so numerics alone cannot tell them apart; the container and text bytes can.

BFGcause of 200
loadloadrejectCUDApp container; E1-E5 narrow it
loadrejectloadOmega machine code (encoding or a field the driver checks in the text)
loadrejectrejectboth, or the combination
reject--capmerc/merc required on this driver; F inherits B's gap

Static comparison, D against A (host, cuobjdump/nvdisasm 13.0)

Shared: e_flags 0x6007902, ABI version 8, OS/ABI 0x41, ET_EXEC, five program headers, EIATTR_MERCURY_ISA_VERSION 1.1, CUDA_API_VERSION 0x82, the same KPARAM_INFO (3 x 8 bytes at 0x0/0x8/0x10, cbank 0x1f), CBANK_PARAM_SIZE 0x18, PARAM_CBANK at 0x380 size 0x18, all-zero .nv.constant0.

D lacks, beyond what E1-E4 add: EIATTR_EXIT_INSTR_OFFSETS (A: 0x30, 0x780), EIATTR_CRS_STACK_SIZE (A: 0), the symbols .nv.reservedSmem.offset0 and __nv_reservedSMEM_offset_0_alias (the section is present), .debug_frame with its relocations, and the capmerc/merc sections (B). D's .nv.constant0 has sh_link 3 and align 16 (A: 0 and 4). D's MAXREG is 0x20 with REGCOUNT 32 (A: 0xff and 40). D's text is 0x480 bytes with one EXIT at 0x400, followed by a BRA self-loop.

Probes

Host results (EXERCISED)

build/cubin_probe                       -> usage, rc=2
build/cubin_probe --bogus               -> usage, rc=2
build/cubin_probe --load-only X fn 16 16 8 (no window)
  -> refused: SPARK_WINDOW is not set; no authorized GPU window, rc=3
max_cubin_probe (no window)             -> refused, rc=3
run_matrix.sh (no window)               -> refused, rc=3
run_matrix.sh with stub probes          -> 15 rows; launch rows skipped when a load fails

Device results (EXERCISED on GB10)

Driver 580.173.02, MAX 26.7.0 (max/v26.7.0 527d069e), mojo 1.2.0. Every window was --gb10 shared --quiet none under ledger L881, value-only, with a BOARD START/CLOSED line. Cells are probe exit codes (0 pass or expected refusal, 1 MAX raised at launch, 4 load/CUDA failure, - not attempted).

windowimageswall
20261030T235211Z-0352f1A-N4 (15)~70 s
20261030T235858Z-10fa8cA-N4 + H1-H7 (22)~73 s
20261031T003009Z-0b0fa9A, D, W1, W2, X, N1-N4 (9)~17 s

Window 1 and window 2 agree on all 15 shared rows. Window 2:

nameC loadC runMAX loadMAX runobserved
A-ctl0000worst_abs 0
B-ctl-nomerc0000capmerc/merc not required
C-omega-stale-nophdr0-0-refused, 200
D-omega-main4-4-cuModuleLoadDataEx -> 200; MAX CUDA_ERROR_INVALID_IMAGE (#68)
E1-omega-symfix4-4-200
E2-E50401load; launch 715 an illegal instruction / CUDA_ERROR_ILLEGAL_INSTRUCTION
F-ctlcontainer-omega-sass0000Omega machine code runs in the control container
G-omegacontainer-ctl-sass4-4-200: the container is the load cause
H1-e5-reg400000715 gone
H2-e5-regcount400000REGCOUNT alone fixes the launch
H3-e5-maxreg400401MAXREG alone does not
H4-e5-reg340000peak+2 suffices
H5-e5-isa10401ISA_CLASS is not the cause
H6-e3-reg400000own tkinfo + regs 40 = minimal fix
H7-d-reg400-0-refused, 200: tkinfo is required
N1-N40-0-refused as expected

Window 3 (the fixed writer's own output):

nameC loadC runMAX loadMAX runobserved
A-ctl0000worst_abs 0, bad 0
D-omega-main4-4-200 (regression control)
W1-writer-matmul0000worst_abs 0, bad 0, sentinel untouched 0, C and MAX
W2-writer-attention0-0-cuModuleLoadDataEx -> 0, cuModuleGetFunction -> 0; not launched
X-attn-main0-0-refused, 200
N1-ctl-truncated0-0-refused, 999 / CUDA_ERROR_INVALID_IMAGE
N2-ctl-wrong-entry0-0-refused, 500 / CUDA_ERROR_NOT_FOUND
N3-ctl-eflags-sm800-0-refused, 209 / CUDA_ERROR_NO_BINARY_FOR_GPU
N4-max-vecadd-sm800-0-refused, 209 / CUDA_ERROR_NO_BINARY_FOR_GPU

Verdict. The CUDApp writer had two defects on sm_121:

  1. No .note.nv.tkinfo → cuModuleLoadData 200 (#68). Evidence: D, E1, G, H7 refused; E2-E4, H6 loaded.
  2. .nv.info REGCOUNT equal to the codegen peak (32) → launch 715. Evidence: H1, H2, H4 run; H3, H5 still 715.

This change writes a tkinfo note in both packers and makes artifact-export declare omega_bw_gpr_declared(peak) registers. W1 is that output, unedited, and passes Gate 2 through MAX. Attention launch is Gate 3. The live omega_gpu_matmul_api.c path still stores the peak and needs a paired omega-mv + CUDApp change (drift baseline).

Raw: <window>/raw.log and results.tsv here; the window directories under ~/yardsticks/windows/ hold open.json/close.json.