Skip to content

Commit 7170da9

Browse files
committed
Address source-check issues
Signed-off-by: Larsen, Steffen <[email protected]>
1 parent baa805f commit 7170da9

File tree

6 files changed

+40
-23
lines changed

6 files changed

+40
-23
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_inter_process_communication.asciidoc

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,28 +145,39 @@ and any resulting objects are undefined.
145145
a!
146146
[source]
147147
----
148-
ipc_memory(span<const char, sycl::dynamic_extent> ipc_memory_handle_data,
149-
const sycl::context &ctx, const sycl::device &dev)
148+
static void *open(ipc_memory_handle_data_t ipc_memory_handle_data,
149+
const sycl::context &ctx, const sycl::device &dev)
150150
----
151151
!====
152152

153-
_Effects:_ Constructs an IPC memory object in `ctx` from the handle data
154-
`ipc_memory_handle_data` of returned by the `get_handle_data()` member function
155-
of another `ipc_memory` object.
153+
_Effects:_ Returns a pointer to the same device USM memory as the device USM
154+
memory associated with the `ipc_memory` object that the handle data originated
155+
from.
156156
The `ipc_memory` object that the handle data originated from is allowed to be
157157
from another process on the host system.
158158
If the `ipc_memory` object that the handle data originated from has been
159159
destroyed, the behaviors of this constructor and any resulting objects are
160160
undefined.
161161
If the device USM memory the original `ipc_memory` object was created with was
162-
not originally allocated on `dev`, the behaviors of this constructor and any
163-
resulting objects are undefined.
162+
not originally allocated on `dev`, the behaviors of this function is undefined.
164163

165164
!====
166165
a!
167166
[source]
168167
----
169-
span<const char, sycl::dynamic_extent> get_handle_data() const
168+
static void close(void *ptr, const sycl::context &ctx)
169+
----
170+
!====
171+
172+
_Effects:_ Closes a device USM pointer previously returned by a call to
173+
`ipc_memory::open()`.
174+
Accessing `ptr` after a call to this function results in undefined behavior.
175+
176+
!====
177+
a!
178+
[source]
179+
----
180+
ipc_memory_handle_data_t get_handle_data() const
170181
----
171182
!====
172183

unified-runtime/scripts/core/exp-inter-process-communication.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ params:
4646
returns:
4747
- $X_RESULT_ERROR_INVALID_CONTEXT
4848
- $X_RESULT_ERROR_INVALID_NULL_HANDLE:
49-
- "NULL == hContext"
49+
- "`NULL == hContext`"
5050
- $X_RESULT_ERROR_INVALID_NULL_POINTER:
51-
- "NULL == phIPCMem"
51+
- "`NULL == phIPCMem`"
5252
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
5353
- $X_RESULT_ERROR_OUT_OF_RESOURCES
5454
--- #--------------------------------------------------------------------------
@@ -67,8 +67,8 @@ params:
6767
returns:
6868
- $X_RESULT_ERROR_INVALID_CONTEXT
6969
- $X_RESULT_ERROR_INVALID_NULL_HANDLE:
70-
- "NULL == hContext"
71-
- "NULL == hIPCMem"
70+
- "`NULL == hContext`"
71+
- "`NULL == hIPCMem`"
7272
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
7373
- $X_RESULT_ERROR_OUT_OF_RESOURCES
7474
--- #--------------------------------------------------------------------------
@@ -96,11 +96,11 @@ params:
9696
returns:
9797
- $X_RESULT_ERROR_INVALID_CONTEXT
9898
- $X_RESULT_ERROR_INVALID_NULL_HANDLE:
99-
- "NULL == hContext"
100-
- "NULL == hDevice"
99+
- "`NULL == hContext`"
100+
- "`NULL == hDevice`"
101101
- $X_RESULT_ERROR_INVALID_NULL_POINTER:
102-
- "NULL == ipcMemHandleData"
103-
- "NULL == ppMem"
102+
- "`NULL == ipcMemHandleData`"
103+
- "`NULL == ppMem`"
104104
- $X_RESULT_ERROR_INVALID_VALUE:
105105
- "ipcMemHandleDataSize is not the same as the size of IPC memory handle data"
106106
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
@@ -121,9 +121,9 @@ params:
121121
returns:
122122
- $X_RESULT_ERROR_INVALID_CONTEXT
123123
- $X_RESULT_ERROR_INVALID_NULL_HANDLE:
124-
- "NULL == hContext"
124+
- "`NULL == hContext`"
125125
- $X_RESULT_ERROR_INVALID_NULL_POINTER:
126-
- "NULL == pMem"
126+
- "`NULL == pMem`"
127127
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
128128
- $X_RESULT_ERROR_OUT_OF_RESOURCES
129129
--- #--------------------------------------------------------------------------
@@ -148,7 +148,7 @@ params:
148148
returns:
149149
- $X_RESULT_ERROR_INVALID_CONTEXT
150150
- $X_RESULT_ERROR_INVALID_NULL_HANDLE:
151-
- "NULL == hContext"
152-
- "NULL == hIPCMem"
151+
- "`NULL == hContext`"
152+
- "`NULL == hIPCMem`"
153153
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
154154
- $X_RESULT_ERROR_OUT_OF_RESOURCES

unified-runtime/source/adapters/cuda/memory.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,9 @@ urIPCPutMemHandleExp(ur_context_handle_t, ur_exp_ipc_mem_handle_t hIPCMem) {
621621
UR_APIEXPORT ur_result_t UR_APICALL urIPCOpenMemHandleExp(
622622
ur_context_handle_t hContext, ur_device_handle_t hDevice,
623623
void *pIPCMemHandleData, size_t ipcMemHandleDataSize, void **ppMem) {
624+
if (nullptr == pIPCMemHandleData)
625+
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
626+
624627
umf_memory_pool_handle_t umfPool = hDevice->MemoryPoolDevice;
625628

626629
size_t umfHandleSize = 0;

unified-runtime/source/adapters/level_zero/memory.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,9 @@ ur_result_t urIPCOpenMemHandleExp(ur_context_handle_t hContext,
19831983
ur_device_handle_t hDevice,
19841984
void *pIPCMemHandleData,
19851985
size_t ipcMemHandleDataSize, void **ppMem) {
1986+
if (nullptr == pIPCMemHandleData)
1987+
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
1988+
19861989
auto *pool = hContext->DefaultPool.getPool(usm::pool_descriptor{
19871990
&hContext->DefaultPool, hContext, hDevice, UR_USM_TYPE_DEVICE, false});
19881991
if (!pool)

unified-runtime/source/adapters/level_zero/v2/memory.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,9 @@ ur_result_t urIPCOpenMemHandleExp(ur_context_handle_t hContext,
806806
ur_device_handle_t hDevice,
807807
void *pIPCMemHandleData,
808808
size_t ipcMemHandleDataSize, void **ppMem) {
809+
if (nullptr == pIPCMemHandleData)
810+
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
811+
809812
auto *pool = hContext->getDefaultUSMPool()->getPool(
810813
usm::pool_descriptor{hContext->getDefaultUSMPool(), hContext, hDevice,
811814
UR_USM_TYPE_DEVICE, false});

unified-runtime/source/loader/layers/validation/ur_valddi.cpp

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)