Skip to content

fix(cuda.core): allow NUMA pools on older drivers - #2858

Open
aryanputta wants to merge 5 commits into
NVIDIA:mainfrom
aryanputta:fix/pinned-host-numa-2795
Open

aryanputta wants to merge 5 commits into
NVIDIA:mainfrom
aryanputta:fix/pinned-host-numa-2795

Conversation

@aryanputta

@aryanputta aryanputta commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2795

Summary

Allow explicit HOST_NUMA allocations to reach the CUDA driver when the newer capability attribute is unavailable, while preserving early rejection for unsupported ordinary HOST pools.

CUDA 12.6-12.8 support HOST_NUMA pools, but the capability query returns CUDA_ERROR_INVALID_VALUE. The previous check exposed that as false and rejected valid pools.

Validation

  • Existing explicit-NUMA integration coverage
  • git diff --check
  • DCO sign-off included
  • Full CUDA integration tests require an NVIDIA Linux runner

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@copy-pr-bot

copy-pr-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.core Everything related to the cuda.core module label Sep 14, 2026
@aryanputta aryanputta closed this Sep 14, 2026
@aryanputta aryanputta reopened this Sep 14, 2026
@rparolin
rparolin requested review from Andy-Jost and mdboom October 8, 2026 16:52
@rparolin rparolin added this to the cuda.core 1.3.0 milestone Oct 8, 2026

@Andy-Jost Andy-Jost left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. The diagnosis in #2795 is right: a driver older than 12.9 cannot answer CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED, and cuda.core reads the error as False.

Removing the check from allocate() goes too far, though. A 12.9+ driver can answer the query, and a False answer there is real. #2487 added the check because a pool on an unsupported device can return buffers that fail at first use (#2486).

A simpler fix is to repair the property itself. allocate() already reads it, so allocate() then needs no change, and host_numa_memory_pools_supported also stops reporting False on 12.6–12.8 drivers. For example, in _device.pyx (with cy_driver_version cimported from cuda.core._utils.version):

@property
def host_numa_memory_pools_supported(self) -> bool:
    if cy_driver_version() >= (12, 9, 0):
        return bool(
            self._get_cached_attribute(driver.CUdevice_attribute.CU_DEVICE_ATTRIBUTE_HOST_NUMA_MEMORY_POOLS_SUPPORTED)
        )
    # The attribute arrived in CUDA 12.9, HOST_NUMA pools in 12.6 (#2795).
    return cy_driver_version() >= (12, 6, 0) and self.memory_pools_supported and not self.integrated

The integrated clause keeps today's answer on Jetson. The evidence in #2795 comes from a discrete GPU, and #2486 showed host pools on Jetson returning unusable buffers.

Please also:

  • Revert the change to allocate().
  • Add a test that simulates a pre-12.9 driver.
  • Say in the property's docstring that the value is inferred on drivers before 12.9.
  • Rebase on main.

When the update is in, I will start the GPU CI.

@Andy-Jost

Copy link
Copy Markdown
Contributor

I revised my review above: please repair the property instead of changing allocate().

Signed-off-by: Aryan <aryansputta@gmail.com>
Signed-off-by: Aryan <aryansputta@gmail.com>
@aryanputta
aryanputta force-pushed the fix/pinned-host-numa-2795 branch from 7be3e09 to 5b7cd96 Compare October 12, 2026 23:29
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved reporting of host NUMA memory pool support across CUDA driver versions. CUDA 12.9 and newer use the value reported by the driver; older versions infer support based on driver version, memory pool availability, and whether the device is integrated. This provides consistent capability reporting, including on versions where the CUDA attribute is unavailable.
  • Documentation
    • Clarified that support is inferred for drivers earlier than CUDA 12.9.

The device property queries the CUDA attribute on drivers 12.9 and newer. On earlier drivers, it infers support from the driver version, memory-pool support, and whether the device is integrated. A subprocess test covers simulated driver versions 12.5, 12.6, and 12.8.

Changes: Host NUMA capability detection

Layer / File(s) Summary
Driver-version capability detection
cuda_core/cuda/core/_device.pyi, cuda_core/cuda/core/_device.pyx, cuda_core/tests/test_device.py
The property queries the CUDA attribute on drivers 12.9 and newer. On earlier drivers, it reports support when the driver is at least 12.6, memory pools are supported, and the device is not integrated. The stub documents this behavior, and the test checks simulated driver versions.

Assessment against linked issues

Objective Addressed Explanation
Prevent false negatives for HOST_NUMA pools on CUDA 12.6–12.8 drivers [#2795] ✅

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Low · up to 5e001

Explicit HOST_NUMA pools on CUDA 12.6–12.8 are no longer rejected when the capability attribute can't be queried. One minor test-hygiene item remains open: the new subprocess test doesn't set up its own CUDA context. It does not affect runtime behavior.

Security architecture risk: Minimal · up to 5e001

The change makes eligible GPUs usable with NUMA pinned pools on older drivers. It can extend access to more GPUs within the process, but it does not change who can import a pool or who owns and releases it.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — On CUDA 12.6–12.8, the grant set can expand to every process-visible device that meets the inferred predicate for the affected pool. This changes which GPUs can access that pool within the process, not which processes receive its IPC handle.

Trust Boundaries and Controls

  • observed — For a new IPC import, CUDA must accept the shareable handle before the library requests device access. Imported resources still cannot allocate, and the subprocess that simulates driver versions is test-only.

Resilience and Maintainability Implications

  • observed — IPC grants run per device and retry an already-mapped result once. A terminal error stops initialization before registry publication. Earlier successful grants are not undone by that loop: access belongs to the shared pool, and the last owner release attempts revocation before destroying imports and allowing waiting importers to proceed.
Finishing Touches

Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 901a4f5 and 5e001ff.

Files selected for processing: 2

  • cuda_core/cuda/core/_device.pyx
  • cuda_core/tests/test_device.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 6e65bbdc-a1ad-4b22-96d8-b427516ea9e2
📥 Commits

Reviewing files that changed from the base of the PR and between 5fe0749 and 5b7cd96.

📒 Files selected for processing (3)
  • cuda_core/cuda/core/_device.pyi
  • cuda_core/cuda/core/_device.pyx
  • cuda_core/tests/test_device.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Comment thread cuda_core/tests/test_device.py Resolved
Signed-off-by: Aryan <aryansputta@gmail.com>
@Andy-Jost

Copy link
Copy Markdown
Contributor

/ok to test 6efba07

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Signed-off-by: Aryan <aryansputta@gmail.com>

@pytest.mark.agent_authored(model="gpt-6")
@pytest.mark.parametrize("driver_version", [12050, 12060, 12080])
def test_host_numa_memory_pools_supported_on_pre_12_9_driver(driver_version, tmp_path):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

important: Establish a CUDA context in the child process.

The subprocess calls CUDA APIs and constructs DeviceProperties, but it never creates, sets, and destroys a CUDA context. Add explicit context setup with cleanup before DeviceProperties._init(device).

As per path instructions: tests that call CUDA APIs must establish their own context.

Source: Path instructions

…2795

Signed-off-by: Aryan Putta <aryansputta@gmail.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	cuda_core/tests/test_device.py

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.core Everything related to the cuda.core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: PinnedMemoryResource rejects usable HOST_NUMA pools on CUDA 12.6-12.8 drivers

4 participants