Application-implemented class for controlling allocation on the GPU. More...
Public Member Functions | |
virtual void * | allocate (uint64_t size, uint64_t alignment, uint32_t flags)=0 |
A callback implemented by the application to handle acquisition of GPU memory. More... | |
virtual void | free (void *memory)=0 |
A callback implemented by the application to handle release of GPU memory. More... | |
virtual | ~IGpuAllocator () |
Destructor declared virtual as general good practice for a class with virtual methods. More... | |
Application-implemented class for controlling allocation on the GPU.
|
inlinevirtual |
Destructor declared virtual as general good practice for a class with virtual methods.
TensorRT never calls the destructor for an IGpuAllocator defined by the application.
|
pure virtual |
A callback implemented by the application to handle acquisition of GPU memory.
size | The size of the memory required. |
alignment | The required alignment of memory. Alignment will 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. |
If an allocation request of size 0 is made, nullptr should be returned.
If an allocation request cannot be satisfied, nullptr should be returned.
|
pure virtual |
A 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().
memory | The acquired memory. |