feat(agent): cuinterpose shim symbol resolution and forwarding - #215
Closed
galletas1712 wants to merge 1 commit into
Closed
galletas1712 wants to merge 1 commit into
galletas1712 wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
This was referenced Sep 4, 2026
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 4, 2026 20:10
eac35f8 to
e5b36ad
Compare
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 11, 2026 02:23
e5b36ad to
78372a1
Compare
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 11, 2026 06:10
78372a1 to
c88e8fc
Compare
galletas1712
removed this pull request from stack #221
September 11, 2026 06:11
galletas1712
added this pull request to stack #293
September 11, 2026 06:11
This was referenced Sep 11, 2026
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 11, 2026 06:16
c88e8fc to
c6f98ce
Compare
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 11, 2026 06:21
c6f98ce to
4dc1da4
Compare
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 11, 2026 06:41
4dc1da4 to
10ff15b
Compare
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 11, 2026 08:31
10ff15b to
54fc9cf
Compare
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 11, 2026 09:41
54fc9cf to
622e6c5
Compare
Replace the inert placeholder with a shim that intercepts CUDA driver entry points reached through direct linking, dlsym, cuGetProcAddress variants, and cudaGetDriverEntryPoint variants. Ask the real resolver first and substitute only APIs supported by the installed driver. Build against CUDA 13.1 headers for the device-explicit multicast bind ABI without linking libcuda or libcudart. Define the sealed 256-byte POSIX ticket used by later tracking layers. It names the creator participant, private control endpoint, resource kind, and random 128-bit allocation ID. The allocation ID is the opaque bearer capability and future export-cache key; there is no separate authorization field. Peer export requests return one validated SCM_RIGHTS descriptor and use scoped cleanup on all error paths. Keep generic C infrastructure under util/, suppress SIGPIPE on socket writes, close descriptors from malformed messages, and test every forwarding route and ticket invariant with fake CUDA libraries under sanitizers. Signed-off-by: Schwinn Saereesitthipitak <schwinns@nvidia.com>
galletas1712
force-pushed
the
feat/cuinterpose-shim-forwarding
branch
from
September 11, 2026 10:08
622e6c5 to
b6a0ecc
Compare
This was referenced Sep 12, 2026
This was referenced Sep 16, 2026
Contributor
Author
|
Superseded by the replacement 13-PR C-frontend/Rust-backend cuinterpose draft stack: https://github.com/ai-dynamo/snapshot/stack/339 (#326–#338), tracking approved proposal #295. The new stack preserves one reviewable stage per PR, with tests collected in #338 and the design in #337. PageBroker transfer changes remain a separate dependency. Closing this older C implementation; retaining its branch and discussion for reference. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Layer 5 of the eleven-PR cuinterpose stack #293. Closed PR #214 is intentionally not in the active stack.
This PR replaces the inert shim with transparent CUDA forwarding and defines the POSIX ticket primitives later tracking layers use. No allocation or multicast state is tracked at this layer.
Cuinterpose intercepts all four ways an application can reach a driver entry point: direct ELF binding,
dlsym, thecuGetProcAddress*family, and the CUDA runtime'scudaGetDriverEntryPoint*family. Resolver wrappers call the real resolver first and substitute only successful CUDA results, so the shim never invents APIs unsupported by the installed driver. CUDA 13.1 requests select the device-explicit multicast bind ABI.The intercepted surface covers CUDA VMM create/release/retain/map/unmap/access/export/import/property APIs and the corresponding multicast operations. Every wrapper checks symbol availability and forwards arguments/results unchanged in this PR.
posix.cdefines the sealed 256-byte memfd ticket used in later layers. A ticket names the original creator participant and endpoint, resource kind, and random 128-bit allocation ID. The allocation ID is the opaque resource identity and export-cache key. An importer sends anEXPORTrequest carrying the participant, resource kind, and allocation identity needed for lookup. The creator rejects unknown IDs and returns a fresh real CUDA descriptor overSCM_RIGHTSfor a known cached resource. Both peer traffic and coordinator traffic terminate on the same owner-only per-process Unix socket once #217 starts it. The peer request path uses scoped descriptor ownership and direct error returns; it has nogotocleanup path.Tests cover direct and resolver forwarding, ABI selection, ticket validation, descriptor passing, malformed ancillary data, unavailable symbols, and the rule that resolver failure is not substituted.
Stack boundary
Based on #223. #216 implements coordinator orchestration and global validation. #217 turns the forwarding wrappers into active POSIX-FD tracking and starts the per-process listener.
Validation
On the final stack,
make testpasses in all Go modules. The pinned CUDA 13.1 builder compiles the production shim and coordinator with-Werror; the forwarding suite passes 12 tests, and the protocol suite passes 9 tests, with ASan/UBSan enabled. The final published stack head0eae9c4f9b66093332f00a332afaf56048e1e64apassed the fullmake checkgate, the CUDA 13.1 production build, and all 73 sanitizer-backed native cuinterpose tests. Its physical-GPU suite passed all 3 tests with no skips on two DRA-assigned NVIDIA B200 GPUs. The unicast test kept an explicit allocation-ID ticket-backed peer mapping per worker live across capture and restore; the multicast test required a nonzero multicast VA and shim-logical handle, exercisedBindAddr, and passed its collective and captured-graph replay. Detailed hardware evidence and measurements are in #220.