28#ifndef NV_INFER_SAFE_MEM_ALLOCATOR_H
29#define NV_INFER_SAFE_MEM_ALLOCATOR_H
Application-implemented class for controlling memory allocation on the GPU/CPU.
Definition: NvInferSafeMemAllocator.h:86
ISafeMemAllocator(ISafeMemAllocator const &)=default
Copy constructor (defaulted).
virtual bool deallocate(void *const memory, MemoryPlacement const flags, ISafeRecorder &recorder) noexcept=0
A thread-safe callback implemented by the application to handle release of GPU/CPU memory.
ISafeMemAllocator & operator=(ISafeMemAllocator &&) &=default
Move assignment operator (defaulted).
ISafeMemAllocator(ISafeMemAllocator &&)=default
Move constructor (defaulted).
ISafeMemAllocator & operator=(ISafeMemAllocator const &) &=default
Copy assignment operator (defaulted).
virtual ~ISafeMemAllocator()=default
Destructor for ISafeMemAllocator.
virtual void * allocate(uint64_t const size, uint64_t const alignment, MemoryPlacement const flags, MemoryUsage const usage, ISafeRecorder &recorder) noexcept=0
A thread-safe callback implemented by the application to handle acquisition of GPU/CPU memory.
ISafeMemAllocator()=default
Default constructor for ISafeMemAllocator.
Interface for extended recorder which allows error, warn, debug, or info messages to be recorded.
Definition: NvInferSafeRecorder.h:77
MemoryUsage
Enum to describe the usage of memory region.
Definition: NvInferSafeMemAllocator.h:67
@ kSCRATCH
Scratchpad memory per context used for intermediate tensors.
@ kIMMUTABLE
Memory (network weights) that is initialized once and can be shared across different graphs.
@ kIOTENSOR
Memory used for IO Tensors.
@ kGENERIC
Uncommitted memory usage.
MemoryPlacement
Enum to describe the placement of the memory region.
Definition: NvInferSafeMemAllocator.h:49
@ kMANAGED
CUDA managed memory (not used for safety)
@ kCPU
Regular (paged) host memory allocated via malloc, or aligned_alloc.
@ kGPU
Device memory allocated via cudaMalloc.
@ kCPU_PINNED
Page-locked host memory allocated via cudaHostAlloc, mappable to device (for zero-copy)
@ kNONE
Invalid or unspecified placement (used for error checking)
constexpr uint64_t kMAXIMUM_ALLOC_SIZE
Legacy constant (16 GiB) kept for TensorRT excessiveMemoryDetection test build compatibility.
Definition: NvInferSafeMemAllocator.h:42
Definition: NvInferConsistency.h:30