refactor: correct driver extension header files

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2025-09-11 15:05:47 +00:00
committed by Compute-Runtime-Automation
parent e80b84e699
commit 53fc4c1958
19 changed files with 262 additions and 82 deletions

View File

@@ -11,7 +11,8 @@
#include "level_zero/ze_intel_gpu.h"
namespace L0 {
ZE_APIEXPORT ze_result_t ZE_APICALL
ze_result_t ZE_APICALL
zexCommandListAppendWaitOnMemory(
zex_command_list_handle_t hCommandList,
zex_wait_on_mem_desc_t *desc,
@@ -34,7 +35,7 @@ zexCommandListAppendWaitOnMemory(
}
}
ZE_APIEXPORT ze_result_t ZE_APICALL
ze_result_t ZE_APICALL
zexCommandListAppendWaitOnMemory64(
zex_command_list_handle_t hCommandList,
zex_wait_on_mem_desc_t *desc,
@@ -50,7 +51,7 @@ zexCommandListAppendWaitOnMemory64(
return L0::CommandList::fromHandle(hCommandList)->appendWaitOnMemory(reinterpret_cast<void *>(desc), ptr, data, static_cast<ze_event_handle_t>(hSignalEvent), true);
}
ZE_APIEXPORT ze_result_t ZE_APICALL
ze_result_t ZE_APICALL
zexCommandListAppendWriteToMemory(
zex_command_list_handle_t hCommandList,
zex_write_to_mem_desc_t *desc,
@@ -71,4 +72,37 @@ zexCommandListAppendWriteToMemory(
return ZE_RESULT_ERROR_UNKNOWN;
}
}
} // namespace L0
} // namespace L0
extern "C" {
ZE_APIEXPORT ze_result_t ZE_APICALL
zexCommandListAppendWaitOnMemory(
zex_command_list_handle_t hCommandList,
zex_wait_on_mem_desc_t *desc,
void *ptr,
uint32_t data,
zex_event_handle_t hSignalEvent) {
return L0::zexCommandListAppendWaitOnMemory(hCommandList, desc, ptr, data, hSignalEvent);
}
ZE_APIEXPORT ze_result_t ZE_APICALL
zexCommandListAppendWaitOnMemory64(
zex_command_list_handle_t hCommandList,
zex_wait_on_mem_desc_t *desc,
void *ptr,
uint64_t data,
zex_event_handle_t hSignalEvent) {
return L0::zexCommandListAppendWaitOnMemory64(hCommandList, desc, ptr, data, hSignalEvent);
}
ZE_APIEXPORT ze_result_t ZE_APICALL
zexCommandListAppendWriteToMemory(
zex_command_list_handle_t hCommandList,
zex_write_to_mem_desc_t *desc,
void *ptr,
uint64_t data) {
return L0::zexCommandListAppendWriteToMemory(hCommandList, desc, ptr, data);
}
} // extern "C"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -12,7 +12,7 @@
#include "level_zero/core/source/device/device.h"
namespace L0 {
ZE_APIEXPORT ze_result_t ZE_APICALL zeIntelMediaCommunicationCreate(ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_intel_media_communication_desc_t *desc, ze_intel_media_doorbell_handle_desc_t *phDoorbell) {
ze_result_t ZE_APICALL zeIntelMediaCommunicationCreate(ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_intel_media_communication_desc_t *desc, ze_intel_media_doorbell_handle_desc_t *phDoorbell) {
auto device = Device::fromHandle(toInternalType(hDevice));
if (!device || !desc || !phDoorbell) {
@@ -27,7 +27,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeIntelMediaCommunicationCreate(ze_context_h
return ZE_RESULT_ERROR_UNKNOWN;
}
ZE_APIEXPORT ze_result_t ZE_APICALL zeIntelMediaCommunicationDestroy(ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_intel_media_doorbell_handle_desc_t *phDoorbell) {
ze_result_t ZE_APICALL zeIntelMediaCommunicationDestroy(ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_intel_media_doorbell_handle_desc_t *phDoorbell) {
auto device = Device::fromHandle(toInternalType(hDevice));
if (!device || !phDoorbell) {
@@ -42,3 +42,13 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeIntelMediaCommunicationDestroy(ze_context_
}
} // namespace L0
extern "C" {
ZE_APIEXPORT ze_result_t ZE_APICALL zeIntelMediaCommunicationCreate(ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_intel_media_communication_desc_t *desc, ze_intel_media_doorbell_handle_desc_t *phDoorbell) {
return L0::zeIntelMediaCommunicationCreate(hContext, hDevice, desc, phDoorbell);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zeIntelMediaCommunicationDestroy(ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_intel_media_doorbell_handle_desc_t *phDoorbell) {
return L0::zeIntelMediaCommunicationDestroy(hContext, hDevice, phDoorbell);
}
} // extern "C"

View File

@@ -41,8 +41,6 @@ zexDriverGetHostPointerBaseAddress(
return L0::DriverHandle::fromHandle(toInternalType(hDriver))->getHostPointerBaseAddress(ptr, baseAddress);
}
} // namespace L0
ze_result_t ZE_APICALL
zeIntelGetDriverVersionString(
ze_driver_handle_t hDriver,
@@ -63,8 +61,18 @@ zeIntelGetDriverVersionString(
return ZE_RESULT_SUCCESS;
}
} // namespace L0
extern "C" {
ZE_APIEXPORT ze_result_t ZE_APICALL
zeIntelGetDriverVersionString(
ze_driver_handle_t hDriver,
char *pDriverVersion,
size_t *pVersionSize) {
return L0::zeIntelGetDriverVersionString(hDriver, pDriverVersion, pVersionSize);
}
ZE_APIEXPORT ze_result_t ZE_APICALL
zexDriverImportExternalPointer(
ze_driver_handle_t hDriver,
@@ -87,4 +95,4 @@ zexDriverGetHostPointerBaseAddress(
void **baseAddress) {
return L0::zexDriverGetHostPointerBaseAddress(hDriver, ptr, baseAddress);
}
}
} // extern "C"

View File

@@ -20,7 +20,7 @@
namespace L0 {
ZE_APIEXPORT ze_result_t ZE_APICALL
ze_result_t ZE_APICALL
zexEventGetDeviceAddress(ze_event_handle_t event, uint64_t *completionValue, uint64_t *address) {
auto eventObj = Event::fromHandle(toInternalType(event));
@@ -44,7 +44,7 @@ zexEventGetDeviceAddress(ze_event_handle_t event, uint64_t *completionValue, uin
return ZE_RESULT_SUCCESS;
}
ZE_APIEXPORT ze_result_t ZE_APICALL
ze_result_t ZE_APICALL
zexCounterBasedEventCreate2(ze_context_handle_t hContext, ze_device_handle_t hDevice, const zex_counter_based_event_desc_t *desc, ze_event_handle_t *phEvent) {
constexpr uint32_t supportedBasedFlags = (ZEX_COUNTER_BASED_EVENT_FLAG_IMMEDIATE | ZEX_COUNTER_BASED_EVENT_FLAG_NON_IMMEDIATE);
@@ -105,7 +105,7 @@ zexCounterBasedEventCreate2(ze_context_handle_t hContext, ze_device_handle_t hDe
return result;
}
ZE_APIEXPORT ze_result_t ZE_APICALL
ze_result_t ZE_APICALL
zexCounterBasedEventCreate(ze_context_handle_t hContext, ze_device_handle_t hDevice, uint64_t *deviceAddress, uint64_t *hostAddress, uint64_t completionValue, const ze_event_desc_t *desc, ze_event_handle_t *phEvent) {
constexpr uint32_t counterBasedFlags = ZEX_COUNTER_BASED_EVENT_FLAG_IMMEDIATE | ZEX_COUNTER_BASED_EVENT_FLAG_NON_IMMEDIATE;
@@ -129,10 +129,10 @@ zexCounterBasedEventCreate(ze_context_handle_t hContext, ze_device_handle_t hDev
counterBasedDesc.pNext = &externalSyncAllocProperties;
}
return zexCounterBasedEventCreate2(hContext, hDevice, &counterBasedDesc, phEvent);
return L0::zexCounterBasedEventCreate2(hContext, hDevice, &counterBasedDesc, phEvent);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexIntelAllocateNetworkInterrupt(ze_context_handle_t hContext, uint32_t &networkInterruptId) {
ze_result_t ZE_APICALL zexIntelAllocateNetworkInterrupt(ze_context_handle_t hContext, uint32_t &networkInterruptId) {
auto context = static_cast<ContextImp *>(L0::Context::fromHandle(toInternalType(hContext)));
if (!context) {
@@ -146,7 +146,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zexIntelAllocateNetworkInterrupt(ze_context_
return ZE_RESULT_SUCCESS;
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexIntelReleaseNetworkInterrupt(ze_context_handle_t hContext, uint32_t networkInterruptId) {
ze_result_t ZE_APICALL zexIntelReleaseNetworkInterrupt(ze_context_handle_t hContext, uint32_t networkInterruptId) {
auto context = static_cast<ContextImp *>(L0::Context::fromHandle(toInternalType(hContext)));
if (!context || !context->getDriverHandle()->getMemoryManager()->releaseInterrupt(networkInterruptId, context->rootDeviceIndices[0])) {
@@ -156,7 +156,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zexIntelReleaseNetworkInterrupt(ze_context_h
return ZE_RESULT_SUCCESS;
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventGetIpcHandle(ze_event_handle_t hEvent, zex_ipc_counter_based_event_handle_t *phIpc) {
ze_result_t ZE_APICALL zexCounterBasedEventGetIpcHandle(ze_event_handle_t hEvent, zex_ipc_counter_based_event_handle_t *phIpc) {
auto event = Event::fromHandle(hEvent);
if (!event || !phIpc || !event->isCounterBasedExplicitlyEnabled()) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
@@ -167,7 +167,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventGetIpcHandle(ze_event_ha
return event->getCounterBasedIpcHandle(*ipcData);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventOpenIpcHandle(ze_context_handle_t hContext, zex_ipc_counter_based_event_handle_t hIpc, ze_event_handle_t *phEvent) {
ze_result_t ZE_APICALL zexCounterBasedEventOpenIpcHandle(ze_context_handle_t hContext, zex_ipc_counter_based_event_handle_t hIpc, ze_event_handle_t *phEvent) {
auto context = static_cast<ContextImp *>(L0::Context::fromHandle(hContext));
if (!context || !phEvent) {
@@ -179,8 +179,57 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventOpenIpcHandle(ze_context
return context->openCounterBasedIpcHandle(*ipcData, phEvent);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventCloseIpcHandle(ze_event_handle_t hEvent) {
ze_result_t ZE_APICALL zexCounterBasedEventCloseIpcHandle(ze_event_handle_t hEvent) {
return Event::fromHandle(hEvent)->destroy();
}
} // namespace L0
extern "C" {
ZE_APIEXPORT ze_result_t ZE_APICALL
zexEventGetDeviceAddress(
ze_event_handle_t event,
uint64_t *completionValue,
uint64_t *address) {
return L0::zexEventGetDeviceAddress(event, completionValue, address);
}
// deprecated
ZE_APIEXPORT ze_result_t ZE_APICALL
zexCounterBasedEventCreate(
ze_context_handle_t hContext,
ze_device_handle_t hDevice,
uint64_t *deviceAddress,
uint64_t *hostAddress,
uint64_t completionValue,
const ze_event_desc_t *desc,
ze_event_handle_t *phEvent) {
return L0::zexCounterBasedEventCreate(hContext, hDevice, deviceAddress, hostAddress, completionValue, desc, phEvent);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexIntelAllocateNetworkInterrupt(ze_context_handle_t hContext, uint32_t &networkInterruptId) {
return L0::zexIntelAllocateNetworkInterrupt(hContext, networkInterruptId);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexIntelReleaseNetworkInterrupt(ze_context_handle_t hContext, uint32_t networkInterruptId) {
return L0::zexIntelReleaseNetworkInterrupt(hContext, networkInterruptId);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventCreate2(ze_context_handle_t hContext, ze_device_handle_t hDevice, const zex_counter_based_event_desc_t *desc, ze_event_handle_t *phEvent) {
return L0::zexCounterBasedEventCreate2(hContext, hDevice, desc, phEvent);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventGetIpcHandle(ze_event_handle_t hEvent, zex_ipc_counter_based_event_handle_t *phIpc) {
return L0::zexCounterBasedEventGetIpcHandle(hEvent, phIpc);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventOpenIpcHandle(ze_context_handle_t hContext, zex_ipc_counter_based_event_handle_t hIpc, ze_event_handle_t *phEvent) {
return L0::zexCounterBasedEventOpenIpcHandle(hContext, hIpc, phEvent);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventCloseIpcHandle(ze_event_handle_t hEvent) {
return L0::zexCounterBasedEventCloseIpcHandle(hEvent);
}
} // extern "C"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -54,4 +54,4 @@ zexMemOpenIpcHandles(
void **pptr) {
return L0::zexMemOpenIpcHandles(hContext, hDevice, numIpcHandles, pIpcHandles, flags, pptr);
}
}
} // extern "C"

View File

@@ -36,16 +36,22 @@ zexKernelGetArgumentType(
return L0::Kernel::fromHandle(toInternalType(hKernel))->getArgumentType(argIndex, pSize, pString);
}
} // namespace L0
ze_result_t ZE_APICALL
zeIntelKernelGetBinaryExp(
ze_kernel_handle_t hKernel, size_t *pSize, char *pKernelBinary) {
return L0::Kernel::fromHandle(toInternalType(hKernel))->getKernelProgramBinary(pSize, pKernelBinary);
}
} // namespace L0
extern "C" {
ZE_APIEXPORT ze_result_t ZE_APICALL
zeIntelKernelGetBinaryExp(
ze_kernel_handle_t hKernel, size_t *pSize, char *pKernelBinary) {
return L0::zeIntelKernelGetBinaryExp(hKernel, pSize, pKernelBinary);
}
ZE_APIEXPORT ze_result_t ZE_APICALL
zexKernelGetBaseAddress(
ze_kernel_handle_t hKernel,
@@ -69,4 +75,4 @@ zexKernelGetArgumentType(
char *pString) {
return L0::zexKernelGetArgumentType(hKernel, argIndex, pSize, pString);
}
}
} // extern "C"

View File

@@ -573,4 +573,20 @@ zeMemGetAtomicAccessAttributeExp(
return L0::zeMemGetAtomicAccessAttributeExp(hContext, hDevice, ptr, size, pAttr);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetPitchFor2dImage(
ze_context_handle_t hContext,
ze_device_handle_t hDevice,
size_t imageWidth,
size_t imageHeight,
unsigned int elementSizeInBytes,
size_t *rowPitch) {
return L0::zeMemGetPitchFor2dImage(hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch);
}
ZE_APIEXPORT ze_result_t ZE_APICALL zeImageGetDeviceOffsetExp(
ze_image_handle_t hImage,
uint64_t *pDeviceOffset) {
return L0::zeImageGetDeviceOffsetExp(hImage, pDeviceOffset);
}
} // extern "C"