GetHostPointer#
Fully qualified name: cupva::mem::GetHostPointer
Defined in cupva_host.hpp
-
void *cupva::mem::GetHostPointer(void *const devicePtr)#
Get the host CPU mapped pointer for the given PVA pointer.
Returns a pointer to host mapped device memory allocated by mem::Alloc(), imported by mem::ImportFromHostPtr(), or imported by nvsci::mem::Import() functions. The memory is automatically unmapped when the underlying device memory is freed.
Not all memories are mappable to CPU pointers:
CupvaMemAlloc and CupvaImportFromHostPtr memories are always mappable.
CUDA device pointers are not mappable through this API. Use the CUDA host pointer returned by its allocation API instead.
For legacy reasons, this API supports obtaining a CPU mapped host pointer to device pointers imported from NvSciBuf using CupvaMemImport, if the internal allocation allows CPU mapping of the buffer. This behavior is deprecated and will be removed in a future release. Users should instead use NvSciBuf APIs directly to map CPU host pointers for NvSciBuf allocations.
Usage considerations
Allowed context for the API call
Interrupt handler: No
Signal handler: No
Thread-safe: Yes
Re-entrant: No
Async/Sync: Sync
Required privileges: None
Allowed execution state
Initialization: Yes
Operational: No
Reinit/Deinit Preparation: Yes
Maturity: GA
- Parameters:
devicePtr – [in] The input device pointer which can only be accessed by PVA.
- Throws:
cupva::Exception(InvalidArgument) – The device pointer value or type is invalid or pointer is not mappable.
cupva::Exception(DriverAPIError) – Getting CPU mapped pointer failed due to driver API error.
cupva::Exception(NotAllowedInOperationalState) – if current context is null and default context does not exist and NVIDIA DRIVE OS VM state is “Operational”
- Returns:
The mapped host pointer which can be accessed by CPU user code.
- Pre:
None