Files
compute-runtime/level_zero/api/driver_experimental/public/zex_memory.cpp
Jaime Arteaga 3f26f45c10 Add support for IPC handles with implicit scaling
When using implicit scaling, device allocations may have
more than one internal allocation created internally. In that case,
a separate dma-buf handle per internal allocation needs to be
exported.

So introduced two driver experimental extensions to export and
import more than one IPC handle:

- zexMemGetIpcHandles
- zexMemOpenIpcHandles

Related-To: LOCI-2919

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2022-05-09 00:38:17 +02:00

29 lines
846 B
C++

/*
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/api/driver_experimental/public/zex_api.h"
#include "level_zero/core/source/context/context.h"
ZE_APIEXPORT ze_result_t ZE_APICALL
zexMemGetIpcHandles(
ze_context_handle_t hContext,
const void *ptr,
uint32_t *numIpcHandles,
ze_ipc_mem_handle_t *pIpcHandles) {
return L0::Context::fromHandle(hContext)->getIpcMemHandles(ptr, numIpcHandles, pIpcHandles);
}
ZE_APIEXPORT ze_result_t ZE_APICALL
zexMemOpenIpcHandles(
ze_context_handle_t hContext,
ze_device_handle_t hDevice,
uint32_t numIpcHandles,
ze_ipc_mem_handle_t *pIpcHandles,
ze_ipc_memory_flags_t flags,
void **pptr) {
return L0::Context::fromHandle(hContext)->openIpcMemHandles(hDevice, numIpcHandles, pIpcHandles, flags, pptr);
}