#include <NvInferRuntime.h>
◆ IGpuAsyncAllocator()
nvinfer1::v_1_0::IGpuAsyncAllocator::IGpuAsyncAllocator |
( |
| ) |
|
|
default |
◆ ~IGpuAsyncAllocator()
nvinfer1::v_1_0::IGpuAsyncAllocator::~IGpuAsyncAllocator |
( |
| ) |
|
|
overridedefault |
◆ allocate()
TRT_DEPRECATED void * nvinfer1::v_1_0::IGpuAsyncAllocator::allocate |
( |
uint64_t const |
size, |
|
|
uint64_t const |
alignment, |
|
|
AllocatorFlags const |
flags |
|
) |
| |
|
inlineoverridevirtualnoexcept |
A thread-safe callback implemented by the application to handle acquisition of GPU memory.
- Parameters
-
size | The size of the memory block required (in bytes). |
alignment | The required alignment of memory. Alignment will be zero or a power of 2 not exceeding the alignment guaranteed by cudaMalloc. Thus this allocator can be safely implemented with cudaMalloc/cudaFree. An alignment value of zero indicates any alignment is acceptable. |
flags | Reserved for future use. In the current release, 0 will be passed. |
- Returns
- If the allocation was successful, the start address of a device memory block of the requested size. If an allocation request of size 0 is made, nullptr must be returned. If an allocation request cannot be satisfied, nullptr must be returned. If a non-null address is returned, it is guaranteed to have the specified alignment.
- Note
- The implementation must guarantee thread safety for concurrent allocateAsync/deallocateAsync/reallocate requests.
Usage considerations
- Allowed context for the API call
- Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads.
- Deprecated:
- Deprecated in TensorRT 10.0. Superseded by allocateAsync
Implements nvinfer1::v_1_0::IGpuAllocator.
◆ allocateAsync()
void * nvinfer1::v_1_0::IGpuAsyncAllocator::allocateAsync |
( |
uint64_t const |
size, |
|
|
uint64_t const |
alignment, |
|
|
AllocatorFlags const |
flags, |
|
|
cudaStream_t |
|
|
) |
| |
|
overridepure virtualnoexcept |
A thread-safe callback implemented by the application to handle stream-ordered asynchronous acquisition of GPU memory.
- Parameters
-
size | The size of the memory block required (in bytes). |
alignment | The required alignment of memory. Alignment will be zero or a power of 2 not exceeding the alignment guaranteed by cudaMalloc. Thus this allocator can be safely implemented with cudaMalloc/cudaFree. An alignment value of zero indicates any alignment is acceptable. |
flags | Reserved for future use. In the current release, 0 will be passed. |
stream | Specifies the cudastream for the asynchronous allocation. If nullptr or 0 is passed, the default stream will be used. |
- Returns
- If the allocation was successful, the start address of a device memory block of the requested size. If an allocation request of size 0 is made, nullptr must be returned. If an allocation request cannot be satisfied, nullptr must be returned. If a non-null address is returned, it is guaranteed to have the specified alignment.
- Note
- The implementation must guarantee thread safety for concurrent allocateAsync/deallocateAsync requests.
-
The implementation is not required to be asynchronous. It is permitted to synchronize, albeit doing so will lose the performance advantage of asynchronous allocation.
Usage considerations
- Allowed context for the API call
- Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads.
Reimplemented from nvinfer1::v_1_0::IGpuAllocator.
◆ deallocate()
TRT_DEPRECATED bool nvinfer1::v_1_0::IGpuAsyncAllocator::deallocate |
( |
void *const |
memory | ) |
|
|
inlineoverridevirtualnoexcept |
A thread-safe callback implemented by the application to handle release of GPU memory.
TensorRT may pass a nullptr to this function if it was previously returned by allocate().
- Parameters
-
memory | A memory address that was previously returned by an allocate() or reallocate() call of the same allocator object. |
- Returns
- True if the acquired memory is released successfully.
- Note
- The implementation must guarantee thread safety for concurrent allocate/reallocate/deallocate requests.
Usage considerations
- Allowed context for the API call
- Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads.
- Deprecated:
- Deprecated in TensorRT 10.0. Superseded by deallocateAsync
Implements nvinfer1::v_1_0::IGpuAllocator.
◆ deallocateAsync()
bool nvinfer1::v_1_0::IGpuAsyncAllocator::deallocateAsync |
( |
void *const |
memory, |
|
|
cudaStream_t |
|
|
) |
| |
|
overridepure virtualnoexcept |
A thread-safe callback implemented by the application to handle stream-ordered asynchronous release of GPU memory.
TensorRT may pass a nullptr to this function if it was previously returned by allocate().
- Parameters
-
memory | A memory address that was previously returned by an allocate() or reallocate() call of the same allocator object. |
stream | Specifies the cudastream for the asynchronous deallocation. If nullptr or 0 is passed, the default stream will be used. |
- Returns
- True if the acquired memory is released successfully.
- Note
- The implementation must guarantee thread safety for concurrent allocateAsync/deallocateAsync requests.
-
The implementation is not required to be asynchronous. It is permitted to synchronize, albeit doing so will lose the performance advantage of asynchronous deallocation. Either way, it is critical that it not actually free the memory until the current stream position is reached.
Usage considerations
- Allowed context for the API call
- Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads.
Reimplemented from nvinfer1::v_1_0::IGpuAllocator.
◆ getInterfaceInfo()
InterfaceInfo nvinfer1::v_1_0::IGpuAsyncAllocator::getInterfaceInfo |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
The documentation for this class was generated from the following file: