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"

View File

@@ -24,7 +24,7 @@ namespace L0::ult {
struct AUBVariableRegisterPerThreadL0 : Test<AUBFixtureL0> {
std::vector<uint32_t> getGrfSizes(ze_device_handle_t device) {
ze_device_module_properties_t deviceModuleProperties{};
zex_device_module_register_file_exp_t deviceModuleRegisterFile{};
zex_device_module_register_file_exp_t deviceModuleRegisterFile{ZEX_STRUCTURE_DEVICE_MODULE_REGISTER_FILE_EXP};
deviceModuleProperties.pNext = &deviceModuleRegisterFile;
EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGetModuleProperties(device, &deviceModuleProperties));

View File

@@ -1268,9 +1268,9 @@ struct HostImportApiFixture : public HostPointerManagerFixure {
using DriverExperimentalApiTest = Test<HostImportApiFixture>;
TEST_F(DriverExperimentalApiTest, whenRetrievingApiFunctionThenExpectProperPointer) {
decltype(&zexDriverImportExternalPointer) expectedImport = L0::zexDriverImportExternalPointer;
decltype(&zexDriverReleaseImportedPointer) expectedRelease = L0::zexDriverReleaseImportedPointer;
decltype(&zexDriverGetHostPointerBaseAddress) expectedGet = L0::zexDriverGetHostPointerBaseAddress;
decltype(&zexDriverImportExternalPointer) expectedImport = zexDriverImportExternalPointer;
decltype(&zexDriverReleaseImportedPointer) expectedRelease = zexDriverReleaseImportedPointer;
decltype(&zexDriverGetHostPointerBaseAddress) expectedGet = zexDriverGetHostPointerBaseAddress;
decltype(&zeDriverGetDefaultContext) expectedZeDriverGetDefaultContext = zeDriverGetDefaultContext;
decltype(&zerGetDefaultContext) expectedZerGetDefaultContext = zerGetDefaultContext;
decltype(&zerGetLastErrorDescription) expectedZerGetLastErrorDescription = zerGetLastErrorDescription;
@@ -1282,17 +1282,17 @@ TEST_F(DriverExperimentalApiTest, whenRetrievingApiFunctionThenExpectProperPoint
decltype(&zeCommandListAppendLaunchKernelWithArguments) expectedZeCommandListAppendLaunchKernelWithArguments = zeCommandListAppendLaunchKernelWithArguments;
decltype(&zeCommandListAppendLaunchKernelWithParameters) expectedZeCommandListAppendLaunchKernelWithParameters = zeCommandListAppendLaunchKernelWithParameters;
decltype(&zexKernelGetBaseAddress) expectedKernelGetBaseAddress = L0::zexKernelGetBaseAddress;
decltype(&zexKernelGetBaseAddress) expectedKernelGetBaseAddress = zexKernelGetBaseAddress;
decltype(&zeIntelGetDriverVersionString) expectedIntelGetDriverVersionString = zeIntelGetDriverVersionString;
decltype(&zeIntelMediaCommunicationCreate) expectedIntelMediaCommunicationCreate = L0::zeIntelMediaCommunicationCreate;
decltype(&zeIntelMediaCommunicationDestroy) expectedIntelMediaCommunicationDestroy = L0::zeIntelMediaCommunicationDestroy;
decltype(&zexIntelAllocateNetworkInterrupt) expectedIntelAllocateNetworkInterrupt = L0::zexIntelAllocateNetworkInterrupt;
decltype(&zexIntelReleaseNetworkInterrupt) expectedIntelReleaseNetworkInterrupt = L0::zexIntelReleaseNetworkInterrupt;
decltype(&zeIntelMediaCommunicationCreate) expectedIntelMediaCommunicationCreate = zeIntelMediaCommunicationCreate;
decltype(&zeIntelMediaCommunicationDestroy) expectedIntelMediaCommunicationDestroy = zeIntelMediaCommunicationDestroy;
decltype(&zexIntelAllocateNetworkInterrupt) expectedIntelAllocateNetworkInterrupt = zexIntelAllocateNetworkInterrupt;
decltype(&zexIntelReleaseNetworkInterrupt) expectedIntelReleaseNetworkInterrupt = zexIntelReleaseNetworkInterrupt;
decltype(&zexCounterBasedEventCreate2) expectedCounterBasedEventCreate2 = L0::zexCounterBasedEventCreate2;
decltype(&zexCounterBasedEventGetIpcHandle) expectedCounterBasedEventGetIpcHandle = L0::zexCounterBasedEventGetIpcHandle;
decltype(&zexCounterBasedEventOpenIpcHandle) expectedCounterBasedEventOpenIpcHandle = L0::zexCounterBasedEventOpenIpcHandle;
decltype(&zexCounterBasedEventCloseIpcHandle) expectedCounterBasedEventCloseIpcHandle = L0::zexCounterBasedEventCloseIpcHandle;
decltype(&zexCounterBasedEventCreate2) expectedCounterBasedEventCreate2 = zexCounterBasedEventCreate2;
decltype(&zexCounterBasedEventGetIpcHandle) expectedCounterBasedEventGetIpcHandle = zexCounterBasedEventGetIpcHandle;
decltype(&zexCounterBasedEventOpenIpcHandle) expectedCounterBasedEventOpenIpcHandle = zexCounterBasedEventOpenIpcHandle;
decltype(&zexCounterBasedEventCloseIpcHandle) expectedCounterBasedEventCloseIpcHandle = zexCounterBasedEventCloseIpcHandle;
void *funPtr = nullptr;

View File

@@ -55,7 +55,7 @@ namespace ult {
using ModuleTest = Test<ModuleFixture>;
TEST_F(ModuleTest, GivenGeneralRegisterFileDescriptorWhenGetKernelPropertiesIsCalledThenDescriptorIsCorrectlySet) {
zex_device_module_register_file_exp_t descriptor{};
zex_device_module_register_file_exp_t descriptor{ZEX_STRUCTURE_DEVICE_MODULE_REGISTER_FILE_EXP};
ze_device_module_properties_t properties{};
properties.pNext = &descriptor;
@@ -96,14 +96,14 @@ TEST_F(ModuleTest, GivenGeneralRegisterFileDescriptorWhenGetKernelPropertiesIsCa
EXPECT_EQ(expectedRegisterFileSizesCount, descriptor.registerFileSizesCount);
EXPECT_EQ(expectedRegisterFileSizes, queriedRegisterFileSizes);
descriptor = {};
descriptor = {ZEX_STRUCTURE_DEVICE_MODULE_REGISTER_FILE_EXP};
}
}
TEST_F(ModuleTest, GivenKernelRegisterFileDescriptorWhenGetPropertiesIsCalledThenDescriptorIsCorrectlySet) {
createKernel();
zex_kernel_register_file_size_exp_t descriptor{};
zex_kernel_register_file_size_exp_t descriptor{ZEX_STRUCTURE_KERNEL_REGISTER_FILE_SIZE_EXP};
ze_kernel_properties_t properties{};
properties.pNext = &descriptor;

View File

@@ -19,6 +19,7 @@
// driver experimental API headers
#include "zex_cmdlist.h"
#include "zex_context.h"
#include "zex_driver.h"
#include "zex_event.h"
#include "zex_graph.h"

View File

@@ -1,16 +1,23 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#ifndef _ZEX_CMDLIST_H
#define _ZEX_CMDLIST_H
#if defined(__cplusplus)
#pragma once
#endif
#include <level_zero/ze_api.h>
#include "zex_common.h"
namespace L0 {
#if defined(__cplusplus)
extern "C" {
#endif
ZE_APIEXPORT ze_result_t ZE_APICALL
zexCommandListAppendWaitOnMemory(
@@ -34,4 +41,9 @@ zexCommandListAppendWriteToMemory(
zex_write_to_mem_desc_t *desc,
void *ptr,
uint64_t data);
} // namespace L0
#if defined(__cplusplus)
} // extern "C"
#endif
#endif // _ZEX_CMDLIST_H

View File

@@ -1,18 +1,29 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#ifndef _ZEX_CONTEXT_H
#define _ZEX_CONTEXT_H
#if defined(__cplusplus)
#pragma once
#endif
#include <level_zero/ze_api.h>
#include "zex_common.h"
namespace L0 {
#if defined(__cplusplus)
extern "C" {
#endif
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_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);
} // namespace L0
#if defined(__cplusplus)
} // extern "C"
#endif
#endif // _ZEX_CONTEXT_H

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,34 +7,39 @@
#ifndef _ZEX_DRIVER_H
#define _ZEX_DRIVER_H
#if defined(__cplusplus)
#pragma once
#endif
#include "zex_api.h"
#include <level_zero/ze_api.h>
namespace L0 {
#if defined(__cplusplus)
extern "C" {
#endif
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zexDriverImportExternalPointer(
ze_driver_handle_t hDriver, ///< [in] handle of the driver
void *ptr, ///< [in] pointer to be imported to the driver
size_t size ///< [in] size to be imported
);
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zexDriverReleaseImportedPointer(
ze_driver_handle_t hDriver, ///< [in] handle of the driver
void *ptr ///< [in] pointer to be released from the driver
);
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zexDriverGetHostPointerBaseAddress(
ze_driver_handle_t hDriver, ///< [in] handle of the driver
void *ptr, ///< [in] pointer to be checked if imported to the driver
void **baseAddress ///< [out] if not null, returns address of the base pointer of the imported pointer
);
} // namespace L0
#if defined(__cplusplus)
} // extern "C"
#endif
#endif // _ZEX_DRIVER_H

View File

@@ -1,16 +1,23 @@
/*
* Copyright (C) 2023-2024 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#ifndef _ZEX_EVENT_H
#define _ZEX_EVENT_H
#if defined(__cplusplus)
#pragma once
#endif
#include <level_zero/ze_api.h>
#include "zex_common.h"
namespace L0 {
#if defined(__cplusplus)
extern "C" {
#endif
ZE_APIEXPORT ze_result_t ZE_APICALL
zexEventGetDeviceAddress(
@@ -41,4 +48,8 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventOpenIpcHandle(ze_context
ZE_APIEXPORT ze_result_t ZE_APICALL zexCounterBasedEventCloseIpcHandle(ze_event_handle_t hEvent);
} // namespace L0
#if defined(__cplusplus)
} // extern "C"
#endif
#endif // _ZEX_EVENT_H

View File

@@ -5,7 +5,12 @@
*
*/
#ifndef _ZEX_GRAPH_H
#define _ZEX_GRAPH_H
#if defined(__cplusplus)
#pragma once
#endif
#include <level_zero/ze_api.h>
#include "zex_common.h"
@@ -54,3 +59,4 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeGraphDumpContentsExp(ze_graph_handle_t hGr
#endif
#endif // ZE_RECORD_REPLAY_GRAPH_EXP_NAME
#endif // _ZEX_GRAPH_H

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,7 +11,7 @@
#pragma once
#endif
#include "zex_api.h"
#include <level_zero/ze_api.h>
///////////////////////////////////////////////////////////////////////////////
// It indicates that the application wants the L0 driver implementation to use
@@ -34,7 +34,10 @@ typedef enum _zex_mem_ipc_handles_version_t {
} zex_mem_ipc_handles_version_t;
namespace L0 {
#if defined(__cplusplus)
extern "C" {
#endif
///////////////////////////////////////////////////////////////////////////////
/// @brief Returns an array IPC memory handles for the specified allocation
///
@@ -48,7 +51,7 @@ namespace L0 {
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + `ptr` not known
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zexMemGetIpcHandles(
ze_context_handle_t hContext, ///< [in] handle of the context object
const void *ptr, ///< [in] pointer to the device memory allocation
@@ -74,7 +77,7 @@ zexMemGetIpcHandles(
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT
/// + handles not known
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zexMemOpenIpcHandles(
ze_context_handle_t hContext, ///< [in] handle of the context object
ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle
@@ -85,6 +88,8 @@ zexMemOpenIpcHandles(
void **pptr ///< [out] pointer to device allocation in this process
);
} // namespace L0
#if defined(__cplusplus)
} // extern "C"
#endif
#endif // _ZEX_MEMORY_H

View File

@@ -11,45 +11,51 @@
#pragma once
#endif
#include "zex_api.h"
namespace L0 {
ze_result_t ZE_APICALL
#include <level_zero/ze_api.h>
#if defined(__cplusplus)
extern "C" {
#endif
ZE_APIEXPORT ze_result_t ZE_APICALL
zexKernelGetBaseAddress(
ze_kernel_handle_t hKernel,
uint64_t *baseAddress);
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zexKernelGetArgumentSize(
ze_kernel_handle_t hKernel,
uint32_t argIndex,
uint32_t *pArgSize);
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zexKernelGetArgumentType(
ze_kernel_handle_t hKernel,
uint32_t argIndex,
uint32_t *pSize,
char *pString);
} // namespace L0
#if defined(__cplusplus)
} // extern "C"
#endif
///////////////////////////////////////////////////////////////////////////////
/// @brief General Register File descriptor.
/// Must be passed to zeDeviceGetModuleProperties via pNext member of ze_device_module_properties_t.
typedef struct _zex_device_module_register_file_exp_t {
ze_structure_type_ext_t stype = ZEX_STRUCTURE_DEVICE_MODULE_REGISTER_FILE_EXP; ///< [in] type of this structure
const void *pNext = nullptr; ///< [in, out][optional] pointer to extension-specific structure
uint32_t registerFileSizesCount; ///< [out] Size of array of supported GRF sizes
uint32_t *registerFileSizes = nullptr; ///< [in, out][optional] Array of supported GRF sizes
ze_structure_type_ext_t stype; ///< [in] type of this structure
const void *pNext; ///< [in, out][optional] pointer to extension-specific structure
uint32_t registerFileSizesCount; ///< [out] Size of array of supported GRF sizes
uint32_t *registerFileSizes; ///< [in, out][optional] Array of supported GRF sizes
} zex_device_module_register_file_exp_t;
///////////////////////////////////////////////////////////////////////////////
/// @brief Kernel register file size information
/// Must be passed to zeKernelGetProperties via pNext member of ze_kernel_properties_t
typedef struct _zex_kernel_register_file_size_exp_t {
ze_structure_type_ext_t stype = ZEX_STRUCTURE_KERNEL_REGISTER_FILE_SIZE_EXP; ///< [in] type of this structure
const void *pNext = nullptr; ///< [in, out][optional] pointer to extension-specific structure
uint32_t registerFileSize; ///< [out] Register file size used in kernel
ze_structure_type_ext_t stype; ///< [in] type of this structure
const void *pNext; ///< [in, out][optional] pointer to extension-specific structure
uint32_t registerFileSize; ///< [out] Register file size used in kernel
} zex_kernel_register_file_size_exp_t;
#endif // _ZEX_MODULE_H

View File

@@ -224,10 +224,10 @@ typedef enum _ze_intel_device_block_array_exp_flag_t {
/// @brief Device 2D block array properties
typedef struct _ze_intel_device_block_array_exp_properties_t {
ze_structure_type_ext_t stype = ZE_INTEL_DEVICE_BLOCK_ARRAY_EXP_PROPERTIES; ///< [in] type of this structure
void *pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
///< structure (i.e. contains sType and pNext).
ze_intel_device_block_array_exp_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_intel_device_block_array_exp_flag_t
ze_structure_type_ext_t stype; ///< [in] type of this structure
void *pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific
///< structure (i.e. contains sType and pNext).
ze_intel_device_block_array_exp_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_intel_device_block_array_exp_flag_t
} ze_intel_device_block_array_exp_properties_t;
///////////////////////////////////////////////////////////////////////////////
@@ -248,7 +248,7 @@ typedef enum _ze_intel_device_block_array_exp_properties_version_t {
/// - Major.Minor.Patch+Optional per semver guidelines https://semver.org/#spec-item-10
/// @returns
/// - ::ZE_RESULT_SUCCESS
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zeIntelGetDriverVersionString(
ze_driver_handle_t hDriver, ///< [in] Driver handle whose version is being read.
char *pDriverVersion, ///< [in,out] pointer to driver version string.
@@ -279,7 +279,7 @@ typedef enum _ze_intel_kernel_get_binary_exp_version_t {
} ze_intel_kernel_get_binary_exp_version_t;
ze_result_t ZE_APICALL
ZE_APIEXPORT ze_result_t ZE_APICALL
zeIntelKernelGetBinaryExp(
ze_kernel_handle_t hKernel, ///< [in] Kernel handle
size_t *pSize, ///< [in, out] pointer to variable with size of GEN ISA binary