1#include <muda/type_traits/type_label.h>
4#include <muda/buffer/buffer_2d_view.h>
5#include <muda/buffer/buffer_3d_view.h>
7namespace muda::details::buffer
11MUDA_INLINE MUDA_HOST
void kernel_destruct(cudaStream_t stream, VarView<T> view)
14 if constexpr(muda::is_trivially_destructible_v<T>)
17 ParallelFor(1, 1, 0, stream)
18 .apply(1, [view] __device__(
int i)
mutable { view.data()->~T(); });
23MUDA_INLINE MUDA_HOST
void kernel_destruct(
int grid_dim,
26 BufferView<T> buffer_view)
29 if constexpr(muda::is_trivially_destructible_v<T>)
32 ParallelFor(grid_dim, block_dim,
size_t{0}, stream)
33 .apply(
static_cast<int>(buffer_view.size()),
34 [buffer_view] __device__(
int i)
mutable
35 { buffer_view.data(i)->~T(); });
40MUDA_INLINE MUDA_HOST
void kernel_destruct(
int grid_dim,
43 Buffer2DView<T> buffer_view)
46 if constexpr(muda::is_trivially_destructible_v<T>)
49 ParallelFor(grid_dim, block_dim, 0, stream)
50 .apply(buffer_view.total_size(),
51 [buffer_view] __device__(
int i)
mutable
52 { buffer_view.data(i)->~T(); });
57MUDA_INLINE MUDA_HOST
void kernel_destruct(
int grid_dim,
60 Buffer3DView<T> buffer_view)
63 if constexpr(muda::is_trivially_destructible_v<T>)
66 ParallelFor(grid_dim, block_dim, 0, stream)
67 .apply(buffer_view.total_size(),
68 [buffer_view] __device__(
int i)
mutable
69 { buffer_view.data(i)->~T(); });
A view interface for any array-like liner memory, which can be constructed from DeviceBuffer/DeviceVe...
A frequently used parallel for loop, DynamicBlockDim and GridStrideLoop strategy are provided,...