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>
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