Add VMMAllocatedMemoryResource for Virtual Memory Management APIs#972
Closed
NoahOksuz wants to merge 2 commits intoNVIDIA:mainfrom
Closed
Add VMMAllocatedMemoryResource for Virtual Memory Management APIs#972NoahOksuz wants to merge 2 commits intoNVIDIA:mainfrom
NoahOksuz wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
Contributor
Member
|
@SubGlitch1 Thank you for your interest in contributing. However, this task has been discussed internally in NVIDIA, assigned to @benhg (from NV), and already has a WIP (#968). Please kindly allow us to complete the work there. In the future, we kindly encourage you to discuss with us prior to contributing, to ensure we don't run into such conflicts again. Thanks! 🙂 |
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.
Add VMMAllocatedMemoryResource for Virtual Memory Management APIs
Summary
This PR implements a new
VMMAllocatedMemoryResourceclass that provides access to CUDA's Virtual Memory Management (VMM) APIs through the cuda.core memory resource interface. This addresses the feature request for usingcuMemCreate,cuMemMap, and related APIs for advanced memory management scenarios. for #967Changes
Core Implementation
New
VMMAllocatedMemoryResourceclass incuda/core/experimental/_memory.pyxMemoryResourceabstract interfacecuMemCreate,cuMemAddressReserve,cuMemMap,cuMemSetAccess,cuMemUnmap,cuMemAddressFree,cuMemReleaseDevice integration in
cuda/core/experimental/_device.pyDevice.create_vmm_memory_resource()convenience methodModule exports in
cuda/core/experimental/__init__.pyVMMAllocatedMemoryResourceto public APITesting & Examples
Comprehensive test suite in
tests/test_vmm_memory_resource.pyWorking example in
examples/vmm_memory_example.pyTechnical Details
Memory Management Flow
cuMemCreate→cuMemAddressReserve→cuMemMap→cuMemSetAccesscuMemUnmap→cuMemAddressFree→cuMemReleaseKey Features
cuMemGetAllocationGranularityCU_DEVICE_ATTRIBUTE_VIRTUAL_MEMORY_MANAGEMENT_SUPPORTEDAPI Design
Testing
All tests pass on VMM-capable hardware:
Files Changed
cuda_core/cuda/core/experimental/_memory.pyx- Core implementationcuda_core/cuda/core/experimental/_device.py- Device integrationcuda_core/cuda/core/experimental/__init__.py- Module exportscuda_core/tests/test_vmm_memory_resource.py- Test suitecuda_core/examples/vmm_memory_example.py- Usage example