Skip to content

Commit 9059799

Browse files
Do not copy ze_ipc_event_pool_handle_t in internal functions of NEO
The size of this type is at least 64 bytes due to ZE_MAX_IPC_HANDLE_SIZE. This change introduces usage of const reference instead of copying. Signed-off-by: Patryk Wrobel <[email protected]>
1 parent 5e36b1f commit 9059799

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

level_zero/core/source/context/context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ struct Context : _ze_context_handle_t {
144144
size_t size,
145145
ze_memory_access_attribute_t *access,
146146
size_t *outSize) = 0;
147-
virtual ze_result_t openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
147+
virtual ze_result_t openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t &hIpc,
148148
ze_event_pool_handle_t *phEventPool) = 0;
149149
virtual ze_result_t createEventPool(const ze_event_pool_desc_t *desc,
150150
uint32_t numDevices,

level_zero/core/source/context/context_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ ze_result_t EventPoolImp::getIpcHandle(ze_ipc_event_pool_handle_t *pIpcHandle) {
556556
return ZE_RESULT_SUCCESS;
557557
}
558558

559-
ze_result_t ContextImp::openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
559+
ze_result_t ContextImp::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t &hIpc,
560560
ze_event_pool_handle_t *phEventPool) {
561561
uint64_t handle = 0u;
562562
memcpy_s(&handle, sizeof(int), hIpc.data, sizeof(int));

level_zero/core/source/context/context_imp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct ContextImp : Context {
126126
size_t size,
127127
ze_memory_access_attribute_t *access,
128128
size_t *outSize) override;
129-
ze_result_t openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc,
129+
ze_result_t openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t &hIpc,
130130
ze_event_pool_handle_t *phEventPool) override;
131131
ze_result_t createEventPool(const ze_event_pool_desc_t *desc,
132132
uint32_t numDevices,

level_zero/core/test/unit_tests/mocks/mock_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct Mock<Context> : public Context {
5656
ADDMETHOD_NOBASE(unMapVirtualMem, ze_result_t, ZE_RESULT_SUCCESS, (const void *ptr, size_t size));
5757
ADDMETHOD_NOBASE(setVirtualMemAccessAttribute, ze_result_t, ZE_RESULT_SUCCESS, (const void *ptr, size_t size, ze_memory_access_attribute_t access));
5858
ADDMETHOD_NOBASE(getVirtualMemAccessAttribute, ze_result_t, ZE_RESULT_SUCCESS, (const void *ptr, size_t size, ze_memory_access_attribute_t *access, size_t *outSize));
59-
ADDMETHOD_NOBASE(openEventPoolIpcHandle, ze_result_t, ZE_RESULT_SUCCESS, (ze_ipc_event_pool_handle_t hIpc, ze_event_pool_handle_t *phEventPool));
59+
ADDMETHOD_NOBASE(openEventPoolIpcHandle, ze_result_t, ZE_RESULT_SUCCESS, (const ze_ipc_event_pool_handle_t &hIpc, ze_event_pool_handle_t *phEventPool));
6060
ADDMETHOD_NOBASE(createEventPool, ze_result_t, ZE_RESULT_SUCCESS, (const ze_event_pool_desc_t *desc, uint32_t numDevices, ze_device_handle_t *phDevices, ze_event_pool_handle_t *phEventPool));
6161
ADDMETHOD_NOBASE(createImage, ze_result_t, ZE_RESULT_SUCCESS, (ze_device_handle_t hDevice, const ze_image_desc_t *desc, ze_image_handle_t *phImage));
6262
};

0 commit comments

Comments
 (0)