Wrapper presenting a synchronous resource as a stream-ordered one, so it can drive components that require the AsyncResource concept (TempPool and the GPU builders).
More...
|
| void * | allocate_async (size_t bytes, size_t alignment, cudaStream_t) |
| | Allocates through the synchronous resource; the result is valid on every stream, hence trivially valid on stream.
|
| void | deallocate_async (void *p, size_t bytes, size_t alignment, cudaStream_t stream) |
| | Synchronizes stream, then frees through the synchronous resource – the synchronize makes the quiescence contract hold. Null is a no-op and skips the synchronize.
|
| void * | allocate (size_t bytes, size_t alignment) |
| | Synchronous pair, forwarding to the wrapped resource.
|
| void | deallocate (void *p, size_t bytes, size_t alignment) |
template<class R>
struct nanovdb::cuda::AsyncFromSync< R >
Wrapper presenting a synchronous resource as a stream-ordered one, so it can drive components that require the AsyncResource concept (TempPool and the GPU builders).
- Template Parameters
-
| R | the wrapped synchronous resource, held by value; wrap a ResourceRef<R> to borrow a stateful instance instead. |
The mirror of SyncFromAsync, and the analog of cuda::mr's synchronous_resource_adapter. allocate_async forwards to R::allocate, whose memory is immediately valid on every stream – a stronger guarantee than stream-ordering requires. deallocate_async synchronizes stream before R::deallocate, establishing the quiescence the synchronous contract demands.
- Warning
- Every deallocation synchronizes its stream, so expect serialization relative to a genuinely stream-ordered resource. That is the unavoidable cost of a synchronous backend under a stream-ordered algorithm; this wrapper exists so the cost is explicit and chosen by the caller – e.g. on a device without memory-pool support – rather than silently substituted.