Unregister#

Fully qualified name: cupva::mem::Unregister

Defined in src/host/cpp_api/include/cupva_host.hpp

void cupva::mem::Unregister(const void *const ptr)#

Unregisters an external pointer from CUPVA space.

This API should be used only to unregister CUDA or HOST device pointers registered using Register(). In safety critical systems, this API must be called only during deinit time.

User should call CupvaMemUnregister for each explicitly registered address range before calling free (e.g. cudaMemFree or OS free()) on the underlying buffer. It is undefined what happens if user does not follow this.

When using driver versions >=2006, except for QNX Safety :

  • CUDA device pointers will automatically be registered/unregistered with CUPVA if CUDA interop is enabled.

  • Calling Register/Unregister on CUDA device pointers is not necessary. These APIs will have no effect in this case and will not generate an error in order to preserve compatibility of user code.

Usage considerations

  • Allowed context for the API call

    • Thread-safe: No

  • API group

    • Init: No

    • Runtime: No

    • De-Init: Yes

Parameters:

ptr[in] The device pointer pointing to the registered memory.

Throws:
  • cupva::Exception(InvalidArgument) – The device pointer is invalid.

  • cupva::Exception(DriverAPIError) – Deallocation failed due to driver API error. This error does not apply to CUDA device pointers with driver version >=2006, except for QNX Safety.

  • cupva::Exception(NotAllowedInOperationalState) – If called when NVIDIA DRIVE OS VM state is “Operational”