Skip to content

Commit e141d9e

Browse files
author
Hugh Delaney
committed
Add some description for behaviour of the urMemGetNativeHandle for CUDA and HIP
1 parent eb03e5c commit e141d9e

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

scripts/core/CUDA.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,25 @@ take the extra global offset argument. Use of the global offset is not
148148
recommended for non SYCL compiler toolchains. This parameter can be ignored if
149149
the user does not wish to use the global offset.
150150

151+
Interoperability
152+
================
153+
154+
Unified Runtime offers a number of entry points in order to get native handles
155+
for UR objects. The native handle may refer to a number of different native CUDA
156+
types, depending on the entry point called.
157+
158+
- ${x}MemGetNativeHandle stores a ``CUdeviceptr`` in the ${x}_native_handle_t
159+
argument passed. The ``CUdeviceptr`` will be resident on the
160+
${x}_device_handle_t provided as an argument, if the device shares a context
161+
with the ${x}_mem_handle_t. If the ${x}_device_handle_t argument passed to
162+
${x}MemGetNativeHandle is ``nullptr``,
163+
``UR_RESULT_ERROR_UNSUPPORTED_FEATURE`` will be returned.
164+
165+
..
166+
TODO: add more descriptions of the native types that will be stored in
167+
ur_native_handle_t types for different calls to urTypeGetNative and
168+
urTypeCreateWithNativeHandle.
169+
151170
Other Notes
152171
===========
153172

scripts/core/HIP.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,25 @@ take the extra global offset argument. Use of the global offset is not
9191
recommended for non SYCL compiler toolchains. This parameter can be ignored if
9292
the user does not wish to use the global offset.
9393

94+
Interoperability
95+
================
96+
97+
Unified Runtime offers a number of entry points in order to get native handles
98+
for UR objects. The native handle may refer to a number of different native HIP
99+
types, depending on the entry point called.
100+
101+
- ${x}MemGetNativeHandle stores a ``hipDeviceptr_t`` in the
102+
${x}_native_handle_t argument passed. The ``hipDeviceptr_t`` will be resident
103+
on the ${x}_device_handle_t provided as an argument, if the device shares a
104+
context with the ${x}_mem_handle_t. If the ${x}_device_handle_t argument
105+
passed to ${x}MemGetNativeHandle is ``nullptr``,
106+
``UR_RESULT_ERROR_UNSUPPORTED_FEATURE`` will be returned.
107+
..
108+
TODO: add more descriptions of the native types that will be stored in
109+
ur_native_handle_t types for different calls to urTypeGetNative and
110+
urTypeCreateWithNativeHandle.
111+
112+
94113
Other Notes
95114
===========
96115

scripts/core/memory.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ params:
435435
- type: $x_device_handle_t
436436
name: hDevice
437437
desc: |
438-
[in] handle of the device that the native handle will be resident on.
438+
[in] handle of the device on which the native handle will reside.
439439
- type: $x_native_handle_t*
440440
name: phNativeMem
441441
desc: |

0 commit comments

Comments
 (0)