CUDA Interoperability#
APIs for interoperability with CUDA.
Functions#
- bool cupva::cuda::ContextSupportsCuda(cupva::impl::Context const *const ctx=cupva::Context::GetCurrent()) noexcept
Check if CUDA interop is enabled.
- Stream cupva::cuda::CreateStream(cudaStream_t const cudaStream, EngineType const absEngine=PVA0, AffinityType const vpuAffinity=VPU_ANY)
Create a PVA Stream object from a CUDA stream handle.
- void cupva::cuda::ForceDisableSupport()
Disable CUDA interop support.
- void cupva::cuda::SetAffinity(cudaStream_t const cudaStream, AffinityType const vpuAffinity)
Set the VPU affinity for a CUDA stream.
- void cupva::cuda::Submit(cudaStream_t const cudaStream, Cmd const *const commands, CmdStatus *const status=nullptr, int32_t const count=1, OrderType const order=IN_ORDER, int32_t const executionTimeout=-1, int32_t const submitTimeout=-1)
Submit a batch of Commands to a CUDA Stream .
- void cupva::cuda::Submit(cudaStream_t const cudaStream, const BaseCmd &command, CmdStatus *const status=nullptr, OrderType const order=IN_ORDER, int32_t const executionTimeout=-1, int32_t const submitTimeout=-1)
Submit one command to a CUDA Stream .
- void cupva::cuda::Submit(cudaStream_t const cudaStream, CmdBuffer const &cmdBuf, int32_t const executionTimeout=-1, int32_t const submitTimeout=-1)
- void cupva::cuda::Submit(cudaStream_t const cudaStream, const std::initializer_list< Cmd > &cmdList, CmdStatus *const status=nullptr, OrderType const order=IN_ORDER, int32_t const executionTimeout=-1, int32_t const submitTimeout=-1)
Submit a command list to a CUDA Stream .
- void * cupva::cuda::mem::Import(void *const cudaDevPtr, int64_t const size, cupva::mem::AccessType const access=cupva::mem::AccessType::READ_WRITE)
Create a CUPVA pointer from a CUDA device pointer.
Functions#
- void *cupva::cuda::mem::Import(
- void *const cudaDevPtr,
- int64_t const size,
- cupva::mem::AccessType const access = cupva::mem::AccessType::READ_WRITE,
Create a CUPVA pointer from a CUDA device pointer.
- Deprecated:
This function is deprecated. CUDA device pointers no longer need to be imported explicitly.
Importing a CUDA device pointer creates a mapping which must be released by calling cupva::mem::Free() when the application has finished using the buffer. The CUDA device pointer must be at least 64B aligned.
Usage considerations
Allowed context for the API call
Thread-safe: No
API group
Init: Yes
Runtime: No
De-Init: No
- Parameters:
cudaDevPtr – [in] The CUDA device pointer returned by a CUDA API (cudaMalloc, for example)
size – [in] The size of the allocation in bytes
access – [in] Specifies the access type of the mapped memory.
- Throws:
cupva::Exception(InvalidArgument) – PVA needs 64B aligned addresses and CUDA device pointer is not aligned on 64B.
cupva::Exception(DriverAPIError) – Getting a device pointer failed due to driver API error.
cupva::Exception(NotAllowedInOperationalState) – if called when NVIDIA DRIVE OS VM state is “Operational”
cupva::Exception(CUDADisabled) – if called after disabling CUDA interop for this process
- Returns:
The CUPVA device pointer pointing to the imported memory.