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/issues/52d7db7d3a7499ee # 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 # [CUDA++×MAX P1] Export native sm_121 matmul/attention artifact metadata for independently checked handoff Closed · #68 · open 2026-10-24 03:05 UTC · closed 2026-11-06 01:22 UTC (reason completed) Imported from GitHub aien-dev/CUDApp#68, by drakestapleton drakestapleton wrote on 2026-10-24 03:05 UTC Parent: https://github.com/aien-dev/omega-mv/issues/679 ; consume CUDApp #35, #5, #10, #16 and Omega #632/#623. Source: src/omega_blackwell_matmul.h (OmegaMatMulSpec/Kernel), src/omega_blackwell_qmd.h (QMD), src/omega_gpu_matmul_api.h, src/omega_gpu_attention_api.h, src/omega_gpu_platform.h (ABI 1.2). Extend current approved export seam, not another compiler/driver, for offline kernel bytes+SHA-256, immutable semantic/op contract ID, ISA/device capabilities, QMD/launch descriptor byte digest, compiler+firmware/driver prereqs, resource requirements, bounds, numeric contract and provenance. Never export live raw GPU VA or capability or assume MAX pointers interchangeable with Omega addresses. Independent disassembly, code/launch digest mismatch/unsupported dtype or shape/wrong target/stale receipt fail closed. Signed receipt does not imply full translation equivalence. Host export PASS separate from scheduled real GB10 codegen/execution evidence; zero vendor user-space dependencies in Omega native path, while MAX dependencies audited separately. .om final replacement under Omega #599. drakestapleton wrote on 2026-10-24 03:12 UTC ## Source-backed upstream contribution update (2026-10-23) User explicitly wants code contributed to modular/modular, using CUDApp for Blackwell parity/performance. Coordination: https://github.com/aien-dev/CUDApp/issues/69 . MAX already has a native code bundle interface: `SDK/include/HAL/M_driver_bundle.h` (`M_driver_static_bundle`, `M_driver_bundle_load`), `Target/lib/CUDA/M_driver_function.cpp`, `Target/test/CUDAPluginTest.cpp`, `max/driver/src/max_license/_hal/context.mojo`. NeoDriver README explains its `StaticBundle` (CUBIN bytes) -> `RuntimeBundle` -> Function -> queue execution. DO NOT reverse-engineer a nonexistent interface without first exercising this one. Missing from our side: CUDApp `OmegaBlackwellKernel.code` contains raw SASS bytes, not automatically a valid CUBIN (ELF container, entry symbol, ABI/register/shared-memory metadata). First bridge contract is a valid loadable CUBIN + frozen argument ABI + verified code digest and target. MAX must own its context, buffer, stream and launch; Omega native QMD and GPU VAs cannot be handed across this boundary. Prove a minimal kernel and negatives before matmul/attention. Upstream rules: Modular's `max/kernels/CONTRIBUTING.md` / `max/docs/contributing/contribution-areas.md` currently accept bug fixes only. Their `AI_TOOL_POLICY.md` requires human review of AI-generated issues/PRs before they are submitted; do not auto-post to upstream. GPU support tracker `modular/modular#6570` may offer a first bounded issue. Their `#6961` RDMA VMM allocation bug is seemingly already guarded in current source; do not duplicate. CUDApp current first-party code AGPL-3.0-only, so audit/dual-license or use an eligible permissive source lineage before contributing code into Apache/LLVM paths. No benchmarked 'better than CUDA' result has been established yet; use same hardware and independent correctness oracle. Deliver upstream-ready branch/patch and reviewed reproduction results in AIEN-owned repo; only then human-reviewed fork/issue/PR to modular/modular. In-graph branch no longer needs speculative direct-driver ABI reverse engineering if the published HAL bundle API suffices. did:key:`z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd` wrote on 2026-11-18 17:12 UTC Recovered GitHub comment by @aien-spark on 2026-10-24T04:00:13Z. Original comment `6379592583` Implemented and host-qualified on `feat/max-artifact-export` @ `fcd7d24`. - `src/omega_cubin.c` writes a real sm_121 cubin ELF (`e_machine=190`, `e_flags=0x6007902`) containing the generated text byte-for-byte, `.nv.info` parameter metadata, and zero-VA QMD templates. - `src/omega_native_artifact.c` binds op, shape, bounds, contract id, semantic spec id, ISA, text/QMD/cbank SHA-256, numeric tolerance, driver minimum and provenance; admission rejects tamper, ISA/format/driver/reloc/VA/contract mismatches. - `make test-native-artifact`: 42 checks, 0 failed. `tools/artifact_smoke.sh`: `ARTIFACT SMOKE PASS` with `nvdisasm`/`cuobjdump` accepting both cubins. - Artifacts: matmul `8dcc18e06f2306a785dd413c73f7289e12df0df995066ccb8cd5ff985a709db6`, attention `b7c2c772ca3401160fa18c73d7c653114db20f928aaa993f217657e81df95cb8`. - `tools/interop/cubin_probe` is built but NOT_RUN: no authorized window; device load/launch and numeric parity are unproven. Not closing: the driver/device acceptance half is blocked. did:key:`z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd` wrote on 2026-11-18 17:12 UTC Recovered GitHub comment by @aien-spark on 2026-10-26T19:26:41Z. Original comment `6425324164` ## capmerc gap: a host-only census (2026-10-26, no GPU) Earlier note on this issue: CUDA++ sm_121 cubins fail device load with `cuModuleLoadData` error 200. The suspected cause is missing `.nv.capmerc`/`.nv.merc` sections. That came from a GPU-window session and was not rerun here. New host evidence: `/home/drakestapleton/handoffs/CudaComplete/logs/capmerc-census.log`. I extracted every sm_120/sm_121 cubin from `libcurand.so.10.4.0.35` (CUDA 13.0, ptxas V13.0.39) and counted sections with `readelf -SW`. - 14 of the 22 cubins contain kernels. In every one of them, each `.text.` has exactly one `.nv.capmerc.text.`; the totals per file are 19 to 54. They also carry `.nv.merc.*` mirrors: symtab, nv.info, per-kernel info, debug_frame, constant.pic/user and global.init. - The 8 cubins without capmerc contain no `.text` at all. They still carry 1 to 4 `.nv.merc.*` sections. - NVIDIA's sm_121 cubins with kernels use e_flags `0x6007902`, the same value as ours. - Our `evidence/MAX-INTEROP/68/{matmul-16x16x8,attention-hd128-gqa8}.cubin`: 1 `.text`, 0 capmerc, 0 merc. - Local ptxas 13.0.88 emits `.nv.capmerc.text.k` plus the merc family for a one-entry sm_121 PTX by default. Its strings include `--binary-kind ` and `Self check for capsule mercury (capmerc)`, but ptxas rejects both as `Unknown option`. No public tool (`ptxas`, `nvcc`, `nvlink`, `nvdisasm`, `cuobjdump` `--help`) documents them. Evidence levels: - REPRODUCED: every NVIDIA sm_12x cubin in that library that has kernels also has a capmerc section for each kernel. - SUSPECTED, not shown: that the driver requires capmerc, which would make it the cause of error 200. A cubin with kernels and without capmerc was never observed being accepted or rejected in isolation. What is not done, deliberately: - No capmerc bytes were written. NVIDIA publishes no format. ptxas strings suggest SASS can be "reconstituted" from capmerc, so it is a second encoding of the kernel, not a checksum. The only oracle that could validate hand-written capmerc is a device load, which needs a GPU window (NOT_RUN). Cheapest discriminating test, for the next authorized window: - Load a ptxas-built sm_121 cubin, once as built and once with the capmerc/merc sections stripped. - If the stripped copy returns 200, capmerc is required. The route for CUDA++ is then either to emit PTX and let NVIDIA's JIT finalize it on the MAX side, or a documented capmerc writer. did:key:`z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd` wrote on 2026-11-18 17:22 UTC Recovered GitHub comment. Original comment `6534637826` Device runs that were never receipted (2026-10-30 reconciliation). The earlier "error 200" note comes from an omp session transcript, not from a receipt. The facts: window image result 20261024T043818Z-aa5c86 `evidence/MAX-INTEROP/68/matmul-16x16x8.cubin` (no program headers) `cuModuleLoadData -> 200`, rc=4 same ptxas sm_121 reference (a different kernel) loaded 20261024T044814Z-4dc098 `/tmp/phdr-mat.cubin` (with PHDR + PT_LOAD) still `-> 200`, rc=4 - Program headers are not sufficient. The "confirmed on GB10" wording in commit `130a101` and in the `omega_cubin.c` comment overstates these runs; CUDApp#202 corrects it. - `68/matmul-16x16x8.cubin` (`7d130693…`) predates the PHDR change, so it is stale as the writer's output. - CUDApp#202 adds a JIT-logging `cubin_probe` (`cuModuleLoadDataEx`, error/info logs, `--load-only` and `--expect-reject` modes) and a 12-image matrix. The matrix isolates capmerc, tkinfo, callgraph and symtab, against a ptxas control with the same ABI, plus 4 negatives. Each image runs through both libcuda and MAX `DeviceExternalFunction`. - Device rows are NOT_RUN until a ledger grant exists. Receipt location: `evidence/MAX-INTEROP/G2/`. Sign in to comment