You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These operations are implemented on Buffer because the CUDA driver APIs apply to a memory range, not specifically to ManagedMemoryResource. That allows the new methods to work for both:
buffers allocated from ManagedMemoryResource
externally wrapped managed allocations
The implementation adds managed-memory detection for buffers, normalizes device/host/NUMA location inputs, and forwards to the existing
driver bindings for cuMemAdvise, cuMemPrefetchAsync, and cuMemDiscardAndPrefetchBatchAsync.
Tests
Adds coverage for:
advise/prefetch/discard-prefetch on managed-memory buffers
support for externally wrapped managed allocations
rejection on non-managed buffers
invalid input combinations
observable driver-side effects via cuMemRangeGetAttribute(...)
question: Does making these member functions of the Buffer type preclude this functionality for allocations that weren't created through the Buffer type? Did we consider making these free functions instead of member functions on the Buffer type?
question: Does making these member functions of the Buffer type preclude this functionality for allocations that weren't created through the Buffer type? Did we consider making these free functions instead of member functions on the Buffer type?
I'm moving this back into draft. We discussed in our team meeting because I was already hesitant as Buffer is becoming a 'God object' with the functionality is gaining. We were going to explore alternatives. Free functions sounds like a good alternative to explore.
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
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.
Summary
Add managed-memory range controls to
cuda.core.Buffer:Buffer.advise(...)Buffer.prefetch(...)Buffer.discard_prefetch(...)This addresses #1332.
Details
These operations are implemented on
Bufferbecause the CUDA driver APIs apply to a memory range, not specifically toManagedMemoryResource. That allows the new methods to work for both:ManagedMemoryResourceThe implementation adds managed-memory detection for buffers, normalizes device/host/NUMA location inputs, and forwards to the existing
driver bindings for
cuMemAdvise,cuMemPrefetchAsync, andcuMemDiscardAndPrefetchBatchAsync.Tests
Adds coverage for:
cuMemRangeGetAttribute(...)Closes #1332