interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

[BRIDGE-MAX P1] Reverse-engineer MAX native GPU execution interop boundary when public API is insufficient

Open · #7 · open 2026-10-24 03:07 UTC

Imported from GitHub aien-dev/omega-bridge#7, by drakestapleton

drakestapleton wrote on 2026-10-24 03:07 UTC

Parent: https://github.com/aien-dev/omega-mv/issues/679; precedence: https://github.com/aien-dev/omega-bridge/issues/4; target integration: https://github.com/aien-dev/omega-bridge/issues/6; GPU adapter scope: https://github.com/aien-dev/omega-bridge/issues/3.

User decision — 2026-10-23

If Modular MAX does not expose a sufficient supported native GPU executable submission interface, reverse-engineer the missing interoperability boundary from publicly available source and permitted local runtime observations. The lack of a documented API is a research/implementation task, not an immediate project NO-GO.

This work is interoperability with MAX, not an AI-assisted clone/replacement of MAX. Read and comply with the exact licensed revision of https://github.com/modular/modular/blob/main/Licenses/MAX_LICENSE, including §1.4(d), which permits AI-assisted work on interoperability but restricts using MAX to AI-generate competing reimplementations. Do not bypass authentication, copy proprietary undisclosed source, disable security controls, or distribute components contrary to their terms. Clarify uncertain license/ABI terms before redistributing.

Code-grounded reconnaissance targets

Staged technical work (only after #4 determines public API insufficient)

  1. Map MAX graph op lowering -> generated kernel artifact -> driver module loading -> device allocation -> dispatch enqueue -> synchronization/completion -> observable output. Extract minimal types, field meanings, lifetimes, fences, error paths, and versioned ABI, with file/line refs.
  2. Construct a small controlled probe corpus (vector add first; BF16 matmul and GQA attention after contracts are frozen). Compare known MAX output and launch traces against Omega's independently emitted sm_121 kernel, code digest, QMD and execution receipt.
  3. Determine integration mode explicitly: supported extension, source-level MAX driver adapter, new registered device plugin, or isolated sidecar with explicit memory transport. Never assume native SASS accepted or cross-context GPU VAs transferable.
  4. Reconstruct a bounded interop ABI: capability and backend negotiation; modules/artifact representation; ownership and rights; address-space boundary; dtype/layout; stream/event ordering; barriers and completion; error and cancellation; artifact hashes, proof tier and receipts. Unknown semantics must refuse.
  5. Build an opt-in experimental adapter using published source/runtime interfaces and separately authorized sandbox tests. All final AIEN-owned code must follow the seeded .om transition from https://github.com/aien-dev/omega-mv/issues/599. External MAX components isolated, identified by license, not copied into AIEN native code.
  6. Differential/mutation tests: bad binary, bad module target, malformed launch/QMD, stale/foreign buffer, alias violation, premature free, missing synchronization, wrong result, incompatible ABI, unexpected vendor dependency and unqualified hardware must be rejected or explicitly BLOCKED. Independent reviewer validates bounded evidence before actual Spark GPU tests.

Safety and acceptance

No privileged driver or kernel modification, no GPU reset, no interference with live serving or model residency, no unapproved production deployment. Host/mock probes first; hardware runs only with Spark coordinator and resource reservations. Keep source/code hashes and raw commands/exits, decode/trace references and negative tests; NOT_RUN != PASS. Verify MAX dependencies separately: Omega user-space CUDA-free does not imply MAX CUDA-free.

Deliver at least an exact pinned interface map, license boundary, reproduction probe, one validated bounded adapter implementation or a documented specific impossibility with test evidence, and a handoff to Bridge #6. No artificial performance or in-graph execution claims. Do not contact Modular, file upstream PR, or share private receipts without user authorization.

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:19 UTC

Recovered GitHub comment. Original comment 6379594678

Source map delivered on feat/gpu-interop @ 87aec91; probes NOT_RUN.

  • Mapped the pinned package's load_function, the main-branch HAL cubin path, module/context ownership, and the PTX-vs-cubin boundary. Findings: docs/max/MAX-26.7-FEASIBILITY.md.
  • Dynamic probes that would run a kernel were not executed: the chip is reserved and spark-window open refuses (L332 L424 …). No GPU handle was opened.
  • No bypass: no driver reset, no private HAL call, no cross-context pointer.

Next probes (require a window): byte-slice load_function, entry lookup failure modes, and cubin-vs-PTX acceptance, each in a separate process.

Sign in to comment