cuda::experimental::graph_buffer#
-
template<class _Tp>
class graph_buffer# Graph buffer#
graph_bufferprovides typed device memory allocated as a CUDA graph node. It mirrors the API ofcuda::bufferbut takes apath_builder&instead of astream_ref. Allocation inserts acuGraphAddMemAllocNodeinto the graph.- Memory can be freed in three ways:
destroy(path_builder&)— inserts a free node into the graphdestroy(stream_ref)— frees asynchronously on a stream (for memory that outlives the graph)Destructor — frees on the stored stream if one was set via
set_stream()
If the destructor runs with no stream set and the buffer is non-empty, it asserts in debug mode. In release mode the memory leaks.
- Template Parameters:
_Tp – The element type stored in the buffer. Must be trivially copyable.
Public Types
-
using size_type = ::cuda::std::size_t#
-
using properties_list = ::cuda::mr::properties_list<::cuda::mr::device_accessible>#
Public Functions
-
graph_buffer() = delete#
- inline graph_buffer(
- path_builder &__pb,
- graph_memory_resource __mr,
- size_type __count,
- ::cuda::no_init_t
Allocates uninitialized storage for
__countelements.
- inline graph_buffer(
- path_builder &__pb,
- graph_memory_resource __mr,
- size_type __count,
- const _Tp &__value
Allocates storage and fills with
__value.
- inline graph_buffer(
- path_builder &__pb,
- graph_memory_resource __mr,
- ::cuda::std::span<const _Tp> __src
Allocates storage and copies from a contiguous span.
- inline graph_buffer(
- path_builder &__pb,
- graph_memory_resource __mr,
- ::cuda::std::initializer_list<_Tp> __ilist
Allocates storage and copies from an initializer list.
-
graph_buffer(const graph_buffer&) = delete#
-
graph_buffer &operator=(const graph_buffer&) = delete#
-
inline graph_buffer(graph_buffer &&__other) noexcept#
Move-constructs from another graph_buffer.
-
inline graph_buffer &operator=(graph_buffer &&__other) noexcept#
Move-assigns from another graph_buffer.
-
inline ~graph_buffer()#
Destructor. Frees device memory on the stored stream if one was set.
-
inline void set_stream(::cuda::stream_ref __stream) noexcept#
Set the stream to use for automatic cleanup in the destructor.
-
inline ::cuda::stream_ref stream() const noexcept#
Returns the stream set for automatic cleanup.
-
inline graph_node_ref destroy(path_builder &__pb)#
Insert a free node into the graph to deallocate the buffer.
-
inline void destroy(::cuda::stream_ref __stream)#
Free the buffer’s device memory asynchronously on a stream.
-
inline const_pointer data() const noexcept#
-
inline const_pointer begin() const noexcept#
-
inline const_pointer end() const noexcept#
-
inline constexpr bool empty() const noexcept#
-
inline const graph_memory_resource &memory_resource() const noexcept#