Repository navigation
Conversation
VirtualMemoryResource passed -1 as the location id for host_numa allocations, and cuMemCreate rejects that with CUDA_ERROR_INVALID_VALUE. Add VirtualMemoryResourceOptions.numa_id. It is required for host_numa, rejected for other location types, and must match in a per-call modify_allocation config. Reject host_numa_current at construction, because the driver does not accept it for physical allocations. Closes NVIDIA#2694 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Som Tripathi <somtri@iastate.edu>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Priority: ➖ Normal Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
- Review profile: CHILL
- Plan: Enterprise
- Run ID:
b60e59cb-b28e-419e-a1f0-4c8405fefed6
📒 Files selected for processing: 5
cuda_core/cuda/core/_memory/_virtual_memory_resource.pyicuda_core/cuda/core/_memory/_virtual_memory_resource.pyxcuda_core/docs/source/release/1.3.0-notes.rstcuda_core/tests/memory_ipc/test_vmm_ipc.pycuda_core/tests/test_memory.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
The numa_id docstring points to Device.properties.host_numa_id, which is -1 on a system without NUMA, and numa_id rejects -1. cuMemCreate wants location id 0 on such a system, so say that in the docstring. Signed-off-by: Som Tripathi <somtri@iastate.edu>
|
/ok to test 1e11c4a |
Andy-Jost
left a comment
There was a problem hiding this comment.
Thank you for the fix, @somtri. The change is small, it matches the scope agreed in #2694, and the new tests cover the host_numa path that was broken. I have one non-blocking nit.
Nits
cuda_core/cuda/core/_memory/_virtual_memory_resource.pyx, line 716 (modify_allocationdocstring). The new check at lines 484-488 rejects a per-callconfigwhosenuma_iddiffers from the resource's, but the docstring still describes onlylocation_typeandhandle_type. Please addnuma_idin two places: theconfigentry under Parameters ("must name the resource's location_type, handle_type, and numa_id") and theValueErrorentry under Raises ("if config names a different location type, handle type, or numa_id"). That matches how the existing location_type rule is documented.
Your questions
- Keep the per-call
numa_idmismatch check inmodify_allocation. Yes, keep it. It mirrors the existing location_type rule, and_fill_propreads the location from the resource's config, so without the check a different per-callnuma_idwould be ignored silently. We prefer an explicit error over a silent fallback. The docstring update in nit 1 is the only follow-up. - The
test_vmm_ipc.pychange that has not run locally. That is fine. The module skips on Windows, and CI runs it on Linux, so CI will be its first run. If the host_numa row fails there, we can look at it together.
Next steps
I am adding the missing metadata (assignee, bug and P1 labels, milestone "cuda.core 1.3.0") and starting CI with /ok to test. Once CI is green and the docstring nit is in, I will merge.
…1.0 library names) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
I merged |
|
/ok to test e9a2441 |
|
Description
closes #2694
VirtualMemoryResourcewithlocation_type="host_numa"passed-1as the location id tocuMemCreate, and the driver rejects that withCUDA_ERROR_INVALID_VALUE. This follows the fix described in the issue comment:VirtualMemoryResourceOptionshas a newnuma_id: int | None = Nonefield, added last so the positional order does not change._check_configrequires it for"host_numa", rejects it for every other location type, and rejects negative values with the messagePinnedMemoryResourceOptionsuses._fill_propwrites it toprop.location.id.location_type="host_numa_current"raisesValueErrorat construction. The enum member stays.modify_allocation,_check_configalso rejects a per-callconfigwhosenuma_iddiffers from the resource's, as it already does forlocation_type._fill_proptakes the location from the resource, so without the check a different value would be ignored silently. I can drop it if you prefer.test_vmm_host_location_types_report_host_accessibleandtest_is_ipc_enabledbuilthost_numawithoutnuma_idand builthost_numa_current, so both needed updates. Three new tests cover the allocation, thehost_numa_currentrejection, and thenuma_idchecks. They carryagent_authoredmarkers.1.3.0-notes.rst.The allocation test writes and reads the buffer from the host. The resource grants access only to its own location, so
cuMemsetD8on the buffer fails withCUDA_ERROR_INVALID_VALUEunless the device is inpeers. That is the host-resourcepeersgap from #2910, which this PR leaves alone.Testing
Windows 11, RTX 3080 Laptop GPU (WDDM, driver 617.42), CUDA 13.4, cuda-bindings 13.4.4, Python 3.14. The device reports
host_numa_id = 0andhost_numa_virtual_memory_management_supported = True.The issue's reproducer, extended to host_numa_current and catching each error, before the change:
After the change,
numa_id=0allocates 2097152 bytes, andhost_numa_currentraisesValueErrorat construction.test_is_ipc_enabledskips on Windows ("Sharing virtual memory needs POSIX file descriptor handles"), so thetest_vmm_ipc.pychange has not run locally.pre-commit runpasses on the five changed files.Claude Code (claude-opus-5-5) wrote this change and ran the tests above on my machine. I reviewed the diff.
Checklist