Objective — upstream contribution to Modular MAX from CUDApp/Omega
User direction (2026-10-23): make code contributions to https://github.com/modular/modular that allow NVIDIA GPUs to execute as fast as or faster than NVIDIA CUDA-based baselines, without dropping correctness, portability, sovereignty or provenance. This issue coordinates upstreamable implementation, not merely an interoperability whitepaper. Parent https://github.com/aien-dev/omega-mv/issues/679; CUDApp #68 native artifact export; Bridge #4/#6/#7 MAX ABI work; Omega #680/#681 contracts/verification.
Source-grounded findings (2026-10-23)
- MAX has an existing CUBIN loading/execution surface:
SDK/include/HAL/M_driver_bundle.h(M_driver_static_bundle,M_driver_bundle_load),SDK/include/HAL/M_driver_function.h,Target/lib/CUDA/M_driver_function.cpp,max/driver/src/max_license/_hal/context.mojo(NVIDIA bundle typecubin),Target/test/CUDAPluginTest.cpp; the new NeoDriver client is incubating, MAX still uses legacy DeviceContext by default. Readmax/driver/src/max_license/README.md. Therefore do not reverse-engineer an already exposed kernel loader. First requirement is producing a valid relocatable/loadable NVIDIA CUBIN code object, not passing raw 16-byte SASS instructions as a CUBIN. - CUDApp
src/omega_blackwell_matmul.hcurrently exposesOmegaBlackwellKernel.code,code_digest,gpr_count;src/omega_blackwell_qmd.hdescribes direct low-level launch. MAX owning CUDA contexts/queues means never inject Omega QMD or reuse the direct native device VA/queue. Model semantic+launch metadata -> MAX-owned CUBIN/function launch arguments and barriers. - MAX 26.7's NVIDIA path continues using vendor
libcudaat runtime andlibnvptxcompilerwhen compiling PTX; a CUDApp-produced CUBIN can potentially bypass the latter for that kernel, but does not imply all MAX execution is CUDA-free. - Consumer Blackwell upstream tracker https://github.com/modular/modular/issues/6570 invites help for sm_120/sm_121.
#6961VMM capability problem appears already fixed in current source (MLRT/lib/Driver/DeviceContext/CUDA/CUDADeviceContext.cpptests GPU_DIRECT_RDMA_WITH_CUDA_VMM_SUPPORTED). No duplicate PR without latest-version repro. - Current CUDApp source AGPL-3.0-only, archived MIT grant at commit
232332422bfdc31c8918085b50f13c1e18ab702e; upstream MAX kernels Apache 2.0/LLVM, MAX driver under MAX License. Audit each line and require rights holder's explicit compatible relicensing of any post-MIT first-party code before porting/including. Do not blindly copy AGPL source into Apache files. - Modular contribution rules
CONTRIBUTING.md,max/kernels/CONTRIBUTING.md,max/docs/contributing/contribution-areas.md: only bug fixes currently accepted in many areas; substantive new backend/kernel features require maintainer-approved issue first.AI_TOOL_POLICY.md: AI-assisted patches/issues require human review and human submission, no fully autonomous agent posts to their project. GitHub connector has no push permission to modular/modular and no fork creation action; no fork/PR has been created.
Workstreams / acceptance
- Pick one verifiable Blackwell regression/missing primitive or proven hotspot tied to a still-reproducible upstream issue, preferably #6570. Pin MAX version and source. Demonstrate correctness and a real performance deficiency rather than hypothesize.
- Implement and host-qualify a versioned CUDApp
sm_121native-code to valid CUBIN module packager/exporter with entry symbol, arg ABI, registers, shared memory, metadata, linking requirements, and architecture; inspect independently (ELF/load checker). RawOmegaBlackwellKernel.codeis not a module. Treat new packaging as CUDApp #68 dependency; don't add NVIDIA compiler to the native producer path. - Adapt to existing MAX HAL bundle/function with MAX-owned memory and streams; introduce no duplicate driver. Prove expected refusals for invalid arch, malformed cubin, stale code, wrong ABI, buffer owner mismatch, launch layout, sync hazards. Stage first under user-owned repositories with tests.
- Compare single-kernel/whole-graph baselines vs MAX unmodified, NVIDIA CUDA library kernel, and CUDApp native on same GB10, same dtype/layout/shape, equivalent accuracy, memory residency, graph capture, cold/warm, synchronization, p50/p95 and energy if instrumented. >=5 randomized paired trials in approved Spark window. Physical peak and sustained throughput measured; no blanket faster-than-CUDA claim without proof.
- Prepare a small upstream first PR for a reproducible bug fix / missing sm_121 intrinsic or library regression, with a test + kbench benchmark, and a separate, reviewable future proposal for optional external CUBIN artifact provider. No giant drop of the AGPL runtime or replacement of CUDA stack.
- Secure human author review of the code and AI-assisted description, source provenance and license grants, then user creates/links a fork and submits an upstream issue for maintainer acceptance. Do not autonomously post issues, PRs or comments to Modular under their AI Tool Use Policy. If no fork, remain READY_FOR_HUMAN_SUBMISSION with exact patch/commit/repro.
- Gate upstream readiness by actual build/test/reviewer evidence and exact commit hashes; the current issue is design-and-contribution coordination only, NOT IMPLEMENTED. No live model or driver changes and no unauthorized GPU reset. Final AIEN-owned production source must follow Omega #599 .om replacement; modular-facing Mojo/C++ extension remains an external-system artifact with explicit separate licensing.
Required PR set
PR-0 small accepted bug fix or missing primitive on sm_121, independently benchmarked. PR-1 optional native CUBIN artifact acceptance/validation through existing MAX HAL, only after approved proposal. PR-2 bounded matmul/attention improvement/conformance and evidence, after PR-1 and numerical parity. Do not broaden PR-0 to an entire competing runtime.