CRTP base supplying the synchronous half of the resource concept in terms of the stream-ordered half, so a custom stream-ordered resource only has to write allocate_async and deallocate_async.
More...
template<class Derived>
struct nanovdb::cuda::SyncFromAsync< Derived >
CRTP base supplying the synchronous half of the resource concept in terms of the stream-ordered half, so a custom stream-ordered resource only has to write allocate_async and deallocate_async.
- Template Parameters
-
| Derived | the resource deriving from this base |
A stream-ordered resource must also model the synchronous concept (is_async_resource implies is_resource), which means writing four methods where two would do. The synchronous pair is not a bare delegate: memory from allocate must be usable immediately on any stream, so the null-stream allocation has to be synchronized before it is returned. Omitting that synchronization yields memory that satisfies the concept but is not actually synchronous – a race rather than a compile error – so it lives here rather than being rewritten per resource.
static constexpr size_t DEFAULT_ALIGNMENT = 256;
void* allocate_async(size_t bytes, size_t alignment, cudaStream_t stream);
void deallocate_async(void* p, size_t bytes, size_t alignment, cudaStream_t stream);
};
CRTP base supplying the synchronous half of the resource concept in terms of the stream-ordered half,...
Definition DeviceResource.h:195