forked from NVIDIA/libcudacxx
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory resource / view #2
Open
mzient
wants to merge
360
commits into
jrhemstad:cuda_memory_resource
Choose a base branch
from
mzient:memres_view
base: cuda_memory_resource
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
mzient
force-pushed
the
memres_view
branch
2 times, most recently
from
June 7, 2021 17:27
5e19b23
to
319db3e
Compare
Refactor <atomic> and move implementation to libcxx
Create release 1.6.0.
Revert "Add parity waiting"
Fix atomic and barrier on NVRTC.
…stexpr Add `inline` and `constexpr` qualifiers to `__cxx_atomic_is_lock_free`
Fix `cuda::atomic<Integral>`'s `fetch_max/fetch_min` extension
Add a path for nvc++ host side atomics in __config
…d probably don't need them for tests
- add (basic_)resource_view template - add private base classes for memory resources - make memory kind a tag type - rename unified memory to managed - fix tests for exceptions - adjust __cuda_util for no-exceptions builds TODO: add tests for views. Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
properly propagated to the resource view via operator->. Signed-off-by: Michał Zientkiewicz <[email protected]>
* Fix typos. * Move base interfaces to namespace detail. * Add resource_view comparison. * Add a view_resource with default property (is_kind). Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
* Remove superfluous override * Make __do_as_kind final Signed-off-by: Michał Zientkiewicz <[email protected]>
…ror`. Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Add operator bool in resource view. Disallow construction of resource_view from integer (0). Add context to as_kind. Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
…red_resource. Signed-off-by: Michał Zientkiewicz <[email protected]>
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.
This is a copy of PR PR #158 in libcudacxx
This work builds on [NVIDIA#105] ((NVIDIA#105)
The resource is defined in terms of memory kind.
resource_view (a glorifieid pointer with elaborate conversion logic) is defined in terms of the properties of the memory allocated. This allows, for example, to define a function that expects a resource_view<memory_access::host> to take memory_resource and memory_resource, even though these types are not related.
Summary (from #105 ):
cuda::memory_kind (namespace)
Groups kinds of memory allocated
Possible values: device, managed, pinned, host
cuda::memory_resource<memory_kind, context>
Synchronous (de)allocation of storage of the specified memory_kind
cuda::stream_ordered_memory_resource<memory_kind>
Asynchronous, stream-ordered (de)allocation of storage of the specified memory_kind
The semantics of stream ordered memory allocation are as defined here
stream_ordered_memory_resource inherits from memory_resource and provides a default implementation of allocate/deallocate by allocating on the default stream and synchronizing.
cuda::stream_view
A non-owning wrapper for cudaStream_t
cuda::cuda_error
Exception thrown on CUDA runtime API errors
throw_on_cuda_error utility for checking result of CUDA runtime API calls
New (wrt #105 ):
cuda::basic_resource_view<resource_pointer, properties...> a pointer-like object that can be used in place of memory_resource and pameterized in terms of memory properties instead of memory kind.
cuda::memory_resource_base, cuda::stream_ordered_memory_resource_base - base classes with common interface for all memory resources regardless of their memory kind. The bases are private so that the user can't blindly declare a function parameter as cuda::memory_resource_base and unsafely pass a resource of any kind there. Instead, resource_view should be used.
resource_view, stream_ordererd_resource_view - template aliases for basic_resource_view, with pointers the base resource types substituted for the resource_pointer. These types are befriended with (stream_ordered_)memory_resource and therefore the access to the private base class is allowed. There's no way to obtain the base pointer except for calling operator-> which is intended for exposing the resource interface.
TODO: Add tests for resource_view