← Back to Pull requests

feat(cuda.core): share VirtualMemoryResource buffers with fabric handles #3230

Closed
unknown closed this pull request without merging on Nov 09, 2026 17:06 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 22:35 UTC
Author

Summary

Buffers of a VirtualMemoryResource configured with handle_type="fabric" can now be shared between processes on one node. This adds the fabric transport that #2980 tracks, beside the POSIX fd transport from #3028.

Changes

  • New VirtualMemoryFabricBufferDescriptor (listed in api_private.rst): one opaque 64-byte CUmemFabricHandle per physical allocation, the allocation sizes, the buffer size, and the exporting device's UUID. It is plain data: pickle and multiprocessing carry it without the file-descriptor machinery, it compares and hashes by value, and from_handles() rebuilds one received through a transport of your own, with validation. The export zeroes the handle struct first, so two exports of one allocation carry the same bytes and no stack bytes travel in a descriptor.

  • Both VMM descriptors derive from a private _VirtualMemoryDescriptor, so Buffer.from_ipc_descriptor and the resource's import run one loop for both transports. The fd descriptor keeps its ownership and identity semantics and its from_fds().

  • VirtualMemoryResource construction checks Device.properties.handle_type_fabric_supported for handle_type="fabric" and raises RuntimeError that names the NVLink fabric and IMEX channel requirements, before an allocation can fail opaquely. A device can report support while the allocation is refused (the attribute does not check for an NVLink fabric, and older drivers do not check for an IMEX channel); a refused allocation then carries a note that says so. is_ipc_enabled is True for "fabric" on Linux with device-located memory.

  • Fabric descriptors pin nothing. The exporter keeps the buffer alive until every importer has imported it; after import, the imported allocation holds its own driver references. A stale or forged handle fails at import with a driver error and a note about stale handles, forgery, and IMEX channels. The docstrings, the release note, and VMM_DESIGN.md say so wherever descriptor lifetime is described.

  • A location mismatch at import names the owning device by UUID and says which local device it is, or that it is not visible in this process.

  • _ipc.pyi and _virtual_memory_resource.pyi are regenerated by the stub hook.

  • Tests: tests/memory_ipc/test_vmm_fabric.py covers export shape, descriptor validation and pickling, Queue, Pipe, Process-argument, and Pool round trips for descriptors and buffers, a second-GPU import with peer access, handle-type mismatch, garbage and stale handles, re-export of imports, a queued buffer that does not pin, and the unsupported-device error. The fabric fixtures skip on devices without fabric handle support, and on devices that report it but refuse the allocation (one probe allocation per device).
  • Validation

    Fabric handles need an NVLink fabric and an accessible IMEX channel. The project's CI has no such runner, so the fabric cases skip there; the release note says that this release's fabric support is not covered by CI. On the CI runners the attribute is true while every fabric allocation is refused with a driver error: the runner VMs disable NVLink and have no IMEX channel, and the attribute checks neither on those drivers. That is why the fixtures probe instead of trusting the attribute.

    Validation on NVIDIA internal hardware: a two-GPU B300 system ran the memory_ipc suite and test_memory.py twice: on the first commit (478 passed, 21 skipped; the one failure found the uninitialized padding in the exported handle struct) and on the fix and on the PR head with main merged (479 passed, 21 skipped each), and a Hopper system without fabric support ran the fabric and fd suites (30 passed, 17 skipped, with the unsupported-device error test among the passes). The fabric suite also passed inside a container on the B300 system (a stock CUDA base image with the GPUs injected by the NVIDIA container CLI and the IMEX channel device node mounted; 18 passed, 1 skipped, three runs). Multi-node sharing is out of scope and untested.

    Related Work

    Part of #2980. Follows #3028 and #3229; this PR includes the #3229 commit until that PR merges.

    🤖 Generated with Claude Code

    Diff: 524 lines (+393 / -131) across 6 files Reviewer: brandon-b-miller Review duration: 19831m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 524 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.375
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3230"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.8% (MEDIUM) · Higher = larger blast radius
    47.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.9% · Safe to merge
    18.9%