From 902fc2f6c45c4ae4a7dc7102ba8e4fb582f9849a Mon Sep 17 00:00:00 2001 From: Jaime Arteaga Date: Wed, 29 Jul 2020 02:45:54 -0700 Subject: [PATCH] level-zero v1.0 (2/N) Change-Id: I1419231a721fab210e166d26a264cae04d661dcd Signed-off-by: Jaime Arteaga Signed-off-by: macabral Signed-off-by: davidoli Signed-off-by: Aravind Gopalakrishnan Signed-off-by: Spruit, Neil R Signed-off-by: Latif, Raiyan Signed-off-by: Artur Harasimiuk --- level_zero/CMakeLists.txt | 7 +- level_zero/api/CMakeLists.txt | 2 + level_zero/api/core/CMakeLists.txt | 1 - level_zero/api/core/ze_barrier.cpp | 4 - level_zero/api/core/ze_cl_interop.cpp | 40 - level_zero/api/core/ze_cmdlist.cpp | 24 +- level_zero/api/core/ze_cmdqueue.cpp | 14 +- level_zero/api/core/ze_context.cpp | 6 - level_zero/api/core/ze_copy.cpp | 36 +- level_zero/api/core/ze_core_loader.cpp | 387 +- level_zero/api/core/ze_device.cpp | 9 +- level_zero/api/core/ze_driver.cpp | 8 +- level_zero/api/core/ze_event.cpp | 27 +- level_zero/api/core/ze_fence.cpp | 6 +- level_zero/api/core/ze_image.cpp | 7 +- level_zero/api/core/ze_memory.cpp | 103 +- level_zero/api/core/ze_module.cpp | 44 +- level_zero/api/core/ze_residency.cpp | 4 - level_zero/api/core/ze_sampler.cpp | 12 - .../api/experimental/tracing/zet_tracing.cpp | 32 +- level_zero/api/sysman/CMakeLists.txt | 11 + level_zero/api/sysman/ze_sysman_loader.cpp | 389 ++ level_zero/api/sysman/zes_sysman.cpp | 733 +++ level_zero/api/tools/CMakeLists.txt | 2 - level_zero/api/tools/ze_tools_loader.cpp | 418 +- level_zero/api/tools/zet_driver.cpp | 23 - level_zero/api/tools/zet_metric.cpp | 123 +- level_zero/api/tools/zet_module.cpp | 10 +- level_zero/api/tools/zet_sysman.cpp | 1405 ------ .../source/additional_kernel_properties.cpp | 2 +- .../builtin/builtin_functions_lib_impl.cpp | 4 +- level_zero/core/source/cmdlist/cmdlist.h | 4 - level_zero/core/source/cmdlist/cmdlist_hw.inl | 8 +- .../core/source/cmdlist/cmdlist_imp.cpp | 8 - level_zero/core/source/cmdlist/cmdlist_imp.h | 2 - level_zero/core/source/cmdqueue/cmdqueue.cpp | 6 +- level_zero/core/source/cmdqueue/cmdqueue.h | 5 +- .../core/source/cmdqueue/cmdqueue_hw.inl | 2 +- .../core/source/cmdqueue/cmdqueue_imp.h | 4 +- level_zero/core/source/context/context.h | 21 +- .../core/source/context/context_imp.cpp | 30 +- level_zero/core/source/context/context_imp.h | 17 +- level_zero/core/source/device/device.h | 8 +- level_zero/core/source/device/device_imp.cpp | 171 +- level_zero/core/source/device/device_imp.h | 8 +- level_zero/core/source/driver/driver.cpp | 4 +- level_zero/core/source/driver/driver.h | 4 +- level_zero/core/source/driver/driver_handle.h | 10 +- .../core/source/driver/driver_handle_imp.cpp | 4 +- .../core/source/driver/driver_handle_imp.h | 9 +- level_zero/core/source/driver/driver_imp.h | 2 +- level_zero/core/source/event/event.cpp | 49 +- level_zero/core/source/event/event.h | 9 +- level_zero/core/source/fence/fence.cpp | 6 +- level_zero/core/source/fence/fence.h | 6 +- level_zero/core/source/image/image.h | 2 +- .../source/image/image_format_desc_helper.cpp | 4 +- .../source/image/image_format_desc_helper.h | 4 +- level_zero/core/source/image/image_formats.h | 2 +- level_zero/core/source/kernel/kernel.h | 10 +- level_zero/core/source/kernel/kernel_imp.cpp | 90 +- level_zero/core/source/kernel/kernel_imp.h | 10 +- level_zero/core/source/memory/memory.cpp | 8 +- .../source/memory/memory_operations_helper.h | 2 +- level_zero/core/source/module/module_imp.cpp | 2 +- level_zero/core/source/sampler/sampler.h | 2 +- .../core/test/black_box_tests/zello_world.cpp | 141 +- .../unit_tests/fixtures/cmdlist_fixture.h | 16 +- .../test/unit_tests/fixtures/module_fixture.h | 6 +- .../gen12lp/test_device_gen12lp.cpp | 10 - .../test/unit_tests/gen9/test_device_gen9.cpp | 8 +- .../core/test/unit_tests/mocks/CMakeLists.txt | 2 +- .../core/test/unit_tests/mocks/mock_cmdlist.h | 4 - .../test/unit_tests/mocks/mock_cmdqueue.h | 4 +- .../core/test/unit_tests/mocks/mock_context.h | 36 +- .../core/test/unit_tests/mocks/mock_device.h | 10 +- .../core/test/unit_tests/mocks/mock_driver.h | 4 +- .../unit_tests/mocks/mock_driver_handle.cpp | 4 +- .../unit_tests/mocks/mock_driver_handle.h | 12 +- .../core/test/unit_tests/mocks/mock_event.h | 3 +- .../sources/cmdlist/test_cmdlist_1.cpp | 98 +- .../sources/cmdlist/test_cmdlist_2.cpp | 35 +- .../sources/cmdlist/test_cmdlist_api.cpp | 12 +- .../test_cmdlist_append_launch_kernel.cpp | 72 +- .../test_cmdlist_append_signal_event.cpp | 15 +- .../test_cmdlist_append_wait_on_events.cpp | 8 +- .../sources/cmdqueue/test_cmdqueue.cpp | 179 +- .../debugger/test_module_with_debug.cpp | 6 +- .../unit_tests/sources/device/test_device.cpp | 111 +- .../unit_tests/sources/event/test_event.cpp | 90 +- .../unit_tests/sources/image/test_image.cpp | 21 +- .../unit_tests/sources/kernel/test_kernel.cpp | 26 +- .../unit_tests/sources/memory/test_memory.cpp | 50 +- .../unit_tests/sources/module/test_module.cpp | 25 +- .../sources/sampler/test_sampler.cpp | 2 - level_zero/ddi/ze_ddi_tables.h | 4 + .../source/tracing/CMakeLists.txt | 64 +- .../experimental/source/tracing/tracing.h | 16 +- .../source/tracing/tracing_barrier_imp.cpp | 21 - .../source/tracing/tracing_barrier_imp.h | 5 +- .../source/tracing/tracing_cl_interop_imp.cpp | 107 - .../source/tracing/tracing_cl_interop_imp.h | 31 - .../source/tracing/tracing_cmdlist_imp.cpp | 17 +- .../source/tracing/tracing_cmdlist_imp.h | 11 +- .../source/tracing/tracing_cmdqueue_imp.cpp | 10 +- .../source/tracing/tracing_cmdqueue_imp.h | 2 - .../source/tracing/tracing_copy_imp.cpp | 174 +- .../source/tracing/tracing_copy_imp.h | 32 +- .../source/tracing/tracing_device_imp.cpp | 75 +- .../source/tracing/tracing_device_imp.h | 17 +- .../source/tracing/tracing_driver_imp.cpp | 46 +- .../source/tracing/tracing_driver_imp.h | 12 +- .../source/tracing/tracing_event_imp.cpp | 36 +- .../source/tracing/tracing_event_imp.h | 13 +- .../source/tracing/tracing_fence_imp.cpp | 2 +- .../source/tracing/tracing_fence_imp.h | 4 +- .../source/tracing/tracing_global_imp.cpp | 2 +- .../source/tracing/tracing_global_imp.h | 4 +- .../source/tracing/tracing_image_imp.cpp | 6 +- .../source/tracing/tracing_image_imp.h | 5 +- .../source/tracing/tracing_imp.cpp | 4 +- .../experimental/source/tracing/tracing_imp.h | 4 +- .../source/tracing/tracing_memory_imp.cpp | 223 +- .../source/tracing/tracing_memory_imp.h | 82 +- .../source/tracing/tracing_module_imp.cpp | 76 +- .../source/tracing/tracing_module_imp.h | 16 +- .../source/tracing/tracing_residency_imp.cpp | 128 +- .../source/tracing/tracing_residency_imp.h | 26 +- .../source/tracing/tracing_sampler_imp.cpp | 6 +- .../source/tracing/tracing_sampler_imp.h | 3 +- level_zero/source/inc/ze_intel_gpu.h | 2 +- level_zero/tools/source/metrics/metric.cpp | 17 +- level_zero/tools/source/metrics/metric.h | 33 +- .../source/metrics/metric_enumeration_imp.cpp | 59 +- .../source/metrics/metric_enumeration_imp.h | 18 +- .../tools/source/metrics/metric_query_imp.cpp | 24 +- .../tools/source/metrics/metric_query_imp.h | 6 +- .../source/metrics/metric_streamer_imp.cpp | 2 +- .../tools/source/sysman/engine/engine.cpp | 25 +- .../tools/source/sysman/engine/engine.h | 19 +- .../tools/source/sysman/engine/engine_imp.cpp | 29 - .../tools/source/sysman/engine/engine_imp.h | 8 +- .../sysman/engine/linux/os_engine_imp.cpp | 16 - .../sysman/engine/linux/os_engine_imp.h | 1 - .../tools/source/sysman/engine/os_engine.h | 5 +- .../sysman/engine/windows/os_engine_imp.cpp | 5 - .../source/sysman/fabric_port/fabric_port.cpp | 14 - .../source/sysman/fabric_port/fabric_port.h | 22 +- .../sysman/fabric_port/fabric_port_imp.cpp | 31 - .../sysman/fabric_port/fabric_port_imp.h | 11 +- .../fabric_port/linux/os_fabric_port_imp.cpp | 60 +- .../fabric_port/linux/os_fabric_port_imp.h | 16 - .../sysman/fabric_port/os_fabric_port.h | 14 +- .../sysman/fabric_port/windows/CMakeLists.txt | 12 +- .../windows/os_fabric_port_imp.cpp | 36 - .../fabric_port/windows/os_fabric_port_imp.h | 10 - .../source/sysman/frequency/frequency.cpp | 14 - .../tools/source/sysman/frequency/frequency.h | 20 +- .../source/sysman/frequency/frequency_imp.cpp | 117 - .../source/sysman/frequency/frequency_imp.h | 9 +- .../frequency/linux/os_frequency_imp.cpp | 2 +- .../source/sysman/frequency/os_frequency.h | 1 - .../global_operations/global_operations.h | 5 +- .../global_operations_imp.cpp | 23 +- .../global_operations/global_operations_imp.h | 4 +- .../linux/os_global_operations_imp.cpp | 32 +- .../linux/os_global_operations_imp.h | 14 +- .../global_operations/os_global_operations.h | 16 +- .../windows/os_global_operations_imp.cpp | 28 +- .../source/sysman/linux/os_sysman_imp.cpp | 13 +- .../tools/source/sysman/linux/os_sysman_imp.h | 2 - .../sysman/memory/linux/dg1/os_memory_imp.cpp | 4 +- .../sysman/memory/linux/dg1/os_memory_imp.h | 2 +- .../sysman/memory/linux/os_memory_imp.cpp | 2 +- .../sysman/memory/linux/os_memory_imp.h | 2 +- .../tools/source/sysman/memory/memory.cpp | 2 +- .../tools/source/sysman/memory/memory.h | 20 +- .../tools/source/sysman/memory/memory_imp.cpp | 10 +- .../tools/source/sysman/memory/memory_imp.h | 10 +- .../tools/source/sysman/memory/os_memory.h | 4 +- .../sysman/memory/windows/os_memory_imp.cpp | 4 +- level_zero/tools/source/sysman/os_sysman.h | 5 +- .../source/sysman/pci/linux/os_pci_imp.cpp | 8 +- .../source/sysman/pci/linux/os_pci_imp.h | 2 +- level_zero/tools/source/sysman/pci/os_pci.h | 2 +- level_zero/tools/source/sysman/pci/pci.h | 6 +- .../tools/source/sysman/pci/pci_imp.cpp | 6 +- level_zero/tools/source/sysman/pci/pci_imp.h | 8 +- .../source/sysman/pci/windows/os_pci_imp.cpp | 4 +- .../sysman/power/linux/os_power_imp.cpp | 4 - .../source/sysman/power/linux/os_power_imp.h | 1 - .../tools/source/sysman/power/os_power.h | 7 +- .../tools/source/sysman/power/power.cpp | 16 +- level_zero/tools/source/sysman/power/power.h | 19 +- .../tools/source/sysman/power/power_imp.cpp | 27 - .../tools/source/sysman/power/power_imp.h | 5 - .../sysman/power/windows/os_power_imp.cpp | 6 - .../source/sysman/ras/linux/os_ras_imp.cpp | 15 +- .../source/sysman/ras/linux/os_ras_imp.h | 5 +- level_zero/tools/source/sysman/ras/os_ras.h | 5 +- level_zero/tools/source/sysman/ras/ras.cpp | 8 +- level_zero/tools/source/sysman/ras/ras.h | 25 +- .../tools/source/sysman/ras/ras_imp.cpp | 32 +- level_zero/tools/source/sysman/ras/ras_imp.h | 11 +- .../source/sysman/ras/windows/os_ras_imp.cpp | 9 +- .../sysman/scheduler/linux/os_scheduler_imp.h | 6 +- .../tools/source/sysman/scheduler/scheduler.h | 12 +- .../source/sysman/scheduler/scheduler_imp.cpp | 20 +- .../source/sysman/scheduler/scheduler_imp.h | 12 +- .../sysman/standby/linux/os_standby_imp.cpp | 23 - .../sysman/standby/linux/os_standby_imp.h | 3 - .../tools/source/sysman/standby/os_standby.h | 7 +- .../tools/source/sysman/standby/standby.cpp | 14 - .../tools/source/sysman/standby/standby.h | 19 +- .../source/sysman/standby/standby_imp.cpp | 21 +- .../tools/source/sysman/standby/standby_imp.h | 10 +- .../sysman/standby/windows/os_standby_imp.cpp | 12 +- level_zero/tools/source/sysman/sysman.cpp | 36 - level_zero/tools/source/sysman/sysman.h | 52 +- level_zero/tools/source/sysman/sysman_imp.cpp | 210 +- level_zero/tools/source/sysman/sysman_imp.h | 67 +- .../temperature/linux/os_temperature_imp.cpp | 14 +- .../temperature/linux/os_temperature_imp.h | 3 +- .../sysman/temperature/os_temperature.h | 5 +- .../source/sysman/temperature/temperature.cpp | 27 +- .../source/sysman/temperature/temperature.h | 22 +- .../sysman/temperature/temperature_imp.cpp | 17 - .../sysman/temperature/temperature_imp.h | 5 - .../windows/os_temperature_imp.cpp | 5 - .../source/sysman/windows/os_sysman_imp.cpp | 9 +- .../source/sysman/windows/os_sysman_imp.h | 2 - level_zero/tools/source/tools_init_imp.cpp | 3 +- .../tools/test/unit_tests/CMakeLists.txt | 4 +- .../sources/metrics/mock_metric_enumeration.h | 1 - .../metrics/test_metric_enumeration.cpp | 90 +- .../metrics/test_metric_query_pool_1.cpp | 181 +- .../metrics/test_metric_query_pool_2.cpp | 90 +- .../sources/metrics/test_metric_streamer.cpp | 827 +--- .../engine/linux/test_sysman_engine.cpp | 6 +- .../linux/test_sysman_fabric_port.cpp | 28 +- .../frequency/linux/test_sysman_frequency.cpp | 2 +- .../linux/test_global_operations.cpp | 6 +- .../memory/linux/dg1/test_sysman_memory.cpp | 14 +- .../sysman/pci/linux/test_sysman_pci.cpp | 6 +- .../sysman/power/linux/test_sysman_power.cpp | 10 +- .../sysman/ras/linux/test_sysman_ras.cpp | 52 +- .../scheduler/linux/test_sysman_scheduler.cpp | 30 +- .../standby/linux/test_sysman_standby.cpp | 12 +- .../linux/test_sysman_temperature.cpp | 4 +- .../unit_tests/sources/sysman/test_sysman.cpp | 4 +- manifests/manifest.yml | 4 +- third_party/level_zero/ze_api_ext.h | 1330 ----- third_party/level_zero/zes_api_ext.h | 4402 ----------------- third_party/level_zero/zet_api_ext.h | 475 -- version.cmake | 4 +- 255 files changed, 3200 insertions(+), 12829 deletions(-) delete mode 100644 level_zero/api/core/ze_cl_interop.cpp create mode 100644 level_zero/api/sysman/CMakeLists.txt create mode 100644 level_zero/api/sysman/ze_sysman_loader.cpp create mode 100644 level_zero/api/sysman/zes_sysman.cpp delete mode 100644 level_zero/api/tools/zet_driver.cpp delete mode 100644 level_zero/api/tools/zet_sysman.cpp delete mode 100644 level_zero/experimental/source/tracing/tracing_cl_interop_imp.cpp delete mode 100644 level_zero/experimental/source/tracing/tracing_cl_interop_imp.h delete mode 100644 third_party/level_zero/ze_api_ext.h delete mode 100644 third_party/level_zero/zes_api_ext.h delete mode 100644 third_party/level_zero/zet_api_ext.h diff --git a/level_zero/CMakeLists.txt b/level_zero/CMakeLists.txt index 6bd37d8ee0..409ed58dd8 100644 --- a/level_zero/CMakeLists.txt +++ b/level_zero/CMakeLists.txt @@ -21,9 +21,7 @@ if(BUILD_WITH_L0) if(IS_DIRECTORY "${LEVEL_ZERO_ROOT_tmp}") set(CUSTOM_L0_INCLUDE_PATH "${LEVEL_ZERO_ROOT_tmp}/include/level_zero/") file(GLOB LEVEL_ZERO_SOURCE_HEADERS - "${LEVEL_ZERO_ROOT_tmp}/include/core/*" - "${LEVEL_ZERO_ROOT_tmp}/include/tools/*" - "${LEVEL_ZERO_ROOT_tmp}/include/experimental/*" + "${LEVEL_ZERO_ROOT_tmp}/include/*.h" ) file(MAKE_DIRECTORY ${CUSTOM_L0_INCLUDE_PATH}) file(COPY ${LEVEL_ZERO_SOURCE_HEADERS} DESTINATION ${CUSTOM_L0_INCLUDE_PATH}) @@ -46,6 +44,7 @@ if(BUILD_WITH_L0) add_definitions( -DL0_PROJECT_VERSION_MAJOR="${PROJECT_VERSION_MAJOR}" ) add_definitions( -DL0_PROJECT_VERSION_MINOR="${PROJECT_VERSION_MINOR}" ) + add_definitions( -DL0_PROJECT_VERSION_PATCH="${PROJECT_VERSION_PATCH}" ) add_definitions( -DNEO_VERSION_BUILD="${NEO_VERSION_BUILD}" ) add_definitions( -DZE_ENABLE_OCL_INTEROP=1) @@ -448,7 +447,7 @@ set_property(TARGET ${TARGET_NAME_L0} APPEND_STRING PROPERTY COMPILE_FLAGS ${ASA set_target_properties(${TARGET_NAME_L0} PROPERTIES FOLDER ${TARGET_NAME_L0} VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" - SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}" + SOVERSION "${PROJECT_VERSION_MAJOR}" ) if(UNIX) diff --git a/level_zero/api/CMakeLists.txt b/level_zero/api/CMakeLists.txt index 3e6ba747c8..9ef59091c6 100644 --- a/level_zero/api/CMakeLists.txt +++ b/level_zero/api/CMakeLists.txt @@ -8,11 +8,13 @@ add_subdirectory(core) add_subdirectory(experimental${BRANCH_DIR_SUFFIX}/) add_subdirectory(experimental/tracing) add_subdirectory(tools) +add_subdirectory(sysman) set(L0_API "") append_sources_from_properties(L0_API L0_SRCS_API L0_EXPERIMENTAL_API L0_EXPERIMENTAL_TRACING_API + L0_SYSMAN_API L0_TOOLS_API) set_property(GLOBAL PROPERTY L0_API ${L0_API}) diff --git a/level_zero/api/core/CMakeLists.txt b/level_zero/api/core/CMakeLists.txt index 18002e570b..25b3c88572 100644 --- a/level_zero/api/core/CMakeLists.txt +++ b/level_zero/api/core/CMakeLists.txt @@ -7,7 +7,6 @@ set(L0_SRCS_API ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/ze_barrier.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/ze_cl_interop.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_cmdlist.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_cmdqueue.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_context.cpp diff --git a/level_zero/api/core/ze_barrier.cpp b/level_zero/api/core/ze_barrier.cpp index 9878c4b7d6..2601229ba5 100644 --- a/level_zero/api/core/ze_barrier.cpp +++ b/level_zero/api/core/ze_barrier.cpp @@ -8,8 +8,6 @@ #include "level_zero/core/source/cmdlist/cmdlist.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendBarrier( ze_command_list_handle_t hCommandList, @@ -36,5 +34,3 @@ zeDeviceSystemBarrier( ze_device_handle_t hDevice) { return L0::Device::fromHandle(hDevice)->systemBarrier(); } - -} // extern "C" diff --git a/level_zero/api/core/ze_cl_interop.cpp b/level_zero/api/core/ze_cl_interop.cpp deleted file mode 100644 index 62c7f0f34a..0000000000 --- a/level_zero/api/core/ze_cl_interop.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "level_zero/core/source/device/device.h" -#include - -extern "C" { - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLMemory( - ze_device_handle_t hDevice, - cl_context context, - cl_mem mem, - void **ptr) { - return L0::Device::fromHandle(hDevice)->registerCLMemory(context, mem, ptr); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLProgram( - ze_device_handle_t hDevice, - cl_context context, - cl_program program, - ze_module_handle_t *phModule) { - return L0::Device::fromHandle(hDevice)->registerCLProgram(context, program, phModule); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLCommandQueue( - ze_device_handle_t hDevice, - cl_context context, - cl_command_queue commandQueue, - ze_command_queue_handle_t *phCommandQueue) { - return L0::Device::fromHandle(hDevice)->registerCLCommandQueue(context, commandQueue, phCommandQueue); -} - -} // extern "C" diff --git a/level_zero/api/core/ze_cmdlist.cpp b/level_zero/api/core/ze_cmdlist.cpp index 5e0a4425ef..7227416a5d 100644 --- a/level_zero/api/core/ze_cmdlist.cpp +++ b/level_zero/api/core/ze_cmdlist.cpp @@ -9,20 +9,8 @@ #include "level_zero/core/source/context/context.h" #include -#include "third_party/level_zero/ze_api_ext.h" - -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListCreate( - ze_device_handle_t hDevice, - const ze_command_list_desc_t *desc, - ze_command_list_handle_t *phCommandList) { - return L0::Device::fromHandle(hDevice)->createCommandList(desc, phCommandList); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListCreateExt( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_list_desc_t *desc, @@ -32,14 +20,6 @@ zeCommandListCreateExt( ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListCreateImmediate( - ze_device_handle_t hDevice, - const ze_command_queue_desc_t *altdesc, - ze_command_list_handle_t *phCommandList) { - return L0::Device::fromHandle(hDevice)->createCommandListImmediate(altdesc, phCommandList); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListCreateImmediateExt( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t *altdesc, @@ -66,7 +46,7 @@ zeCommandListReset( } ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListAppendWriteGlobalTimestampExt( +zeCommandListAppendWriteGlobalTimestamp( ze_command_list_handle_t hCommandList, uint64_t *dstptr, ze_event_handle_t hSignalEvent, @@ -74,5 +54,3 @@ zeCommandListAppendWriteGlobalTimestampExt( ze_event_handle_t *phWaitEvents) { return L0::CommandList::fromHandle(hCommandList)->appendWriteGlobalTimestamp(dstptr, hSignalEvent, numWaitEvents, phWaitEvents); } - -} // extern "C" diff --git a/level_zero/api/core/ze_cmdqueue.cpp b/level_zero/api/core/ze_cmdqueue.cpp index c58b05f20e..ad31183910 100644 --- a/level_zero/api/core/ze_cmdqueue.cpp +++ b/level_zero/api/core/ze_cmdqueue.cpp @@ -9,18 +9,8 @@ #include "level_zero/core/source/context/context.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueCreate( - ze_device_handle_t hDevice, - const ze_command_queue_desc_t *desc, - ze_command_queue_handle_t *phCommandQueue) { - return L0::Device::fromHandle(hDevice)->createCommandQueue(desc, phCommandQueue); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandQueueCreateExt( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t *desc, @@ -46,8 +36,6 @@ zeCommandQueueExecuteCommandLists( ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueSynchronize( ze_command_queue_handle_t hCommandQueue, - uint32_t timeout) { + uint64_t timeout) { return L0::CommandQueue::fromHandle(hCommandQueue)->synchronize(timeout); } - -} // extern "C" diff --git a/level_zero/api/core/ze_context.cpp b/level_zero/api/core/ze_context.cpp index e7e81a1f11..5197573ae6 100644 --- a/level_zero/api/core/ze_context.cpp +++ b/level_zero/api/core/ze_context.cpp @@ -9,10 +9,6 @@ #include "level_zero/core/source/driver/driver_handle.h" #include -#include "third_party/level_zero/ze_api_ext.h" - -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeContextCreate( ze_driver_handle_t hDriver, @@ -110,5 +106,3 @@ zeVirtualMemGetAccessAttribute( size_t *outSize) { return L0::Context::fromHandle(hContext)->getVirtualMemAccessAttribute(ptr, size, access, outSize); } - -} // extern "C" diff --git a/level_zero/api/core/ze_copy.cpp b/level_zero/api/core/ze_copy.cpp index 3c5acf8f98..6bc981daf9 100644 --- a/level_zero/api/core/ze_copy.cpp +++ b/level_zero/api/core/ze_copy.cpp @@ -8,15 +8,15 @@ #include "level_zero/core/source/cmdlist/cmdlist.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy( ze_command_list_handle_t hCommandList, void *dstptr, const void *srcptr, size_t size, - ze_event_handle_t hEvent) { + ze_event_handle_t hEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { return L0::CommandList::fromHandle(hCommandList)->appendMemoryCopy(dstptr, srcptr, size, hEvent, 0, nullptr); } @@ -27,7 +27,9 @@ zeCommandListAppendMemoryFill( const void *pattern, size_t patternSize, size_t size, - ze_event_handle_t hEvent) { + ze_event_handle_t hEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { return L0::CommandList::fromHandle(hCommandList)->appendMemoryFill(ptr, pattern, patternSize, size, hEvent); } @@ -42,7 +44,9 @@ zeCommandListAppendMemoryCopyRegion( const ze_copy_region_t *srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, - ze_event_handle_t hEvent) { + ze_event_handle_t hEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { return L0::CommandList::fromHandle(hCommandList)->appendMemoryCopyRegion(dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hEvent); } @@ -51,7 +55,9 @@ zeCommandListAppendImageCopy( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, - ze_event_handle_t hEvent) { + ze_event_handle_t hEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { return L0::CommandList::fromHandle(hCommandList)->appendImageCopy(hDstImage, hSrcImage, hEvent, 0, nullptr); } @@ -62,7 +68,9 @@ zeCommandListAppendImageCopyRegion( ze_image_handle_t hSrcImage, const ze_image_region_t *pDstRegion, const ze_image_region_t *pSrcRegion, - ze_event_handle_t hEvent) { + ze_event_handle_t hEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { return L0::CommandList::fromHandle(hCommandList)->appendImageCopyRegion(hDstImage, hSrcImage, pDstRegion, pSrcRegion, hEvent, 0, nullptr); } @@ -72,8 +80,10 @@ zeCommandListAppendImageCopyToMemory( void *dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t *pSrcRegion, - ze_event_handle_t hEvent) { - return L0::CommandList::fromHandle(hCommandList)->appendImageCopyToMemory(dstptr, hSrcImage, pSrcRegion, hEvent, 0, nullptr); + ze_event_handle_t hEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { + return L0::CommandList::fromHandle(hCommandList)->appendImageCopyToMemory(dstptr, hSrcImage, pSrcRegion, hEvent, numWaitEvents, phWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -82,8 +92,10 @@ zeCommandListAppendImageCopyFromMemory( ze_image_handle_t hDstImage, const void *srcptr, const ze_image_region_t *pDstRegion, - ze_event_handle_t hEvent) { - return L0::CommandList::fromHandle(hCommandList)->appendImageCopyFromMemory(hDstImage, srcptr, pDstRegion, hEvent, 0, nullptr); + ze_event_handle_t hEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { + return L0::CommandList::fromHandle(hCommandList)->appendImageCopyFromMemory(hDstImage, srcptr, pDstRegion, hEvent, numWaitEvents, phWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -116,5 +128,3 @@ zeCommandListAppendMemoryCopyFromContext( ze_event_handle_t *phWaitEvents) { return L0::CommandList::fromHandle(hCommandList)->appendMemoryCopyFromContext(dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents); } - -} // extern "C" diff --git a/level_zero/api/core/ze_core_loader.cpp b/level_zero/api/core/ze_core_loader.cpp index 73c6dfe760..2a9235868f 100644 --- a/level_zero/api/core/ze_core_loader.cpp +++ b/level_zero/api/core/ze_core_loader.cpp @@ -11,11 +11,8 @@ #include #include -#include "third_party/level_zero/ze_api_ext.h" #include "ze_ddi_tables.h" -extern "C" { - ze_gpu_driver_dditable_t driver_ddiTable; ZE_APIEXPORT ze_result_t ZE_APICALL @@ -31,23 +28,14 @@ zeGetDriverProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGet = (ze_pfnDriverGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGet"); pDdiTable->pfnGetApiVersion = (ze_pfnDriverGetApiVersion_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetApiVersion"); pDdiTable->pfnGetProperties = (ze_pfnDriverGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetProperties"); - pDdiTable->pfnGetIPCProperties = (ze_pfnDriverGetIPCProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetIPCProperties"); - pDdiTable->pfnGetExtensionFunctionAddress = (ze_pfnDriverGetExtensionFunctionAddress_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetExtensionFunctionAddress"); - pDdiTable->pfnAllocSharedMem = (ze_pfnDriverAllocSharedMem_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverAllocSharedMem"); - pDdiTable->pfnAllocDeviceMem = (ze_pfnDriverAllocDeviceMem_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverAllocDeviceMem"); - pDdiTable->pfnAllocHostMem = (ze_pfnDriverAllocHostMem_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverAllocHostMem"); - pDdiTable->pfnFreeMem = (ze_pfnDriverFreeMem_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverFreeMem"); - pDdiTable->pfnGetMemAllocProperties = (ze_pfnDriverGetMemAllocProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetMemAllocProperties"); - pDdiTable->pfnGetMemAddressRange = (ze_pfnDriverGetMemAddressRange_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetMemAddressRange"); - pDdiTable->pfnGetMemIpcHandle = (ze_pfnDriverGetMemIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetMemIpcHandle"); - pDdiTable->pfnOpenMemIpcHandle = (ze_pfnDriverOpenMemIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverOpenMemIpcHandle"); - pDdiTable->pfnCloseMemIpcHandle = (ze_pfnDriverCloseMemIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverCloseMemIpcHandle"); + pDdiTable->pfnGetIpcProperties = (ze_pfnDriverGetIpcProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetIpcProperties"); + pDdiTable->pfnGetExtensionProperties = (ze_pfnDriverGetExtensionProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetExtensionFunctionAddress"); driver_ddiTable.core_ddiTable.Driver = *pDdiTable; if (driver_ddiTable.enableTracing) { pDdiTable->pfnGet = (ze_pfnDriverGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGet_Tracing"); @@ -62,49 +50,234 @@ zeGetDriverProcAddrTable( if (nullptr == pDdiTable->pfnGetProperties) { pDdiTable->pfnGetProperties = driver_ddiTable.core_ddiTable.Driver.pfnGetProperties; } - pDdiTable->pfnGetIPCProperties = (ze_pfnDriverGetIPCProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetIPCProperties_Tracing"); - if (nullptr == pDdiTable->pfnGetIPCProperties) { - pDdiTable->pfnGetIPCProperties = driver_ddiTable.core_ddiTable.Driver.pfnGetIPCProperties; + pDdiTable->pfnGetIpcProperties = (ze_pfnDriverGetIpcProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetIPCProperties_Tracing"); + if (nullptr == pDdiTable->pfnGetIpcProperties) { + pDdiTable->pfnGetIpcProperties = driver_ddiTable.core_ddiTable.Driver.pfnGetIpcProperties; } - pDdiTable->pfnGetExtensionFunctionAddress = (ze_pfnDriverGetExtensionFunctionAddress_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetExtensionFunctionAddress_Tracing"); - if (nullptr == pDdiTable->pfnGetExtensionFunctionAddress) { - pDdiTable->pfnGetExtensionFunctionAddress = driver_ddiTable.core_ddiTable.Driver.pfnGetExtensionFunctionAddress; + pDdiTable->pfnGetExtensionProperties = (ze_pfnDriverGetExtensionProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetExtensionFunctionAddress_Tracing"); + if (nullptr == pDdiTable->pfnGetExtensionProperties) { + pDdiTable->pfnGetExtensionProperties = driver_ddiTable.core_ddiTable.Driver.pfnGetExtensionProperties; } - pDdiTable->pfnAllocSharedMem = (ze_pfnDriverAllocSharedMem_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverAllocSharedMem_Tracing"); - if (nullptr == pDdiTable->pfnAllocSharedMem) { - pDdiTable->pfnAllocSharedMem = driver_ddiTable.core_ddiTable.Driver.pfnAllocSharedMem; + } + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetMemProcAddrTable( + ze_api_version_t version, + ze_mem_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + driver_ddiTable.driverLibrary = LOAD_INTEL_GPU_LIBRARY(); + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; } - pDdiTable->pfnAllocDeviceMem = (ze_pfnDriverAllocDeviceMem_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverAllocDeviceMem_Tracing"); - if (nullptr == pDdiTable->pfnAllocDeviceMem) { - pDdiTable->pfnAllocDeviceMem = driver_ddiTable.core_ddiTable.Driver.pfnAllocDeviceMem; + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnAllocShared = (ze_pfnMemAllocShared_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemAllocShared"); + pDdiTable->pfnAllocDevice = (ze_pfnMemAllocDevice_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemAllocDevice"); + pDdiTable->pfnAllocHost = (ze_pfnMemAllocHost_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemAllocHost"); + pDdiTable->pfnFree = (ze_pfnMemFree_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemFree"); + pDdiTable->pfnGetAllocProperties = (ze_pfnMemGetAllocProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemGetAllocProperties"); + pDdiTable->pfnGetAddressRange = (ze_pfnMemGetAddressRange_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemGetAddressRange"); + pDdiTable->pfnGetIpcHandle = (ze_pfnMemGetIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemGetIpcHandle"); + pDdiTable->pfnOpenIpcHandle = (ze_pfnMemOpenIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemOpenIpcHandle"); + pDdiTable->pfnCloseIpcHandle = (ze_pfnMemCloseIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemCloseIpcHandle"); + driver_ddiTable.core_ddiTable.Mem = *pDdiTable; + if (driver_ddiTable.enableTracing) { + pDdiTable->pfnAllocShared = (ze_pfnMemAllocShared_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemAllocShared_Tracing"); + if (nullptr == pDdiTable->pfnAllocShared) { + pDdiTable->pfnAllocShared = driver_ddiTable.core_ddiTable.Mem.pfnAllocShared; } - pDdiTable->pfnAllocHostMem = (ze_pfnDriverAllocHostMem_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverAllocHostMem_Tracing"); - if (nullptr == pDdiTable->pfnAllocHostMem) { - pDdiTable->pfnAllocHostMem = driver_ddiTable.core_ddiTable.Driver.pfnAllocHostMem; + pDdiTable->pfnAllocDevice = (ze_pfnMemAllocDevice_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemAllocDevice_Tracing"); + if (nullptr == pDdiTable->pfnAllocDevice) { + pDdiTable->pfnAllocDevice = driver_ddiTable.core_ddiTable.Mem.pfnAllocDevice; } - pDdiTable->pfnFreeMem = (ze_pfnDriverFreeMem_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverFreeMem_Tracing"); - if (nullptr == pDdiTable->pfnFreeMem) { - pDdiTable->pfnFreeMem = driver_ddiTable.core_ddiTable.Driver.pfnFreeMem; + pDdiTable->pfnAllocHost = (ze_pfnMemAllocHost_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemAllocHost_Tracing"); + if (nullptr == pDdiTable->pfnAllocHost) { + pDdiTable->pfnAllocHost = driver_ddiTable.core_ddiTable.Mem.pfnAllocHost; } - pDdiTable->pfnGetMemAllocProperties = (ze_pfnDriverGetMemAllocProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetMemAllocProperties_Tracing"); - if (nullptr == pDdiTable->pfnGetMemAllocProperties) { - pDdiTable->pfnGetMemAllocProperties = driver_ddiTable.core_ddiTable.Driver.pfnGetMemAllocProperties; + pDdiTable->pfnFree = (ze_pfnMemFree_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemFree_Tracing"); + if (nullptr == pDdiTable->pfnAllocHost) { + pDdiTable->pfnAllocHost = driver_ddiTable.core_ddiTable.Mem.pfnAllocHost; } - pDdiTable->pfnGetMemAddressRange = (ze_pfnDriverGetMemAddressRange_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetMemAddressRange_Tracing"); - if (nullptr == pDdiTable->pfnGetMemAddressRange) { - pDdiTable->pfnGetMemAddressRange = driver_ddiTable.core_ddiTable.Driver.pfnGetMemAddressRange; + pDdiTable->pfnGetAllocProperties = (ze_pfnMemGetAllocProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemGetAllocProperties_Tracing"); + if (nullptr == pDdiTable->pfnGetAllocProperties) { + pDdiTable->pfnGetAllocProperties = driver_ddiTable.core_ddiTable.Mem.pfnGetAllocProperties; } - pDdiTable->pfnGetMemIpcHandle = (ze_pfnDriverGetMemIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverGetMemIpcHandle_Tracing"); - if (nullptr == pDdiTable->pfnGetMemIpcHandle) { - pDdiTable->pfnGetMemIpcHandle = driver_ddiTable.core_ddiTable.Driver.pfnGetMemIpcHandle; + pDdiTable->pfnGetAddressRange = (ze_pfnMemGetAddressRange_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemGetAddressRange_Tracing"); + if (nullptr == pDdiTable->pfnGetAddressRange) { + pDdiTable->pfnGetAddressRange = driver_ddiTable.core_ddiTable.Mem.pfnGetAddressRange; } - pDdiTable->pfnOpenMemIpcHandle = (ze_pfnDriverOpenMemIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverOpenMemIpcHandle_Tracing"); - if (nullptr == pDdiTable->pfnOpenMemIpcHandle) { - pDdiTable->pfnOpenMemIpcHandle = driver_ddiTable.core_ddiTable.Driver.pfnOpenMemIpcHandle; + pDdiTable->pfnGetIpcHandle = (ze_pfnMemGetIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemGetIpcHandle_Tracing"); + if (nullptr == pDdiTable->pfnGetIpcHandle) { + pDdiTable->pfnGetIpcHandle = driver_ddiTable.core_ddiTable.Mem.pfnGetIpcHandle; } - pDdiTable->pfnCloseMemIpcHandle = (ze_pfnDriverCloseMemIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDriverCloseMemIpcHandle_Tracing"); - if (nullptr == pDdiTable->pfnCloseMemIpcHandle) { - pDdiTable->pfnCloseMemIpcHandle = driver_ddiTable.core_ddiTable.Driver.pfnCloseMemIpcHandle; + pDdiTable->pfnOpenIpcHandle = (ze_pfnMemOpenIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemOpenIpcHandle_Tracing"); + if (nullptr == pDdiTable->pfnOpenIpcHandle) { + pDdiTable->pfnOpenIpcHandle = driver_ddiTable.core_ddiTable.Mem.pfnOpenIpcHandle; + } + pDdiTable->pfnCloseIpcHandle = (ze_pfnMemCloseIpcHandle_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeMemCloseIpcHandle_Tracing"); + if (nullptr == pDdiTable->pfnCloseIpcHandle) { + pDdiTable->pfnCloseIpcHandle = driver_ddiTable.core_ddiTable.Mem.pfnCloseIpcHandle; + } + } + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetContextProcAddrTable( + ze_api_version_t version, + ze_context_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + driver_ddiTable.driverLibrary = LOAD_INTEL_GPU_LIBRARY(); + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnCreate = (ze_pfnContextCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextCreate"); + pDdiTable->pfnDestroy = (ze_pfnContextDestroy_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextDestroy"); + pDdiTable->pfnGetStatus = (ze_pfnContextGetStatus_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextGetStatus"); + pDdiTable->pfnSystemBarrier = (ze_pfnContextSystemBarrier_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextSystemBarrier"); + pDdiTable->pfnMakeMemoryResident = (ze_pfnContextMakeMemoryResident_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextMakeMemoryResident"); + pDdiTable->pfnEvictMemory = (ze_pfnContextEvictMemory_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextEvictMemory"); + pDdiTable->pfnMakeImageResident = (ze_pfnContextMakeImageResident_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextMakeImageResident"); + pDdiTable->pfnEvictImage = (ze_pfnContextEvictImage_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextEvictImage"); + + driver_ddiTable.core_ddiTable.Context = *pDdiTable; + if (driver_ddiTable.enableTracing) { + pDdiTable->pfnCreate = (ze_pfnContextCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextCreate_Tracing"); + if (nullptr == pDdiTable->pfnCreate) { + pDdiTable->pfnCreate = driver_ddiTable.core_ddiTable.Context.pfnCreate; + } + pDdiTable->pfnDestroy = (ze_pfnContextDestroy_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextDestroy_Tracing"); + if (nullptr == pDdiTable->pfnDestroy) { + pDdiTable->pfnDestroy = driver_ddiTable.core_ddiTable.Context.pfnDestroy; + } + pDdiTable->pfnGetStatus = (ze_pfnContextGetStatus_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextGetStatus_Tracing"); + if (nullptr == pDdiTable->pfnGetStatus) { + pDdiTable->pfnGetStatus = driver_ddiTable.core_ddiTable.Context.pfnGetStatus; + } + pDdiTable->pfnSystemBarrier = (ze_pfnContextSystemBarrier_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextSystemBarrier_Tracing"); + if (nullptr == pDdiTable->pfnSystemBarrier) { + pDdiTable->pfnSystemBarrier = driver_ddiTable.core_ddiTable.Context.pfnSystemBarrier; + } + pDdiTable->pfnMakeMemoryResident = (ze_pfnContextMakeMemoryResident_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextMakeMemoryResident_Tracing"); + if (nullptr == pDdiTable->pfnMakeMemoryResident) { + pDdiTable->pfnMakeMemoryResident = driver_ddiTable.core_ddiTable.Context.pfnMakeMemoryResident; + } + pDdiTable->pfnEvictMemory = (ze_pfnContextEvictMemory_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextEvictMemory_Tracing"); + if (nullptr == pDdiTable->pfnEvictMemory) { + pDdiTable->pfnEvictMemory = driver_ddiTable.core_ddiTable.Context.pfnEvictMemory; + } + pDdiTable->pfnMakeImageResident = (ze_pfnContextMakeImageResident_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextMakeImageResident_Tracing"); + if (nullptr == pDdiTable->pfnMakeImageResident) { + pDdiTable->pfnMakeImageResident = driver_ddiTable.core_ddiTable.Context.pfnMakeImageResident; + } + pDdiTable->pfnEvictImage = (ze_pfnContextEvictImage_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeContextEvictImage_Tracing"); + if (nullptr == pDdiTable->pfnEvictImage) { + pDdiTable->pfnEvictImage = driver_ddiTable.core_ddiTable.Context.pfnEvictImage; + } + } + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetPhysicalMemProcAddrTable( + ze_api_version_t version, + ze_physical_mem_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + driver_ddiTable.driverLibrary = LOAD_INTEL_GPU_LIBRARY(); + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnCreate = (ze_pfnPhysicalMemCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zePhysicalMemCreate"); + pDdiTable->pfnDestroy = (ze_pfnPhysicalMemDestroy_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zePhysicalMemDestory"); + + driver_ddiTable.core_ddiTable.PhysicalMem = *pDdiTable; + if (driver_ddiTable.enableTracing) { + pDdiTable->pfnCreate = (ze_pfnPhysicalMemCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zePhysicalMemCreate"); + if (nullptr == pDdiTable->pfnCreate) { + pDdiTable->pfnCreate = driver_ddiTable.core_ddiTable.PhysicalMem.pfnCreate; + } + pDdiTable->pfnDestroy = (ze_pfnPhysicalMemDestroy_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zePhysicalMemDestory"); + if (nullptr == pDdiTable->pfnDestroy) { + pDdiTable->pfnDestroy = driver_ddiTable.core_ddiTable.PhysicalMem.pfnDestroy; + } + } + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetVirtualMemProcAddrTable( + ze_api_version_t version, + ze_virtual_mem_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + driver_ddiTable.driverLibrary = LOAD_INTEL_GPU_LIBRARY(); + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnReserve = (ze_pfnVirtualMemReserve_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemReserve"); + pDdiTable->pfnFree = (ze_pfnVirtualMemFree_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemFree"); + pDdiTable->pfnQueryPageSize = (ze_pfnVirtualMemQueryPageSize_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemQueryPageSize"); + pDdiTable->pfnMap = (ze_pfnVirtualMemMap_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemMap "); + pDdiTable->pfnUnmap = (ze_pfnVirtualMemUnmap_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemUnmap "); + pDdiTable->pfnSetAccessAttribute = (ze_pfnVirtualMemSetAccessAttribute_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemSetAccessAttribute"); + pDdiTable->pfnGetAccessAttribute = (ze_pfnVirtualMemGetAccessAttribute_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemGetAccessAttribute"); + + driver_ddiTable.core_ddiTable.VirtualMem = *pDdiTable; + if (driver_ddiTable.enableTracing) { + pDdiTable->pfnReserve = (ze_pfnVirtualMemReserve_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemReserve_Tracing"); + if (nullptr == pDdiTable->pfnReserve) { + pDdiTable->pfnReserve = driver_ddiTable.core_ddiTable.VirtualMem.pfnReserve; + } + pDdiTable->pfnFree = (ze_pfnVirtualMemFree_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemFree_Tracing"); + if (nullptr == pDdiTable->pfnFree) { + pDdiTable->pfnFree = driver_ddiTable.core_ddiTable.VirtualMem.pfnFree; + } + pDdiTable->pfnQueryPageSize = (ze_pfnVirtualMemQueryPageSize_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemQueryPageSize_Tracing"); + if (nullptr == pDdiTable->pfnQueryPageSize) { + pDdiTable->pfnQueryPageSize = driver_ddiTable.core_ddiTable.VirtualMem.pfnQueryPageSize; + } + pDdiTable->pfnMap = (ze_pfnVirtualMemMap_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemMap_Tracing"); + if (nullptr == pDdiTable->pfnMap) { + pDdiTable->pfnMap = driver_ddiTable.core_ddiTable.VirtualMem.pfnMap; + } + pDdiTable->pfnUnmap = (ze_pfnVirtualMemUnmap_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemUnmap_Tracing"); + if (nullptr == pDdiTable->pfnUnmap) { + pDdiTable->pfnUnmap = driver_ddiTable.core_ddiTable.VirtualMem.pfnUnmap; + } + pDdiTable->pfnSetAccessAttribute = (ze_pfnVirtualMemSetAccessAttribute_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemSetAccessAttribute_Tracing"); + if (nullptr == pDdiTable->pfnSetAccessAttribute) { + pDdiTable->pfnSetAccessAttribute = driver_ddiTable.core_ddiTable.VirtualMem.pfnSetAccessAttribute; + } + pDdiTable->pfnGetAccessAttribute = (ze_pfnVirtualMemGetAccessAttribute_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeVirtualMemGetAccessAttribute_Tracing"); + if (nullptr == pDdiTable->pfnGetAccessAttribute) { + pDdiTable->pfnGetAccessAttribute = driver_ddiTable.core_ddiTable.VirtualMem.pfnGetAccessAttribute; } } return result; @@ -123,7 +296,7 @@ zeGetGlobalProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnInit = (ze_pfnInit_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeInit"); @@ -150,35 +323,32 @@ zeGetDeviceProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGet = (ze_pfnDeviceGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGet"); + pDdiTable->pfnGetCommandQueueGroupProperties = (ze_pfnDeviceGetCommandQueueGroupProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetCommandQueueGroupProperties"); pDdiTable->pfnGetSubDevices = (ze_pfnDeviceGetSubDevices_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetSubDevices"); pDdiTable->pfnGetProperties = (ze_pfnDeviceGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetProperties"); - pDdiTable->pfnSystemBarrier = (ze_pfnDeviceSystemBarrier_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceSystemBarrier"); - pDdiTable->pfnRegisterCLMemory = (ze_pfnDeviceRegisterCLMemory_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceRegisterCLMemory"); - pDdiTable->pfnRegisterCLProgram = (ze_pfnDeviceRegisterCLProgram_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceRegisterCLProgram"); - pDdiTable->pfnRegisterCLCommandQueue = (ze_pfnDeviceRegisterCLCommandQueue_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceRegisterCLCommandQueue"); pDdiTable->pfnGetComputeProperties = (ze_pfnDeviceGetComputeProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetComputeProperties"); - pDdiTable->pfnGetKernelProperties = (ze_pfnDeviceGetKernelProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetKernelProperties"); + pDdiTable->pfnGetModuleProperties = (ze_pfnDeviceGetModuleProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetKernelProperties"); pDdiTable->pfnGetMemoryProperties = (ze_pfnDeviceGetMemoryProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetMemoryProperties"); pDdiTable->pfnGetMemoryAccessProperties = (ze_pfnDeviceGetMemoryAccessProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetMemoryAccessProperties"); pDdiTable->pfnGetCacheProperties = (ze_pfnDeviceGetCacheProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetCacheProperties"); pDdiTable->pfnGetImageProperties = (ze_pfnDeviceGetImageProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetImageProperties"); pDdiTable->pfnGetP2PProperties = (ze_pfnDeviceGetP2PProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetP2PProperties"); pDdiTable->pfnCanAccessPeer = (ze_pfnDeviceCanAccessPeer_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceCanAccessPeer"); - pDdiTable->pfnSetLastLevelCacheConfig = (ze_pfnDeviceSetLastLevelCacheConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceSetLastLevelCacheConfig"); - pDdiTable->pfnMakeMemoryResident = (ze_pfnDeviceMakeMemoryResident_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceMakeMemoryResident"); - pDdiTable->pfnEvictMemory = (ze_pfnDeviceEvictMemory_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceEvictMemory"); - pDdiTable->pfnMakeImageResident = (ze_pfnDeviceMakeImageResident_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceMakeImageResident"); - pDdiTable->pfnEvictImage = (ze_pfnDeviceEvictImage_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceEvictImage"); + pDdiTable->pfnGetStatus = (ze_pfnDeviceGetStatus_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetStatus"); driver_ddiTable.core_ddiTable.Device = *pDdiTable; if (driver_ddiTable.enableTracing) { pDdiTable->pfnGet = (ze_pfnDeviceGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGet_Tracing"); if (nullptr == pDdiTable->pfnGet) { pDdiTable->pfnGet = driver_ddiTable.core_ddiTable.Device.pfnGet; } + pDdiTable->pfnGetCommandQueueGroupProperties = (ze_pfnDeviceGetCommandQueueGroupProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetCommandQueueGroupProperties_Tracing"); + if (nullptr == pDdiTable->pfnGetCommandQueueGroupProperties) { + pDdiTable->pfnGetCommandQueueGroupProperties = driver_ddiTable.core_ddiTable.Device.pfnGetCommandQueueGroupProperties; + } pDdiTable->pfnGetSubDevices = (ze_pfnDeviceGetSubDevices_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetSubDevices_Tracing"); if (nullptr == pDdiTable->pfnGetSubDevices) { pDdiTable->pfnGetSubDevices = driver_ddiTable.core_ddiTable.Device.pfnGetSubDevices; @@ -187,29 +357,13 @@ zeGetDeviceProcAddrTable( if (nullptr == pDdiTable->pfnGetProperties) { pDdiTable->pfnGetProperties = driver_ddiTable.core_ddiTable.Device.pfnGetProperties; } - pDdiTable->pfnSystemBarrier = (ze_pfnDeviceSystemBarrier_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceSystemBarrier_Tracing"); - if (nullptr == pDdiTable->pfnSystemBarrier) { - pDdiTable->pfnSystemBarrier = driver_ddiTable.core_ddiTable.Device.pfnSystemBarrier; - } - pDdiTable->pfnRegisterCLMemory = (ze_pfnDeviceRegisterCLMemory_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceRegisterCLMemory_Tracing"); - if (nullptr == pDdiTable->pfnRegisterCLMemory) { - pDdiTable->pfnRegisterCLMemory = driver_ddiTable.core_ddiTable.Device.pfnRegisterCLMemory; - } - pDdiTable->pfnRegisterCLProgram = (ze_pfnDeviceRegisterCLProgram_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceRegisterCLProgram_Tracing"); - if (nullptr == pDdiTable->pfnRegisterCLProgram) { - pDdiTable->pfnRegisterCLProgram = driver_ddiTable.core_ddiTable.Device.pfnRegisterCLProgram; - } - pDdiTable->pfnRegisterCLCommandQueue = (ze_pfnDeviceRegisterCLCommandQueue_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceRegisterCLCommandQueue_Tracing"); - if (nullptr == pDdiTable->pfnRegisterCLCommandQueue) { - pDdiTable->pfnRegisterCLCommandQueue = driver_ddiTable.core_ddiTable.Device.pfnRegisterCLCommandQueue; - } pDdiTable->pfnGetComputeProperties = (ze_pfnDeviceGetComputeProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetComputeProperties_Tracing"); if (nullptr == pDdiTable->pfnGetComputeProperties) { pDdiTable->pfnGetComputeProperties = driver_ddiTable.core_ddiTable.Device.pfnGetComputeProperties; } - pDdiTable->pfnGetKernelProperties = (ze_pfnDeviceGetKernelProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetKernelProperties_Tracing"); - if (nullptr == pDdiTable->pfnGetKernelProperties) { - pDdiTable->pfnGetKernelProperties = driver_ddiTable.core_ddiTable.Device.pfnGetKernelProperties; + pDdiTable->pfnGetModuleProperties = (ze_pfnDeviceGetModuleProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetKernelProperties_Tracing"); + if (nullptr == pDdiTable->pfnGetModuleProperties) { + pDdiTable->pfnGetModuleProperties = driver_ddiTable.core_ddiTable.Device.pfnGetModuleProperties; } pDdiTable->pfnGetMemoryProperties = (ze_pfnDeviceGetMemoryProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetMemoryProperties_Tracing"); if (nullptr == pDdiTable->pfnGetMemoryProperties) { @@ -235,25 +389,9 @@ zeGetDeviceProcAddrTable( if (nullptr == pDdiTable->pfnCanAccessPeer) { pDdiTable->pfnCanAccessPeer = driver_ddiTable.core_ddiTable.Device.pfnCanAccessPeer; } - pDdiTable->pfnSetLastLevelCacheConfig = (ze_pfnDeviceSetLastLevelCacheConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceSetLastLevelCacheConfig_Tracing"); - if (nullptr == pDdiTable->pfnSetLastLevelCacheConfig) { - pDdiTable->pfnSetLastLevelCacheConfig = driver_ddiTable.core_ddiTable.Device.pfnSetLastLevelCacheConfig; - } - pDdiTable->pfnMakeMemoryResident = (ze_pfnDeviceMakeMemoryResident_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceMakeMemoryResident_Tracing"); - if (nullptr == pDdiTable->pfnMakeMemoryResident) { - pDdiTable->pfnMakeMemoryResident = driver_ddiTable.core_ddiTable.Device.pfnMakeMemoryResident; - } - pDdiTable->pfnEvictMemory = (ze_pfnDeviceEvictMemory_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceEvictMemory_Tracing"); - if (nullptr == pDdiTable->pfnEvictMemory) { - pDdiTable->pfnEvictMemory = driver_ddiTable.core_ddiTable.Device.pfnEvictMemory; - } - pDdiTable->pfnMakeImageResident = (ze_pfnDeviceMakeImageResident_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceMakeImageResident_Tracing"); - if (nullptr == pDdiTable->pfnMakeImageResident) { - pDdiTable->pfnMakeImageResident = driver_ddiTable.core_ddiTable.Device.pfnMakeImageResident; - } - pDdiTable->pfnEvictImage = (ze_pfnDeviceEvictImage_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceEvictImage_Tracing"); - if (nullptr == pDdiTable->pfnEvictImage) { - pDdiTable->pfnEvictImage = driver_ddiTable.core_ddiTable.Device.pfnEvictImage; + pDdiTable->pfnGetStatus = (ze_pfnDeviceGetStatus_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeDeviceGetStatus_Tracing"); + if (nullptr == pDdiTable->pfnGetStatus) { + pDdiTable->pfnGetStatus = driver_ddiTable.core_ddiTable.Device.pfnGetStatus; } } return result; @@ -272,7 +410,7 @@ zeGetCommandQueueProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = (ze_pfnCommandQueueCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeCommandQueueCreate"); @@ -314,7 +452,7 @@ zeGetCommandListProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnAppendBarrier = (ze_pfnCommandListAppendBarrier_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeCommandListAppendBarrier"); @@ -451,7 +589,7 @@ zeGetFenceProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = (ze_pfnFenceCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeFenceCreate"); @@ -498,7 +636,7 @@ zeGetEventPoolProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = (ze_pfnEventPoolCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeEventPoolCreate"); @@ -545,7 +683,7 @@ zeGetEventProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = (ze_pfnEventCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeEventCreate"); @@ -554,7 +692,6 @@ zeGetEventProcAddrTable( pDdiTable->pfnHostSynchronize = (ze_pfnEventHostSynchronize_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeEventHostSynchronize"); pDdiTable->pfnQueryStatus = (ze_pfnEventQueryStatus_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeEventQueryStatus"); pDdiTable->pfnHostReset = (ze_pfnEventHostReset_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeEventHostReset"); - pDdiTable->pfnGetTimestamp = (ze_pfnEventGetTimestamp_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeEventGetTimestamp"); driver_ddiTable.core_ddiTable.Event = *pDdiTable; if (driver_ddiTable.enableTracing) { pDdiTable->pfnCreate = (ze_pfnEventCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeEventCreate_Tracing"); @@ -581,10 +718,6 @@ zeGetEventProcAddrTable( if (nullptr == pDdiTable->pfnHostReset) { pDdiTable->pfnHostReset = driver_ddiTable.core_ddiTable.Event.pfnHostReset; } - pDdiTable->pfnGetTimestamp = (ze_pfnEventGetTimestamp_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeEventGetTimestamp_Tracing"); - if (nullptr == pDdiTable->pfnGetTimestamp) { - pDdiTable->pfnGetTimestamp = driver_ddiTable.core_ddiTable.Event.pfnGetTimestamp; - } } return result; } @@ -602,7 +735,7 @@ zeGetImageProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = (ze_pfnImageGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeImageGetProperties"); @@ -639,7 +772,7 @@ zeGetModuleProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = (ze_pfnModuleCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeModuleCreate"); @@ -691,7 +824,7 @@ zeGetModuleBuildLogProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnDestroy = (ze_pfnModuleBuildLogDestroy_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeModuleBuildLogDestroy"); @@ -723,25 +856,21 @@ zeGetKernelProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnSetIntermediateCacheConfig = (ze_pfnKernelSetIntermediateCacheConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSetIntermediateCacheConfig"); pDdiTable->pfnCreate = (ze_pfnKernelCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelCreate"); pDdiTable->pfnDestroy = (ze_pfnKernelDestroy_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelDestroy"); pDdiTable->pfnSetGroupSize = (ze_pfnKernelSetGroupSize_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSetGroupSize"); pDdiTable->pfnSuggestGroupSize = (ze_pfnKernelSuggestGroupSize_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSuggestGroupSize"); pDdiTable->pfnSuggestMaxCooperativeGroupCount = (ze_pfnKernelSuggestMaxCooperativeGroupCount_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSuggestMaxCooperativeGroupCount"); pDdiTable->pfnSetArgumentValue = (ze_pfnKernelSetArgumentValue_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSetArgumentValue"); - pDdiTable->pfnSetAttribute = (ze_pfnKernelSetAttribute_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSetAttribute"); - pDdiTable->pfnGetAttribute = (ze_pfnKernelGetAttribute_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelGetAttribute"); + pDdiTable->pfnSetIndirectAccess = (ze_pfnKernelSetIndirectAccess_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSetIndirectAccess"); + pDdiTable->pfnGetIndirectAccess = (ze_pfnKernelGetIndirectAccess_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelGetIndirectAccess"); + pDdiTable->pfnGetSourceAttributes = (ze_pfnKernelGetSourceAttributes_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelGetAttribute"); pDdiTable->pfnGetProperties = (ze_pfnKernelGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelGetProperties"); driver_ddiTable.core_ddiTable.Kernel = *pDdiTable; if (driver_ddiTable.enableTracing) { - pDdiTable->pfnSetIntermediateCacheConfig = (ze_pfnKernelSetIntermediateCacheConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSetIntermediateCacheConfig_Tracing"); - if (nullptr == pDdiTable->pfnSetIntermediateCacheConfig) { - pDdiTable->pfnSetIntermediateCacheConfig = driver_ddiTable.core_ddiTable.Kernel.pfnSetIntermediateCacheConfig; - } pDdiTable->pfnCreate = (ze_pfnKernelCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelCreate_Tracing"); if (nullptr == pDdiTable->pfnCreate) { pDdiTable->pfnCreate = driver_ddiTable.core_ddiTable.Kernel.pfnCreate; @@ -766,13 +895,17 @@ zeGetKernelProcAddrTable( if (nullptr == pDdiTable->pfnSetArgumentValue) { pDdiTable->pfnSetArgumentValue = driver_ddiTable.core_ddiTable.Kernel.pfnSetArgumentValue; } - pDdiTable->pfnSetAttribute = (ze_pfnKernelSetAttribute_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSetAttribute_Tracing"); - if (nullptr == pDdiTable->pfnSetAttribute) { - pDdiTable->pfnSetAttribute = driver_ddiTable.core_ddiTable.Kernel.pfnSetAttribute; + pDdiTable->pfnSetIndirectAccess = (ze_pfnKernelSetIndirectAccess_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelSetIndirectAccess_Tracing"); + if (nullptr == pDdiTable->pfnSetIndirectAccess) { + pDdiTable->pfnSetIndirectAccess = driver_ddiTable.core_ddiTable.Kernel.pfnSetIndirectAccess; } - pDdiTable->pfnGetAttribute = (ze_pfnKernelGetAttribute_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelGetAttribute_Tracing"); - if (nullptr == pDdiTable->pfnGetAttribute) { - pDdiTable->pfnGetAttribute = driver_ddiTable.core_ddiTable.Kernel.pfnGetAttribute; + pDdiTable->pfnGetIndirectAccess = (ze_pfnKernelGetIndirectAccess_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelGetIndirectAccess_Tracing"); + if (nullptr == pDdiTable->pfnGetIndirectAccess) { + pDdiTable->pfnGetIndirectAccess = driver_ddiTable.core_ddiTable.Kernel.pfnGetIndirectAccess; + } + pDdiTable->pfnGetSourceAttributes = (ze_pfnKernelGetSourceAttributes_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelGetAttribute_Tracing"); + if (nullptr == pDdiTable->pfnGetSourceAttributes) { + pDdiTable->pfnGetSourceAttributes = driver_ddiTable.core_ddiTable.Kernel.pfnGetSourceAttributes; } pDdiTable->pfnGetProperties = (ze_pfnKernelGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeKernelGetProperties_Tracing"); if (nullptr == pDdiTable->pfnGetProperties) { @@ -795,7 +928,7 @@ zeGetSamplerProcAddrTable( if (nullptr == driver_ddiTable.driverLibrary) { return ZE_RESULT_ERROR_UNINITIALIZED; } - driver_ddiTable.enableTracing = getenv_tobool("ZE_ENABLE_API_TRACING"); + driver_ddiTable.enableTracing = getenv_tobool("ZET_ENABLE_API_TRACING_EXP"); } ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = (ze_pfnSamplerCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zeSamplerCreate"); @@ -813,5 +946,3 @@ zeGetSamplerProcAddrTable( } return result; } - -} // extern "C" diff --git a/level_zero/api/core/ze_device.cpp b/level_zero/api/core/ze_device.cpp index 71c88fd9f3..bd9cef774a 100644 --- a/level_zero/api/core/ze_device.cpp +++ b/level_zero/api/core/ze_device.cpp @@ -11,8 +11,6 @@ #include #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGet( ze_driver_handle_t hDriver, @@ -46,7 +44,7 @@ zeDeviceGetComputeProperties( ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetKernelProperties( ze_device_handle_t hDevice, - ze_device_kernel_properties_t *pKernelProperties) { + ze_device_module_properties_t *pKernelProperties) { return L0::Device::fromHandle(hDevice)->getKernelProperties(pKernelProperties); } @@ -68,6 +66,7 @@ zeDeviceGetMemoryAccessProperties( ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetCacheProperties( ze_device_handle_t hDevice, + uint32_t *pCount, ze_device_cache_properties_t *pCacheProperties) { return L0::Device::fromHandle(hDevice)->getCacheProperties(pCacheProperties); } @@ -98,7 +97,7 @@ zeDeviceCanAccessPeer( ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceSetLastLevelCacheConfig( ze_device_handle_t hDevice, - ze_cache_config_t cacheConfig) { + ze_cache_config_flags_t cacheConfig) { return L0::Device::fromHandle(hDevice)->setLastLevelCacheConfig(cacheConfig); } @@ -109,5 +108,3 @@ zeDeviceGetCommandQueueGroupProperties( ze_command_queue_group_properties_t *pCommandQueueGroupProperties) { return L0::Device::fromHandle(hDevice)->getCommandQueueGroupProperties(pCount, pCommandQueueGroupProperties); } - -} // extern "C" diff --git a/level_zero/api/core/ze_driver.cpp b/level_zero/api/core/ze_driver.cpp index f416669cab..3e18bccfc2 100644 --- a/level_zero/api/core/ze_driver.cpp +++ b/level_zero/api/core/ze_driver.cpp @@ -9,11 +9,9 @@ #include "level_zero/core/source/driver/driver_handle.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeInit( - ze_init_flag_t flags) { + ze_init_flags_t flags) { return L0::init(flags); } @@ -39,7 +37,7 @@ zeDriverGetApiVersion( } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetIPCProperties( +zeDriverGetIpcProperties( ze_driver_handle_t hDriver, ze_driver_ipc_properties_t *pIPCProperties) { return L0::DriverHandle::fromHandle(hDriver)->getIPCProperties(pIPCProperties); @@ -60,5 +58,3 @@ zeDriverGetExtensionProperties( ze_driver_extension_properties_t *pExtensionProperties) { return L0::DriverHandle::fromHandle(hDriver)->getExtensionProperties(pCount, pExtensionProperties); } - -} // extern "C" diff --git a/level_zero/api/core/ze_event.cpp b/level_zero/api/core/ze_event.cpp index ce2920af56..d73e47d4a1 100644 --- a/level_zero/api/core/ze_event.cpp +++ b/level_zero/api/core/ze_event.cpp @@ -8,16 +8,14 @@ #include "level_zero/core/source/event/event.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolCreate( - ze_driver_handle_t hDriver, + ze_context_handle_t hContext, const ze_event_pool_desc_t *desc, uint32_t numDevices, ze_device_handle_t *phDevices, ze_event_pool_handle_t *phEventPool) { - return L0::DriverHandle::fromHandle(hDriver)->createEventPool(desc, numDevices, phDevices, phEventPool); + return L0::Context::fromHandle(hContext)->createEventPool(desc, numDevices, phDevices, phEventPool); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -49,10 +47,10 @@ zeEventPoolGetIpcHandle( ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolOpenIpcHandle( - ze_driver_handle_t hDriver, + ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc, ze_event_pool_handle_t *phEventPool) { - return L0::DriverHandle::fromHandle(hDriver)->openEventPoolIpcHandle(hIpc, phEventPool); + return L0::Context::fromHandle(hContext)->openEventPoolIpcHandle(hIpc, phEventPool); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -85,7 +83,7 @@ zeEventHostSignal( ZE_APIEXPORT ze_result_t ZE_APICALL zeEventHostSynchronize( ze_event_handle_t hEvent, - uint32_t timeout) { + uint64_t timeout) { return L0::Event::fromHandle(hEvent)->hostSynchronize(timeout); } @@ -109,17 +107,8 @@ zeEventHostReset( } ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventGetTimestamp( +zeEventQueryKernelTimestamp( ze_event_handle_t hEvent, - ze_event_timestamp_type_t timestampType, - void *dstptr) { - return L0::Event::fromHandle(hEvent)->getTimestamp(timestampType, dstptr); + ze_kernel_timestamp_result_t *timestampType) { + return L0::Event::fromHandle(hEvent)->queryKernelTimestamp(timestampType); } - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventQueryKernelTimestampExt( - ze_event_handle_t hEvent, - ze_kernel_timestamp_result_t *dstptr) { - return L0::Event::fromHandle(hEvent)->queryKernelTimestamp(dstptr); -} -} // extern "C" \ No newline at end of file diff --git a/level_zero/api/core/ze_fence.cpp b/level_zero/api/core/ze_fence.cpp index c094a21856..941c37b09f 100644 --- a/level_zero/api/core/ze_fence.cpp +++ b/level_zero/api/core/ze_fence.cpp @@ -8,8 +8,6 @@ #include "level_zero/core/source/fence/fence.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceCreate( ze_command_queue_handle_t hCommandQueue, @@ -27,7 +25,7 @@ zeFenceDestroy( ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceHostSynchronize( ze_fence_handle_t hFence, - uint32_t timeout) { + uint64_t timeout) { return L0::Fence::fromHandle(hFence)->hostSynchronize(timeout); } @@ -42,5 +40,3 @@ zeFenceReset( ze_fence_handle_t hFence) { return L0::Fence::fromHandle(hFence)->reset(); } - -} // extern "C" diff --git a/level_zero/api/core/ze_image.cpp b/level_zero/api/core/ze_image.cpp index b873e3b386..bb06df2cb1 100644 --- a/level_zero/api/core/ze_image.cpp +++ b/level_zero/api/core/ze_image.cpp @@ -8,8 +8,6 @@ #include "level_zero/core/source/image/image.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeImageGetProperties( ze_device_handle_t hDevice, @@ -20,10 +18,11 @@ zeImageGetProperties( ZE_APIEXPORT ze_result_t ZE_APICALL zeImageCreate( + ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t *desc, ze_image_handle_t *phImage) { - return L0::Device::fromHandle(hDevice)->createImage(desc, phImage); + return L0::Context::fromHandle(hContext)->createImage(hDevice, desc, phImage); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -31,5 +30,3 @@ zeImageDestroy( ze_image_handle_t hImage) { return L0::Image::fromHandle(hImage)->destroy(); } - -} // extern "C" diff --git a/level_zero/api/core/ze_memory.cpp b/level_zero/api/core/ze_memory.cpp index 64695dcd7d..e661380e04 100644 --- a/level_zero/api/core/ze_memory.cpp +++ b/level_zero/api/core/ze_memory.cpp @@ -8,93 +8,46 @@ #include "level_zero/core/source/driver/driver_handle.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocSharedMem( - ze_driver_handle_t hDriver, +zeMemAllocShared( + ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t *deviceDesc, const ze_host_mem_alloc_desc_t *hostDesc, size_t size, size_t alignment, ze_device_handle_t hDevice, void **pptr) { - return L0::DriverHandle::fromHandle(hDriver)->allocSharedMem(hDevice, deviceDesc->flags, hostDesc->flags, size, alignment, pptr); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemAllocShared(ze_context_handle_t hContext, - const ze_device_mem_alloc_desc_t *deviceDesc, - const ze_host_mem_alloc_desc_t *hostDesc, - size_t size, - size_t alignment, - ze_device_handle_t hDevice, - void **pptr) { return L0::Context::fromHandle(hContext)->allocSharedMem(hDevice, deviceDesc->flags, hostDesc->flags, size, alignment, pptr); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocDeviceMem( - ze_driver_handle_t hDriver, +zeMemAllocDevice( + ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t *deviceDesc, size_t size, size_t alignment, ze_device_handle_t hDevice, void **pptr) { - return L0::DriverHandle::fromHandle(hDriver)->allocDeviceMem(hDevice, deviceDesc->flags, size, alignment, pptr); + return L0::Context::fromHandle(hContext)->allocDeviceMem(hDevice, 0, size, alignment, pptr); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemAllocDevice(ze_context_handle_t hContext, - const ze_device_mem_alloc_desc_t *deviceDesc, - size_t size, - size_t alignment, - ze_device_handle_t hDevice, - void **pptr) { - return L0::Context::fromHandle(hContext)->allocDeviceMem(hDevice, deviceDesc->flags, size, alignment, pptr); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocHostMem( - ze_driver_handle_t hDriver, +zeMemAllocHost( + ze_context_handle_t hContext, const ze_host_mem_alloc_desc_t *hostDesc, size_t size, size_t alignment, void **pptr) { - return L0::DriverHandle::fromHandle(hDriver)->allocHostMem(hostDesc->flags, size, alignment, pptr); + return L0::Context::fromHandle(hContext)->allocHostMem(0, size, alignment, pptr); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemAllocHost(ze_context_handle_t hContext, - const ze_host_mem_alloc_desc_t *hostDesc, - size_t size, - size_t alignment, - void **pptr) { - return L0::Context::fromHandle(hContext)->allocHostMem(hostDesc->flags, size, alignment, pptr); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverFreeMem( - ze_driver_handle_t hDriver, +zeMemFree( + ze_context_handle_t hContext, void *ptr) { - return L0::DriverHandle::fromHandle(hDriver)->freeMem(ptr); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemFree(ze_context_handle_t hContext, - void *ptr) { return L0::Context::fromHandle(hContext)->freeMem(ptr); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemAllocProperties( - ze_driver_handle_t hDriver, - const void *ptr, - ze_memory_allocation_properties_t *pMemAllocProperties, - ze_device_handle_t *phDevice) { - return L0::DriverHandle::fromHandle(hDriver)->getMemAllocProperties(ptr, pMemAllocProperties, phDevice); -} - ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetAllocProperties( ze_context_handle_t hContext, @@ -104,15 +57,6 @@ zeMemGetAllocProperties( return L0::Context::fromHandle(hContext)->getMemAllocProperties(ptr, pMemAllocProperties, phDevice); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemAddressRange( - ze_driver_handle_t hDriver, - const void *ptr, - void **pBase, - size_t *pSize) { - return L0::DriverHandle::fromHandle(hDriver)->getMemAddressRange(ptr, pBase, pSize); -} - ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetAddressRange( ze_context_handle_t hContext, @@ -122,14 +66,6 @@ zeMemGetAddressRange( return L0::Context::fromHandle(hContext)->getMemAddressRange(ptr, pBase, pSize); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemIpcHandle( - ze_driver_handle_t hDriver, - const void *ptr, - ze_ipc_mem_handle_t *pIpcHandle) { - return L0::DriverHandle::fromHandle(hDriver)->getIpcMemHandle(ptr, pIpcHandle); -} - ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetIpcHandle( ze_context_handle_t hContext, @@ -138,16 +74,6 @@ zeMemGetIpcHandle( return L0::Context::fromHandle(hContext)->getIpcMemHandle(ptr, pIpcHandle); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverOpenMemIpcHandle( - ze_driver_handle_t hDriver, - ze_device_handle_t hDevice, - ze_ipc_mem_handle_t handle, - ze_ipc_memory_flag_t flags, - void **pptr) { - return L0::DriverHandle::fromHandle(hDriver)->openIpcMemHandle(hDevice, handle, flags, pptr); -} - ZE_APIEXPORT ze_result_t ZE_APICALL zeMemOpenIpcHandle( ze_context_handle_t hContext, @@ -158,18 +84,9 @@ zeMemOpenIpcHandle( return L0::Context::fromHandle(hContext)->openIpcMemHandle(hDevice, handle, flags, pptr); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverCloseMemIpcHandle( - ze_driver_handle_t hDriver, - const void *ptr) { - return L0::DriverHandle::fromHandle(hDriver)->closeIpcMemHandle(ptr); -} - ZE_APIEXPORT ze_result_t ZE_APICALL zeMemCloseIpcHandle( ze_context_handle_t hContext, const void *ptr) { return L0::Context::fromHandle(hContext)->closeIpcMemHandle(ptr); } - -} // extern "C" diff --git a/level_zero/api/core/ze_module.cpp b/level_zero/api/core/ze_module.cpp index 69ad04d9fb..072c717cbd 100644 --- a/level_zero/api/core/ze_module.cpp +++ b/level_zero/api/core/ze_module.cpp @@ -8,21 +8,8 @@ #include "level_zero/core/source/module/module.h" #include -#include "third_party/level_zero/ze_api_ext.h" - -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleCreate( - ze_device_handle_t hDevice, - const ze_module_desc_t *desc, - ze_module_handle_t *phModule, - ze_module_build_log_handle_t *phBuildLog) { - return L0::Device::fromHandle(hDevice)->createModule(desc, phModule, phBuildLog); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeModuleCreateExt( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_module_desc_t *desc, @@ -63,6 +50,7 @@ ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleGetGlobalPointer( ze_module_handle_t hModule, const char *pGlobalName, + size_t *pSize, void **pptr) { return L0::Module::fromHandle(hModule)->getGlobalPointer(pGlobalName, pptr); } @@ -135,27 +123,31 @@ zeKernelSetArgumentValue( } ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelSetAttribute( +zeKernelSetIndirectAccess( ze_kernel_handle_t hKernel, - ze_kernel_attribute_t attr, - uint32_t size, - const void *pValue) { - return L0::Kernel::fromHandle(hKernel)->setAttribute(attr, size, pValue); + ze_kernel_indirect_access_flags_t flags) { + return L0::Kernel::fromHandle(hKernel)->setIndirectAccess(flags); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelGetAttribute( +zeKernelGetIndirectAccess( + ze_kernel_handle_t hKernel, + ze_kernel_indirect_access_flags_t *pFlags) { + return L0::Kernel::fromHandle(hKernel)->getIndirectAccess(pFlags); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zeKernelGetSourceAttributes( ze_kernel_handle_t hKernel, - ze_kernel_attribute_t attr, uint32_t *pSize, - void *pValue) { - return L0::Kernel::fromHandle(hKernel)->getAttribute(attr, pSize, pValue); + char **pString) { + return L0::Kernel::fromHandle(hKernel)->getSourceAttributes(pSize, pString); } ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSetIntermediateCacheConfig( ze_kernel_handle_t hKernel, - ze_cache_config_t cacheConfig) { + ze_cache_config_flags_t cacheConfig) { return L0::Kernel::fromHandle(hKernel)->setIntermediateCacheConfig(cacheConfig); } @@ -215,8 +207,8 @@ zeCommandListAppendLaunchMultipleKernelsIndirect( ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelGetPropertiesExt( ze_kernel_handle_t hKernel, - ze_kernel_propertiesExt_t *pKernelProperties) { - return L0::Kernel::fromHandle(hKernel)->getPropertiesExt(pKernelProperties); + ze_kernel_properties_t *pKernelProperties) { + return L0::Kernel::fromHandle(hKernel)->getProperties(pKernelProperties); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -234,5 +226,3 @@ zeModuleDynamicLinkExt( ze_module_build_log_handle_t *phLinkLog) { return L0::Module::fromHandle(phModules[0])->performDynamicLink(numModules, phModules, phLinkLog); } - -} // extern "C" diff --git a/level_zero/api/core/ze_residency.cpp b/level_zero/api/core/ze_residency.cpp index 349812e49e..6a9d835f53 100644 --- a/level_zero/api/core/ze_residency.cpp +++ b/level_zero/api/core/ze_residency.cpp @@ -8,8 +8,6 @@ #include "level_zero/core/source/device/device.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceMakeMemoryResident( ze_device_handle_t hDevice, @@ -39,5 +37,3 @@ zeDeviceEvictImage( ze_image_handle_t hImage) { return L0::Device::fromHandle(hDevice)->evictImage(hImage); } - -} // extern "C" diff --git a/level_zero/api/core/ze_sampler.cpp b/level_zero/api/core/ze_sampler.cpp index d8ead1c7e3..1f3d4816c2 100644 --- a/level_zero/api/core/ze_sampler.cpp +++ b/level_zero/api/core/ze_sampler.cpp @@ -9,18 +9,8 @@ #include "level_zero/core/source/sampler/sampler.h" #include -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL zeSamplerCreate( - ze_device_handle_t hDevice, - const ze_sampler_desc_t *desc, - ze_sampler_handle_t *phSampler) { - return L0::Device::fromHandle(hDevice)->createSampler(desc, phSampler); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeSamplerCreateExt( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_sampler_desc_t *desc, @@ -33,5 +23,3 @@ zeSamplerDestroy( ze_sampler_handle_t hSampler) { return L0::Sampler::fromHandle(hSampler)->destroy(); } - -} // extern "C" diff --git a/level_zero/api/experimental/tracing/zet_tracing.cpp b/level_zero/api/experimental/tracing/zet_tracing.cpp index a7369341f8..d5db33be61 100644 --- a/level_zero/api/experimental/tracing/zet_tracing.cpp +++ b/level_zero/api/experimental/tracing/zet_tracing.cpp @@ -8,43 +8,37 @@ #include "level_zero/experimental/source/tracing/tracing.h" #include -#include "third_party/level_zero/ze_api_ext.h" - -extern "C" { - ZE_APIEXPORT ze_result_t ZE_APICALL -zetTracerCreate( - zet_driver_handle_t hDriver, - const zet_tracer_desc_t *desc, - zet_tracer_handle_t *phTracer) { - return L0::createAPITracer(hDriver, desc, phTracer); +zetTracerExpCreate( + zet_context_handle_t hContext, + const zet_tracer_exp_desc_t *desc, + zet_tracer_exp_handle_t *phTracer) { + return L0::createAPITracer(hContext, desc, phTracer); } ZE_APIEXPORT ze_result_t ZE_APICALL -zetTracerDestroy( - zet_tracer_handle_t hTracer) { +zetTracerExpDestroy( + zet_tracer_exp_handle_t hTracer) { return L0::APITracer::fromHandle(hTracer)->destroyTracer(hTracer); } ZE_APIEXPORT ze_result_t ZE_APICALL -zetTracerSetPrologues( - zet_tracer_handle_t hTracer, +zetTracerExpSetPrologues( + zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t *pCoreCbs) { return L0::APITracer::fromHandle(hTracer)->setPrologues(pCoreCbs); } ZE_APIEXPORT ze_result_t ZE_APICALL -zetTracerSetEpilogues( - zet_tracer_handle_t hTracer, +zetTracerExpSetEpilogues( + zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t *pCoreCbs) { return L0::APITracer::fromHandle(hTracer)->setEpilogues(pCoreCbs); } ZE_APIEXPORT ze_result_t ZE_APICALL -zetTracerSetEnabled( - zet_tracer_handle_t hTracer, +zetTracerExpSetEnabled( + zet_tracer_exp_handle_t hTracer, ze_bool_t enable) { return L0::APITracer::fromHandle(hTracer)->enableTracer(enable); } - -} // extern C diff --git a/level_zero/api/sysman/CMakeLists.txt b/level_zero/api/sysman/CMakeLists.txt new file mode 100644 index 0000000000..0cade0eb8f --- /dev/null +++ b/level_zero/api/sysman/CMakeLists.txt @@ -0,0 +1,11 @@ +# +# Copyright (C) 2020 Intel Corporation +# +# SPDX-License-Identifier: MIT +# + +set(L0_SYSMAN_API + ${CMAKE_CURRENT_SOURCE_DIR}/ze_sysman_loader.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/zes_sysman.cpp +) +set_property(GLOBAL PROPERTY L0_SYSMAN_API ${L0_SYSMAN_API}) diff --git a/level_zero/api/sysman/ze_sysman_loader.cpp b/level_zero/api/sysman/ze_sysman_loader.cpp new file mode 100644 index 0000000000..8418c99288 --- /dev/null +++ b/level_zero/api/sysman/ze_sysman_loader.cpp @@ -0,0 +1,389 @@ +/* + * Copyright (C) 2019-2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "level_zero/source/inc/ze_intel_gpu.h" +#include +#include +#include +#include +#include +#include + +#include "ze_ddi_tables.h" + +extern ze_gpu_driver_dditable_t driver_ddiTable; + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetDeviceProcAddrTable( + ze_api_version_t version, + zes_device_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + + pDdiTable->pfnGetProperties = (zes_pfnDeviceGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceGetProperties"); + pDdiTable->pfnGetState = (zes_pfnDeviceGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceGetState"); + pDdiTable->pfnReset = (zes_pfnDeviceReset_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceReset"); + pDdiTable->pfnProcessesGetState = (zes_pfnDeviceProcessesGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceProcessesGetState"); + pDdiTable->pfnPciGetProperties = (zes_pfnDevicePciGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDevicePciGetProperties"); + pDdiTable->pfnPciGetState = (zes_pfnDevicePciGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDevicePciGetState"); + pDdiTable->pfnPciGetBars = (zes_pfnDevicePciGetBars_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDevicePciGetBars"); + pDdiTable->pfnPciGetStats = (zes_pfnDevicePciGetStats_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDevicePciGetStats"); + pDdiTable->pfnEnumDiagnosticTestSuites = (zes_pfnDeviceEnumDiagnosticTestSuites_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumDiagnosticTestSuites"); + pDdiTable->pfnEnumEngineGroups = (zes_pfnDeviceEnumEngineGroups_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumEngineGroups"); + pDdiTable->pfnEventRegister = (zes_pfnDeviceEventRegister_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEventRegister"); + pDdiTable->pfnEnumFabricPorts = (zes_pfnDeviceEnumFabricPorts_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumFabricPorts"); + pDdiTable->pfnEnumFans = (zes_pfnDeviceEnumFans_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumFans"); + pDdiTable->pfnEnumFirmwares = (zes_pfnDeviceEnumFirmwares_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumFirmwares"); + pDdiTable->pfnEnumFrequencyDomains = (zes_pfnDeviceEnumFrequencyDomains_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumFrequencyDomains"); + pDdiTable->pfnEnumLeds = (zes_pfnDeviceEnumLeds_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumLeds"); + pDdiTable->pfnEnumMemoryModules = (zes_pfnDeviceEnumMemoryModules_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumMemoryModules"); + pDdiTable->pfnEnumPerformanceFactorDomains = (zes_pfnDeviceEnumPerformanceFactorDomains_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumPerformanceFactorDomains"); + pDdiTable->pfnEnumPowerDomains = (zes_pfnDeviceEnumPowerDomains_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumPowerDomains"); + pDdiTable->pfnEnumPsus = (zes_pfnDeviceEnumPsus_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumPsus"); + pDdiTable->pfnEnumRasErrorSets = (zes_pfnDeviceEnumRasErrorSets_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumRasErrorSets"); + pDdiTable->pfnEnumSchedulers = (zes_pfnDeviceEnumSchedulers_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumSchedulers"); + pDdiTable->pfnEnumStandbyDomains = (zes_pfnDeviceEnumStandbyDomains_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumStandbyDomains"); + pDdiTable->pfnEnumTemperatureSensors = (zes_pfnDeviceEnumTemperatureSensors_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDeviceEnumTemperatureSensors"); + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetDriverProcAddrTable( + ze_api_version_t version, + zes_driver_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnEventListen = (zes_pfnDriverEventListen_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDriverEventListen"); + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetDiagnosticsProcAddrTable( + ze_api_version_t version, + zes_diagnostics_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnDiagnosticsGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDiagnosticsGetProperties"); + pDdiTable->pfnGetTests = (zes_pfnDiagnosticsGetTests_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDiagnosticsGetTests"); + pDdiTable->pfnRunTests = (zes_pfnDiagnosticsRunTests_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesDiagnosticsRunTests"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetEngineProcAddrTable( + ze_api_version_t version, + zes_engine_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnEngineGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesEngineGetProperties"); + pDdiTable->pfnGetActivity = (zes_pfnEngineGetActivity_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesEngineGetActivity"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetFabricPortProcAddrTable( + ze_api_version_t version, + zes_fabric_port_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + + pDdiTable->pfnGetProperties = (zes_pfnFabricPortGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFabricPortGetProperties"); + pDdiTable->pfnGetLinkType = (zes_pfnFabricPortGetLinkType_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFabricPortGetLinkType"); + pDdiTable->pfnGetConfig = (zes_pfnFabricPortGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFabricPortGetConfig"); + pDdiTable->pfnSetConfig = (zes_pfnFabricPortSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFabricPortSetConfig"); + pDdiTable->pfnGetState = (zes_pfnFabricPortGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFabricPortGetState"); + pDdiTable->pfnGetThroughput = (zes_pfnFabricPortGetThroughput_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFabricPortGetThroughput"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetFanProcAddrTable( + ze_api_version_t version, + zes_fan_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + + pDdiTable->pfnGetProperties = (zes_pfnFanGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFanGetProperties"); + pDdiTable->pfnGetConfig = (zes_pfnFanGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFanGetConfig"); + pDdiTable->pfnSetDefaultMode = (zes_pfnFanSetDefaultMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFanSetDefaultMode"); + pDdiTable->pfnSetFixedSpeedMode = (zes_pfnFanSetFixedSpeedMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFanSetFixedSpeedMode"); + pDdiTable->pfnSetSpeedTableMode = (zes_pfnFanSetSpeedTableMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFanSetSpeedTableMode"); + pDdiTable->pfnGetState = (zes_pfnFanGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFanGetState"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetFirmwareProcAddrTable( + ze_api_version_t version, + zes_firmware_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnFirmwareGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFirmwareGetProperties"); + pDdiTable->pfnFlash = (zes_pfnFirmwareFlash_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFirmwareFlash"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetFrequencyProcAddrTable( + ze_api_version_t version, + zes_frequency_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnFrequencyGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyGetProperties"); + pDdiTable->pfnGetAvailableClocks = (zes_pfnFrequencyGetAvailableClocks_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyGetAvailableClocks"); + pDdiTable->pfnGetRange = (zes_pfnFrequencyGetRange_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyGetRange"); + pDdiTable->pfnSetRange = (zes_pfnFrequencySetRange_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencySetRange"); + pDdiTable->pfnGetState = (zes_pfnFrequencyGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyGetState"); + pDdiTable->pfnGetThrottleTime = (zes_pfnFrequencyGetThrottleTime_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyGetThrottleTime"); + pDdiTable->pfnOcGetCapabilities = (zes_pfnFrequencyOcGetCapabilities_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcGetCapabilities"); + pDdiTable->pfnOcGetFrequencyTarget = (zes_pfnFrequencyOcGetFrequencyTarget_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcGetFrequencyTarget"); + pDdiTable->pfnOcSetFrequencyTarget = (zes_pfnFrequencyOcSetFrequencyTarget_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcSetFrequencyTarget"); + pDdiTable->pfnOcGetVoltageTarget = (zes_pfnFrequencyOcGetVoltageTarget_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcGetVoltageTarget"); + pDdiTable->pfnOcSetVoltageTarget = (zes_pfnFrequencyOcSetVoltageTarget_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcSetVoltageTarget"); + pDdiTable->pfnOcSetMode = (zes_pfnFrequencyOcSetMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcSetMode"); + pDdiTable->pfnOcGetMode = (zes_pfnFrequencyOcGetMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcGetMode"); + pDdiTable->pfnOcGetIccMax = (zes_pfnFrequencyOcGetIccMax_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcGetIccMax"); + pDdiTable->pfnOcSetIccMax = (zes_pfnFrequencyOcSetIccMax_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcSetIccMax"); + pDdiTable->pfnOcGetTjMax = (zes_pfnFrequencyOcGetTjMax_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcGetTjMax"); + pDdiTable->pfnOcSetTjMax = (zes_pfnFrequencyOcSetTjMax_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesFrequencyOcSetTjMax"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetLedProcAddrTable( + ze_api_version_t version, + zes_led_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnLedGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesLedGetProperties"); + pDdiTable->pfnGetState = (zes_pfnLedGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesLedGetState"); + pDdiTable->pfnSetState = (zes_pfnLedSetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesLedSetState"); + pDdiTable->pfnSetColor = (zes_pfnLedSetColor_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesLedSetColor"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetMemoryProcAddrTable( + ze_api_version_t version, + zes_memory_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnMemoryGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesMemoryGetProperties"); + pDdiTable->pfnGetState = (zes_pfnMemoryGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesMemoryGetState"); + pDdiTable->pfnGetBandwidth = (zes_pfnMemoryGetBandwidth_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesMemoryGetBandwidth"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetPerformanceFactorProcAddrTable( + ze_api_version_t version, + zes_performance_factor_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnPerformanceFactorGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPerformanceFactorGetProperties"); + pDdiTable->pfnGetConfig = (zes_pfnPerformanceFactorGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPerformanceFactorGetConfig"); + pDdiTable->pfnSetConfig = (zes_pfnPerformanceFactorSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPerformanceFactorSetConfig"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetPowerProcAddrTable( + ze_api_version_t version, + zes_power_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnPowerGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPowerGetProperties"); + pDdiTable->pfnGetEnergyCounter = (zes_pfnPowerGetEnergyCounter_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPowerGetEnergyCounter"); + pDdiTable->pfnGetLimits = (zes_pfnPowerGetLimits_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPowerGetLimits"); + pDdiTable->pfnSetLimits = (zes_pfnPowerSetLimits_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPowerSetLimits"); + pDdiTable->pfnGetEnergyThreshold = (zes_pfnPowerGetEnergyThreshold_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPowerGetEnergyThreshold"); + pDdiTable->pfnSetEnergyThreshold = (zes_pfnPowerSetEnergyThreshold_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPowerSetEnergyThreshold"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetPsuProcAddrTable( + ze_api_version_t version, + zes_psu_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnPsuGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPsuGetProperties"); + pDdiTable->pfnGetState = (zes_pfnPsuGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesPsuGetState"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetRasProcAddrTable( + ze_api_version_t version, + zes_ras_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnRasGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesRasGetProperties"); + pDdiTable->pfnGetConfig = (zes_pfnRasGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesRasGetConfig"); + pDdiTable->pfnSetConfig = (zes_pfnRasSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesRasSetConfig"); + pDdiTable->pfnGetState = (zes_pfnRasGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesRasGetState"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetSchedulerProcAddrTable( + ze_api_version_t version, + zes_scheduler_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnSchedulerGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesSchedulerGetProperties"); + pDdiTable->pfnGetCurrentMode = (zes_pfnSchedulerGetCurrentMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesSchedulerGetCurrentMode"); + pDdiTable->pfnGetTimeoutModeProperties = (zes_pfnSchedulerGetTimeoutModeProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesSchedulerGetTimeoutModeProperties"); + pDdiTable->pfnGetTimesliceModeProperties = (zes_pfnSchedulerGetTimesliceModeProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesSchedulerGetTimesliceModeProperties"); + pDdiTable->pfnSetTimeoutMode = (zes_pfnSchedulerSetTimeoutMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesSchedulerSetTimeoutMode"); + pDdiTable->pfnSetTimesliceMode = (zes_pfnSchedulerSetTimesliceMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesSchedulerSetTimesliceMode"); + pDdiTable->pfnSetExclusiveMode = (zes_pfnSchedulerSetExclusiveMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesSchedulerSetExclusiveMode"); + pDdiTable->pfnSetComputeUnitDebugMode = (zes_pfnSchedulerSetComputeUnitDebugMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesSchedulerSetComputeUnitDebugMode"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetStandbyProcAddrTable( + ze_api_version_t version, + zes_standby_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnStandbyGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesStandbyGetProperties"); + pDdiTable->pfnGetMode = (zes_pfnStandbyGetMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesStandbyGetMode"); + pDdiTable->pfnSetMode = (zes_pfnStandbySetMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesStandbySetMode"); + + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zesGetTemperatureProcAddrTable( + ze_api_version_t version, + zes_temperature_dditable_t *pDdiTable) { + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + ze_result_t result = ZE_RESULT_SUCCESS; + pDdiTable->pfnGetProperties = (zes_pfnTemperatureGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesTemperatureGetProperties"); + pDdiTable->pfnGetConfig = (zes_pfnTemperatureGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesTemperatureGetConfig"); + pDdiTable->pfnSetConfig = (zes_pfnTemperatureSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesTemperatureSetConfig"); + pDdiTable->pfnGetState = (zes_pfnTemperatureGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zesTemperatureGetState"); + + return result; +} diff --git a/level_zero/api/sysman/zes_sysman.cpp b/level_zero/api/sysman/zes_sysman.cpp new file mode 100644 index 0000000000..21f92370f0 --- /dev/null +++ b/level_zero/api/sysman/zes_sysman.cpp @@ -0,0 +1,733 @@ +/* + * Copyright (C) 2019-2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include + +#include "sysman/sysman.h" + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceGetProperties( + zes_device_handle_t hDevice, + zes_device_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceGetState( + zes_device_handle_t hDevice, + zes_device_state_t *pState) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumSchedulers( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_sched_handle_t *phScheduler) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesSchedulerGetProperties( + zes_sched_handle_t hScheduler, + zes_sched_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesSchedulerGetCurrentMode( + zes_sched_handle_t hScheduler, + zes_sched_mode_t *pMode) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesSchedulerGetTimeoutModeProperties( + zes_sched_handle_t hScheduler, + ze_bool_t getDefaults, + zes_sched_timeout_properties_t *pConfig) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesSchedulerGetTimesliceModeProperties( + zes_sched_handle_t hScheduler, + ze_bool_t getDefaults, + zes_sched_timeslice_properties_t *pConfig) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesSchedulerSetTimeoutMode( + zes_sched_handle_t hScheduler, + zes_sched_timeout_properties_t *pProperties, + ze_bool_t *pNeedReload) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesSchedulerSetTimesliceMode( + zes_sched_handle_t hScheduler, + zes_sched_timeslice_properties_t *pProperties, + ze_bool_t *pNeedReload) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesSchedulerSetExclusiveMode( + zes_sched_handle_t hScheduler, + ze_bool_t *pNeedReload) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesSchedulerSetComputeUnitDebugMode( + zes_sched_handle_t hScheduler, + ze_bool_t *pNeedReload) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceProcessesGetState( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_process_state_t *pProcesses) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceReset( + zes_device_handle_t hDevice, + ze_bool_t force) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDevicePciGetProperties( + zes_device_handle_t hDevice, + zes_pci_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDevicePciGetState( + zes_device_handle_t hDevice, + zes_pci_state_t *pState) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDevicePciGetBars( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_pci_bar_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDevicePciGetStats( + zes_device_handle_t hDevice, + zes_pci_stats_t *pStats) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumPowerDomains( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_pwr_handle_t *phPower) { + return L0::SysmanDevice::fromHandle(hDevice)->powerGet(pCount, phPower); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerGetProperties( + zes_pwr_handle_t hPower, + zes_power_properties_t *pProperties) { + return L0::Power::fromHandle(hPower)->powerGetProperties(pProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerGetEnergyCounter( + zes_pwr_handle_t hPower, + zes_power_energy_counter_t *pEnergy) { + return L0::Power::fromHandle(hPower)->powerGetEnergyCounter(pEnergy); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerGetLimits( + zes_pwr_handle_t hPower, + zes_power_sustained_limit_t *pSustained, + zes_power_burst_limit_t *pBurst, + zes_power_peak_limit_t *pPeak) { + return L0::Power::fromHandle(hPower)->powerGetLimits(pSustained, pBurst, pPeak); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerSetLimits( + zes_pwr_handle_t hPower, + const zes_power_sustained_limit_t *pSustained, + const zes_power_burst_limit_t *pBurst, + const zes_power_peak_limit_t *pPeak) { + return L0::Power::fromHandle(hPower)->powerSetLimits(pSustained, pBurst, pPeak); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerGetEnergyThreshold( + zes_pwr_handle_t hPower, + zes_energy_threshold_t *pThreshold) { + return L0::Power::fromHandle(hPower)->powerGetEnergyThreshold(pThreshold); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerSetEnergyThreshold( + zes_pwr_handle_t hPower, + double threshold) { + return L0::Power::fromHandle(hPower)->powerSetEnergyThreshold(threshold); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumFrequencyDomains( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_freq_handle_t *phFrequency) { + return L0::SysmanDevice::fromHandle(hDevice)->frequencyGet(pCount, phFrequency); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyGetProperties( + zes_freq_handle_t hFrequency, + zes_freq_properties_t *pProperties) { + return L0::Frequency::fromHandle(hFrequency)->frequencyGetProperties(pProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyGetAvailableClocks( + zes_freq_handle_t hFrequency, + uint32_t *pCount, + double *phFrequency) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyGetRange( + zes_freq_handle_t hFrequency, + zes_freq_range_t *pLimits) { + return L0::Frequency::fromHandle(hFrequency)->frequencyGetRange(pLimits); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencySetRange( + zes_freq_handle_t hFrequency, + const zes_freq_range_t *pLimits) { + return L0::Frequency::fromHandle(hFrequency)->frequencySetRange(pLimits); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyGetState( + zes_freq_handle_t hFrequency, + zes_freq_state_t *pState) { + return L0::Frequency::fromHandle(hFrequency)->frequencyGetState(pState); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyGetThrottleTime( + zes_freq_handle_t hFrequency, + zes_freq_throttle_time_t *pThrottleTime) { + return L0::Frequency::fromHandle(hFrequency)->frequencyGetThrottleTime(pThrottleTime); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcGetFrequencyTarget( + zes_freq_handle_t hFrequency, + double *pCurrentOcFrequency) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcSetFrequencyTarget( + zes_freq_handle_t hFrequency, + double currentOcFrequency) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcGetVoltageTarget( + zes_freq_handle_t hFrequency, + double *pCurrentVoltageTarget, + double *pCurrentVoltageOffset) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcSetVoltageTarget( + zes_freq_handle_t hFrequency, + double currentVoltageTarget, + double currentVoltageOffset) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcSetMode( + zes_freq_handle_t hFrequency, + zes_oc_mode_t currentOcMode) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcGetMode( + zes_freq_handle_t hFrequency, + zes_oc_mode_t *pCurrentOcMode) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcGetCapabilities( + zes_freq_handle_t hFrequency, + zes_oc_capabilities_t *pOcCapabilities) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcGetIccMax( + zes_freq_handle_t hFrequency, + double *pOcIccMax) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcSetIccMax( + zes_freq_handle_t hFrequency, + double ocIccMax) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcGetTjMax( + zes_freq_handle_t hFrequency, + double *pOcTjMax) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFrequencyOcSetTjMax( + zes_freq_handle_t hFrequency, + double ocTjMax) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumEngineGroups( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_engine_handle_t *phEngine) { + return L0::SysmanDevice::fromHandle(hDevice)->engineGet(pCount, phEngine); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesEngineGetProperties( + zes_engine_handle_t hEngine, + zes_engine_properties_t *pProperties) { + return L0::Engine::fromHandle(hEngine)->engineGetProperties(pProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesEngineGetActivity( + zes_engine_handle_t hEngine, + zes_engine_stats_t *pStats) { + return L0::Engine::fromHandle(hEngine)->engineGetActivity(pStats); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumStandbyDomains( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_standby_handle_t *phStandby) { + return L0::SysmanDevice::fromHandle(hDevice)->standbyGet(pCount, phStandby); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesStandbyGetProperties( + zes_standby_handle_t hStandby, + zes_standby_properties_t *pProperties) { + return L0::Standby::fromHandle(hStandby)->standbyGetProperties(pProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesStandbyGetMode( + zes_standby_handle_t hStandby, + zes_standby_promo_mode_t *pMode) { + return L0::Standby::fromHandle(hStandby)->standbyGetMode(pMode); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesStandbySetMode( + zes_standby_handle_t hStandby, + zes_standby_promo_mode_t mode) { + return L0::Standby::fromHandle(hStandby)->standbySetMode(mode); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumFirmwares( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_firmware_handle_t *phFirmware) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFirmwareGetProperties( + zes_firmware_handle_t hFirmware, + zes_firmware_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFirmwareFlash( + zes_firmware_handle_t hFirmware, + void *pImage, + uint32_t size) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumMemoryModules( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_mem_handle_t *phMemory) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesMemoryGetProperties( + zes_mem_handle_t hMemory, + zes_mem_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesMemoryGetState( + zes_mem_handle_t hMemory, + zes_mem_state_t *pState) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesMemoryGetBandwidth( + zes_mem_handle_t hMemory, + zes_mem_bandwidth_t *pBandwidth) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumFabricPorts( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_fabric_port_handle_t *phPort) { + return L0::SysmanDevice::fromHandle(hDevice)->fabricPortGet(pCount, phPort); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFabricPortGetProperties( + zes_fabric_port_handle_t hPort, + zes_fabric_port_properties_t *pProperties) { + return L0::FabricPort::fromHandle(hPort)->fabricPortGetProperties(pProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFabricPortGetLinkType( + zes_fabric_port_handle_t hPort, + zes_fabric_link_type_t *pLinkType) { + return L0::FabricPort::fromHandle(hPort)->fabricPortGetLinkType(pLinkType); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFabricPortGetConfig( + zes_fabric_port_handle_t hPort, + zes_fabric_port_config_t *pConfig) { + return L0::FabricPort::fromHandle(hPort)->fabricPortGetConfig(pConfig); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFabricPortSetConfig( + zes_fabric_port_handle_t hPort, + const zes_fabric_port_config_t *pConfig) { + return L0::FabricPort::fromHandle(hPort)->fabricPortSetConfig(pConfig); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFabricPortGetState( + zes_fabric_port_handle_t hPort, + zes_fabric_port_state_t *pState) { + return L0::FabricPort::fromHandle(hPort)->fabricPortGetState(pState); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFabricPortGetThroughput( + zes_fabric_port_handle_t hPort, + zes_fabric_port_throughput_t *pThroughput) { + return L0::FabricPort::fromHandle(hPort)->fabricPortGetThroughput(pThroughput); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumTemperatureSensors( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_temp_handle_t *phTemperature) { + return L0::SysmanDevice::fromHandle(hDevice)->temperatureGet(pCount, phTemperature); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesTemperatureGetProperties( + zes_temp_handle_t hTemperature, + zes_temp_properties_t *pProperties) { + return L0::Temperature::fromHandle(hTemperature)->temperatureGetProperties(pProperties); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesTemperatureGetConfig( + zes_temp_handle_t hTemperature, + zes_temp_config_t *pConfig) { + return L0::Temperature::fromHandle(hTemperature)->temperatureGetConfig(pConfig); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesTemperatureSetConfig( + zes_temp_handle_t hTemperature, + const zes_temp_config_t *pConfig) { + return L0::Temperature::fromHandle(hTemperature)->temperatureSetConfig(pConfig); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesTemperatureGetState( + zes_temp_handle_t hTemperature, + double *pTemperature) { + return L0::Temperature::fromHandle(hTemperature)->temperatureGetState(pTemperature); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumPsus( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_psu_handle_t *phPsu) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPsuGetProperties( + zes_psu_handle_t hPsu, + zes_psu_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPsuGetState( + zes_psu_handle_t hPsu, + zes_psu_state_t *pState) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumFans( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_fan_handle_t *phFan) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFanGetProperties( + zes_fan_handle_t hFan, + zes_fan_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFanGetConfig( + zes_fan_handle_t hFan, + zes_fan_config_t *pConfig) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFanSetDefaultMode( + zes_fan_handle_t hFan) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFanSetFixedSpeedMode( + zes_fan_handle_t hFan, + const zes_fan_speed_t *speed) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFanSetSpeedTableMode( + zes_fan_handle_t hFan, + const zes_fan_speed_table_t *speedTable) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesFanGetState( + zes_fan_handle_t hFan, + zes_fan_speed_units_t units, + int32_t *pSpeed) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumLeds( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_led_handle_t *phLed) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesLedGetProperties( + zes_led_handle_t hLed, + zes_led_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesLedGetState( + zes_led_handle_t hLed, + zes_led_state_t *pState) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesLedSetState( + zes_led_handle_t hLed, + ze_bool_t enable) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesLedSetColor( + zes_led_handle_t hLed, + const zes_led_color_t *pColor) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumRasErrorSets( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_ras_handle_t *phRas) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesRasGetProperties( + zes_ras_handle_t hRas, + zes_ras_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesRasGetConfig( + zes_ras_handle_t hRas, + zes_ras_config_t *pConfig) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesRasSetConfig( + zes_ras_handle_t hRas, + const zes_ras_config_t *pConfig) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesRasGetState( + zes_ras_handle_t hRas, + ze_bool_t clear, + zes_ras_state_t *pState) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEventRegister( + zes_device_handle_t hDevice, + zes_event_type_flags_t events) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDriverEventListen( + ze_driver_handle_t hDriver, + uint32_t timeout, + uint32_t count, + zes_device_handle_t *phDevices, + uint32_t *pNumDeviceEvents, + zes_event_type_flags_t *pEvents) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumDiagnosticTestSuites( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_diag_handle_t *phDiagnostics) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDiagnosticsGetProperties( + zes_diag_handle_t hDiagnostics, + zes_diag_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDiagnosticsGetTests( + zes_diag_handle_t hDiagnostics, + uint32_t *pCount, + zes_diag_test_t *pTests) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDiagnosticsRunTests( + zes_diag_handle_t hDiagnostics, + uint32_t start, + uint32_t end, + zes_diag_result_t *pResult) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesDeviceEnumPerformanceFactorDomains( + zes_device_handle_t hDevice, + uint32_t *pCount, + zes_perf_handle_t *phPerf) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPerformanceFactorGetProperties( + zes_perf_handle_t hPerf, + zes_perf_properties_t *pProperties) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPerformanceFactorGetConfig( + zes_perf_handle_t hPerf, + double *pFactor) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPerformanceFactorSetConfig( + zes_perf_handle_t hPerf, + double factor) { + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; +} diff --git a/level_zero/api/tools/CMakeLists.txt b/level_zero/api/tools/CMakeLists.txt index 6b37d23d34..e6368b4832 100644 --- a/level_zero/api/tools/CMakeLists.txt +++ b/level_zero/api/tools/CMakeLists.txt @@ -7,8 +7,6 @@ set(L0_TOOLS_API ${CMAKE_CURRENT_SOURCE_DIR}/ze_tools_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zet_metric.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/zet_sysman.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/zet_driver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zet_module.cpp ) set_property(GLOBAL PROPERTY L0_TOOLS_API ${L0_TOOLS_API}) diff --git a/level_zero/api/tools/ze_tools_loader.cpp b/level_zero/api/tools/ze_tools_loader.cpp index 730b6d10be..b091ec145c 100644 --- a/level_zero/api/tools/ze_tools_loader.cpp +++ b/level_zero/api/tools/ze_tools_loader.cpp @@ -8,20 +8,35 @@ #include "level_zero/source/inc/ze_intel_gpu.h" #include #include +#include +#include #include #include -#include "third_party/level_zero/ze_api_ext.h" #include "ze_ddi_tables.h" -extern "C" { - extern ze_gpu_driver_dditable_t driver_ddiTable; -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetGlobalProcAddrTable( +ZE_DLLEXPORT ze_result_t ZE_APICALL +zetGetContextProcAddrTable( ze_api_version_t version, - zet_global_dditable_t *pDdiTable) { + zet_context_dditable_t *pDdiTable) { + ze_result_t result = ZE_RESULT_SUCCESS; + if (nullptr == pDdiTable) + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + if (driver_ddiTable.version < version) + return ZE_RESULT_ERROR_UNKNOWN; + if (nullptr == driver_ddiTable.driverLibrary) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + pDdiTable->pfnActivateMetricGroups = (zet_pfnContextActivateMetricGroups_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetContextActivateMetricGroups"); + return result; +} + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zetGetMetricStreamerProcAddrTable( + ze_api_version_t version, + zet_metric_streamer_dditable_t *pDdiTable) { if (nullptr == pDdiTable) return ZE_RESULT_ERROR_INVALID_ARGUMENT; if (driver_ddiTable.version < version) @@ -30,14 +45,18 @@ zetGetGlobalProcAddrTable( return ZE_RESULT_ERROR_UNINITIALIZED; } ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnInit = (zet_pfnInit_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetInit"); + + pDdiTable->pfnOpen = (zet_pfnMetricStreamerOpen_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetMetricStreamerOpen"); + pDdiTable->pfnClose = (zet_pfnMetricStreamerClose_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetMetricStreamerClose"); + pDdiTable->pfnReadData = (zet_pfnMetricStreamerReadData_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetMetricStreamerReadData"); + return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetDeviceProcAddrTable( +ZE_DLLEXPORT ze_result_t ZE_APICALL +zetGetTracerExpProcAddrTable( ze_api_version_t version, - zet_device_dditable_t *pDdiTable) { + zet_tracer_exp_dditable_t *pDdiTable) { if (nullptr == pDdiTable) return ZE_RESULT_ERROR_INVALID_ARGUMENT; if (driver_ddiTable.version < version) @@ -46,11 +65,15 @@ zetGetDeviceProcAddrTable( return ZE_RESULT_ERROR_UNINITIALIZED; } ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnActivateMetricGroups = (zet_pfnDeviceActivateMetricGroups_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDeviceActivateMetricGroups"); + pDdiTable->pfnCreate = (zet_pfnTracerExpCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerExpCreate"); + pDdiTable->pfnDestroy = (zet_pfnTracerExpDestroy_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerExpDestroy"); + pDdiTable->pfnSetPrologues = (zet_pfnTracerExpSetPrologues_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerExpSetPrologues"); + pDdiTable->pfnSetEpilogues = (zet_pfnTracerExpSetEpilogues_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerExpSetEpilogues"); + pDdiTable->pfnSetEnabled = (zet_pfnTracerExpSetEnabled_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerExpSetEnabled"); return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetCommandListProcAddrTable( ze_api_version_t version, zet_command_list_dditable_t *pDdiTable) { @@ -62,14 +85,14 @@ zetGetCommandListProcAddrTable( return ZE_RESULT_ERROR_UNINITIALIZED; } ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnAppendMetricTracerMarker = (zet_pfnCommandListAppendMetricTracerMarker_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetCommandListAppendMetricTracerMarker"); + pDdiTable->pfnAppendMetricStreamerMarker = (zet_pfnCommandListAppendMetricStreamerMarker_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetCommandListAppendMetricStreamerMarker"); pDdiTable->pfnAppendMetricQueryBegin = (zet_pfnCommandListAppendMetricQueryBegin_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetCommandListAppendMetricQueryBegin"); pDdiTable->pfnAppendMetricQueryEnd = (zet_pfnCommandListAppendMetricQueryEnd_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetCommandListAppendMetricQueryEnd"); pDdiTable->pfnAppendMetricMemoryBarrier = (zet_pfnCommandListAppendMetricMemoryBarrier_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetCommandListAppendMetricMemoryBarrier"); return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetModuleProcAddrTable( ze_api_version_t version, zet_module_dditable_t *pDdiTable) { @@ -85,7 +108,7 @@ zetGetModuleProcAddrTable( return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetKernelProcAddrTable( ze_api_version_t version, zet_kernel_dditable_t *pDdiTable) { @@ -101,7 +124,7 @@ zetGetKernelProcAddrTable( return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupProcAddrTable( ze_api_version_t version, zet_metric_group_dditable_t *pDdiTable) { @@ -119,7 +142,7 @@ zetGetMetricGroupProcAddrTable( return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProcAddrTable( ze_api_version_t version, zet_metric_dditable_t *pDdiTable) { @@ -136,25 +159,7 @@ zetGetMetricProcAddrTable( return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetMetricTracerProcAddrTable( - ze_api_version_t version, - zet_metric_tracer_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnOpen = (zet_pfnMetricTracerOpen_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetMetricTracerOpen"); - pDdiTable->pfnClose = (zet_pfnMetricTracerClose_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetMetricTracerClose"); - pDdiTable->pfnReadData = (zet_pfnMetricTracerReadData_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetMetricTracerReadData"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryPoolProcAddrTable( ze_api_version_t version, zet_metric_query_pool_dditable_t *pDdiTable) { @@ -171,7 +176,7 @@ zetGetMetricQueryPoolProcAddrTable( return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryProcAddrTable( ze_api_version_t version, zet_metric_query_dditable_t *pDdiTable) { @@ -190,10 +195,10 @@ zetGetMetricQueryProcAddrTable( return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetTracerProcAddrTable( +ZE_DLLEXPORT ze_result_t ZE_APICALL +zetGetDeviceProcAddrTable( ze_api_version_t version, - zet_tracer_dditable_t *pDdiTable) { + zet_device_dditable_t *pDdiTable) { if (nullptr == pDdiTable) return ZE_RESULT_ERROR_INVALID_ARGUMENT; if (driver_ddiTable.version < version) @@ -202,334 +207,11 @@ zetGetTracerProcAddrTable( return ZE_RESULT_ERROR_UNINITIALIZED; } ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnCreate = (zet_pfnTracerCreate_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerCreate"); - pDdiTable->pfnDestroy = (zet_pfnTracerDestroy_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerDestroy"); - pDdiTable->pfnSetPrologues = (zet_pfnTracerSetPrologues_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerSetPrologues"); - pDdiTable->pfnSetEpilogues = (zet_pfnTracerSetEpilogues_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerSetEpilogues"); - pDdiTable->pfnSetEnabled = (zet_pfnTracerSetEnabled_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetTracerSetEnabled"); + pDdiTable->pfnGetDebugProperties = (zet_pfnDeviceGetDebugProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDeviceGetDebugProperties"); return result; } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanProcAddrTable( - ze_api_version_t version, - zet_sysman_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGet = (zet_pfnSysmanGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanGet"); - pDdiTable->pfnDeviceGetProperties = (zet_pfnSysmanDeviceGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanDeviceGetProperties"); - pDdiTable->pfnSchedulerGetSupportedModes = (zet_pfnSysmanSchedulerGetSupportedModes_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanSchedulerGetSupportedModes"); - pDdiTable->pfnSchedulerGetCurrentMode = (zet_pfnSysmanSchedulerGetCurrentMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanSchedulerGetCurrentMode"); - pDdiTable->pfnSchedulerGetTimeoutModeProperties = (zet_pfnSysmanSchedulerGetTimeoutModeProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanSchedulerGetTimeoutModeProperties"); - pDdiTable->pfnSchedulerGetTimesliceModeProperties = (zet_pfnSysmanSchedulerGetTimesliceModeProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanSchedulerGetTimesliceModeProperties"); - pDdiTable->pfnSchedulerSetTimeoutMode = (zet_pfnSysmanSchedulerSetTimeoutMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanSchedulerSetTimeoutMode"); - pDdiTable->pfnSchedulerSetTimesliceMode = (zet_pfnSysmanSchedulerSetTimesliceMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanSchedulerSetTimesliceMode"); - pDdiTable->pfnSchedulerSetExclusiveMode = (zet_pfnSysmanSchedulerSetExclusiveMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanSchedulerSetExclusiveMode"); - pDdiTable->pfnSchedulerSetComputeUnitDebugMode = (zet_pfnSysmanSchedulerSetComputeUnitDebugMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanSchedulerSetComputeUnitDebugMode"); - pDdiTable->pfnPerformanceProfileGetSupported = (zet_pfnSysmanPerformanceProfileGetSupported_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPerformanceProfileGetSupported"); - pDdiTable->pfnPerformanceProfileGet = (zet_pfnSysmanPerformanceProfileGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPerformanceProfileGet"); - pDdiTable->pfnPerformanceProfileSet = (zet_pfnSysmanPerformanceProfileSet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPerformanceProfileSet"); - pDdiTable->pfnProcessesGetState = (zet_pfnSysmanProcessesGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanProcessesGetState"); - pDdiTable->pfnDeviceReset = (zet_pfnSysmanDeviceReset_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanDeviceReset"); - pDdiTable->pfnDeviceGetRepairStatus = (zet_pfnSysmanDeviceGetRepairStatus_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanDeviceGetRepairStatus"); - pDdiTable->pfnPciGetProperties = (zet_pfnSysmanPciGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPciGetProperties"); - pDdiTable->pfnPciGetState = (zet_pfnSysmanPciGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPciGetState"); - pDdiTable->pfnPciGetBars = (zet_pfnSysmanPciGetBars_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPciGetBars"); - pDdiTable->pfnPciGetStats = (zet_pfnSysmanPciGetStats_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPciGetStats"); - pDdiTable->pfnPowerGet = (zet_pfnSysmanPowerGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPowerGet"); - pDdiTable->pfnFrequencyGet = (zet_pfnSysmanFrequencyGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyGet"); - pDdiTable->pfnEngineGet = (zet_pfnSysmanEngineGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanEngineGet"); - pDdiTable->pfnStandbyGet = (zet_pfnSysmanStandbyGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanStandbyGet"); - pDdiTable->pfnFirmwareGet = (zet_pfnSysmanFirmwareGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFirmwareGet"); - pDdiTable->pfnMemoryGet = (zet_pfnSysmanMemoryGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanMemoryGet"); - pDdiTable->pfnFabricPortGet = (zet_pfnSysmanFabricPortGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFabricPortGet"); - pDdiTable->pfnTemperatureGet = (zet_pfnSysmanTemperatureGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanTemperatureGet"); - pDdiTable->pfnPsuGet = (zet_pfnSysmanPsuGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPsuGet"); - pDdiTable->pfnFanGet = (zet_pfnSysmanFanGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFanGet"); - pDdiTable->pfnLedGet = (zet_pfnSysmanLedGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanLedGet"); - pDdiTable->pfnRasGet = (zet_pfnSysmanRasGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanRasGet"); - pDdiTable->pfnEventGet = (zet_pfnSysmanEventGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanEventGet"); - pDdiTable->pfnDiagnosticsGet = (zet_pfnSysmanDiagnosticsGet_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanDiagnosticsGet"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanPowerProcAddrTable( - ze_api_version_t version, - zet_sysman_power_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanPowerGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPowerGetProperties"); - pDdiTable->pfnGetEnergyCounter = (zet_pfnSysmanPowerGetEnergyCounter_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPowerGetEnergyCounter"); - pDdiTable->pfnGetLimits = (zet_pfnSysmanPowerGetLimits_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPowerGetLimits"); - pDdiTable->pfnSetLimits = (zet_pfnSysmanPowerSetLimits_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPowerSetLimits"); - pDdiTable->pfnGetEnergyThreshold = (zet_pfnSysmanPowerGetEnergyThreshold_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPowerGetEnergyThreshold"); - pDdiTable->pfnSetEnergyThreshold = (zet_pfnSysmanPowerSetEnergyThreshold_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPowerSetEnergyThreshold"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanFrequencyProcAddrTable( - ze_api_version_t version, - zet_sysman_frequency_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanFrequencyGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyGetProperties"); - pDdiTable->pfnGetAvailableClocks = (zet_pfnSysmanFrequencyGetAvailableClocks_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyGetAvailableClocks"); - pDdiTable->pfnGetRange = (zet_pfnSysmanFrequencyGetRange_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyGetRange"); - pDdiTable->pfnSetRange = (zet_pfnSysmanFrequencySetRange_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencySetRange"); - pDdiTable->pfnGetState = (zet_pfnSysmanFrequencyGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyGetState"); - pDdiTable->pfnGetThrottleTime = (zet_pfnSysmanFrequencyGetThrottleTime_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyGetThrottleTime"); - pDdiTable->pfnOcGetCapabilities = (zet_pfnSysmanFrequencyOcGetCapabilities_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyOcGetCapabilities"); - pDdiTable->pfnOcGetConfig = (zet_pfnSysmanFrequencyOcGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyOcGetConfig"); - pDdiTable->pfnOcSetConfig = (zet_pfnSysmanFrequencyOcSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyOcSetConfig"); - pDdiTable->pfnOcGetIccMax = (zet_pfnSysmanFrequencyOcGetIccMax_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyOcGetIccMax"); - pDdiTable->pfnOcSetIccMax = (zet_pfnSysmanFrequencyOcSetIccMax_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyOcSetIccMax"); - pDdiTable->pfnOcGetTjMax = (zet_pfnSysmanFrequencyOcGetTjMax_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyOcGetTjMax"); - pDdiTable->pfnOcSetTjMax = (zet_pfnSysmanFrequencyOcSetTjMax_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFrequencyOcSetTjMax"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanEngineProcAddrTable( - ze_api_version_t version, - zet_sysman_engine_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanEngineGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanEngineGetProperties"); - pDdiTable->pfnGetActivity = (zet_pfnSysmanEngineGetActivity_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanEngineGetActivity"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanStandbyProcAddrTable( - ze_api_version_t version, - zet_sysman_standby_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanStandbyGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanStandbyGetProperties"); - pDdiTable->pfnGetMode = (zet_pfnSysmanStandbyGetMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanStandbyGetMode"); - pDdiTable->pfnSetMode = (zet_pfnSysmanStandbySetMode_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanStandbySetMode"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanFirmwareProcAddrTable( - ze_api_version_t version, - zet_sysman_firmware_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanFirmwareGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFirmwareGetProperties"); - pDdiTable->pfnGetChecksum = (zet_pfnSysmanFirmwareGetChecksum_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFirmwareGetChecksum"); - pDdiTable->pfnFlash = (zet_pfnSysmanFirmwareFlash_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFirmwareFlash"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanMemoryProcAddrTable( - ze_api_version_t version, - zet_sysman_memory_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanMemoryGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanMemoryGetProperties"); - pDdiTable->pfnGetState = (zet_pfnSysmanMemoryGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanMemoryGetState"); - pDdiTable->pfnGetBandwidth = (zet_pfnSysmanMemoryGetBandwidth_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanMemoryGetBandwidth"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanFabricPortProcAddrTable( - ze_api_version_t version, - zet_sysman_fabric_port_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanFabricPortGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFabricPortGetProperties"); - pDdiTable->pfnGetLinkType = (zet_pfnSysmanFabricPortGetLinkType_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFabricPortGetLinkType"); - pDdiTable->pfnGetConfig = (zet_pfnSysmanFabricPortGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFabricPortGetConfig"); - pDdiTable->pfnSetConfig = (zet_pfnSysmanFabricPortSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFabricPortSetConfig"); - pDdiTable->pfnGetState = (zet_pfnSysmanFabricPortGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFabricPortGetState"); - pDdiTable->pfnGetThroughput = (zet_pfnSysmanFabricPortGetThroughput_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFabricPortGetThroughput"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanTemperatureProcAddrTable( - ze_api_version_t version, - zet_sysman_temperature_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanTemperatureGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanTemperatureGetProperties"); - pDdiTable->pfnGetConfig = (zet_pfnSysmanTemperatureGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanTemperatureGetConfig"); - pDdiTable->pfnSetConfig = (zet_pfnSysmanTemperatureSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanTemperatureSetConfig"); - pDdiTable->pfnGetState = (zet_pfnSysmanTemperatureGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanTemperatureGetState"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanPsuProcAddrTable( - ze_api_version_t version, - zet_sysman_psu_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanPsuGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPsuGetProperties"); - pDdiTable->pfnGetState = (zet_pfnSysmanPsuGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanPsuGetState"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanFanProcAddrTable( - ze_api_version_t version, - zet_sysman_fan_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanFanGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFanGetProperties"); - pDdiTable->pfnGetConfig = (zet_pfnSysmanFanGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFanGetConfig"); - pDdiTable->pfnSetConfig = (zet_pfnSysmanFanSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFanSetConfig"); - pDdiTable->pfnGetState = (zet_pfnSysmanFanGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanFanGetState"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanLedProcAddrTable( - ze_api_version_t version, - zet_sysman_led_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanLedGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanLedGetProperties"); - pDdiTable->pfnGetState = (zet_pfnSysmanLedGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanLedGetState"); - pDdiTable->pfnSetState = (zet_pfnSysmanLedSetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanLedSetState"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanRasProcAddrTable( - ze_api_version_t version, - zet_sysman_ras_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanRasGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanRasGetProperties"); - pDdiTable->pfnGetConfig = (zet_pfnSysmanRasGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanRasGetConfig"); - pDdiTable->pfnSetConfig = (zet_pfnSysmanRasSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanRasSetConfig"); - pDdiTable->pfnGetState = (zet_pfnSysmanRasGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanRasGetState"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanDiagnosticsProcAddrTable( - ze_api_version_t version, - zet_sysman_diagnostics_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetProperties = (zet_pfnSysmanDiagnosticsGetProperties_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanDiagnosticsGetProperties"); - pDdiTable->pfnGetTests = (zet_pfnSysmanDiagnosticsGetTests_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanDiagnosticsGetTests"); - pDdiTable->pfnRunTests = (zet_pfnSysmanDiagnosticsRunTests_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanDiagnosticsRunTests"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetGetSysmanEventProcAddrTable( - ze_api_version_t version, - zet_sysman_event_dditable_t *pDdiTable) { - if (nullptr == pDdiTable) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - if (driver_ddiTable.version < version) - return ZE_RESULT_ERROR_UNKNOWN; - if (nullptr == driver_ddiTable.driverLibrary) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - ze_result_t result = ZE_RESULT_SUCCESS; - pDdiTable->pfnGetConfig = (zet_pfnSysmanEventGetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanEventGetConfig"); - pDdiTable->pfnSetConfig = (zet_pfnSysmanEventSetConfig_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanEventSetConfig"); - pDdiTable->pfnGetState = (zet_pfnSysmanEventGetState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanEventGetState"); - pDdiTable->pfnListen = (zet_pfnSysmanEventListen_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetSysmanEventListen"); - return result; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDebugProcAddrTable( ze_api_version_t version, zet_debug_dditable_t *pDdiTable) { @@ -543,15 +225,11 @@ zetGetDebugProcAddrTable( ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnAttach = (zet_pfnDebugAttach_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugAttach"); pDdiTable->pfnDetach = (zet_pfnDebugDetach_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugDetach"); - pDdiTable->pfnGetNumThreads = (zet_pfnDebugGetNumThreads_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugGetNumThreads"); pDdiTable->pfnReadEvent = (zet_pfnDebugReadEvent_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugReadEvent"); pDdiTable->pfnInterrupt = (zet_pfnDebugInterrupt_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugInterrupt"); pDdiTable->pfnResume = (zet_pfnDebugResume_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugResume"); pDdiTable->pfnReadMemory = (zet_pfnDebugReadMemory_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugReadMemory"); pDdiTable->pfnWriteMemory = (zet_pfnDebugWriteMemory_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugWriteMemory"); - pDdiTable->pfnReadState = (zet_pfnDebugReadState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugReadState"); - pDdiTable->pfnWriteState = (zet_pfnDebugWriteState_t)GET_FUNCTION_PTR(driver_ddiTable.driverLibrary, "zetDebugWriteState"); + return result; } - -} // extern C diff --git a/level_zero/api/tools/zet_driver.cpp b/level_zero/api/tools/zet_driver.cpp deleted file mode 100644 index 590d76d4ad..0000000000 --- a/level_zero/api/tools/zet_driver.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "level_zero/tools/source/tools_init.h" -#include - -#include "third_party/level_zero/ze_api_ext.h" - -#include - -extern "C" { - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetInit( - ze_init_flag_t flags) { - return L0::ToolsInit::get()->initTools(flags); -} - -} // extern C diff --git a/level_zero/api/tools/zet_metric.cpp b/level_zero/api/tools/zet_metric.cpp index 7ffe43ed2d..8ea7167df9 100644 --- a/level_zero/api/tools/zet_metric.cpp +++ b/level_zero/api/tools/zet_metric.cpp @@ -10,11 +10,7 @@ #include "level_zero/tools/source/metrics/metric.h" #include -#include "third_party/level_zero/zet_api_ext.h" - -extern "C" { - -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricGroupGet( zet_device_handle_t hDevice, uint32_t *pCount, @@ -22,22 +18,14 @@ zetMetricGroupGet( return L0::metricGroupGet(hDevice, pCount, phMetricGroups); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricGroupGetProperties( zet_metric_group_handle_t hMetricGroup, zet_metric_group_properties_t *pProperties) { - return L0::MetricGroup::fromHandle(hMetricGroup)->getProperties(pProperties); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricGroupGetPropertiesExt( - zet_metric_group_handle_t hMetricGroup, - zet_metric_group_properties_ext_t *pProperties) { - return L0::MetricGroup::fromHandle(hMetricGroup)->getPropertiesExt(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricGet( zet_metric_group_handle_t hMetricGroup, uint32_t *pCount, @@ -45,32 +33,15 @@ zetMetricGet( return L0::MetricGroup::fromHandle(hMetricGroup)->getMetric(pCount, phMetrics); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricGetProperties( zet_metric_handle_t hMetric, zet_metric_properties_t *pProperties) { return L0::Metric::fromHandle(hMetric)->getProperties(pProperties); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricGetPropertiesExt( - zet_metric_handle_t hMetric, - zet_metric_properties_ext_t *pProperties) { - return L0::Metric::fromHandle(hMetric)->getPropertiesExt(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricGroupCalculateMetricValues( - zet_metric_group_handle_t hMetricGroup, - size_t rawDataSize, - const uint8_t *pRawData, - uint32_t *pMetricValueCount, - zet_typed_value_t *pMetricValues) { - return L0::MetricGroup::fromHandle(hMetricGroup)->calculateMetricValues(ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawDataSize, pRawData, pMetricValueCount, pMetricValues); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricGroupCalculateMetricValuesExt( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, @@ -80,15 +51,7 @@ zetMetricGroupCalculateMetricValuesExt( return L0::MetricGroup::fromHandle(hMetricGroup)->calculateMetricValues(type, rawDataSize, pRawData, pMetricValueCount, pMetricValues); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetDeviceActivateMetricGroups( - zet_device_handle_t hDevice, - uint32_t count, - zet_metric_group_handle_t *phMetricGroups) { - return L0::Device::fromHandle(hDevice)->activateMetricGroups(count, phMetricGroups); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetContextActivateMetricGroups( zet_context_handle_t hContext, zet_device_handle_t hDevice, @@ -97,39 +60,6 @@ zetContextActivateMetricGroups( return L0::Context::fromHandle(hContext)->activateMetricGroups(hDevice, count, phMetricGroups); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricTracerOpen( - zet_device_handle_t hDevice, - zet_metric_group_handle_t hMetricGroup, - zet_metric_tracer_desc_t *pDesc, - ze_event_handle_t hNotificationEvent, - zet_metric_tracer_handle_t *phMetricTracer) { - return L0::metricTracerOpen(hDevice, hMetricGroup, pDesc, hNotificationEvent, phMetricTracer); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetCommandListAppendMetricTracerMarker( - ze_command_list_handle_t hCommandList, - zet_metric_tracer_handle_t hMetricTracer, - uint32_t value) { - return L0::CommandList::fromHandle(hCommandList)->appendMetricTracerMarker(hMetricTracer, value); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricTracerClose( - zet_metric_tracer_handle_t hMetricTracer) { - return L0::MetricTracer::fromHandle(hMetricTracer)->close(); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricTracerReadData( - zet_metric_tracer_handle_t hMetricTracer, - uint32_t maxReportCount, - size_t *pRawDataSize, - uint8_t *pRawData) { - return L0::MetricTracer::fromHandle(hMetricTracer)->readData(maxReportCount, pRawDataSize, pRawData); -} - ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricStreamerOpen( zet_context_handle_t hContext, @@ -164,32 +94,23 @@ zetMetricStreamerReadData( return L0::MetricStreamer::fromHandle(hMetricStreamer)->readData(maxReportCount, pRawDataSize, pRawData); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricQueryPoolCreate( + zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t *desc, zet_metric_query_pool_handle_t *phMetricQueryPool) { - return L0::metricQueryPoolCreate(hDevice, hMetricGroup, desc, phMetricQueryPool); + return L0::metricQueryPoolCreate(hContext, hDevice, hMetricGroup, desc, phMetricQueryPool); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricQueryPoolCreateExt( - zet_context_handle_t hContext, - zet_device_handle_t hDevice, - zet_metric_group_handle_t hMetricGroup, - const zet_metric_query_pool_desc_ext_t *desc, - zet_metric_query_pool_handle_t *phMetricQueryPool) { - return L0::metricQueryPoolCreateExt(hContext, hDevice, hMetricGroup, desc, phMetricQueryPool); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricQueryPoolDestroy( zet_metric_query_pool_handle_t hMetricQueryPool) { return L0::MetricQueryPool::fromHandle(hMetricQueryPool)->destroy(); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricQueryCreate( zet_metric_query_pool_handle_t hMetricQueryPool, uint32_t index, @@ -197,35 +118,27 @@ zetMetricQueryCreate( return L0::MetricQueryPool::fromHandle(hMetricQueryPool)->createMetricQuery(index, phMetricQuery); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricQueryDestroy( zet_metric_query_handle_t hMetricQuery) { return L0::MetricQuery::fromHandle(hMetricQuery)->destroy(); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricQueryReset( zet_metric_query_handle_t hMetricQuery) { return L0::MetricQuery::fromHandle(hMetricQuery)->reset(); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetCommandListAppendMetricQueryBegin( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery) { return L0::CommandList::fromHandle(hCommandList)->appendMetricQueryBegin(hMetricQuery); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetCommandListAppendMetricQueryEnd( - zet_command_list_handle_t hCommandList, - zet_metric_query_handle_t hMetricQuery, - ze_event_handle_t hCompletionEvent) { - return L0::CommandList::fromHandle(hCommandList)->appendMetricQueryEnd(hMetricQuery, hCompletionEvent, 0, nullptr); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetCommandListAppendMetricQueryEndExt( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent, @@ -234,18 +147,16 @@ zetCommandListAppendMetricQueryEndExt( return L0::CommandList::fromHandle(hCommandList)->appendMetricQueryEnd(hMetricQuery, hSignalEvent, numWaitEvents, phWaitEvents); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetCommandListAppendMetricMemoryBarrier( zet_command_list_handle_t hCommandList) { return L0::CommandList::fromHandle(hCommandList)->appendMetricMemoryBarrier(); } -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetMetricQueryGetData( zet_metric_query_handle_t hMetricQuery, size_t *pRawDataSize, uint8_t *pRawData) { return L0::MetricQuery::fromHandle(hMetricQuery)->getData(pRawDataSize, pRawData); } - -} // extern C diff --git a/level_zero/api/tools/zet_module.cpp b/level_zero/api/tools/zet_module.cpp index 8af06f192e..29da415786 100644 --- a/level_zero/api/tools/zet_module.cpp +++ b/level_zero/api/tools/zet_module.cpp @@ -8,11 +8,7 @@ #include "level_zero/core/source/module/module.h" #include -#include "third_party/level_zero/zet_api_ext.h" - -extern "C" { - -ZE_APIEXPORT ze_result_t ZE_APICALL +ZE_DLLEXPORT ze_result_t ZE_APICALL zetModuleGetDebugInfo( zet_module_handle_t hModule, zet_module_debug_info_format_t format, @@ -22,10 +18,8 @@ zetModuleGetDebugInfo( } ZE_APIEXPORT ze_result_t ZE_APICALL -zetKernelGetProfileInfoExt( +zetKernelGetProfileInfo( zet_kernel_handle_t hKernel, zet_profile_properties_t *pProfileProperties) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - -} // extern C diff --git a/level_zero/api/tools/zet_sysman.cpp b/level_zero/api/tools/zet_sysman.cpp deleted file mode 100644 index 711152d6d2..0000000000 --- a/level_zero/api/tools/zet_sysman.cpp +++ /dev/null @@ -1,1405 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include - -#include "sysman/sysman.h" -#include "third_party/level_zero/zes_api_ext.h" - -extern "C" { - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanGet( - zet_device_handle_t hDevice, - zet_sysman_version_t version, - zet_sysman_handle_t *phSysman) { - return L0::SysmanHandleContext::sysmanGet(hDevice, phSysman); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceGetProperties( - zes_device_handle_t hDevice, - zes_device_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanDeviceGetProperties( - zet_sysman_handle_t hSysman, - zet_sysman_properties_t *pProperties) { - return L0::Sysman::fromHandle(hSysman)->deviceGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceGetState( - zes_device_handle_t hDevice, - zes_device_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumSchedulers( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_sched_handle_t *phScheduler) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerGetProperties( - zes_sched_handle_t hScheduler, - zes_sched_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerGetCurrentMode( - zes_sched_handle_t hScheduler, - zes_sched_mode_t *pMode) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanSchedulerGetCurrentMode( - zet_sysman_handle_t hSysman, - zet_sched_mode_t *pMode) { - return L0::Sysman::fromHandle(hSysman)->schedulerGetCurrentMode(pMode); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerGetTimeoutModeProperties( - zes_sched_handle_t hScheduler, - ze_bool_t getDefaults, - zes_sched_timeout_properties_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanSchedulerGetTimeoutModeProperties( - zet_sysman_handle_t hSysman, - ze_bool_t getDefaults, - zet_sched_timeout_properties_t *pConfig) { - return L0::Sysman::fromHandle(hSysman)->schedulerGetTimeoutModeProperties(getDefaults, pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerGetTimesliceModeProperties( - zes_sched_handle_t hScheduler, - ze_bool_t getDefaults, - zes_sched_timeslice_properties_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanSchedulerGetTimesliceModeProperties( - zet_sysman_handle_t hSysman, - ze_bool_t getDefaults, - zet_sched_timeslice_properties_t *pConfig) { - return L0::Sysman::fromHandle(hSysman)->schedulerGetTimesliceModeProperties(getDefaults, pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerSetTimeoutMode( - zes_sched_handle_t hScheduler, - zes_sched_timeout_properties_t *pProperties, - ze_bool_t *pNeedReload) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanSchedulerSetTimeoutMode( - zet_sysman_handle_t hSysman, - zet_sched_timeout_properties_t *pProperties, - ze_bool_t *pNeedReboot) { - return L0::Sysman::fromHandle(hSysman)->schedulerSetTimeoutMode(pProperties, pNeedReboot); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerSetTimesliceMode( - zes_sched_handle_t hScheduler, - zes_sched_timeslice_properties_t *pProperties, - ze_bool_t *pNeedReload) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanSchedulerSetTimesliceMode( - zet_sysman_handle_t hSysman, - zet_sched_timeslice_properties_t *pProperties, - ze_bool_t *pNeedReboot) { - return L0::Sysman::fromHandle(hSysman)->schedulerSetTimesliceMode(pProperties, pNeedReboot); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerSetExclusiveMode( - zes_sched_handle_t hScheduler, - ze_bool_t *pNeedReload) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanSchedulerSetExclusiveMode( - zet_sysman_handle_t hSysman, - ze_bool_t *pNeedReboot) { - return L0::Sysman::fromHandle(hSysman)->schedulerSetExclusiveMode(pNeedReboot); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerSetComputeUnitDebugMode( - zes_sched_handle_t hScheduler, - ze_bool_t *pNeedReload) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanSchedulerSetComputeUnitDebugMode( - zet_sysman_handle_t hSysman, - ze_bool_t *pNeedReboot) { - return L0::Sysman::fromHandle(hSysman)->schedulerSetComputeUnitDebugMode(pNeedReboot); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceProcessesGetState( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_process_state_t *pProcesses) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanProcessesGetState( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_process_state_t *pProcesses) { - return L0::Sysman::fromHandle(hSysman)->processesGetState(pCount, pProcesses); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceReset( - zes_device_handle_t hDevice, - ze_bool_t force) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanDeviceReset( - zet_sysman_handle_t hSysman) { - return L0::Sysman::fromHandle(hSysman)->deviceReset(); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanDeviceGetRepairStatus( - zet_sysman_handle_t hSysman, - zet_repair_status_t *pRepairStatus) { - return L0::Sysman::fromHandle(hSysman)->deviceGetRepairStatus(pRepairStatus); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDevicePciGetProperties( - zes_device_handle_t hDevice, - zes_pci_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPciGetProperties( - zet_sysman_handle_t hSysman, - zet_pci_properties_t *pProperties) { - return L0::Sysman::fromHandle(hSysman)->pciGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDevicePciGetState( - zes_device_handle_t hDevice, - zes_pci_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPciGetState( - zet_sysman_handle_t hSysman, - zet_pci_state_t *pState) { - return L0::Sysman::fromHandle(hSysman)->pciGetState(pState); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDevicePciGetBars( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_pci_bar_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPciGetBars( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_pci_bar_properties_t *pProperties) { - return L0::Sysman::fromHandle(hSysman)->pciGetBars(pCount, pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDevicePciGetStats( - zes_device_handle_t hDevice, - zes_pci_stats_t *pStats) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPciGetStats( - zet_sysman_handle_t hSysman, - zet_pci_stats_t *pStats) { - return L0::Sysman::fromHandle(hSysman)->pciGetStats(pStats); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumPowerDomains( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_pwr_handle_t *phPower) { - return L0::SysmanDevice::fromHandle(hDevice)->powerGet(pCount, phPower); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPowerGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_pwr_handle_t *phPower) { - return L0::Sysman::fromHandle(hSysman)->powerGet(pCount, phPower); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerGetProperties( - zes_pwr_handle_t hPower, - zes_power_properties_t *pProperties) { - return L0::Power::fromHandle(hPower)->powerGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPowerGetProperties( - zet_sysman_pwr_handle_t hPower, - zet_power_properties_t *pProperties) { - return L0::Power::fromHandle(hPower)->powerGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerGetEnergyCounter( - zes_pwr_handle_t hPower, - zes_power_energy_counter_t *pEnergy) { - return L0::Power::fromHandle(hPower)->powerGetEnergyCounter(pEnergy); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPowerGetEnergyCounter( - zet_sysman_pwr_handle_t hPower, - zet_power_energy_counter_t *pEnergy) { - return L0::Power::fromHandle(hPower)->powerGetEnergyCounter(pEnergy); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerGetLimits( - zes_pwr_handle_t hPower, - zes_power_sustained_limit_t *pSustained, - zes_power_burst_limit_t *pBurst, - zes_power_peak_limit_t *pPeak) { - return L0::Power::fromHandle(hPower)->powerGetLimits(pSustained, pBurst, pPeak); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPowerGetLimits( - zet_sysman_pwr_handle_t hPower, - zet_power_sustained_limit_t *pSustained, - zet_power_burst_limit_t *pBurst, - zet_power_peak_limit_t *pPeak) { - return L0::Power::fromHandle(hPower)->powerGetLimits(pSustained, pBurst, pPeak); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerSetLimits( - zes_pwr_handle_t hPower, - const zes_power_sustained_limit_t *pSustained, - const zes_power_burst_limit_t *pBurst, - const zes_power_peak_limit_t *pPeak) { - return L0::Power::fromHandle(hPower)->powerSetLimits(pSustained, pBurst, pPeak); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPowerSetLimits( - zet_sysman_pwr_handle_t hPower, - const zet_power_sustained_limit_t *pSustained, - const zet_power_burst_limit_t *pBurst, - const zet_power_peak_limit_t *pPeak) { - return L0::Power::fromHandle(hPower)->powerSetLimits(pSustained, pBurst, pPeak); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerGetEnergyThreshold( - zes_pwr_handle_t hPower, - zes_energy_threshold_t *pThreshold) { - return L0::Power::fromHandle(hPower)->powerGetEnergyThreshold(pThreshold); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPowerGetEnergyThreshold( - zet_sysman_pwr_handle_t hPower, - zet_energy_threshold_t *pThreshold) { - return L0::Power::fromHandle(hPower)->powerGetEnergyThreshold(pThreshold); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerSetEnergyThreshold( - zes_pwr_handle_t hPower, - double threshold) { - return L0::Power::fromHandle(hPower)->powerSetEnergyThreshold(threshold); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPowerSetEnergyThreshold( - zet_sysman_pwr_handle_t hPower, - double threshold) { - return L0::Power::fromHandle(hPower)->powerSetEnergyThreshold(threshold); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumFrequencyDomains( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_freq_handle_t *phFrequency) { - return L0::SysmanDevice::fromHandle(hDevice)->frequencyGet(pCount, phFrequency); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_freq_handle_t *phFrequency) { - return L0::Sysman::fromHandle(hSysman)->frequencyGet(pCount, phFrequency); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetProperties( - zes_freq_handle_t hFrequency, - zes_freq_properties_t *pProperties) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyGetProperties( - zet_sysman_freq_handle_t hFrequency, - zet_freq_properties_t *pProperties) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetAvailableClocks( - zes_freq_handle_t hFrequency, - uint32_t *pCount, - double *phFrequency) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetAvailableClocks(pCount, phFrequency); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyGetAvailableClocks( - zet_sysman_freq_handle_t hFrequency, - uint32_t *pCount, - double *phFrequency) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetAvailableClocks(pCount, phFrequency); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetRange( - zes_freq_handle_t hFrequency, - zes_freq_range_t *pLimits) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetRange(pLimits); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyGetRange( - zet_sysman_freq_handle_t hFrequency, - zet_freq_range_t *pLimits) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetRange(pLimits); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencySetRange( - zes_freq_handle_t hFrequency, - const zes_freq_range_t *pLimits) { - return L0::Frequency::fromHandle(hFrequency)->frequencySetRange(pLimits); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencySetRange( - zet_sysman_freq_handle_t hFrequency, - const zet_freq_range_t *pLimits) { - return L0::Frequency::fromHandle(hFrequency)->frequencySetRange(pLimits); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetState( - zes_freq_handle_t hFrequency, - zes_freq_state_t *pState) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetState(pState); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyGetState( - zet_sysman_freq_handle_t hFrequency, - zet_freq_state_t *pState) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetState(pState); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetThrottleTime( - zes_freq_handle_t hFrequency, - zes_freq_throttle_time_t *pThrottleTime) { - return L0::Frequency::fromHandle(hFrequency)->frequencyGetThrottleTime(pThrottleTime); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyGetThrottleTime( - zet_sysman_freq_handle_t hFrequency, - zet_freq_throttle_time_t *pThrottleTime) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetFrequencyTarget( - zes_freq_handle_t hFrequency, - double *pCurrentOcFrequency) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetFrequencyTarget( - zes_freq_handle_t hFrequency, - double currentOcFrequency) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetVoltageTarget( - zes_freq_handle_t hFrequency, - double *pCurrentVoltageTarget, - double *pCurrentVoltageOffset) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetVoltageTarget( - zes_freq_handle_t hFrequency, - double currentVoltageTarget, - double currentVoltageOffset) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetMode( - zes_freq_handle_t hFrequency, - zes_oc_mode_t currentOcMode) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetMode( - zes_freq_handle_t hFrequency, - zes_oc_mode_t *pCurrentOcMode) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetCapabilities( - zes_freq_handle_t hFrequency, - zes_oc_capabilities_t *pOcCapabilities) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyOcGetCapabilities( - zet_sysman_freq_handle_t hFrequency, - zet_oc_capabilities_t *pOcCapabilities) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyOcGetConfig( - zet_sysman_freq_handle_t hFrequency, - zet_oc_config_t *pOcConfiguration) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyOcSetConfig( - zet_sysman_freq_handle_t hFrequency, - zet_oc_config_t *pOcConfiguration, - ze_bool_t *pDeviceRestart) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetIccMax( - zes_freq_handle_t hFrequency, - double *pOcIccMax) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyOcGetIccMax( - zet_sysman_freq_handle_t hFrequency, - double *pOcIccMax) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetIccMax( - zes_freq_handle_t hFrequency, - double ocIccMax) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyOcSetIccMax( - zet_sysman_freq_handle_t hFrequency, - double ocIccMax) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetTjMax( - zes_freq_handle_t hFrequency, - double *pOcTjMax) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyOcGetTjMax( - zet_sysman_freq_handle_t hFrequency, - double *pOcTjMax) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetTjMax( - zes_freq_handle_t hFrequency, - double ocTjMax) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFrequencyOcSetTjMax( - zet_sysman_freq_handle_t hFrequency, - double ocTjMax) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumEngineGroups( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_engine_handle_t *phEngine) { - return L0::SysmanDevice::fromHandle(hDevice)->engineGet(pCount, phEngine); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanEngineGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_engine_handle_t *phEngine) { - return L0::Sysman::fromHandle(hSysman)->engineGet(pCount, phEngine); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesEngineGetProperties( - zes_engine_handle_t hEngine, - zes_engine_properties_t *pProperties) { - return L0::Engine::fromHandle(hEngine)->engineGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanEngineGetProperties( - zet_sysman_engine_handle_t hEngine, - zet_engine_properties_t *pProperties) { - return L0::Engine::fromHandle(hEngine)->engineGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesEngineGetActivity( - zes_engine_handle_t hEngine, - zes_engine_stats_t *pStats) { - return L0::Engine::fromHandle(hEngine)->engineGetActivity(pStats); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanEngineGetActivity( - zet_sysman_engine_handle_t hEngine, - zet_engine_stats_t *pStats) { - return L0::Engine::fromHandle(hEngine)->engineGetActivity(pStats); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumStandbyDomains( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_standby_handle_t *phStandby) { - return L0::SysmanDevice::fromHandle(hDevice)->standbyGet(pCount, phStandby); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanStandbyGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_standby_handle_t *phStandby) { - return L0::Sysman::fromHandle(hSysman)->standbyGet(pCount, phStandby); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesStandbyGetProperties( - zes_standby_handle_t hStandby, - zes_standby_properties_t *pProperties) { - return L0::Standby::fromHandle(hStandby)->standbyGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanStandbyGetProperties( - zet_sysman_standby_handle_t hStandby, - zet_standby_properties_t *pProperties) { - return L0::Standby::fromHandle(hStandby)->standbyGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesStandbyGetMode( - zes_standby_handle_t hStandby, - zes_standby_promo_mode_t *pMode) { - return L0::Standby::fromHandle(hStandby)->standbyGetMode(pMode); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanStandbyGetMode( - zet_sysman_standby_handle_t hStandby, - zet_standby_promo_mode_t *pMode) { - return L0::Standby::fromHandle(hStandby)->standbyGetMode(pMode); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesStandbySetMode( - zes_standby_handle_t hStandby, - zes_standby_promo_mode_t mode) { - return L0::Standby::fromHandle(hStandby)->standbySetMode(mode); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanStandbySetMode( - zet_sysman_standby_handle_t hStandby, - zet_standby_promo_mode_t mode) { - return L0::Standby::fromHandle(hStandby)->standbySetMode(mode); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumFirmwares( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_firmware_handle_t *phFirmware) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFirmwareGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_firmware_handle_t *phFirmware) { - return L0::Sysman::fromHandle(hSysman)->firmwareGet(pCount, phFirmware); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFirmwareGetProperties( - zes_firmware_handle_t hFirmware, - zes_firmware_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFirmwareGetProperties( - zet_sysman_firmware_handle_t hFirmware, - zet_firmware_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFirmwareGetChecksum( - zet_sysman_firmware_handle_t hFirmware, - uint32_t *pChecksum) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFirmwareFlash( - zes_firmware_handle_t hFirmware, - void *pImage, - uint32_t size) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFirmwareFlash( - zet_sysman_firmware_handle_t hFirmware, - void *pImage, - uint32_t size) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumMemoryModules( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_mem_handle_t *phMemory) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanMemoryGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_mem_handle_t *phMemory) { - return L0::Sysman::fromHandle(hSysman)->memoryGet(pCount, phMemory); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesMemoryGetProperties( - zes_mem_handle_t hMemory, - zes_mem_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanMemoryGetProperties( - zet_sysman_mem_handle_t hMemory, - zet_mem_properties_t *pProperties) { - return L0::Memory::fromHandle(hMemory)->memoryGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesMemoryGetState( - zes_mem_handle_t hMemory, - zes_mem_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanMemoryGetState( - zet_sysman_mem_handle_t hMemory, - zet_mem_state_t *pState) { - return L0::Memory::fromHandle(hMemory)->memoryGetState(pState); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesMemoryGetBandwidth( - zes_mem_handle_t hMemory, - zes_mem_bandwidth_t *pBandwidth) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanMemoryGetBandwidth( - zet_sysman_mem_handle_t hMemory, - zet_mem_bandwidth_t *pBandwidth) { - return L0::Memory::fromHandle(hMemory)->memoryGetBandwidth(pBandwidth); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumFabricPorts( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_fabric_port_handle_t *phPort) { - return L0::SysmanDevice::fromHandle(hDevice)->fabricPortGet(pCount, phPort); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFabricPortGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_fabric_port_handle_t *phPort) { - return L0::Sysman::fromHandle(hSysman)->fabricPortGet(pCount, phPort); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetProperties( - zes_fabric_port_handle_t hPort, - zes_fabric_port_properties_t *pProperties) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFabricPortGetProperties( - zet_sysman_fabric_port_handle_t hPort, - zet_fabric_port_properties_t *pProperties) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetLinkType( - zes_fabric_port_handle_t hPort, - zes_fabric_link_type_t *pLinkType) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetLinkType(pLinkType); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFabricPortGetLinkType( - zet_sysman_fabric_port_handle_t hPort, - ze_bool_t verbose, - zet_fabric_link_type_t *pLinkType) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetLinkType(verbose, pLinkType); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetConfig( - zes_fabric_port_handle_t hPort, - zes_fabric_port_config_t *pConfig) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFabricPortGetConfig( - zet_sysman_fabric_port_handle_t hPort, - zet_fabric_port_config_t *pConfig) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortSetConfig( - zes_fabric_port_handle_t hPort, - const zes_fabric_port_config_t *pConfig) { - return L0::FabricPort::fromHandle(hPort)->fabricPortSetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFabricPortSetConfig( - zet_sysman_fabric_port_handle_t hPort, - const zet_fabric_port_config_t *pConfig) { - return L0::FabricPort::fromHandle(hPort)->fabricPortSetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetState( - zes_fabric_port_handle_t hPort, - zes_fabric_port_state_t *pState) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetState(pState); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFabricPortGetState( - zet_sysman_fabric_port_handle_t hPort, - zet_fabric_port_state_t *pState) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetState(pState); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetThroughput( - zes_fabric_port_handle_t hPort, - zes_fabric_port_throughput_t *pThroughput) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetThroughput(pThroughput); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFabricPortGetThroughput( - zet_sysman_fabric_port_handle_t hPort, - zet_fabric_port_throughput_t *pThroughput) { - return L0::FabricPort::fromHandle(hPort)->fabricPortGetThroughput(pThroughput); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumTemperatureSensors( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_temp_handle_t *phTemperature) { - return L0::SysmanDevice::fromHandle(hDevice)->temperatureGet(pCount, phTemperature); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanTemperatureGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_temp_handle_t *phTemperature) { - return L0::Sysman::fromHandle(hSysman)->temperatureGet(pCount, phTemperature); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesTemperatureGetProperties( - zes_temp_handle_t hTemperature, - zes_temp_properties_t *pProperties) { - return L0::Temperature::fromHandle(hTemperature)->temperatureGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanTemperatureGetProperties( - zet_sysman_temp_handle_t hTemperature, - zet_temp_properties_t *pProperties) { - return L0::Temperature::fromHandle(hTemperature)->temperatureGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesTemperatureGetConfig( - zes_temp_handle_t hTemperature, - zes_temp_config_t *pConfig) { - return L0::Temperature::fromHandle(hTemperature)->temperatureGetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanTemperatureGetConfig( - zet_sysman_temp_handle_t hTemperature, - zet_temp_config_t *pConfig) { - return L0::Temperature::fromHandle(hTemperature)->temperatureGetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesTemperatureSetConfig( - zes_temp_handle_t hTemperature, - const zes_temp_config_t *pConfig) { - return L0::Temperature::fromHandle(hTemperature)->temperatureSetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanTemperatureSetConfig( - zet_sysman_temp_handle_t hTemperature, - const zet_temp_config_t *pConfig) { - return L0::Temperature::fromHandle(hTemperature)->temperatureSetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesTemperatureGetState( - zes_temp_handle_t hTemperature, - double *pTemperature) { - return L0::Temperature::fromHandle(hTemperature)->temperatureGetState(pTemperature); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanTemperatureGetState( - zet_sysman_temp_handle_t hTemperature, - double *pTemperature) { - return L0::Temperature::fromHandle(hTemperature)->temperatureGetState(pTemperature); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumPsus( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_psu_handle_t *phPsu) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPsuGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_psu_handle_t *phPsu) { - return L0::Sysman::fromHandle(hSysman)->psuGet(pCount, phPsu); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPsuGetProperties( - zes_psu_handle_t hPsu, - zes_psu_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPsuGetProperties( - zet_sysman_psu_handle_t hPsu, - zet_psu_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPsuGetState( - zes_psu_handle_t hPsu, - zes_psu_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanPsuGetState( - zet_sysman_psu_handle_t hPsu, - zet_psu_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumFans( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_fan_handle_t *phFan) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFanGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_fan_handle_t *phFan) { - return L0::Sysman::fromHandle(hSysman)->fanGet(pCount, phFan); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanGetProperties( - zes_fan_handle_t hFan, - zes_fan_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFanGetProperties( - zet_sysman_fan_handle_t hFan, - zet_fan_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanGetConfig( - zes_fan_handle_t hFan, - zes_fan_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFanGetConfig( - zet_sysman_fan_handle_t hFan, - zet_fan_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanSetDefaultMode( - zes_fan_handle_t hFan) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanSetFixedSpeedMode( - zes_fan_handle_t hFan, - const zes_fan_speed_t *speed) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanSetSpeedTableMode( - zes_fan_handle_t hFan, - const zes_fan_speed_table_t *speedTable) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFanSetConfig( - zet_sysman_fan_handle_t hFan, - const zet_fan_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanGetState( - zes_fan_handle_t hFan, - zes_fan_speed_units_t units, - int32_t *pSpeed) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanFanGetState( - zet_sysman_fan_handle_t hFan, - zet_fan_speed_units_t units, - uint32_t *pSpeed) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumLeds( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_led_handle_t *phLed) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanLedGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_led_handle_t *phLed) { - return L0::Sysman::fromHandle(hSysman)->ledGet(pCount, phLed); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesLedGetProperties( - zes_led_handle_t hLed, - zes_led_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanLedGetProperties( - zet_sysman_led_handle_t hLed, - zet_led_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesLedGetState( - zes_led_handle_t hLed, - zes_led_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanLedGetState( - zet_sysman_led_handle_t hLed, - zet_led_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesLedSetState( - zes_led_handle_t hLed, - ze_bool_t enable) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanLedSetState( - zet_sysman_led_handle_t hLed, - const zet_led_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesLedSetColor( - zes_led_handle_t hLed, - const zes_led_color_t *pColor) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumRasErrorSets( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_ras_handle_t *phRas) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanRasGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_ras_handle_t *phRas) { - return L0::Sysman::fromHandle(hSysman)->rasGet(pCount, phRas); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesRasGetProperties( - zes_ras_handle_t hRas, - zes_ras_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanRasGetProperties( - zet_sysman_ras_handle_t hRas, - zet_ras_properties_t *pProperties) { - return L0::Ras::fromHandle(hRas)->rasGetProperties(pProperties); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesRasGetConfig( - zes_ras_handle_t hRas, - zes_ras_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanRasGetConfig( - zet_sysman_ras_handle_t hRas, - zet_ras_config_t *pConfig) { - return L0::Ras::fromHandle(hRas)->rasGetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesRasSetConfig( - zes_ras_handle_t hRas, - const zes_ras_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanRasSetConfig( - zet_sysman_ras_handle_t hRas, - const zet_ras_config_t *pConfig) { - return L0::Ras::fromHandle(hRas)->rasSetConfig(pConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesRasGetState( - zes_ras_handle_t hRas, - ze_bool_t clear, - zes_ras_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanRasGetState( - zet_sysman_ras_handle_t hRas, - ze_bool_t clear, - uint64_t *pTotalErrors, - zet_ras_details_t *pDetails) { - return L0::Ras::fromHandle(hRas)->rasGetState(clear, pTotalErrors, pDetails); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEventRegister( - zes_device_handle_t hDevice, - zes_event_type_flags_t events) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanEventGet( - zet_sysman_handle_t hSysman, - zet_sysman_event_handle_t *phEvent) { - return L0::Sysman::fromHandle(hSysman)->eventGet(phEvent); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanEventGetConfig( - zet_sysman_event_handle_t hEvent, - zet_event_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanEventSetConfig( - zet_sysman_event_handle_t hEvent, - const zet_event_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanEventGetState( - zet_sysman_event_handle_t hEvent, - ze_bool_t clear, - uint32_t *pEvents) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDriverEventListen( - ze_driver_handle_t hDriver, - uint32_t timeout, - uint32_t count, - zes_device_handle_t *phDevices, - uint32_t *pNumDeviceEvents, - zes_event_type_flags_t *pEvents) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanEventListen( - ze_driver_handle_t hDriver, - uint32_t timeout, - uint32_t count, - zet_sysman_event_handle_t *phEvents, - uint32_t *pEvents) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumDiagnosticTestSuites( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_diag_handle_t *phDiagnostics) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanDiagnosticsGet( - zet_sysman_handle_t hSysman, - uint32_t *pCount, - zet_sysman_diag_handle_t *phDiagnostics) { - return L0::Sysman::fromHandle(hSysman)->diagnosticsGet(pCount, phDiagnostics); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDiagnosticsGetProperties( - zes_diag_handle_t hDiagnostics, - zes_diag_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanDiagnosticsGetProperties( - zet_sysman_diag_handle_t hDiagnostics, - zet_diag_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDiagnosticsGetTests( - zes_diag_handle_t hDiagnostics, - uint32_t *pCount, - zes_diag_test_t *pTests) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanDiagnosticsGetTests( - zet_sysman_diag_handle_t hDiagnostics, - uint32_t *pCount, - zet_diag_test_t *pTests) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDiagnosticsRunTests( - zes_diag_handle_t hDiagnostics, - uint32_t start, - uint32_t end, - zes_diag_result_t *pResult) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zetSysmanDiagnosticsRunTests( - zet_sysman_diag_handle_t hDiagnostics, - uint32_t start, - uint32_t end, - zet_diag_result_t *pResult) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumPerformanceFactorDomains( - zes_device_handle_t hDevice, - uint32_t *pCount, - zes_perf_handle_t *phPerf) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPerformanceFactorGetProperties( - zes_perf_handle_t hPerf, - zes_perf_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPerformanceFactorGetConfig( - zes_perf_handle_t hPerf, - double *pFactor) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPerformanceFactorSetConfig( - zes_perf_handle_t hPerf, - double factor) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -} // extern C diff --git a/level_zero/core/source/additional_kernel_properties.cpp b/level_zero/core/source/additional_kernel_properties.cpp index cffd09a718..018ccff273 100644 --- a/level_zero/core/source/additional_kernel_properties.cpp +++ b/level_zero/core/source/additional_kernel_properties.cpp @@ -9,6 +9,6 @@ namespace L0 { -void DeviceImp::processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_kernel_properties_t *pKernelProperties) { +void DeviceImp::processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_module_properties_t *pKernelProperties) { } } // namespace L0 diff --git a/level_zero/core/source/builtin/builtin_functions_lib_impl.cpp b/level_zero/core/source/builtin/builtin_functions_lib_impl.cpp index 2573f21245..e60258b1b0 100644 --- a/level_zero/core/source/builtin/builtin_functions_lib_impl.cpp +++ b/level_zero/core/source/builtin/builtin_functions_lib_impl.cpp @@ -139,7 +139,7 @@ std::unique_ptr BuiltinFunctionsLibImpl::l ze_result_t res; std::unique_ptr module; ze_module_handle_t moduleHandle; - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_NATIVE; moduleDesc.pInputModule = reinterpret_cast(&builtInCode.resource[0]); moduleDesc.inputSize = builtInCode.resource.size(); @@ -150,7 +150,7 @@ std::unique_ptr BuiltinFunctionsLibImpl::l std::unique_ptr kernel; ze_kernel_handle_t kernelHandle; - ze_kernel_desc_t kernelDesc = {ZE_KERNEL_DESC_VERSION_CURRENT}; + ze_kernel_desc_t kernelDesc = {}; kernelDesc.pKernelName = builtInName; res = module->createKernel(&kernelDesc, &kernelHandle); DEBUG_BREAK_IF(res != ZE_RESULT_SUCCESS); diff --git a/level_zero/core/source/cmdlist/cmdlist.h b/level_zero/core/source/cmdlist/cmdlist.h index 34ccd9ce0b..f2a22435b2 100644 --- a/level_zero/core/source/cmdlist/cmdlist.h +++ b/level_zero/core/source/cmdlist/cmdlist.h @@ -16,8 +16,6 @@ #include #include -#include "third_party/level_zero/zet_api_ext.h" - #include struct _ze_command_list_handle_t {}; @@ -112,8 +110,6 @@ struct CommandList : _ze_command_list_handle_t { virtual ze_result_t appendMetricMemoryBarrier() = 0; virtual ze_result_t appendMetricStreamerMarker(zet_metric_streamer_handle_t hMetricStreamer, uint32_t value) = 0; - virtual ze_result_t appendMetricTracerMarker(zet_metric_tracer_handle_t hMetricTracer, - uint32_t value) = 0; virtual ze_result_t appendMetricQueryBegin(zet_metric_query_handle_t hMetricQuery) = 0; virtual ze_result_t appendMetricQueryEnd(zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) = 0; diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index c8deae35b2..43d7374a9e 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -61,7 +61,7 @@ ze_result_t CommandListCoreFamily::executeCommandListImmediate(bo this->close(); ze_command_list_handle_t immediateHandle = this->toHandle(); this->cmdQImmediate->executeCommandLists(1, &immediateHandle, nullptr, performMigration); - this->cmdQImmediate->synchronize(std::numeric_limits::max()); + this->cmdQImmediate->synchronize(std::numeric_limits::max()); this->reset(); return ZE_RESULT_SUCCESS; @@ -1301,7 +1301,7 @@ ze_result_t CommandListCoreFamily::appendSignalEvent(ze_event_han NEO::EncodeMiFlushDW::programMiFlushDw(*commandContainer.getCommandStream(), event->getGpuAddress(), Event::STATE_SIGNALED, false, true); } else { NEO::PipeControlArgs args; - args.dcFlushEnable = (event->signalScope == ZE_EVENT_SCOPE_FLAG_NONE) ? false : true; + args.dcFlushEnable = (!event->signalScope) ? false : true; NEO::MemorySynchronizationCommands::addPipeControlAndProgramPostSyncOperation( *commandContainer.getCommandStream(), POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, event->getGpuAddress(), Event::STATE_SIGNALED, @@ -1336,7 +1336,7 @@ ze_result_t CommandListCoreFamily::appendWaitOnEvents(uint32_t nu eventStateClear, COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD); - bool dcFlushEnable = (event->waitScope == ZE_EVENT_SCOPE_FLAG_NONE) ? false : true; + bool dcFlushEnable = (!event->waitScope) ? false : true; if (dcFlushEnable) { if (isCopyOnlyCmdList) { NEO::EncodeMiFlushDW::programMiFlushDw(*commandContainer.getCommandStream(), 0, 0, false, false); @@ -1389,7 +1389,7 @@ void CommandListCoreFamily::appendEventForProfiling(ze_event_hand NEO::EncodeStoreMMIO::encode(*commandContainer.getCommandStream(), GP_THREAD_TIME_REG_ADDRESS_OFFSET_LOW, contextEndAddr); - args.dcFlushEnable = (event->signalScope == ZE_EVENT_SCOPE_FLAG_NONE) ? false : true; + args.dcFlushEnable = (!event->signalScope) ? false : true; if (args.dcFlushEnable) { NEO::MemorySynchronizationCommands::addPipeControl(*commandContainer.getCommandStream(), args); } diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index 0a417203f9..ad52878711 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -40,14 +40,6 @@ ze_result_t CommandListImp::appendMetricStreamerMarker(zet_metric_streamer_handl return MetricQuery::appendStreamerMarker(*this, hMetricStreamer, value); } -ze_result_t CommandListImp::appendMetricTracerMarker(zet_metric_tracer_handle_t hMetricTracer, - uint32_t value) { - - zet_metric_streamer_handle_t hMetricStreamer = reinterpret_cast(hMetricTracer); - - return MetricQuery::appendStreamerMarker(*this, hMetricStreamer, value); -} - ze_result_t CommandListImp::appendMetricQueryBegin(zet_metric_query_handle_t hMetricQuery) { return MetricQuery::fromHandle(hMetricQuery)->appendBegin(*this); } diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.h b/level_zero/core/source/cmdlist/cmdlist_imp.h index 62237a14c2..a5ee745cb6 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.h +++ b/level_zero/core/source/cmdlist/cmdlist_imp.h @@ -20,8 +20,6 @@ struct CommandListImp : CommandList { ze_result_t appendMetricMemoryBarrier() override; ze_result_t appendMetricStreamerMarker(zet_metric_streamer_handle_t hMetricStreamer, uint32_t value) override; - ze_result_t appendMetricTracerMarker(zet_metric_tracer_handle_t hMetricTracer, - uint32_t value) override; ze_result_t appendMetricQueryBegin(zet_metric_query_handle_t hMetricQuery) override; ze_result_t appendMetricQueryEnd(zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; diff --git a/level_zero/core/source/cmdqueue/cmdqueue.cpp b/level_zero/core/source/cmdqueue/cmdqueue.cpp index f01b961d4f..b6cfe03a04 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.cpp +++ b/level_zero/core/source/cmdqueue/cmdqueue.cpp @@ -60,15 +60,15 @@ void CommandQueueImp::submitBatchBuffer(size_t offset, NEO::ResidencyContainer & buffers.setCurrentFlushStamp(csr->obtainCurrentFlushStamp()); } -ze_result_t CommandQueueImp::synchronize(uint32_t timeout) { +ze_result_t CommandQueueImp::synchronize(uint64_t timeout) { return synchronizeByPollingForTaskCount(timeout); } -ze_result_t CommandQueueImp::synchronizeByPollingForTaskCount(uint32_t timeout) { +ze_result_t CommandQueueImp::synchronizeByPollingForTaskCount(uint64_t timeout) { UNRECOVERABLE_IF(csr == nullptr); auto taskCountToWait = this->taskCount; - bool enableTimeout = (timeout != std::numeric_limits::max()); + bool enableTimeout = (timeout != std::numeric_limits::max()); csr->waitForCompletionWithTimeout(enableTimeout, timeout, this->taskCount); if (*csr->getTagAddress() < taskCountToWait) { diff --git a/level_zero/core/source/cmdqueue/cmdqueue.h b/level_zero/core/source/cmdqueue/cmdqueue.h index bc457b7eef..3a39a8c985 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue.h +++ b/level_zero/core/source/cmdqueue/cmdqueue.h @@ -8,8 +8,7 @@ #pragma once #include "level_zero/core/source/device/device.h" -#include -#include +#include #include @@ -39,7 +38,7 @@ struct CommandQueue : _ze_command_queue_handle_t { virtual ze_result_t executeCommands(uint32_t numCommands, void *phCommands, ze_fence_handle_t hFence) = 0; - virtual ze_result_t synchronize(uint32_t timeout) = 0; + virtual ze_result_t synchronize(uint64_t timeout) = 0; static CommandQueue *create(uint32_t productFamily, Device *device, NEO::CommandStreamReceiver *csr, const ze_command_queue_desc_t *desc, bool isCopyOnly); diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index 711a1384ab..39c8bcd74f 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -339,7 +339,7 @@ ze_result_t CommandQueueHw::executeCommandLists( csr->makeSurfacePackNonResident(residencyContainer); if (getSynchronousMode() == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS) { - this->synchronize(std::numeric_limits::max()); + this->synchronize(std::numeric_limits::max()); } return ZE_RESULT_SUCCESS; diff --git a/level_zero/core/source/cmdqueue/cmdqueue_imp.h b/level_zero/core/source/cmdqueue/cmdqueue_imp.h index b2eb7ba8af..72399e7f3d 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_imp.h +++ b/level_zero/core/source/cmdqueue/cmdqueue_imp.h @@ -66,7 +66,7 @@ struct CommandQueueImp : public CommandQueue { ze_result_t destroy() override; - ze_result_t synchronize(uint32_t timeout) override; + ze_result_t synchronize(uint64_t timeout) override; void initialize(bool copyOnly); @@ -83,7 +83,7 @@ struct CommandQueueImp : public CommandQueue { protected: void submitBatchBuffer(size_t offset, NEO::ResidencyContainer &residencyContainer, void *endingCmdPtr); - ze_result_t synchronizeByPollingForTaskCount(uint32_t timeout); + ze_result_t synchronizeByPollingForTaskCount(uint64_t timeout); void printFunctionsPrintfOutput(); diff --git a/level_zero/core/source/context/context.h b/level_zero/core/source/context/context.h index 57b9006094..c1b7e37c28 100644 --- a/level_zero/core/source/context/context.h +++ b/level_zero/core/source/context/context.h @@ -9,9 +9,7 @@ #include "level_zero/core/source/driver/driver_handle.h" #include - -#include "third_party/level_zero/ze_api_ext.h" -#include "third_party/level_zero/zet_api_ext.h" +#include struct _ze_context_handle_t { virtual ~_ze_context_handle_t() = default; @@ -25,17 +23,17 @@ struct Context : _ze_context_handle_t { virtual ze_result_t destroy() = 0; virtual ze_result_t getStatus() = 0; virtual DriverHandle *getDriverHandle() = 0; - virtual ze_result_t allocHostMem(ze_host_mem_alloc_flag_t flags, + virtual ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) = 0; virtual ze_result_t allocDeviceMem(ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t flags, + ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) = 0; virtual ze_result_t allocSharedMem(ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t deviceFlags, - ze_host_mem_alloc_flag_t hostFlags, + ze_device_mem_alloc_flags_t deviceFlags, + ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment, void **ptr) = 0; @@ -98,6 +96,15 @@ struct Context : _ze_context_handle_t { size_t size, ze_memory_access_attribute_t *access, size_t *outSize) = 0; + virtual ze_result_t openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc, + ze_event_pool_handle_t *phEventPool) = 0; + virtual ze_result_t createEventPool(const ze_event_pool_desc_t *desc, + uint32_t numDevices, + ze_device_handle_t *phDevices, + ze_event_pool_handle_t *phEventPool) = 0; + virtual ze_result_t createImage(ze_device_handle_t hDevice, + const ze_image_desc_t *desc, + ze_image_handle_t *phImage) = 0; static Context *fromHandle(ze_context_handle_t handle) { return static_cast(handle); } inline ze_context_handle_t toHandle() { return this; } diff --git a/level_zero/core/source/context/context_imp.cpp b/level_zero/core/source/context/context_imp.cpp index c537dd8ddf..432bbcb260 100644 --- a/level_zero/core/source/context/context_imp.cpp +++ b/level_zero/core/source/context/context_imp.cpp @@ -29,7 +29,7 @@ ContextImp::ContextImp(DriverHandle *driverHandle) { this->driverHandle = driverHandle; } -ze_result_t ContextImp::allocHostMem(ze_host_mem_alloc_flag_t flags, +ze_result_t ContextImp::allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) { @@ -41,7 +41,7 @@ ze_result_t ContextImp::allocHostMem(ze_host_mem_alloc_flag_t flags, } ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t flags, + ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) { DEBUG_BREAK_IF(nullptr == this->driverHandle); @@ -53,8 +53,8 @@ ze_result_t ContextImp::allocDeviceMem(ze_device_handle_t hDevice, } ze_result_t ContextImp::allocSharedMem(ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t deviceFlags, - ze_host_mem_alloc_flag_t hostFlags, + ze_device_mem_alloc_flags_t deviceFlags, + ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment, void **ptr) { @@ -100,7 +100,7 @@ ze_result_t ContextImp::openIpcMemHandle(ze_device_handle_t hDevice, DEBUG_BREAK_IF(nullptr == this->driverHandle); return this->driverHandle->openIpcMemHandle(hDevice, handle, - ZE_IPC_MEMORY_FLAG_NONE, + ZE_IPC_MEMORY_FLAG_TBD, ptr); } @@ -203,4 +203,24 @@ ze_result_t ContextImp::getVirtualMemAccessAttribute(const void *ptr, return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } +ze_result_t ContextImp::openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc, + ze_event_pool_handle_t *phEventPool) { + DEBUG_BREAK_IF(nullptr == this->driverHandle); + return this->driverHandle->openEventPoolIpcHandle(hIpc, phEventPool); +} + +ze_result_t ContextImp::createEventPool(const ze_event_pool_desc_t *desc, + uint32_t numDevices, + ze_device_handle_t *phDevices, + ze_event_pool_handle_t *phEventPool) { + DEBUG_BREAK_IF(nullptr == this->driverHandle); + return this->driverHandle->createEventPool(desc, numDevices, phDevices, phEventPool); +} + +ze_result_t ContextImp::createImage(ze_device_handle_t hDevice, + const ze_image_desc_t *desc, + ze_image_handle_t *phImage) { + return L0::Device::fromHandle(hDevice)->createImage(desc, phImage); +} + } // namespace L0 diff --git a/level_zero/core/source/context/context_imp.h b/level_zero/core/source/context/context_imp.h index b508924e2d..0637976263 100644 --- a/level_zero/core/source/context/context_imp.h +++ b/level_zero/core/source/context/context_imp.h @@ -18,17 +18,17 @@ struct ContextImp : Context { ze_result_t destroy() override; ze_result_t getStatus() override; DriverHandle *getDriverHandle() override; - ze_result_t allocHostMem(ze_host_mem_alloc_flag_t flags, + ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) override; ze_result_t allocDeviceMem(ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t flags, + ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) override; ze_result_t allocSharedMem(ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t deviceFlags, - ze_host_mem_alloc_flag_t hostFlags, + ze_device_mem_alloc_flags_t deviceFlags, + ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment, void **ptr) override; @@ -91,6 +91,15 @@ struct ContextImp : Context { size_t size, ze_memory_access_attribute_t *access, size_t *outSize) override; + ze_result_t openEventPoolIpcHandle(ze_ipc_event_pool_handle_t hIpc, + ze_event_pool_handle_t *phEventPool) override; + ze_result_t createEventPool(const ze_event_pool_desc_t *desc, + uint32_t numDevices, + ze_device_handle_t *phDevices, + ze_event_pool_handle_t *phEventPool) override; + ze_result_t createImage(ze_device_handle_t hDevice, + const ze_image_desc_t *desc, + ze_image_handle_t *phImage) override; protected: DriverHandle *driverHandle = nullptr; diff --git a/level_zero/core/source/device/device.h b/level_zero/core/source/device/device.h index 4c398b09c6..6b3d469f18 100644 --- a/level_zero/core/source/device/device.h +++ b/level_zero/core/source/device/device.h @@ -19,8 +19,6 @@ #include #include -#include "third_party/level_zero/ze_api_ext.h" - struct _ze_device_handle_t {}; namespace NEO { class Device; @@ -59,15 +57,15 @@ struct Device : _ze_device_handle_t { virtual ze_result_t getComputeProperties(ze_device_compute_properties_t *pComputeProperties) = 0; virtual ze_result_t getP2PProperties(ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t *pP2PProperties) = 0; - virtual ze_result_t getKernelProperties(ze_device_kernel_properties_t *pKernelProperties) = 0; + virtual ze_result_t getKernelProperties(ze_device_module_properties_t *pKernelProperties) = 0; virtual ze_result_t getMemoryProperties(uint32_t *pCount, ze_device_memory_properties_t *pMemProperties) = 0; virtual ze_result_t getMemoryAccessProperties(ze_device_memory_access_properties_t *pMemAccessProperties) = 0; virtual ze_result_t getProperties(ze_device_properties_t *pDeviceProperties) = 0; virtual ze_result_t getSubDevices(uint32_t *pCount, ze_device_handle_t *phSubdevices) = 0; virtual ze_result_t makeImageResident(ze_image_handle_t hImage) = 0; virtual ze_result_t makeMemoryResident(void *ptr, size_t size) = 0; - virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_t cacheConfig) = 0; - virtual ze_result_t setLastLevelCacheConfig(ze_cache_config_t cacheConfig) = 0; + virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) = 0; + virtual ze_result_t setLastLevelCacheConfig(ze_cache_config_flags_t cacheConfig) = 0; virtual ze_result_t getCacheProperties(ze_device_cache_properties_t *pCacheProperties) = 0; virtual ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) = 0; virtual ze_result_t getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) = 0; diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 52b645f62b..9f7168a5e1 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -86,9 +86,8 @@ ze_result_t DeviceImp::createCommandList(const ze_command_list_desc_t *desc, ze_command_list_handle_t *commandList) { auto productFamily = neoDevice->getHardwareInfo().platform.eProductFamily; bool useBliter = false; - auto ret = isCreatedCommandListCopyOnly(desc, &useBliter, ZE_COMMAND_LIST_FLAG_COPY_ONLY); - if (ret != ZE_RESULT_SUCCESS) { - return ret; + if (desc->commandQueueGroupOrdinal == static_cast(NEO::EngineGroupType::Copy)) { + useBliter = true; } *commandList = CommandList::create(productFamily, this, useBliter); @@ -100,11 +99,9 @@ ze_result_t DeviceImp::createCommandListImmediate(const ze_command_queue_desc_t auto productFamily = neoDevice->getHardwareInfo().platform.eProductFamily; bool useBliter = false; - auto ret = isCreatedCommandListCopyOnly(desc, &useBliter, ZE_COMMAND_QUEUE_FLAG_COPY_ONLY); - if (ret != ZE_RESULT_SUCCESS) { - return ret; + if (desc->ordinal == static_cast(NEO::EngineGroupType::Copy)) { + useBliter = true; } - *phCommandList = CommandList::createImmediate(productFamily, this, desc, false, useBliter); return ZE_RESULT_SUCCESS; @@ -116,27 +113,26 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc, NEO::CommandStreamReceiver *csr = nullptr; bool useBliter = false; - auto ret = isCreatedCommandListCopyOnly(desc, &useBliter, ZE_COMMAND_QUEUE_FLAG_COPY_ONLY); - if (ret != ZE_RESULT_SUCCESS) { - return ret; - } - if (useBliter) { + if (desc->ordinal == static_cast(NEO::EngineGroupType::Copy)) { auto &selectorCopyEngine = this->neoDevice->getDeviceById(0)->getSelectorCopyEngine(); csr = this->neoDevice->getDeviceById(0)->getEngine(NEO::EngineHelpers::getBcsEngineType(neoDevice->getHardwareInfo(), selectorCopyEngine), false).commandStreamReceiver; + useBliter = true; } else { - const auto &hardwareInfo = this->neoDevice->getHardwareInfo(); - auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); - if (desc->ordinal >= NEO::HwHelper::getEnginesCount(this->getNEODevice()->getHardwareInfo())) { + if (desc->ordinal >= static_cast(NEO::EngineGroupType::MaxEngineGroups)) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } - uint32_t engineIndex = hwHelper.getComputeEngineIndexByOrdinal(hardwareInfo, desc->ordinal); - if (this->getNEODevice()->getNumAvailableDevices() > 1) { - csr = this->neoDevice->getDeviceById(0)->getEngine(engineIndex).commandStreamReceiver; + if (desc->index >= this->neoDevice->getDeviceById(0)->getEngineGroups()[desc->ordinal].size()) { + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + } + csr = this->neoDevice->getDeviceById(0)->getEngineGroups()[desc->ordinal][desc->index].commandStreamReceiver; } else { - csr = this->neoDevice->getEngine(engineIndex).commandStreamReceiver; + if (desc->index >= this->neoDevice->getEngineGroups()[desc->ordinal].size()) { + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + } + csr = this->neoDevice->getEngineGroups()[desc->ordinal][desc->index].commandStreamReceiver; } UNRECOVERABLE_IF(csr == nullptr); @@ -266,9 +262,7 @@ ze_result_t DeviceImp::getComputeProperties(ze_device_compute_properties_t *pCom ze_result_t DeviceImp::getP2PProperties(ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t *pP2PProperties) { - pP2PProperties->accessSupported = true; - pP2PProperties->atomicsSupported = false; - + pP2PProperties->flags = 0; return ZE_RESULT_SUCCESS; } @@ -297,28 +291,26 @@ ze_result_t DeviceImp::getMemoryProperties(uint32_t *pCount, ze_device_memory_pr ze_result_t DeviceImp::getMemoryAccessProperties(ze_device_memory_access_properties_t *pMemAccessProperties) { pMemAccessProperties->hostAllocCapabilities = - static_cast(ZE_MEMORY_ACCESS | ZE_MEMORY_ATOMIC_ACCESS); + ZE_MEMORY_ACCESS_CAP_FLAG_RW | ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC; pMemAccessProperties->deviceAllocCapabilities = - static_cast(ZE_MEMORY_ACCESS | ZE_MEMORY_ATOMIC_ACCESS); + ZE_MEMORY_ACCESS_CAP_FLAG_RW | ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC; pMemAccessProperties->sharedSingleDeviceAllocCapabilities = - static_cast(ZE_MEMORY_ACCESS | ZE_MEMORY_ATOMIC_ACCESS); - pMemAccessProperties->sharedCrossDeviceAllocCapabilities = - ze_memory_access_capabilities_t{}; - pMemAccessProperties->sharedSystemAllocCapabilities = - ze_memory_access_capabilities_t{}; + ZE_MEMORY_ACCESS_CAP_FLAG_RW | ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC; + pMemAccessProperties->sharedCrossDeviceAllocCapabilities = 0; + pMemAccessProperties->sharedSystemAllocCapabilities = 0; return ZE_RESULT_SUCCESS; } -static constexpr ze_fp_capabilities_t defaultFpFlags = static_cast(ZE_FP_CAPS_ROUND_TO_NEAREST | - ZE_FP_CAPS_ROUND_TO_ZERO | - ZE_FP_CAPS_ROUND_TO_INF | - ZE_FP_CAPS_INF_NAN | - ZE_FP_CAPS_DENORM | - ZE_FP_CAPS_FMA); +static constexpr ze_device_fp_flags_t defaultFpFlags = static_cast(ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST | + ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO | + ZE_DEVICE_FP_FLAG_ROUND_TO_INF | + ZE_DEVICE_FP_FLAG_INF_NAN | + ZE_DEVICE_FP_FLAG_DENORM | + ZE_DEVICE_FP_FLAG_FMA); -ze_result_t DeviceImp::getKernelProperties(ze_device_kernel_properties_t *pKernelProperties) { - memset(pKernelProperties, 0, sizeof(ze_device_kernel_properties_t)); +ze_result_t DeviceImp::getKernelProperties(ze_device_module_properties_t *pKernelProperties) { + memset(pKernelProperties, 0, sizeof(ze_device_module_properties_t)); const auto &hardwareInfo = this->neoDevice->getHardwareInfo(); const auto &deviceInfo = this->neoDevice->getDeviceInfo(); auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); @@ -336,18 +328,23 @@ ze_result_t DeviceImp::getKernelProperties(ze_device_kernel_properties_t *pKerne return ZE_RESULT_ERROR_UNKNOWN; } - pKernelProperties->fp16Supported = true; - pKernelProperties->int64AtomicsSupported = hardwareInfo.capabilityTable.ftrSupportsInteger64BitAtomics; - pKernelProperties->halfFpCapabilities = defaultFpFlags; + pKernelProperties->flags = ZE_DEVICE_MODULE_FLAG_FP16; + if (hardwareInfo.capabilityTable.ftrSupportsInteger64BitAtomics) { + pKernelProperties->flags |= ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS; + } + pKernelProperties->fp16flags = defaultFpFlags; + pKernelProperties->fp32flags = defaultFpFlags; if (NEO::DebugManager.flags.OverrideDefaultFP64Settings.get() == 1) { - pKernelProperties->fp64Supported = true; - pKernelProperties->singleFpCapabilities = ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT; - pKernelProperties->doubleFpCapabilities = defaultFpFlags; + pKernelProperties->fp64flags = defaultFpFlags | ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT; } else { - pKernelProperties->fp64Supported = hardwareInfo.capabilityTable.ftrSupportsFP64; - pKernelProperties->singleFpCapabilities = hardwareInfo.capabilityTable.ftrSupports64BitMath ? ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT : ZE_FP_CAPS_NONE; - pKernelProperties->doubleFpCapabilities = hardwareInfo.capabilityTable.ftrSupportsFP64 ? defaultFpFlags : ZE_FP_CAPS_NONE; + pKernelProperties->fp64flags = 0; + if (hardwareInfo.capabilityTable.ftrSupportsFP64) { + pKernelProperties->fp64flags |= defaultFpFlags; + if (hardwareInfo.capabilityTable.ftrSupports64BitMath) { + pKernelProperties->fp64flags |= ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT; + } + } } pKernelProperties->nativeKernelSupported.id[0] = 0; @@ -372,6 +369,8 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties) pDeviceProperties->deviceId = hardwareInfo.platform.usDeviceID; + pDeviceProperties->flags = 0u; + uint32_t rootDeviceIndex = this->neoDevice->getRootDeviceIndex(); memset(pDeviceProperties->uuid.id, 0, ZE_MAX_DEVICE_UUID_SIZE); @@ -379,23 +378,13 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties) memcpy_s(pDeviceProperties->uuid.id + sizeof(uint32_t), sizeof(uint32_t), &pDeviceProperties->deviceId, sizeof(pDeviceProperties->deviceId)); memcpy_s(pDeviceProperties->uuid.id + (2 * sizeof(uint32_t)), sizeof(uint32_t), &rootDeviceIndex, sizeof(rootDeviceIndex)); - pDeviceProperties->isSubdevice = isSubdevice; - pDeviceProperties->subdeviceId = isSubdevice ? static_cast(neoDevice)->getSubDeviceIndex() : 0; pDeviceProperties->coreClockRate = deviceInfo.maxClockFrequency; - pDeviceProperties->unifiedMemorySupported = true; - - pDeviceProperties->eccMemorySupported = this->neoDevice->getDeviceInfo().errorCorrectionSupport; - - pDeviceProperties->onDemandPageFaultsSupported = hardwareInfo.capabilityTable.supportsOnDemandPageFaults; - - pDeviceProperties->maxCommandQueues = 1; - - pDeviceProperties->numAsyncComputeEngines = NEO::HwHelper::getEnginesCount(hardwareInfo); - - pDeviceProperties->numAsyncCopyEngines = NEO::HwHelper::getCopyEnginesCount(hardwareInfo); + if (hardwareInfo.capabilityTable.supportsOnDemandPageFaults) { + pDeviceProperties->flags |= ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING; + } pDeviceProperties->maxCommandQueuePriority = 0; @@ -459,29 +448,18 @@ ze_result_t DeviceImp::makeMemoryResident(void *ptr, size_t size) { return changeMemoryOperationStatusToL0ResultType(success); } -ze_result_t DeviceImp::setIntermediateCacheConfig(ze_cache_config_t cacheConfig) { +ze_result_t DeviceImp::setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t DeviceImp::setLastLevelCacheConfig(ze_cache_config_t cacheConfig) { +ze_result_t DeviceImp::setLastLevelCacheConfig(ze_cache_config_flags_t cacheConfig) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t DeviceImp::getCacheProperties(ze_device_cache_properties_t *pCacheProperties) { const auto &hardwareInfo = this->getHwInfo(); - auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); - - pCacheProperties->intermediateCacheControlSupported = false; - - pCacheProperties->intermediateCacheSize = getIntermediateCacheSize(hardwareInfo); - - pCacheProperties->intermediateCachelineSize = 0; - - pCacheProperties->lastLevelCacheSizeControlSupported = hwHelper.isL3Configurable(hardwareInfo); - - pCacheProperties->lastLevelCacheSize = static_cast(hardwareInfo.gtSystemInfo.L3CacheSizeInKb * KB); - - pCacheProperties->lastLevelCachelineSize = this->neoDevice->getDeviceInfo().globalMemCachelineSize; + pCacheProperties->cacheSize = getIntermediateCacheSize(hardwareInfo); + pCacheProperties->flags = 0; return ZE_RESULT_SUCCESS; } @@ -491,9 +469,9 @@ ze_result_t DeviceImp::imageGetProperties(const ze_image_desc_t *desc, const auto &deviceInfo = this->neoDevice->getDeviceInfo(); if (deviceInfo.imageSupport) { - pImageProperties->samplerFilterFlags = ZE_IMAGE_SAMPLER_FILTER_FLAGS_LINEAR; + pImageProperties->samplerFilterFlags = ZE_IMAGE_SAMPLER_FILTER_FLAG_LINEAR; } else { - pImageProperties->samplerFilterFlags = ZE_IMAGE_SAMPLER_FILTER_FLAGS_NONE; + pImageProperties->samplerFilterFlags = 0; } return ZE_RESULT_SUCCESS; @@ -502,7 +480,6 @@ ze_result_t DeviceImp::imageGetProperties(const ze_image_desc_t *desc, ze_result_t DeviceImp::getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) { const auto &deviceInfo = this->neoDevice->getDeviceInfo(); - pDeviceImageProperties->supported = deviceInfo.imageSupport; pDeviceImageProperties->maxImageDims1D = static_cast(deviceInfo.image2DMaxWidth); pDeviceImageProperties->maxImageDims2D = static_cast(deviceInfo.image2DMaxHeight); pDeviceImageProperties->maxImageDims3D = static_cast(deviceInfo.image3DMaxDepth); @@ -567,47 +544,12 @@ ze_result_t DeviceImp::registerCLMemory(cl_context context, cl_mem mem, void **p ze_result_t DeviceImp::registerCLProgram(cl_context context, cl_program program, ze_module_handle_t *phModule) { - NEO::Program *neoProgram = static_cast(program); - - if (neoProgram->getIsSpirV()) { - size_t deviceBinarySize = 0; - if (0 != neoProgram->getInfo(CL_PROGRAM_BINARY_SIZES, sizeof(deviceBinarySize), &deviceBinarySize, nullptr)) { - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - } - - std::vector deviceBinary; - deviceBinary.resize(deviceBinarySize); - auto deviceBinaryPtr = deviceBinary.data(); - if (0 != neoProgram->getInfo(CL_PROGRAM_BINARIES, sizeof(void *), &deviceBinaryPtr, nullptr)) { - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - } - - ze_module_desc_t module_desc; - module_desc.version = ZE_MODULE_DESC_VERSION_CURRENT; - module_desc.format = ZE_MODULE_FORMAT_NATIVE; - module_desc.inputSize = deviceBinarySize; - module_desc.pInputModule = deviceBinary.data(); - module_desc.pBuildFlags = nullptr; - - return createModule(&module_desc, phModule, nullptr); - } else { - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - } + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_result_t DeviceImp::registerCLCommandQueue(cl_context context, cl_command_queue commandQueue, ze_command_queue_handle_t *phCommandQueue) { - ze_command_queue_desc_t desc; - desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT; - desc.flags = ZE_COMMAND_QUEUE_FLAG_NONE; - desc.mode = ZE_COMMAND_QUEUE_MODE_DEFAULT; - desc.priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL; - - auto productFamily = neoDevice->getHardwareInfo().platform.eProductFamily; - auto csr = neoDevice->getDefaultEngine().commandStreamReceiver; - *phCommandQueue = CommandQueue::create(productFamily, this, csr, &desc, false); - - return ZE_RESULT_SUCCESS; + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } const NEO::HardwareInfo &DeviceImp::getHwInfo() const { return neoDevice->getHardwareInfo(); } @@ -684,7 +626,6 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3 if (supportDualStorageSharedMemory) { ze_command_queue_desc_t cmdQueueDesc; - cmdQueueDesc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT; cmdQueueDesc.ordinal = 0; cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS; device->pageFaultCommandList = diff --git a/level_zero/core/source/device/device_imp.h b/level_zero/core/source/device/device_imp.h index 655c201359..363cacd9e3 100644 --- a/level_zero/core/source/device/device_imp.h +++ b/level_zero/core/source/device/device_imp.h @@ -34,15 +34,15 @@ struct DeviceImp : public Device { ze_result_t getComputeProperties(ze_device_compute_properties_t *pComputeProperties) override; ze_result_t getP2PProperties(ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t *pP2PProperties) override; - ze_result_t getKernelProperties(ze_device_kernel_properties_t *pKernelProperties) override; + ze_result_t getKernelProperties(ze_device_module_properties_t *pKernelProperties) override; ze_result_t getMemoryProperties(uint32_t *pCount, ze_device_memory_properties_t *pMemProperties) override; ze_result_t getMemoryAccessProperties(ze_device_memory_access_properties_t *pMemAccessProperties) override; ze_result_t getProperties(ze_device_properties_t *pDeviceProperties) override; ze_result_t getSubDevices(uint32_t *pCount, ze_device_handle_t *phSubdevices) override; ze_result_t makeImageResident(ze_image_handle_t hImage) override; ze_result_t makeMemoryResident(void *ptr, size_t size) override; - ze_result_t setIntermediateCacheConfig(ze_cache_config_t cacheConfig) override; - ze_result_t setLastLevelCacheConfig(ze_cache_config_t cacheConfig) override; + ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) override; + ze_result_t setLastLevelCacheConfig(ze_cache_config_flags_t cacheConfig) override; ze_result_t getCacheProperties(ze_device_cache_properties_t *pCacheProperties) override; ze_result_t imageGetProperties(const ze_image_desc_t *desc, ze_image_properties_t *pImageProperties) override; ze_result_t getDeviceImageProperties(ze_device_image_properties_t *pDeviceImageProperties) override; @@ -73,7 +73,7 @@ struct DeviceImp : public Device { const NEO::DeviceInfo &getDeviceInfo() const override; NEO::Device *getNEODevice() override; void activateMetricGroups() override; - void processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_kernel_properties_t *pKernelProperties); + void processAdditionalKernelProperties(NEO::HwHelper &hwHelper, ze_device_module_properties_t *pKernelProperties); NEO::GraphicsAllocation *getDebugSurface() const override { return debugSurface; } void setDebugSurface(NEO::GraphicsAllocation *debugSurface) { this->debugSurface = debugSurface; }; ~DeviceImp() override; diff --git a/level_zero/core/source/driver/driver.cpp b/level_zero/core/source/driver/driver.cpp index f04d4feb23..f72788cb76 100644 --- a/level_zero/core/source/driver/driver.cpp +++ b/level_zero/core/source/driver/driver.cpp @@ -78,7 +78,7 @@ void DriverImp::initialize(ze_result_t *result) { ze_result_t DriverImp::initStatus(ZE_RESULT_ERROR_UNINITIALIZED); -ze_result_t DriverImp::driverInit(ze_init_flag_t flag) { +ze_result_t DriverImp::driverInit(ze_init_flags_t flags) { std::call_once(initDriverOnce, [this]() { ze_result_t result; this->initialize(&result); @@ -111,6 +111,6 @@ ze_result_t driverHandleGet(uint32_t *pCount, ze_driver_handle_t *phDriverHandle static DriverImp driverImp; Driver *Driver::driver = &driverImp; -ze_result_t init(ze_init_flag_t flag) { return Driver::get()->driverInit(flag); } +ze_result_t init(ze_init_flags_t flags) { return Driver::get()->driverInit(flags); } } // namespace L0 diff --git a/level_zero/core/source/driver/driver.h b/level_zero/core/source/driver/driver.h index 1cfaa3608d..d4d908fcea 100644 --- a/level_zero/core/source/driver/driver.h +++ b/level_zero/core/source/driver/driver.h @@ -13,7 +13,7 @@ namespace L0 { struct Driver { - virtual ze_result_t driverInit(_ze_init_flag_t) = 0; + virtual ze_result_t driverInit(ze_init_flags_t flags) = 0; virtual void initialize(ze_result_t *result) = 0; static Driver *get() { return driver; } virtual ~Driver() = default; @@ -22,7 +22,7 @@ struct Driver { static Driver *driver; }; -ze_result_t init(_ze_init_flag_t); +ze_result_t init(ze_init_flags_t); ze_result_t driverHandleGet(uint32_t *pCount, ze_driver_handle_t *phDrivers); extern uint32_t driverCount; diff --git a/level_zero/core/source/driver/driver_handle.h b/level_zero/core/source/driver/driver_handle.h index 74be0f95f0..f5da3070b2 100644 --- a/level_zero/core/source/driver/driver_handle.h +++ b/level_zero/core/source/driver/driver_handle.h @@ -13,8 +13,6 @@ #include "level_zero/core/source/device/device.h" #include -#include "third_party/level_zero/ze_api_ext.h" - struct _ze_driver_handle_t { virtual ~_ze_driver_handle_t() = default; }; @@ -37,13 +35,13 @@ struct DriverHandle : _ze_driver_handle_t { ze_memory_allocation_properties_t *pMemAllocProperties, ze_device_handle_t *phDevice) = 0; - virtual ze_result_t allocHostMem(ze_host_mem_alloc_flag_t flags, size_t size, size_t alignment, void **ptr) = 0; + virtual ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) = 0; - virtual ze_result_t allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t flags, size_t size, + virtual ze_result_t allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) = 0; - virtual ze_result_t allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t deviceFlags, - ze_host_mem_alloc_flag_t hostFlags, size_t size, size_t alignment, + virtual ze_result_t allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t deviceFlags, + ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment, void **ptr) = 0; virtual ze_result_t freeMem(const void *ptr) = 0; virtual NEO::MemoryManager *getMemoryManager() = 0; diff --git a/level_zero/core/source/driver/driver_handle_imp.cpp b/level_zero/core/source/driver/driver_handle_imp.cpp index 0ebe0f2b70..e294f8acaf 100644 --- a/level_zero/core/source/driver/driver_handle_imp.cpp +++ b/level_zero/core/source/driver/driver_handle_imp.cpp @@ -69,8 +69,8 @@ ze_result_t DriverHandleImp::getProperties(ze_driver_properties_t *properties) { } ze_result_t DriverHandleImp::getIPCProperties(ze_driver_ipc_properties_t *pIPCProperties) { - pIPCProperties->eventsSupported = false; - pIPCProperties->memsSupported = true; + pIPCProperties->flags = ZE_IPC_PROPERTY_FLAG_MEMORY; + return ZE_RESULT_SUCCESS; } diff --git a/level_zero/core/source/driver/driver_handle_imp.h b/level_zero/core/source/driver/driver_handle_imp.h index dee9932161..01fcfe7711 100644 --- a/level_zero/core/source/driver/driver_handle_imp.h +++ b/level_zero/core/source/driver/driver_handle_imp.h @@ -10,6 +10,7 @@ #include "shared/source/os_interface/os_library.h" #include "level_zero/core/source/driver/driver_handle.h" +#include "level_zero/core/source/event/event.h" #include "level_zero/core/source/get_extension_function_lookup_map.h" namespace L0 { @@ -28,13 +29,13 @@ struct DriverHandleImp : public DriverHandle { ze_memory_allocation_properties_t *pMemAllocProperties, ze_device_handle_t *phDevice) override; - ze_result_t allocHostMem(ze_host_mem_alloc_flag_t flags, size_t size, size_t alignment, void **ptr) override; + ze_result_t allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) override; - ze_result_t allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t flags, size_t size, + ze_result_t allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) override; - ze_result_t allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t deviceFlags, - ze_host_mem_alloc_flag_t hostFlags, size_t size, size_t alignment, + ze_result_t allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t deviceFlags, + ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment, void **ptr) override; ze_result_t getMemAddressRange(const void *ptr, void **pBase, size_t *pSize) override; diff --git a/level_zero/core/source/driver/driver_imp.h b/level_zero/core/source/driver/driver_imp.h index f6cf398886..6555bc49aa 100644 --- a/level_zero/core/source/driver/driver_imp.h +++ b/level_zero/core/source/driver/driver_imp.h @@ -16,7 +16,7 @@ namespace L0 { class DriverImp : public Driver { public: - ze_result_t driverInit(_ze_init_flag_t) override; + ze_result_t driverInit(ze_init_flags_t flags) override; void initialize(ze_result_t *result) override; diff --git a/level_zero/core/source/event/event.cpp b/level_zero/core/source/event/event.cpp index 9fe2650b65..675d3fe737 100644 --- a/level_zero/core/source/event/event.cpp +++ b/level_zero/core/source/event/event.cpp @@ -36,7 +36,7 @@ struct EventImp : public Event { ze_result_t hostSignal() override; - ze_result_t hostSynchronize(uint32_t timeout) override; + ze_result_t hostSynchronize(uint64_t timeout) override; ze_result_t queryStatus() override { uint64_t *hostAddr = static_cast(hostAddress); @@ -62,8 +62,6 @@ struct EventImp : public Event { ze_result_t reset() override; - ze_result_t getTimestamp(ze_event_timestamp_type_t timestampType, void *dstptr) override; - ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) override; Device *device; @@ -76,8 +74,8 @@ struct EventImp : public Event { }; struct EventPoolImp : public EventPool { - EventPoolImp(DriverHandle *driver, uint32_t numDevices, ze_device_handle_t *phDevices, uint32_t numEvents, ze_event_pool_flag_t flags) : numEvents(numEvents) { - if (flags & ZE_EVENT_POOL_FLAG_TIMESTAMP) { + EventPoolImp(DriverHandle *driver, uint32_t numDevices, ze_device_handle_t *phDevices, uint32_t numEvents, ze_event_pool_flags_t flags) : numEvents(numEvents) { + if (flags & ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP) { isEventPoolUsedForTimestamp = true; } ze_device_handle_t hDevice; @@ -205,7 +203,7 @@ ze_result_t EventImp::hostEventSetValueTimestamps(uint32_t eventVal) { auto eventTsSetFunc = [&](auto tsAddr) { auto tsptr = reinterpret_cast(tsAddr); memcpy_s(tsptr, sizeof(uint32_t), static_cast(&eventVal), sizeof(uint32_t)); - if (signalScopeFlag != ZE_EVENT_SCOPE_FLAG_NONE) { + if (!signalScopeFlag) { NEO::CpuIntrinsics::clFlush(tsptr); } }; @@ -231,7 +229,7 @@ ze_result_t EventImp::hostEventSetValue(uint32_t eventVal) { makeAllocationResident(); - if (this->signalScope != ZE_EVENT_SCOPE_FLAG_NONE) { + if (!this->signalScope) { NEO::CpuIntrinsics::clFlush(hostAddr); } @@ -242,9 +240,9 @@ ze_result_t EventImp::hostSignal() { return hostEventSetValue(Event::STATE_SIGNALED); } -ze_result_t EventImp::hostSynchronize(uint32_t timeout) { +ze_result_t EventImp::hostSynchronize(uint64_t timeout) { std::chrono::high_resolution_clock::time_point time1, time2; - int64_t timeDiff = 0; + uint64_t timeDiff = 0; ze_result_t ret = ZE_RESULT_NOT_READY; if (this->csr->getType() == NEO::CommandStreamReceiverType::CSR_AUB) { @@ -284,39 +282,6 @@ ze_result_t EventImp::reset() { return hostEventSetValue(Event::STATE_INITIAL); } -ze_result_t EventImp::getTimestamp(ze_event_timestamp_type_t timestampType, void *dstptr) { - auto baseAddr = reinterpret_cast(hostAddress); - uint64_t tsAddr = 0u; - constexpr uint64_t tsMask = (1ull << 32) - 1; - uint64_t tsData = Event::STATE_INITIAL & tsMask; - - if (!this->isTimestampEvent) - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - - // Ensure timestamps have been written - if (queryStatus() != ZE_RESULT_SUCCESS) { - memcpy_s(dstptr, sizeof(uint64_t), static_cast(&tsData), sizeof(uint64_t)); - return ZE_RESULT_SUCCESS; - } - - if (timestampType == ZE_EVENT_TIMESTAMP_CONTEXT_START) { - tsAddr = baseAddr + offsetof(KernelTimestampEvent, contextStart); - } else if (timestampType == ZE_EVENT_TIMESTAMP_GLOBAL_START) { - tsAddr = baseAddr + offsetof(KernelTimestampEvent, globalStart); - } else if (timestampType == ZE_EVENT_TIMESTAMP_CONTEXT_END) { - tsAddr = baseAddr + offsetof(KernelTimestampEvent, contextEnd); - } else { - tsAddr = baseAddr + offsetof(KernelTimestampEvent, globalEnd); - } - - memcpy_s(static_cast(&tsData), sizeof(uint32_t), reinterpret_cast(tsAddr), sizeof(uint32_t)); - - tsData &= tsMask; - memcpy_s(dstptr, sizeof(uint64_t), static_cast(&tsData), sizeof(uint64_t)); - - return ZE_RESULT_SUCCESS; -} - ze_result_t EventImp::queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) { auto baseAddr = reinterpret_cast(hostAddress); constexpr uint64_t tsMask = (1ull << 32) - 1; diff --git a/level_zero/core/source/event/event.h b/level_zero/core/source/event/event.h index 576ae29b99..941abfcb31 100644 --- a/level_zero/core/source/event/event.h +++ b/level_zero/core/source/event/event.h @@ -10,7 +10,7 @@ #include "level_zero/core/source/cmdlist/cmdlist.h" #include "level_zero/core/source/device/device.h" #include "level_zero/core/source/driver/driver_handle.h" -#include +#include struct _ze_event_handle_t {}; @@ -25,10 +25,9 @@ struct Event : _ze_event_handle_t { virtual ~Event() = default; virtual ze_result_t destroy(); virtual ze_result_t hostSignal() = 0; - virtual ze_result_t hostSynchronize(uint32_t timeout) = 0; + virtual ze_result_t hostSynchronize(uint64_t timeout) = 0; virtual ze_result_t queryStatus() = 0; virtual ze_result_t reset() = 0; - virtual ze_result_t getTimestamp(ze_event_timestamp_type_t timestampType, void *dstptr) = 0; virtual ze_result_t queryKernelTimestamp(ze_kernel_timestamp_result_t *dstptr) = 0; enum State : uint32_t { @@ -51,8 +50,8 @@ struct Event : _ze_event_handle_t { void *hostAddress = nullptr; uint64_t gpuAddress; - ze_event_scope_flag_t signalScope; // Saving scope for use later - ze_event_scope_flag_t waitScope; + ze_event_scope_flags_t signalScope; // Saving scope for use later + ze_event_scope_flags_t waitScope; bool isTimestampEvent = false; diff --git a/level_zero/core/source/fence/fence.cpp b/level_zero/core/source/fence/fence.cpp index 3733af20fc..c3705f1882 100644 --- a/level_zero/core/source/fence/fence.cpp +++ b/level_zero/core/source/fence/fence.cpp @@ -61,9 +61,9 @@ ze_result_t FenceImp::reset() { return ZE_RESULT_SUCCESS; } -ze_result_t FenceImp::hostSynchronize(uint32_t timeout) { +ze_result_t FenceImp::hostSynchronize(uint64_t timeout) { std::chrono::high_resolution_clock::time_point time1, time2; - int64_t timeDiff = 0; + uint64_t timeDiff = 0; ze_result_t ret = ZE_RESULT_NOT_READY; if (cmdQueue->getCsr()->getType() == NEO::CommandStreamReceiverType::CSR_AUB) { @@ -84,7 +84,7 @@ ze_result_t FenceImp::hostSynchronize(uint32_t timeout) { std::this_thread::yield(); NEO::CpuIntrinsics::pause(); - if (timeout == std::numeric_limits::max()) { + if (timeout == std::numeric_limits::max()) { continue; } diff --git a/level_zero/core/source/fence/fence.h b/level_zero/core/source/fence/fence.h index 7bcf36f625..88bf4e39e9 100644 --- a/level_zero/core/source/fence/fence.h +++ b/level_zero/core/source/fence/fence.h @@ -11,7 +11,7 @@ #include "level_zero/core/source/cmdqueue/cmdqueue.h" #include "level_zero/core/source/cmdqueue/cmdqueue_imp.h" -#include +#include #include @@ -23,7 +23,7 @@ struct Fence : _ze_fence_handle_t { static Fence *create(CommandQueueImp *cmdQueue, const ze_fence_desc_t *desc); virtual ~Fence() = default; virtual ze_result_t destroy() = 0; - virtual ze_result_t hostSynchronize(uint32_t timeout) = 0; + virtual ze_result_t hostSynchronize(uint64_t timeout) = 0; virtual ze_result_t queryStatus() = 0; virtual ze_result_t reset() = 0; @@ -61,7 +61,7 @@ struct FenceImp : public Fence { return ZE_RESULT_SUCCESS; } - ze_result_t hostSynchronize(uint32_t timeout) override; + ze_result_t hostSynchronize(uint64_t timeout) override; ze_result_t queryStatus() override; diff --git a/level_zero/core/source/image/image.h b/level_zero/core/source/image/image.h index 4f8bf807a0..ff9c23ead2 100644 --- a/level_zero/core/source/image/image.h +++ b/level_zero/core/source/image/image.h @@ -10,7 +10,7 @@ #include "shared/source/command_container/cmdcontainer.h" #include "level_zero/core/source/device/device.h" -#include +#include struct _ze_image_handle_t {}; diff --git a/level_zero/core/source/image/image_format_desc_helper.cpp b/level_zero/core/source/image/image_format_desc_helper.cpp index 28dae9e337..e5c558e777 100644 --- a/level_zero/core/source/image/image_format_desc_helper.cpp +++ b/level_zero/core/source/image/image_format_desc_helper.cpp @@ -11,7 +11,7 @@ namespace L0 { -cl_channel_type getClChannelDataType(const ze_image_format_desc_t &imgDescription) { +cl_channel_type getClChannelDataType(const ze_image_format_t &imgDescription) { switch (imgDescription.layout) { case ZE_IMAGE_FORMAT_LAYOUT_8: case ZE_IMAGE_FORMAT_LAYOUT_8_8: @@ -88,7 +88,7 @@ cl_channel_type getClChannelDataType(const ze_image_format_desc_t &imgDescriptio return CL_INVALID_VALUE; } -cl_channel_order getClChannelOrder(const ze_image_format_desc_t &imgDescription) { +cl_channel_order getClChannelOrder(const ze_image_format_t &imgDescription) { swizzles imgSwizzles{imgDescription.x, imgDescription.y, imgDescription.z, imgDescription.w}; if (imgSwizzles == swizzles{ZE_IMAGE_FORMAT_SWIZZLE_R, ZE_IMAGE_FORMAT_SWIZZLE_0, ZE_IMAGE_FORMAT_SWIZZLE_0, ZE_IMAGE_FORMAT_SWIZZLE_1}) diff --git a/level_zero/core/source/image/image_format_desc_helper.h b/level_zero/core/source/image/image_format_desc_helper.h index b51340107b..73b2389013 100644 --- a/level_zero/core/source/image/image_format_desc_helper.h +++ b/level_zero/core/source/image/image_format_desc_helper.h @@ -31,7 +31,7 @@ struct swizzles { } }; -cl_channel_type getClChannelDataType(const ze_image_format_desc_t &imgDescription); -cl_channel_order getClChannelOrder(const ze_image_format_desc_t &imgDescription); +cl_channel_type getClChannelDataType(const ze_image_format_t &imgDescription); +cl_channel_order getClChannelOrder(const ze_image_format_t &imgDescription); } // namespace L0 diff --git a/level_zero/core/source/image/image_formats.h b/level_zero/core/source/image/image_formats.h index 328739eeb4..1901f8dace 100644 --- a/level_zero/core/source/image/image_formats.h +++ b/level_zero/core/source/image/image_formats.h @@ -176,6 +176,6 @@ constexpr FormatTypes layoutP416 = {{{GMM_FORMAT_INVALID, NEO::NUM_GFX3DSTATE_SU {GMM_FORMAT_INVALID, NEO::NUM_GFX3DSTATE_SURFACEFORMATS, 0, 1, 1, 1}}}; constexpr std::array formats = {layout8, layout16, layout32, layout88, layout8888, layout1616, layout16161616, layout3232, layout32323232, layout1010102, layout111110, layout565, layout5551, layout4444, layoutY8, - layoutNV12, layoutYUYV, layoutVYUY, layoutYVYU, layoutUYVY, layoutAYUV, layoutYUAV, layoutP010, layoutY410, layoutP012, layoutY16, layoutP016, layoutY216, layoutP216, layoutP416}; + layoutNV12, layoutYUYV, layoutVYUY, layoutYVYU, layoutUYVY, layoutAYUV, layoutP010, layoutY410, layoutP012, layoutY16, layoutP016, layoutY216, layoutP216, layoutP416}; } // namespace ImageFormats } // namespace L0 diff --git a/level_zero/core/source/kernel/kernel.h b/level_zero/core/source/kernel/kernel.h index 432e50769a..583eed8d24 100644 --- a/level_zero/core/source/kernel/kernel.h +++ b/level_zero/core/source/kernel/kernel.h @@ -14,8 +14,6 @@ #include -#include "third_party/level_zero/ze_api_ext.h" - #include #include @@ -91,11 +89,11 @@ struct Kernel : _ze_kernel_handle_t, virtual NEO::DispatchKernelEncoderI { ~Kernel() override = default; virtual ze_result_t destroy() = 0; - virtual ze_result_t setAttribute(ze_kernel_attribute_t attr, uint32_t size, const void *pValue) = 0; - virtual ze_result_t getAttribute(ze_kernel_attribute_t attr, uint32_t *pSize, void *pValue) = 0; - virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_t cacheConfig) = 0; + virtual ze_result_t setIndirectAccess(ze_kernel_indirect_access_flags_t flags) = 0; + virtual ze_result_t getIndirectAccess(ze_kernel_indirect_access_flags_t *flags) = 0; + virtual ze_result_t getSourceAttributes(uint32_t *pSize, char **pString) = 0; + virtual ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) = 0; virtual ze_result_t getProperties(ze_kernel_properties_t *pKernelProperties) = 0; - virtual ze_result_t getPropertiesExt(ze_kernel_propertiesExt_t *pKernelProperties) = 0; virtual ze_result_t setArgumentValue(uint32_t argIndex, size_t argSize, const void *pArgValue) = 0; virtual void setGroupCount(uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) = 0; diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index 2adda487d4..6520fbfe9a 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -55,6 +55,8 @@ inline SamplerPatchValues getAddrMode(ze_sampler_address_mode_t addressingMode) return SamplerPatchValues::AddressNone; case ZE_SAMPLER_ADDRESS_MODE_MIRROR: return SamplerPatchValues::AddressMirroredRepeat; + default: + DEBUG_BREAK_IF(true); } return SamplerPatchValues::AddressNone; } @@ -356,53 +358,43 @@ ze_result_t KernelImp::suggestMaxCooperativeGroupCount(uint32_t *totalGroupCount return ZE_RESULT_SUCCESS; } -ze_result_t KernelImp::setAttribute(ze_kernel_attribute_t attr, uint32_t size, const void *pValue) { - if (size != sizeof(bool)) { - return ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE; - } - - if (attr == ZE_KERNEL_ATTR_INDIRECT_DEVICE_ACCESS) { - this->unifiedMemoryControls.indirectDeviceAllocationsAllowed = *(static_cast(pValue)); - } else if (attr == ZE_KERNEL_ATTR_INDIRECT_HOST_ACCESS) { - this->unifiedMemoryControls.indirectHostAllocationsAllowed = *(static_cast(pValue)); - } else if (attr == ZE_KERNEL_ATTR_INDIRECT_SHARED_ACCESS) { - this->unifiedMemoryControls.indirectSharedAllocationsAllowed = *(static_cast(pValue)); - } else { - return ZE_RESULT_ERROR_INVALID_ENUMERATION; +ze_result_t KernelImp::setIndirectAccess(ze_kernel_indirect_access_flags_t flags) { + if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE) { + this->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true; + } else if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST) { + this->unifiedMemoryControls.indirectHostAllocationsAllowed = true; + } else if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED) { + this->unifiedMemoryControls.indirectSharedAllocationsAllowed = true; } return ZE_RESULT_SUCCESS; } -ze_result_t KernelImp::getAttribute(ze_kernel_attribute_t attr, uint32_t *pSize, void *pValue) { - if (attr == ZE_KERNEL_ATTR_INDIRECT_DEVICE_ACCESS) { - memcpy_s(pValue, sizeof(bool), &this->unifiedMemoryControls.indirectDeviceAllocationsAllowed, sizeof(bool)); - return ZE_RESULT_SUCCESS; +ze_result_t KernelImp::getIndirectAccess(ze_kernel_indirect_access_flags_t *flags) { + *flags = 0; + if (this->unifiedMemoryControls.indirectDeviceAllocationsAllowed) { + *flags |= ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE; + } + if (this->unifiedMemoryControls.indirectHostAllocationsAllowed) { + *flags |= ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE; + } + if (this->unifiedMemoryControls.indirectSharedAllocationsAllowed) { + *flags |= ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE; } - if (attr == ZE_KERNEL_ATTR_INDIRECT_HOST_ACCESS) { - memcpy_s(pValue, sizeof(bool), &this->unifiedMemoryControls.indirectHostAllocationsAllowed, sizeof(bool)); - return ZE_RESULT_SUCCESS; - } + return ZE_RESULT_SUCCESS; +} - if (attr == ZE_KERNEL_ATTR_INDIRECT_SHARED_ACCESS) { - memcpy_s(pValue, sizeof(bool), &this->unifiedMemoryControls.indirectSharedAllocationsAllowed, sizeof(bool)); - return ZE_RESULT_SUCCESS; +ze_result_t KernelImp::getSourceAttributes(uint32_t *pSize, char **pString) { + auto &desc = kernelImmData->getDescriptor(); + if (pString == nullptr) { + *pSize = (uint32_t)desc.kernelMetadata.kernelLanguageAttributes.length() + 1; + } else { + strncpy_s(*pString, desc.kernelMetadata.kernelLanguageAttributes.length() + 1, + desc.kernelMetadata.kernelLanguageAttributes.c_str(), + desc.kernelMetadata.kernelLanguageAttributes.length() + 1); } - - if (attr == ZE_KERNEL_ATTR_SOURCE_ATTRIBUTE) { - auto &desc = kernelImmData->getDescriptor(); - if (pValue == nullptr) { - *pSize = (uint32_t)desc.kernelMetadata.kernelLanguageAttributes.length() + 1; - } else { - strncpy_s((char *)pValue, desc.kernelMetadata.kernelLanguageAttributes.length() + 1, - desc.kernelMetadata.kernelLanguageAttributes.c_str(), - desc.kernelMetadata.kernelLanguageAttributes.length() + 1); - } - return ZE_RESULT_SUCCESS; - } - - return ZE_RESULT_ERROR_INVALID_ENUMERATION; + return ZE_RESULT_SUCCESS; } ze_result_t KernelImp::setArgImmediate(uint32_t argIndex, size_t argSize, const void *argVal) { @@ -549,22 +541,6 @@ ze_result_t KernelImp::setArgSampler(uint32_t argIndex, size_t argSize, const vo return ZE_RESULT_SUCCESS; } -ze_result_t KernelImp::getProperties(ze_kernel_properties_t *pKernelProperties) { - size_t kernelNameSize = std::min(this->kernelImmData->getDescriptor().kernelMetadata.kernelName.size(), - (static_cast(ZE_MAX_KERNEL_NAME) - 1)); - strncpy_s(pKernelProperties->name, ZE_MAX_KERNEL_NAME, - this->kernelImmData->getDescriptor().kernelMetadata.kernelName.c_str(), kernelNameSize); - - pKernelProperties->requiredGroupSizeX = this->groupSize[0]; - pKernelProperties->requiredGroupSizeY = this->groupSize[1]; - pKernelProperties->requiredGroupSizeZ = this->groupSize[2]; - - pKernelProperties->numKernelArgs = - static_cast(this->kernelImmData->getDescriptor().payloadMappings.explicitArgs.size()); - - return ZE_RESULT_SUCCESS; -} - ze_result_t KernelImp::getKernelName(size_t *pSize, char *pName) { size_t kernelNameSize = this->kernelImmData->getDescriptor().kernelMetadata.kernelName.size() + 1; if (0 == *pSize || nullptr == pName) { @@ -579,11 +555,7 @@ ze_result_t KernelImp::getKernelName(size_t *pSize, char *pName) { return ZE_RESULT_SUCCESS; } -ze_result_t KernelImp::getPropertiesExt(ze_kernel_propertiesExt_t *pKernelProperties) { - size_t kernelNameSize = std::min(this->kernelImmData->getDescriptor().kernelMetadata.kernelName.size(), - (static_cast(ZE_MAX_KERNEL_NAME) - 1)); - strncpy_s(pKernelProperties->name, ZE_MAX_KERNEL_NAME, - this->kernelImmData->getDescriptor().kernelMetadata.kernelName.c_str(), kernelNameSize); +ze_result_t KernelImp::getProperties(ze_kernel_properties_t *pKernelProperties) { pKernelProperties->requiredGroupSizeX = this->groupSize[0]; pKernelProperties->requiredGroupSizeY = this->groupSize[1]; diff --git a/level_zero/core/source/kernel/kernel_imp.h b/level_zero/core/source/kernel/kernel_imp.h index 46c45c076f..f3bb60cfe5 100644 --- a/level_zero/core/source/kernel/kernel_imp.h +++ b/level_zero/core/source/kernel/kernel_imp.h @@ -28,15 +28,13 @@ struct KernelImp : Kernel { return ZE_RESULT_SUCCESS; } - ze_result_t setAttribute(ze_kernel_attribute_t attr, uint32_t size, const void *pValue) override; - - ze_result_t getAttribute(ze_kernel_attribute_t attr, uint32_t *pSize, void *pValue) override; + ze_result_t setIndirectAccess(ze_kernel_indirect_access_flags_t flags) override; + ze_result_t getIndirectAccess(ze_kernel_indirect_access_flags_t *flags) override; + ze_result_t getSourceAttributes(uint32_t *pSize, char **pString) override; ze_result_t getProperties(ze_kernel_properties_t *pKernelProperties) override; - ze_result_t getPropertiesExt(ze_kernel_propertiesExt_t *pKernelProperties) override; - - ze_result_t setIntermediateCacheConfig(ze_cache_config_t cacheConfig) override { + ze_result_t setIntermediateCacheConfig(ze_cache_config_flags_t cacheConfig) override { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/core/source/memory/memory.cpp b/level_zero/core/source/memory/memory.cpp index 336539d9c0..7ad658c728 100644 --- a/level_zero/core/source/memory/memory.cpp +++ b/level_zero/core/source/memory/memory.cpp @@ -99,7 +99,7 @@ ze_result_t DriverHandleImp::getMemAddressRange(const void *ptr, void **pBase, s return ZE_RESULT_ERROR_UNKNOWN; } -ze_result_t DriverHandleImp::allocHostMem(ze_host_mem_alloc_flag_t flags, size_t size, size_t alignment, +ze_result_t DriverHandleImp::allocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) { if (size > this->devices[0]->getDeviceInfo().maxMemAllocSize) { *ptr = nullptr; @@ -120,7 +120,7 @@ ze_result_t DriverHandleImp::allocHostMem(ze_host_mem_alloc_flag_t flags, size_t return ZE_RESULT_SUCCESS; } -ze_result_t DriverHandleImp::allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t flags, +ze_result_t DriverHandleImp::allocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) { if (size > this->devices[0]->getNEODevice()->getHardwareCapabilities().maxMemAllocSize) { *ptr = nullptr; @@ -141,8 +141,8 @@ ze_result_t DriverHandleImp::allocDeviceMem(ze_device_handle_t hDevice, ze_devic return ZE_RESULT_SUCCESS; } -ze_result_t DriverHandleImp::allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t deviceFlags, - ze_host_mem_alloc_flag_t hostFlags, size_t size, size_t alignment, +ze_result_t DriverHandleImp::allocSharedMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t deviceFlags, + ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment, void **ptr) { NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY); ze_device_handle_t device; diff --git a/level_zero/core/source/memory/memory_operations_helper.h b/level_zero/core/source/memory/memory_operations_helper.h index 2e57a8f37e..cab2ea7144 100644 --- a/level_zero/core/source/memory/memory_operations_helper.h +++ b/level_zero/core/source/memory/memory_operations_helper.h @@ -9,7 +9,7 @@ #include "shared/source/memory_manager/memory_operations_status.h" -#include +#include static ze_result_t changeMemoryOperationStatusToL0ResultType(NEO::MemoryOperationsStatus status) { switch (status) { diff --git a/level_zero/core/source/module/module_imp.cpp b/level_zero/core/source/module/module_imp.cpp index 2ca71554c7..53a2cbdbc7 100644 --- a/level_zero/core/source/module/module_imp.cpp +++ b/level_zero/core/source/module/module_imp.cpp @@ -83,7 +83,7 @@ bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize for (uint32_t i = 0; i < pConstants->numConstants; i++) { uint64_t specConstantValue = 0; memcpy_s(&specConstantValue, sizeof(uint64_t), - reinterpret_cast(pConstants->pConstantValues[i]), sizeof(uint64_t)); + const_cast(pConstants->pConstantValues[i]), sizeof(uint64_t)); uint32_t specConstantId = pConstants->pConstantIds[i]; specConstantsValues[specConstantId] = specConstantValue; } diff --git a/level_zero/core/source/sampler/sampler.h b/level_zero/core/source/sampler/sampler.h index d368a0738e..a9f6821ccf 100644 --- a/level_zero/core/source/sampler/sampler.h +++ b/level_zero/core/source/sampler/sampler.h @@ -8,7 +8,7 @@ #pragma once #include "level_zero/core/source/device/device.h" -#include +#include struct _ze_sampler_handle_t {}; diff --git a/level_zero/core/test/black_box_tests/zello_world.cpp b/level_zero/core/test/black_box_tests/zello_world.cpp index 3705f10a39..2b128ce4e0 100644 --- a/level_zero/core/test/black_box_tests/zello_world.cpp +++ b/level_zero/core/test/black_box_tests/zello_world.cpp @@ -10,45 +10,45 @@ #include #include #include +#include + +#define VALIDATECALL(myZeCall) \ + do { \ + if (myZeCall != ZE_RESULT_SUCCESS) { \ + std::cout << "Error at " \ + << #myZeCall << ": " \ + << __FUNCTION__ << ": " \ + << __LINE__ << "\n"; \ + std::terminate(); \ + } \ + } while (0); int main(int argc, char *argv[]) { // Initialize driver - ze_result_t res = zeInit(ZE_INIT_FLAG_NONE); - if (res) { - std::terminate(); - } + VALIDATECALL(zeInit(ZE_INIT_FLAG_GPU_ONLY)); // Retrieve driver uint32_t driverCount = 0; - res = zeDriverGet(&driverCount, nullptr); - if (res || driverCount == 0) { - std::terminate(); - } + VALIDATECALL(zeDriverGet(&driverCount, nullptr)); + ze_driver_handle_t driverHandle; - res = zeDriverGet(&driverCount, &driverHandle); - if (res) { - std::terminate(); - } + VALIDATECALL(zeDriverGet(&driverCount, &driverHandle)); + + ze_context_desc_t contextDesc = {}; + ze_context_handle_t context; + VALIDATECALL(zeContextCreate(driverHandle, &contextDesc, &context)); // Retrieve device uint32_t deviceCount = 0; - res = zeDeviceGet(driverHandle, &deviceCount, nullptr); - if (res || deviceCount == 0) { - std::terminate(); - } + VALIDATECALL(zeDeviceGet(driverHandle, &deviceCount, nullptr)); + ze_device_handle_t device; deviceCount = 1; - res = zeDeviceGet(driverHandle, &deviceCount, &device); - if (res) { - std::terminate(); - } + VALIDATECALL(zeDeviceGet(driverHandle, &deviceCount, &device)); // Print some properties - ze_device_properties_t deviceProperties = {ZE_DEVICE_PROPERTIES_VERSION_CURRENT}; - res = zeDeviceGetProperties(device, &deviceProperties); - if (res) { - std::terminate(); - } + ze_device_properties_t deviceProperties = {}; + VALIDATECALL(zeDeviceGetProperties(device, &deviceProperties)); std::cout << "Device : \n" << " * name : " << deviceProperties.name << "\n" @@ -56,45 +56,48 @@ int main(int argc, char *argv[]) { << " * vendorId : " << deviceProperties.vendorId << "\n"; // Create command queue - ze_command_queue_handle_t cmdQueue; - ze_command_queue_desc_t cmdQueueDesc = {ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT}; - cmdQueueDesc.ordinal = 0; - cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; - res = zeCommandQueueCreate(device, &cmdQueueDesc, &cmdQueue); - if (res) { + uint32_t numQueueGroups = 0; + VALIDATECALL(zeDeviceGetCommandQueueGroupProperties(device, &numQueueGroups, nullptr)); + if (numQueueGroups == 0) { + std::cout << "No queue groups found!\n"; std::terminate(); } + std::vector queueProperties(numQueueGroups); + VALIDATECALL(zeDeviceGetCommandQueueGroupProperties(device, &numQueueGroups, + queueProperties.data())); + + ze_command_queue_handle_t cmdQueue; + ze_command_queue_desc_t cmdQueueDesc = {}; + + for (uint32_t i = 0; i < numQueueGroups; i++) { + if (queueProperties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE) { + cmdQueueDesc.ordinal = i; + } + } + cmdQueueDesc.index = 0; + cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; + VALIDATECALL(zeCommandQueueCreate(context, device, &cmdQueueDesc, &cmdQueue)); // Create command list ze_command_list_handle_t cmdList; - ze_command_list_desc_t cmdListDesc = {ZE_COMMAND_LIST_DESC_VERSION_CURRENT}; - res = zeCommandListCreate(device, &cmdListDesc, &cmdList); - if (res) { - std::terminate(); - } + ze_command_list_desc_t cmdListDesc = {}; + cmdListDesc.commandQueueGroupOrdinal = cmdQueueDesc.ordinal; + VALIDATECALL(zeCommandListCreate(context, device, &cmdListDesc, &cmdList)); // Create two shared buffers constexpr size_t allocSize = 4096; ze_device_mem_alloc_desc_t deviceDesc; - deviceDesc.flags = ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT; + deviceDesc.flags = ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_UNCACHED; deviceDesc.ordinal = 0; - deviceDesc.version = ZE_DEVICE_MEM_ALLOC_DESC_VERSION_CURRENT; ze_host_mem_alloc_desc_t hostDesc; - hostDesc.flags = ZE_HOST_MEM_ALLOC_FLAG_DEFAULT; - hostDesc.version = ZE_HOST_MEM_ALLOC_DESC_VERSION_CURRENT; + hostDesc.flags = ZE_HOST_MEM_ALLOC_FLAG_BIAS_UNCACHED; void *srcBuffer = nullptr; - res = zeDriverAllocSharedMem(driverHandle, &deviceDesc, &hostDesc, allocSize, 1, device, &srcBuffer); - if (res) { - std::terminate(); - } + VALIDATECALL(zeMemAllocShared(context, &deviceDesc, &hostDesc, allocSize, 1, device, &srcBuffer)); void *dstBuffer = nullptr; - res = zeDriverAllocSharedMem(driverHandle, &deviceDesc, &hostDesc, allocSize, 1, device, &dstBuffer); - if (res) { - std::terminate(); - } + VALIDATECALL(zeMemAllocShared(context, &deviceDesc, &hostDesc, allocSize, 1, device, &dstBuffer)); // Initialize memory constexpr uint8_t val = 55; @@ -102,26 +105,13 @@ int main(int argc, char *argv[]) { memset(dstBuffer, 0, allocSize); // Perform a GPU copy - res = zeCommandListAppendMemoryCopy(cmdList, dstBuffer, srcBuffer, allocSize, nullptr); - if (res) { - std::terminate(); - } + VALIDATECALL(zeCommandListAppendMemoryCopy(cmdList, dstBuffer, srcBuffer, allocSize, nullptr, 0, nullptr)); // Close list and submit for execution - res = zeCommandListClose(cmdList); - if (res) { - std::terminate(); - } - res = zeCommandQueueExecuteCommandLists(cmdQueue, 1, &cmdList, nullptr); - if (res) { - std::terminate(); - } + VALIDATECALL(zeCommandListClose(cmdList)); + VALIDATECALL(zeCommandQueueExecuteCommandLists(cmdQueue, 1, &cmdList, nullptr)); - // Wait for completion - res = zeCommandQueueSynchronize(cmdQueue, std::numeric_limits::max()); - if (res) { - std::terminate(); - } + VALIDATECALL(zeCommandQueueSynchronize(cmdQueue, std::numeric_limits::max())); // Validate bool outputValidationSuccessful = true; @@ -139,22 +129,11 @@ int main(int argc, char *argv[]) { } // Cleanup - res = zeDriverFreeMem(driverHandle, dstBuffer); - if (res) { - std::terminate(); - } - res = zeDriverFreeMem(driverHandle, srcBuffer); - if (res) { - std::terminate(); - } - res = zeCommandListDestroy(cmdList); - if (res) { - std::terminate(); - } - res = zeCommandQueueDestroy(cmdQueue); - if (res) { - std::terminate(); - } + VALIDATECALL(zeMemFree(context, dstBuffer)); + VALIDATECALL(zeMemFree(context, srcBuffer)); + VALIDATECALL(zeCommandListDestroy(cmdList)); + VALIDATECALL(zeCommandQueueDestroy(cmdQueue)); + VALIDATECALL(zeContextDestroy(context)); std::cout << "\nZello World Results validation " << (outputValidationSuccessful ? "PASSED" : "FAILED") << "\n"; diff --git a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h index 1123cf2005..095abcdaac 100644 --- a/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h +++ b/level_zero/core/test/unit_tests/fixtures/cmdlist_fixture.h @@ -21,16 +21,14 @@ class CommandListFixture : public DeviceFixture { DeviceFixture::SetUp(); commandList.reset(whitebox_cast(CommandList::create(productFamily, device, false))); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_HOST_VISIBLE, - 2}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; + eventPoolDesc.count = 2; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; + eventDesc.wait = 0; + eventDesc.signal = 0; eventPool = std::unique_ptr(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); diff --git a/level_zero/core/test/unit_tests/fixtures/module_fixture.h b/level_zero/core/test/unit_tests/fixtures/module_fixture.h index 98fd4f7f2f..24f1fb74a2 100644 --- a/level_zero/core/test/unit_tests/fixtures/module_fixture.h +++ b/level_zero/core/test/unit_tests/fixtures/module_fixture.h @@ -35,7 +35,7 @@ struct ModuleFixture : public DeviceFixture { ASSERT_NE(0u, size); ASSERT_NE(nullptr, src); - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_NATIVE; moduleDesc.pInputModule = reinterpret_cast(src.get()); moduleDesc.inputSize = size; @@ -46,7 +46,7 @@ struct ModuleFixture : public DeviceFixture { } void createKernel() { - ze_kernel_desc_t desc = {ZE_KERNEL_DESC_VERSION_CURRENT}; + ze_kernel_desc_t desc = {}; desc.pKernelName = kernelName.c_str(); kernel = std::make_unique>(); @@ -81,7 +81,7 @@ struct MultiDeviceModuleFixture : public MultiDeviceFixture { ASSERT_NE(0u, size); ASSERT_NE(nullptr, src); - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_NATIVE; moduleDesc.pInputModule = reinterpret_cast(src.get()); moduleDesc.inputSize = size; diff --git a/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp b/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp index 30708f3d8f..5106c851e8 100644 --- a/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp +++ b/level_zero/core/test/unit_tests/gen12lp/test_device_gen12lp.cpp @@ -18,16 +18,6 @@ using ::testing::_; using ::testing::AnyNumber; using ::testing::Return; -using DevicePropertyTest = Test; - -HWTEST2_F(DevicePropertyTest, givenReturnedDevicePropertiesThenExpectedPageFaultSupportReturned, IsGen12LP) { - ze_device_properties_t deviceProps; - deviceProps.version = ZE_DEVICE_PROPERTIES_VERSION_CURRENT; - - device->getProperties(&deviceProps); - EXPECT_FALSE(deviceProps.onDemandPageFaultsSupported); -} - using DeviceQueueGroupTest = Test; HWTEST2_F(DeviceQueueGroupTest, diff --git a/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp index 8593a149f6..e5d87d65ea 100644 --- a/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp @@ -19,21 +19,19 @@ using ::testing::Return; using KernelPropertyTest = Test; HWTEST2_F(KernelPropertyTest, givenReturnedKernelPropertiesThenExpectedDp4aSupportReturned, IsGen9) { - ze_device_kernel_properties_t kernelProps; - kernelProps.version = ZE_DEVICE_KERNEL_PROPERTIES_VERSION_CURRENT; + ze_device_module_properties_t kernelProps; device->getKernelProperties(&kernelProps); - EXPECT_FALSE(kernelProps.dp4aSupported); + EXPECT_EQ(0u, kernelProps.flags & ZE_DEVICE_MODULE_FLAG_DP4A); } using DevicePropertyTest = Test; HWTEST2_F(DevicePropertyTest, givenReturnedDevicePropertiesThenExpectedPageFaultSupportReturned, IsGen9) { ze_device_properties_t deviceProps; - deviceProps.version = ZE_DEVICE_PROPERTIES_VERSION_CURRENT; device->getProperties(&deviceProps); - EXPECT_FALSE(deviceProps.onDemandPageFaultsSupported); + EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING); } using DeviceQueueGroupTest = Test; diff --git a/level_zero/core/test/unit_tests/mocks/CMakeLists.txt b/level_zero/core/test/unit_tests/mocks/CMakeLists.txt index 4667ce8c96..e4d83cb4fa 100644 --- a/level_zero/core/test/unit_tests/mocks/CMakeLists.txt +++ b/level_zero/core/test/unit_tests/mocks/CMakeLists.txt @@ -21,8 +21,8 @@ set(L0_MOCKS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/mock_driver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mock_driver_handle.h ${CMAKE_CURRENT_SOURCE_DIR}/mock_driver_handle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/mock_event.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mock_event.h + ${CMAKE_CURRENT_SOURCE_DIR}/mock_event.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_resource_info_l0.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel.h ${CMAKE_CURRENT_SOURCE_DIR}/mock_l0_debugger.h diff --git a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h index f272ae466c..eab2d2e4f1 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdlist.h @@ -252,10 +252,6 @@ struct MockCommandList : public CommandList { (zet_metric_streamer_handle_t hMetricStreamer, uint32_t value)); - ADDMETHOD_NOBASE(appendMetricTracerMarker, ze_result_t, ZE_RESULT_SUCCESS, - (zet_metric_tracer_handle_t hMetricTracer, - uint32_t value)); - ADDMETHOD_NOBASE(appendMetricQueryBegin, ze_result_t, ZE_RESULT_SUCCESS, (zet_metric_query_handle_t hMetricQuery)); diff --git a/level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h b/level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h index 5cd269aa93..14df52ccba 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h +++ b/level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h @@ -61,7 +61,7 @@ struct Mock : public CommandQueue { (override)); MOCK_METHOD(ze_result_t, synchronize, - (uint32_t timeout), + (uint64_t timeout), (override)); MOCK_METHOD(void, dispatchTaskCountWrite, @@ -78,7 +78,7 @@ struct MockCommandQueueHw : public L0::CommandQueueHw { MockCommandQueueHw(L0::Device *device, NEO::CommandStreamReceiver *csr, const ze_command_queue_desc_t *desc) : L0::CommandQueueHw(device, csr, desc) { } - ze_result_t synchronize(uint32_t timeout) override { + ze_result_t synchronize(uint64_t timeout) override { synchronizedCalled++; return ZE_RESULT_SUCCESS; } diff --git a/level_zero/core/test/unit_tests/mocks/mock_context.h b/level_zero/core/test/unit_tests/mocks/mock_context.h index 5dbdb1a491..0560d9a6df 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_context.h +++ b/level_zero/core/test/unit_tests/mocks/mock_context.h @@ -22,8 +22,8 @@ using Context = WhiteBox<::L0::Context>; template <> struct Mock : public Context { - Mock(); - ~Mock() override; + Mock() = default; + ~Mock() override = default; MOCK_METHOD(ze_result_t, destroy, @@ -39,7 +39,7 @@ struct Mock : public Context { (override)); MOCK_METHOD(ze_result_t, allocHostMem, - (ze_host_mem_alloc_flag_t flags, + (ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr), @@ -47,7 +47,7 @@ struct Mock : public Context { MOCK_METHOD(ze_result_t, allocDeviceMem, (ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t flags, + ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr), @@ -55,8 +55,8 @@ struct Mock : public Context { MOCK_METHOD(ze_result_t, allocSharedMem, (ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t deviceFlags, - ze_host_mem_alloc_flag_t hostFlags, + ze_device_mem_alloc_flags_t deviceFlags, + ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment, void **ptr), @@ -124,6 +124,12 @@ struct Mock : public Context { const ze_command_queue_desc_t *desc, ze_command_list_handle_t *commandList), (override)); + MOCK_METHOD(ze_result_t, + activateMetricGroups, + (zet_device_handle_t hDevice, + uint32_t count, + zet_metric_group_handle_t *phMetricGroups), + (override)); MOCK_METHOD(ze_result_t, reserveVirtualMem, (const void *pStart, @@ -177,6 +183,24 @@ struct Mock : public Context { ze_memory_access_attribute_t *access, size_t *outSize), (override)); + MOCK_METHOD(ze_result_t, + openEventPoolIpcHandle, + (ze_ipc_event_pool_handle_t hIpc, + ze_event_pool_handle_t *phEventPool), + (override)); + MOCK_METHOD(ze_result_t, + createEventPool, + (const ze_event_pool_desc_t *desc, + uint32_t numDevices, + ze_device_handle_t *phDevices, + ze_event_pool_handle_t *phEventPool), + (override)); + MOCK_METHOD(ze_result_t, + createImage, + (ze_device_handle_t hDevice, + const ze_image_desc_t *desc, + ze_image_handle_t *phImage), + (override)); }; } // namespace ult diff --git a/level_zero/core/test/unit_tests/mocks/mock_device.h b/level_zero/core/test/unit_tests/mocks/mock_device.h index 8ae0258d36..2a3164a2da 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_device.h +++ b/level_zero/core/test/unit_tests/mocks/mock_device.h @@ -94,7 +94,7 @@ struct Mock : public Device { (override)); MOCK_METHOD(ze_result_t, getKernelProperties, - (ze_device_kernel_properties_t * pKernelProperties), + (ze_device_module_properties_t * pKernelProperties), (override)); MOCK_METHOD(ze_result_t, getMemoryProperties, @@ -125,11 +125,11 @@ struct Mock : public Device { (override)); MOCK_METHOD(ze_result_t, setIntermediateCacheConfig, - (ze_cache_config_t CacheConfig), + (ze_cache_config_flags_t CacheConfig), (override)); MOCK_METHOD(ze_result_t, setLastLevelCacheConfig, - (ze_cache_config_t CacheConfig), + (ze_cache_config_flags_t CacheConfig), (override)); MOCK_METHOD(ze_result_t, getCacheProperties, @@ -153,26 +153,22 @@ struct Mock : public Device { (override)); MOCK_METHOD(ze_result_t, systemBarrier, - (), (override)); MOCK_METHOD(ze_result_t, registerCLMemory, - (cl_context context, cl_mem mem, void **ptr), (override)); MOCK_METHOD(ze_result_t, registerCLProgram, - (cl_context context, cl_program program, ze_module_handle_t *phModule), (override)); MOCK_METHOD(ze_result_t, registerCLCommandQueue, - (cl_context context, cl_command_queue commandQueue, ze_command_queue_handle_t *phCommandQueue), diff --git a/level_zero/core/test/unit_tests/mocks/mock_driver.h b/level_zero/core/test/unit_tests/mocks/mock_driver.h index cc16e37a10..61a3de47fb 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_driver.h +++ b/level_zero/core/test/unit_tests/mocks/mock_driver.h @@ -28,14 +28,14 @@ struct Mock : public Driver { MOCK_METHOD(ze_result_t, driverInit, - (ze_init_flag_t), + (ze_init_flags_t), (override)); MOCK_METHOD(void, initialize, (ze_result_t * result), (override)); - ze_result_t mockInit(ze_init_flag_t) { return this->DriverImp::driverInit(ZE_INIT_FLAG_NONE); } + ze_result_t mockInit(ze_init_flag_t) { return this->DriverImp::driverInit(ZE_INIT_FLAG_GPU_ONLY); } void mockInitialize(ze_result_t *result) { *result = ZE_RESULT_SUCCESS; } Driver *previousDriver = nullptr; diff --git a/level_zero/core/test/unit_tests/mocks/mock_driver_handle.cpp b/level_zero/core/test/unit_tests/mocks/mock_driver_handle.cpp index 355508c370..aca05795fe 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_driver_handle.cpp +++ b/level_zero/core/test/unit_tests/mocks/mock_driver_handle.cpp @@ -52,7 +52,7 @@ ze_result_t Mock::doGetDevice(uint32_t *pCount, ze_device_handle_t return ZE_RESULT_SUCCESS; } -ze_result_t Mock::doAllocHostMem(ze_host_mem_alloc_flag_t flags, size_t size, size_t alignment, +ze_result_t Mock::doAllocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) { NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::HOST_UNIFIED_MEMORY); @@ -67,7 +67,7 @@ ze_result_t Mock::doAllocHostMem(ze_host_mem_alloc_flag_t flags, s return ZE_RESULT_SUCCESS; } -ze_result_t Mock::doAllocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flag_t flags, size_t size, size_t alignment, void **ptr) { +ze_result_t Mock::doAllocDeviceMem(ze_device_handle_t hDevice, ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr) { NEO::SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY); auto allocation = svmAllocsManager->createUnifiedMemoryAllocation(0u, size, unifiedMemoryProperties); diff --git a/level_zero/core/test/unit_tests/mocks/mock_driver_handle.h b/level_zero/core/test/unit_tests/mocks/mock_driver_handle.h index b025c078de..bd7a6d43df 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_driver_handle.h +++ b/level_zero/core/test/unit_tests/mocks/mock_driver_handle.h @@ -99,7 +99,7 @@ struct Mock : public DriverHandleImp { (override)); MOCK_METHOD(ze_result_t, allocHostMem, - (ze_host_mem_alloc_flag_t flags, + (ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr), @@ -107,7 +107,7 @@ struct Mock : public DriverHandleImp { MOCK_METHOD(ze_result_t, allocDeviceMem, (ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t flags, + ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr), @@ -115,8 +115,8 @@ struct Mock : public DriverHandleImp { MOCK_METHOD(ze_result_t, allocSharedMem, (ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t deviceFlags, - ze_host_mem_alloc_flag_t hostFlags, + ze_device_mem_alloc_flags_t deviceFlags, + ze_host_mem_alloc_flags_t hostFlags, size_t size, size_t alignment, void **ptr), @@ -139,12 +139,12 @@ struct Mock : public DriverHandleImp { ze_device_handle_t *phDevices); NEO::MemoryManager *doGetMemoryManager(); NEO::SVMAllocsManager *doGetSvmAllocManager(); - ze_result_t doAllocHostMem(ze_host_mem_alloc_flag_t flags, + ze_result_t doAllocHostMem(ze_host_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr); ze_result_t doAllocDeviceMem(ze_device_handle_t hDevice, - ze_device_mem_alloc_flag_t flags, + ze_device_mem_alloc_flags_t flags, size_t size, size_t alignment, void **ptr); diff --git a/level_zero/core/test/unit_tests/mocks/mock_event.h b/level_zero/core/test/unit_tests/mocks/mock_event.h index 82811d1fab..e41882aa92 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_event.h +++ b/level_zero/core/test/unit_tests/mocks/mock_event.h @@ -44,10 +44,9 @@ struct Mock : public Event { MOCK_METHOD3(create, L0::Event *(::L0::EventPool *eventPool, const ze_event_desc_t *desc, ::L0::Device *device)); MOCK_METHOD0(destroy, ze_result_t()); MOCK_METHOD0(hostSignal, ze_result_t()); - MOCK_METHOD1(hostSynchronize, ze_result_t(uint32_t timeout)); + MOCK_METHOD1(hostSynchronize, ze_result_t(uint64_t timeout)); MOCK_METHOD0(queryStatus, ze_result_t()); MOCK_METHOD0(reset, ze_result_t()); - MOCK_METHOD2(getTimestamp, ze_result_t(ze_event_timestamp_type_t timestampType, void *dstptr)); MOCK_METHOD1(queryKernelTimestamp, ze_result_t(ze_kernel_timestamp_result_t *dstptr)); // Fake an allocation for event memory diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp index 39badeb2b6..43cb5f2a7c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_1.cpp @@ -21,6 +21,7 @@ #include "level_zero/core/source/module/module.h" #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" +#include "level_zero/core/test/unit_tests/mocks/mock_context.h" #include "level_zero/core/test/unit_tests/mocks/mock_event.h" #include "level_zero/core/test/unit_tests/mocks/mock_kernel.h" @@ -53,8 +54,9 @@ TEST_F(ContextCommandListCreate, whenCreatingCommandListImmediateFromContextThen using CommandListCreate = Test; -TEST(zeCommandListCreateImmediate, redirectsToObject) { +TEST(zeCommandListCreateImmediate, DISABLED_redirectsToObject) { Mock device; + Mock context; ze_command_queue_desc_t desc = {}; ze_command_list_handle_t commandList = {}; @@ -62,7 +64,7 @@ TEST(zeCommandListCreateImmediate, redirectsToObject) { .Times(1) .WillRepeatedly(::testing::Return(ZE_RESULT_SUCCESS)); - auto result = zeCommandListCreateImmediate(device.toHandle(), &desc, &commandList); + auto result = zeCommandListCreateImmediate(context.toHandle(), device.toHandle(), &desc, &commandList); EXPECT_EQ(ZE_RESULT_SUCCESS, result); } @@ -121,7 +123,7 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemAdviseReturnsSuccess) { void *ptr = nullptr; auto res = driverHandle->allocDeviceMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + 0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, res); EXPECT_NE(nullptr, ptr); @@ -142,7 +144,7 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemoryPrefetchReturnsSuccess) { void *ptr = nullptr; auto res = driverHandle->allocDeviceMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + 0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, res); EXPECT_NE(nullptr, ptr); @@ -158,12 +160,8 @@ TEST_F(CommandListCreate, givenValidPtrThenAppendMemoryPrefetchReturnsSuccess) { } TEST_F(CommandListCreate, givenImmediateCommandListThenCustomNumIddPerBlockUsed) { - const ze_command_queue_desc_t desc = { - ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT, - ZE_COMMAND_QUEUE_FLAG_NONE, - ZE_COMMAND_QUEUE_MODE_DEFAULT, - ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - 0}; + const ze_command_queue_desc_t desc = {}; + std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, false)); ASSERT_NE(nullptr, commandList); @@ -172,12 +170,7 @@ TEST_F(CommandListCreate, givenImmediateCommandListThenCustomNumIddPerBlockUsed) } TEST_F(CommandListCreate, whenCreatingImmediateCommandListThenItHasImmediateCommandQueueCreated) { - const ze_command_queue_desc_t desc = { - ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT, - ZE_COMMAND_QUEUE_FLAG_NONE, - ZE_COMMAND_QUEUE_MODE_DEFAULT, - ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - 0}; + const ze_command_queue_desc_t desc = {}; std::unique_ptr commandList(CommandList::createImmediate(productFamily, device, &desc, false, false)); ASSERT_NE(nullptr, commandList); @@ -367,8 +360,8 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenAppendSignalEventThe std::unique_ptr commandList(CommandList::create(productFamily, device, true)); auto &commandContainer = commandList->commandContainer; MockEvent event; - event.waitScope = ZE_EVENT_SCOPE_FLAG_NONE; - event.signalScope = ZE_EVENT_SCOPE_FLAG_NONE; + event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; + event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST; commandList->appendSignalEvent(event.toHandle()); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( @@ -383,8 +376,8 @@ HWTEST_F(CommandListCreate, givenCommandListWhenAppendSignalEventThePipeControlI std::unique_ptr commandList(CommandList::create(productFamily, device, false)); auto &commandContainer = commandList->commandContainer; MockEvent event; - event.waitScope = ZE_EVENT_SCOPE_FLAG_NONE; - event.signalScope = ZE_EVENT_SCOPE_FLAG_NONE; + event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; + event.signalScope = ZE_EVENT_SCOPE_FLAG_HOST; commandList->appendSignalEvent(event.toHandle()); GenCmdList cmdList; ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( @@ -399,7 +392,7 @@ HWTEST_F(CommandListCreate, givenCommandListWithCopyOnlyWhenAppendWaitEventsWith std::unique_ptr commandList(CommandList::create(productFamily, device, true)); auto &commandContainer = commandList->commandContainer; MockEvent event; - event.signalScope = ZE_EVENT_SCOPE_FLAG_NONE; + event.signalScope = 0; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; auto eventHandle = event.toHandle(); commandList->appendWaitOnEvents(1, &eventHandle); @@ -416,7 +409,7 @@ HWTEST_F(CommandListCreate, givenCommandListyWhenAppendWaitEventsWithDcFlushTheP std::unique_ptr commandList(CommandList::create(productFamily, device, false)); auto &commandContainer = commandList->commandContainer; MockEvent event; - event.signalScope = ZE_EVENT_SCOPE_FLAG_NONE; + event.signalScope = 0; event.waitScope = ZE_EVENT_SCOPE_FLAG_HOST; auto eventHandle = event.toHandle(); commandList->appendWaitOnEvents(1, &eventHandle); @@ -630,7 +623,6 @@ HWTEST2_F(CommandListCreate, givenCopyOnlyCommandListWhenAppenBlitFillThenCopyBl } using ImageSupport = IsWithinProducts; - HWTEST2_F(CommandListCreate, givenCopyCommandListWhenCopyFromImagBlitThenCommandAddedToStream, ImageSupport) { using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; using XY_COPY_BLT = typename GfxFamily::XY_COPY_BLT; @@ -654,15 +646,12 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToMemoryCopy using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM; auto commandList = std::make_unique>>(); commandList->initialize(device, true); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; + + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device)); @@ -716,15 +705,12 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToImageCopyB using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM; auto commandList = std::make_unique>>(); commandList->initialize(device, true); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; + + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device)); @@ -750,15 +736,12 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingBeforeCommandForCo using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM; auto commandList = std::make_unique>>(); commandList->initialize(device, true); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; + + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device)); @@ -786,15 +769,12 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenProfilingAfterCommandForCop using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM; auto commandList = std::make_unique>>(); commandList->initialize(device, true); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; + + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device)); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp index 0cc4f963ea..1a6d7b5277 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp @@ -329,15 +329,13 @@ HWTEST2_F(CommandListCreate, givenCommandListWhenTimestampPassedToMemoryCopyThen void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; + + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; + auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device)); @@ -819,7 +817,6 @@ HWTEST2_F(CommandListCreate, givenPitchAndSlicePitchWhenMemoryCopyRegionCalledSi EXPECT_EQ(cmdList.srcSize.x, pitch); EXPECT_EQ(cmdList.srcSize.y, slicePitch / pitch); } - template class MockCommandListForMemFill : public WhiteBox<::L0::CommandListCoreFamily> { public: @@ -847,15 +844,15 @@ HWTEST2_F(CommandListCreate, givenCopyCommandListWhenTimestampPassedToMemoryCopy commandList.initialize(device, true); void *srcPtr = reinterpret_cast(0x1234); void *dstPtr = reinterpret_cast(0x2345); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; + eventPoolDesc.count = 1; + + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; + eventDesc.signal = 0; + eventDesc.wait = 0; + auto eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto event = std::unique_ptr(L0::Event::create(eventPool.get(), &eventDesc, device)); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_api.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_api.cpp index 7423a91a3e..09be891c3c 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_api.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_api.cpp @@ -9,9 +9,9 @@ #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" +#include "level_zero/core/test/unit_tests/mocks/mock_context.h" #include "level_zero/core/test/unit_tests/mocks/mock_kernel.h" - -#include "third_party/level_zero/ze_api_ext.h" +#include namespace L0 { namespace ult { @@ -41,7 +41,7 @@ TEST_F(zeCommandListAppendMemAdviseTest, whenCalledThenRedirectedToObject) { TEST(zeCommandListAppendMemoryCopy, whenCalledThenRedirectedToObject) { MockCommandList commandList; - auto res = zeCommandListAppendMemoryCopy(&commandList, reinterpret_cast(0x2000), reinterpret_cast(0x1000), 0x1000, nullptr); + auto res = zeCommandListAppendMemoryCopy(&commandList, reinterpret_cast(0x2000), reinterpret_cast(0x1000), 0x1000, nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, res); } @@ -51,7 +51,7 @@ TEST(zeCommandListAppendMemoryFill, whenCalledThenRedirectedToObject) { int value = 0; auto res = zeCommandListAppendMemoryFill(&commandList, reinterpret_cast(0x1000), reinterpret_cast(&value), - sizeof(value), bufferSize, nullptr); + sizeof(value), bufferSize, nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, res); } @@ -63,10 +63,10 @@ TEST(zeCommandListAppendWaitOnEvent, whenCalledThenRedirectedToObject) { EXPECT_EQ(ZE_RESULT_SUCCESS, result); } -TEST(zeCommandListAppendWriteGlobalTimestampExt, whenCalledThenRedirectedToObject) { +TEST(zeCommandListAppendWriteGlobalTimestamp, whenCalledThenRedirectedToObject) { MockCommandList commandList; - auto result = zeCommandListAppendWriteGlobalTimestampExt(commandList.toHandle(), nullptr, nullptr, 0, nullptr); + auto result = zeCommandListAppendWriteGlobalTimestamp(commandList.toHandle(), nullptr, nullptr, 0, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel.cpp index 49370541c3..e2c01adbd0 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel.cpp @@ -209,16 +209,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenEventsWhenAppend Mock<::L0::Kernel> kernel; std::unique_ptr commandList(L0::CommandList::create(productFamily, device, false)); auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_HOST_VISIBLE, - 1}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; + eventPoolDesc.count = 1; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; auto eventPool = std::unique_ptr(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); @@ -273,16 +269,12 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenTimestampEventsWhenAppendingKernel Mock<::L0::Kernel> kernel; std::unique_ptr commandList(L0::CommandList::create(productFamily, device, false)); auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; auto eventPool = std::unique_ptr(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); @@ -360,13 +352,13 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelLaunchWithTSEventAndScopeFla Mock<::L0::Kernel> kernel; std::unique_ptr commandList(L0::CommandList::create(productFamily, device, false)); auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, + const ze_event_desc_t eventDesc = { + ZE_STRUCTURE_TYPE_EVENT_DESC, + nullptr, 0, ZE_EVENT_SCOPE_FLAG_HOST, ZE_EVENT_SCOPE_FLAG_HOST}; @@ -432,7 +424,7 @@ HWTEST_F(CommandListAppendLaunchKernel, givenIndirectDispatchWhenAppendingThenWo std::unique_ptr commandList(L0::CommandList::create(productFamily, device, false)); void *alloc = nullptr; - auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, 16384u, 4096u, &alloc); + auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), 0u, 16384u, 4096u, &alloc); ASSERT_EQ(ZE_RESULT_SUCCESS, result); result = commandList->appendLaunchKernelIndirect(kernel.toHandle(), @@ -542,13 +534,12 @@ HWTEST_F(CommandListAppendLaunchKernel, givenSingleValidWaitEventsAddsSemaphoreT ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream()); auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_HOST_VISIBLE, - 1}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; + eventPoolDesc.count = 1; - ze_event_desc_t eventDesc = {ZE_EVENT_DESC_VERSION_CURRENT, 0, ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; std::unique_ptr eventPool(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); std::unique_ptr event(Event::create(eventPool.get(), &eventDesc, device)); @@ -585,16 +576,15 @@ HWTEST_F(CommandListAppendLaunchKernel, givenMultipleValidWaitEventsAddsSemaphor ASSERT_NE(nullptr, commandList->commandContainer.getCommandStream()); auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_HOST_VISIBLE, - 2}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; + eventPoolDesc.count = 2; - ze_event_desc_t eventDesc1 = {ZE_EVENT_DESC_VERSION_CURRENT, 0, ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_desc_t eventDesc1 = {}; + eventDesc1.index = 0; - ze_event_desc_t eventDesc2 = {ZE_EVENT_DESC_VERSION_CURRENT, 1, ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_desc_t eventDesc2 = {}; + eventDesc2.index = 1; std::unique_ptr eventPool(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); std::unique_ptr event1(Event::create(eventPool.get(), &eventDesc1, device)); @@ -630,7 +620,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenAppendLaunchMult const ze_kernel_handle_t launchFn = kernel->toHandle(); uint32_t *numLaunchArgs; auto result = device->getDriverHandle()->allocDeviceMem( - device->toHandle(), ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, 16384u, 4096u, reinterpret_cast(&numLaunchArgs)); + device->toHandle(), 0u, 16384u, 4096u, reinterpret_cast(&numLaunchArgs)); result = commandList->appendLaunchMultipleKernelsIndirect(1, &launchFn, numLaunchArgs, nullptr, nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, result); *numLaunchArgs = 0; @@ -657,7 +647,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandListAppendLaunchKernel, givenAppendLaunchMult uint32_t *numLaunchArgs; const uint32_t numKernels = 3; auto result = device->getDriverHandle()->allocDeviceMem( - device->toHandle(), ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, 16384u, 4096u, reinterpret_cast(&numLaunchArgs)); + device->toHandle(), 0u, 16384u, 4096u, reinterpret_cast(&numLaunchArgs)); result = commandList->appendLaunchMultipleKernelsIndirect(numKernels, launchFn, numLaunchArgs, nullptr, nullptr, 0, nullptr); ASSERT_EQ(ZE_RESULT_SUCCESS, result); *numLaunchArgs = 2; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_signal_event.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_signal_event.cpp index d4323a7e83..64aad387e1 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_signal_event.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_signal_event.cpp @@ -99,16 +99,13 @@ HWTEST_F(CommandListAppendSignalEvent, givenEventWithScopeFlagDeviceWhenAppendin using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using POST_SYNC_OPERATION = typename PIPE_CONTROL::POST_SYNC_OPERATION; - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_HOST_VISIBLE, - 1}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_DEVICE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; + eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; auto eventPoolHostVisible = std::unique_ptr(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); auto eventHostVisible = std::unique_ptr(Event::create(eventPoolHostVisible.get(), &eventDesc, device)); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp index 4e175feeb7..5bce4b5683 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_wait_on_events.cpp @@ -103,8 +103,12 @@ HWTEST_F(CommandListAppendWaitOnEvent, givenEventWithWaitScopeFlagDeviceWhenAppe using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; auto usedSpaceBefore = commandList->commandContainer.getCommandStream()->getUsed(); - ze_event_desc_t eventDesc = {ZE_EVENT_DESC_VERSION_CURRENT, 1, ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_DEVICE}; + const ze_event_desc_t eventDesc = { + ZE_STRUCTURE_TYPE_EVENT_DESC, + nullptr, + 0, + 0, + ZE_EVENT_SCOPE_FLAG_DEVICE}; auto event = std::unique_ptr(Event::create(eventPool.get(), &eventDesc, device)); ze_event_handle_t hEventHandle = event->toHandle(); diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue.cpp index 9692a9a34e..e755fd43bd 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue.cpp @@ -28,13 +28,7 @@ namespace ult { using CommandQueueCreate = Test; TEST_F(CommandQueueCreate, whenCreatingCommandQueueThenItIsInitialized) { - const ze_command_queue_desc_t desc = { - ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT, - ZE_COMMAND_QUEUE_FLAG_NONE, - ZE_COMMAND_QUEUE_MODE_DEFAULT, - ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - 0}; - + const ze_command_queue_desc_t desc = {}; auto csr = std::unique_ptr(neoDevice->createCommandStreamReceiver()); L0::CommandQueue *commandQueue = CommandQueue::create(productFamily, @@ -53,144 +47,6 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueThenItIsInitialized) { commandQueue->destroy(); } -TEST_F(CommandQueueCreate, givenOrdinalThenQueueIsCreatedOnlyIfOrdinalIsLessThanNumOfAsyncComputeEngines) { - ze_device_properties_t deviceProperties; - ze_result_t res = device->getProperties(&deviceProperties); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - - auto expectedNumOfComputeEngines = NEO::HwHelper::getEnginesCount(device->getNEODevice()->getHardwareInfo()); - EXPECT_EQ(expectedNumOfComputeEngines, deviceProperties.numAsyncComputeEngines); - - ze_command_queue_desc_t desc = {}; - desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT; - desc.ordinal = deviceProperties.numAsyncComputeEngines; - - ze_command_queue_handle_t commandQueue = {}; - res = device->createCommandQueue(&desc, &commandQueue); - EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, res); - EXPECT_EQ(nullptr, commandQueue); - - std::vector commandQueueVector; - for (uint32_t i = 0; i < expectedNumOfComputeEngines; i++) { - desc.ordinal = i; - res = device->createCommandQueue(&desc, &commandQueue); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - EXPECT_NE(nullptr, commandQueue); - - commandQueueVector.push_back(commandQueue); - } - - for (uint32_t i = 0; i < expectedNumOfComputeEngines; i++) { - for (uint32_t j = 0; j < expectedNumOfComputeEngines; j++) { - if (i == j) { - continue; - } - EXPECT_NE(static_cast(commandQueueVector[i])->getCsr(), - static_cast(commandQueueVector[j])->getCsr()); - } - } - - for (auto commandQueue : commandQueueVector) { - L0::CommandQueue::fromHandle(commandQueue)->destroy(); - } -} - -TEST_F(CommandQueueCreate, givenOrdinalWhenQueueIsCreatedThenCorrectEngineIsSelected) { - ze_device_properties_t deviceProperties; - ze_result_t res = device->getProperties(&deviceProperties); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - - auto numOfComputeEngines = NEO::HwHelper::getEnginesCount(device->getNEODevice()->getHardwareInfo()); - - ze_command_queue_desc_t desc = {}; - desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT; - - ze_command_queue_handle_t commandQueue = {}; - - auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); - - for (uint32_t i = 0; i < numOfComputeEngines; i++) { - desc.ordinal = i; - res = device->createCommandQueue(&desc, &commandQueue); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - ASSERT_NE(nullptr, commandQueue); - - EXPECT_EQ(device->getNEODevice()->getEngine(hwHelper.getComputeEngineIndexByOrdinal(*defaultHwInfo, i)).commandStreamReceiver, - static_cast(commandQueue)->getCsr()); - - L0::CommandQueue::fromHandle(commandQueue)->destroy(); - } -} - -struct MultiDeviceCommandQueueCreateTest : public ::testing::Test { - void SetUp() override { - DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices); - auto executionEnvironment = new NEO::ExecutionEnvironment; - auto devices = NEO::DeviceFactory::createDevices(*executionEnvironment); - driverHandle = std::make_unique>(); - driverHandle->initialize(std::move(devices)); - } - - DebugManagerStateRestore restorer; - std::unique_ptr> driverHandle; - const uint32_t numSubDevices = 2u; - - void verifyCreationOfAllCommandQueuesAvailable(L0::Device *device) { - ze_device_properties_t deviceProperties; - ze_result_t res = device->getProperties(&deviceProperties); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - - uint32_t numOfComputeEngines = NEO::HwHelper::getEnginesCount(device->getNEODevice()->getHardwareInfo()); - EXPECT_EQ(numOfComputeEngines, deviceProperties.numAsyncComputeEngines); - - ze_command_queue_desc_t desc = {}; - desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT; - - ze_command_queue_handle_t commandQueue = {}; - - auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); - - for (uint32_t i = 0; i < numOfComputeEngines; i++) { - desc.ordinal = i; - res = device->createCommandQueue(&desc, &commandQueue); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); - ASSERT_NE(nullptr, commandQueue); - - uint32_t engineIndex = hwHelper.getComputeEngineIndexByOrdinal(*defaultHwInfo, - desc.ordinal); - - if (device->getNEODevice()->getNumAvailableDevices() > 1) { - EXPECT_EQ(device->getNEODevice()->getDeviceById(0)->getEngine(engineIndex).commandStreamReceiver, - static_cast(commandQueue)->getCsr()); - } else { - EXPECT_EQ(device->getNEODevice()->getEngine(engineIndex).commandStreamReceiver, - static_cast(commandQueue)->getCsr()); - } - - L0::CommandQueue::fromHandle(commandQueue)->destroy(); - } - } -}; - -TEST_F(MultiDeviceCommandQueueCreateTest, givenOrdinalWhenQueueIsCreatedThenCorrectEngineIsSelected) { - L0::Device *device = driverHandle->devices[0]; - - verifyCreationOfAllCommandQueuesAvailable(device); - - uint32_t count = 0; - ze_result_t result = device->getSubDevices(&count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(numSubDevices, count); - - std::vector subDevices(count); - result = device->getSubDevices(&count, subDevices.data()); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); - - for (auto subDevice : subDevices) { - verifyCreationOfAllCommandQueuesAvailable(Device::fromHandle(subDevice)); - } -} - using CommandQueueSBASupport = IsWithinProducts; struct MockMemoryManagerCommandQueueSBA : public MemoryManagerMock { @@ -232,7 +88,6 @@ struct CommandQueueProgramSBATest : public ::testing::Test { HWTEST2_F(CommandQueueProgramSBATest, whenCreatingCommandQueueThenItIsInitialized, CommandQueueSBASupport) { ze_command_queue_desc_t desc = {}; - desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT; auto csr = std::unique_ptr(neoDevice->createCommandStreamReceiver()); auto commandQueue = new MockCommandQueueHw(device, csr.get(), &desc); commandQueue->initialize(false); @@ -254,12 +109,7 @@ HWTEST2_F(CommandQueueProgramSBATest, whenCreatingCommandQueueThenItIsInitialize } TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingNonCopyBlitCommandListThenWrongCommandListStatusReturned) { - const ze_command_queue_desc_t desc = { - ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT, - ZE_COMMAND_QUEUE_FLAG_COPY_ONLY, - ZE_COMMAND_QUEUE_MODE_DEFAULT, - ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - 0}; + const ze_command_queue_desc_t desc = {}; auto csr = std::unique_ptr(neoDevice->createCommandStreamReceiver()); @@ -280,12 +130,7 @@ TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingNonCopyBlitComm } TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingCopyBlitCommandListThenSuccessReturned) { - const ze_command_queue_desc_t desc = { - ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT, - ZE_COMMAND_QUEUE_FLAG_COPY_ONLY, - ZE_COMMAND_QUEUE_MODE_DEFAULT, - ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - 0}; + const ze_command_queue_desc_t desc = {}; auto defaultCsr = neoDevice->getDefaultEngine().commandStreamReceiver; L0::CommandQueue *commandQueue = CommandQueue::create(productFamily, @@ -309,7 +154,6 @@ using CommandQueueDestroy = Test; HWTEST2_F(CommandQueueDestroy, whenCommandQueueDestroyIsCalledPrintPrintfOutputIsCalled, CommandQueueDestroySupport) { ze_command_queue_desc_t desc = {}; - desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT; auto csr = std::unique_ptr(neoDevice->createCommandStreamReceiver()); auto commandQueue = new MockCommandQueueHw(device, csr.get(), &desc); commandQueue->initialize(false); @@ -324,12 +168,7 @@ HWTEST2_F(CommandQueueDestroy, whenCommandQueueDestroyIsCalledPrintPrintfOutputI using CommandQueueCommands = Test; HWTEST_F(CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHardwareContextIsProgrammedAndGlobalAllocationResident) { - const ze_command_queue_desc_t desc = { - ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT, - ZE_COMMAND_QUEUE_FLAG_NONE, - ZE_COMMAND_QUEUE_MODE_DEFAULT, - ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - 0}; + const ze_command_queue_desc_t desc = {}; MockCsrHw2 csr(*neoDevice->getExecutionEnvironment(), 0); csr.initializeTagAllocation(); @@ -364,12 +203,7 @@ HWTEST_F(CommandQueueCommands, givenCommandQueueWhenExecutingCommandListsThenHar using CommandQueueIndirectAllocations = Test; HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandListsThenExpectedIndirectAllocationsAddedToResidencyContainer) { - const ze_command_queue_desc_t desc = { - ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT, - ZE_COMMAND_QUEUE_FLAG_NONE, - ZE_COMMAND_QUEUE_MODE_DEFAULT, - ZE_COMMAND_QUEUE_PRIORITY_NORMAL, - 0}; + const ze_command_queue_desc_t desc = {}; MockCsrHw2 csr(*neoDevice->getExecutionEnvironment(), 0); csr.initializeTagAllocation(); @@ -385,7 +219,7 @@ HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandL std::unique_ptr commandList(CommandList::create(productFamily, device, true)); void *deviceAlloc = nullptr; - auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, 16384u, 4096u, &deviceAlloc); + auto result = device->getDriverHandle()->allocDeviceMem(device->toHandle(), 0u, 16384u, 4096u, &deviceAlloc); ASSERT_EQ(ZE_RESULT_SUCCESS, result); auto gpuAlloc = device->getDriverHandle()->getSvmAllocsManager()->getSVMAllocs()->get(deviceAlloc)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()); @@ -425,7 +259,6 @@ using ContextCreateCommandQueueTest = Test; TEST_F(ContextCreateCommandQueueTest, givenCallToContextCreateCommandQueueThenCallSucceeds) { ze_command_queue_desc_t desc = {}; - desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT; desc.ordinal = 0u; ze_command_queue_handle_t commandQueue = {}; diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp index e0a0229017..d9dc57edf8 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp @@ -26,7 +26,7 @@ TEST_F(DeviceWithDebuggerEnabledTest, givenDebuggingEnabledWhenModuleIsCreatedTh debugger->isOptDisabled = true; uint8_t binary[10]; - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV; moduleDesc.pInputModule = binary; moduleDesc.inputSize = 10; @@ -47,7 +47,7 @@ TEST_F(DeviceWithDebuggerEnabledTest, GivenDebuggeableKernelWhenModuleIsInitiali device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip); uint8_t binary[10]; - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV; moduleDesc.pInputModule = binary; moduleDesc.inputSize = 10; @@ -79,7 +79,7 @@ TEST_F(DeviceWithDebuggerEnabledTest, GivenNonDebuggeableKernelWhenModuleIsIniti device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->compilerInterface.reset(cip); uint8_t binary[10]; - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV; moduleDesc.pInputModule = binary; moduleDesc.inputSize = 10; diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index acc9e31871..2639b043ba 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -71,40 +71,25 @@ TEST_F(DeviceTest, givenEmptySVmAllocStorageWhenAllocateMemoryFromHostPtrThenVal } TEST_F(DeviceTest, givenKernelPropertiesStructureWhenKernelPropertiesCalledThenAllPropertiesAreAssigned) { - ze_device_kernel_properties_t kernelProperties, kernelPropertiesBefore; - memset(&kernelProperties, std::numeric_limits::max(), sizeof(ze_device_kernel_properties_t)); + const auto &hardwareInfo = this->neoDevice->getHardwareInfo(); + + ze_device_module_properties_t kernelProperties, kernelPropertiesBefore; + memset(&kernelProperties, std::numeric_limits::max(), sizeof(ze_device_module_properties_t)); kernelPropertiesBefore = kernelProperties; device->getKernelProperties(&kernelProperties); EXPECT_NE(kernelPropertiesBefore.spirvVersionSupported, kernelProperties.spirvVersionSupported); EXPECT_NE(kernelPropertiesBefore.nativeKernelSupported.id, kernelProperties.nativeKernelSupported.id); - EXPECT_NE(kernelPropertiesBefore.fp16Supported, kernelProperties.fp16Supported); - EXPECT_NE(kernelPropertiesBefore.fp64Supported, kernelProperties.fp64Supported); - EXPECT_NE(kernelPropertiesBefore.int64AtomicsSupported, kernelProperties.int64AtomicsSupported); + + EXPECT_TRUE(kernelPropertiesBefore.flags & ZE_DEVICE_MODULE_FLAG_FP16); + if (hardwareInfo.capabilityTable.ftrSupportsInteger64BitAtomics) { + EXPECT_TRUE(kernelPropertiesBefore.flags & ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS); + } + EXPECT_NE(kernelPropertiesBefore.maxArgumentsSize, kernelProperties.maxArgumentsSize); EXPECT_NE(kernelPropertiesBefore.printfBufferSize, kernelProperties.printfBufferSize); } -TEST_F(DeviceTest, givenDeviceWithCopyEngineThenNumAsyncCopyEnginesDevicePropertyIsCorrectlyReturned) { - ze_device_properties_t deviceProperties; - deviceProperties.version = ZE_DEVICE_PROPERTIES_VERSION_CURRENT; - deviceProperties.numAsyncCopyEngines = std::numeric_limits::max(); - device->getProperties(&deviceProperties); - - auto expecteNumOfCopyEngines = NEO::HwHelper::getCopyEnginesCount(device->getNEODevice()->getHardwareInfo()); - EXPECT_EQ(expecteNumOfCopyEngines, deviceProperties.numAsyncCopyEngines); -} - -TEST_F(DeviceTest, givenDeviceWithComputeEngineThenNumAsyncComputeEnginesDevicePropertyIsCorrectlyReturned) { - ze_device_properties_t deviceProperties; - deviceProperties.version = ZE_DEVICE_PROPERTIES_VERSION_CURRENT; - deviceProperties.numAsyncComputeEngines = std::numeric_limits::max(); - device->getProperties(&deviceProperties); - - auto expectedNumOfComputeEngines = NEO::HwHelper::getEnginesCount(device->getNEODevice()->getHardwareInfo()); - EXPECT_EQ(expectedNumOfComputeEngines, deviceProperties.numAsyncComputeEngines); -} - TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenAllPropertiesAreAssigned) { ze_device_properties_t deviceProperties, devicePropertiesBefore; @@ -112,15 +97,8 @@ TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenA memset(&deviceProperties.vendorId, std::numeric_limits::max(), sizeof(deviceProperties.vendorId)); memset(&deviceProperties.deviceId, std::numeric_limits::max(), sizeof(deviceProperties.deviceId)); memset(&deviceProperties.uuid, std::numeric_limits::max(), sizeof(deviceProperties.uuid)); - memset(&deviceProperties.isSubdevice, std::numeric_limits::max(), sizeof(deviceProperties.isSubdevice)); memset(&deviceProperties.subdeviceId, std::numeric_limits::max(), sizeof(deviceProperties.subdeviceId)); memset(&deviceProperties.coreClockRate, std::numeric_limits::max(), sizeof(deviceProperties.coreClockRate)); - memset(&deviceProperties.unifiedMemorySupported, std::numeric_limits::max(), sizeof(deviceProperties.unifiedMemorySupported)); - memset(&deviceProperties.eccMemorySupported, std::numeric_limits::max(), sizeof(deviceProperties.eccMemorySupported)); - memset(&deviceProperties.onDemandPageFaultsSupported, std::numeric_limits::max(), sizeof(deviceProperties.onDemandPageFaultsSupported)); - memset(&deviceProperties.maxCommandQueues, std::numeric_limits::max(), sizeof(deviceProperties.maxCommandQueues)); - memset(&deviceProperties.numAsyncComputeEngines, std::numeric_limits::max(), sizeof(deviceProperties.numAsyncComputeEngines)); - memset(&deviceProperties.numAsyncCopyEngines, std::numeric_limits::max(), sizeof(deviceProperties.numAsyncCopyEngines)); memset(&deviceProperties.maxCommandQueuePriority, std::numeric_limits::max(), sizeof(deviceProperties.maxCommandQueuePriority)); memset(&deviceProperties.numThreadsPerEU, std::numeric_limits::max(), sizeof(deviceProperties.numThreadsPerEU)); memset(&deviceProperties.physicalEUSimdWidth, std::numeric_limits::max(), sizeof(deviceProperties.physicalEUSimdWidth)); @@ -137,15 +115,8 @@ TEST_F(DeviceTest, givenDevicePropertiesStructureWhenDevicePropertiesCalledThenA EXPECT_NE(deviceProperties.vendorId, devicePropertiesBefore.vendorId); EXPECT_NE(deviceProperties.deviceId, devicePropertiesBefore.deviceId); EXPECT_NE(0, memcmp(&deviceProperties.uuid, &devicePropertiesBefore.uuid, sizeof(devicePropertiesBefore.uuid))); - EXPECT_NE(deviceProperties.isSubdevice, devicePropertiesBefore.isSubdevice); EXPECT_NE(deviceProperties.subdeviceId, devicePropertiesBefore.subdeviceId); EXPECT_NE(deviceProperties.coreClockRate, devicePropertiesBefore.coreClockRate); - EXPECT_NE(deviceProperties.unifiedMemorySupported, devicePropertiesBefore.unifiedMemorySupported); - EXPECT_NE(deviceProperties.eccMemorySupported, devicePropertiesBefore.eccMemorySupported); - EXPECT_NE(deviceProperties.onDemandPageFaultsSupported, devicePropertiesBefore.onDemandPageFaultsSupported); - EXPECT_NE(deviceProperties.maxCommandQueues, devicePropertiesBefore.maxCommandQueues); - EXPECT_NE(deviceProperties.numAsyncComputeEngines, devicePropertiesBefore.numAsyncComputeEngines); - EXPECT_NE(deviceProperties.numAsyncCopyEngines, devicePropertiesBefore.numAsyncCopyEngines); EXPECT_NE(deviceProperties.maxCommandQueuePriority, devicePropertiesBefore.maxCommandQueuePriority); EXPECT_NE(deviceProperties.numThreadsPerEU, devicePropertiesBefore.numThreadsPerEU); EXPECT_NE(deviceProperties.physicalEUSimdWidth, devicePropertiesBefore.physicalEUSimdWidth); @@ -190,20 +161,22 @@ struct DeviceHasNoDoubleFp64Test : public ::testing::Test { }; TEST_F(DeviceHasNoDoubleFp64Test, givenDeviceThatDoesntHaveFp64WhenDbgFlagEnablesFp64ThenReportFp64Flags) { - ze_device_kernel_properties_t kernelProperties; - memset(&kernelProperties, std::numeric_limits::max(), sizeof(ze_device_kernel_properties_t)); + ze_device_module_properties_t kernelProperties; + memset(&kernelProperties, std::numeric_limits::max(), sizeof(ze_device_module_properties_t)); device->getKernelProperties(&kernelProperties); - EXPECT_EQ(ZE_FP_CAPS_NONE, kernelProperties.doubleFpCapabilities); - EXPECT_EQ(ZE_FP_CAPS_NONE, kernelProperties.singleFpCapabilities); + EXPECT_EQ(0u, kernelProperties.fp64flags); DebugManagerStateRestore dbgRestorer; DebugManager.flags.OverrideDefaultFP64Settings.set(1); device->getKernelProperties(&kernelProperties); - EXPECT_EQ(true, kernelProperties.fp64Supported); - EXPECT_NE(ZE_FP_CAPS_NONE, kernelProperties.doubleFpCapabilities); - EXPECT_EQ(ZE_FP_CAPS_ROUNDED_DIVIDE_SQRT, kernelProperties.singleFpCapabilities); + EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST); + EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO); + EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_ROUND_TO_INF); + EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_INF_NAN); + EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_DENORM); + EXPECT_TRUE(kernelProperties.fp64flags & ZE_DEVICE_FP_FLAG_FMA); } struct MockMemoryManagerMultiDevice : public MemoryManagerMock { @@ -453,52 +426,6 @@ TEST_F(MultipleDevicesSameFamilyAndLocalMemorySupportTest, givenTwoDevicesFromSa EXPECT_FALSE(canAccess); } -TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsDefaultThenUseBliterIsTrueAndSuccessIsReturned) { - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); - hwInfo.capabilityTable.blitterOperationsSupported = true; - auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, rootDeviceIndex); - Mock l0Device(neoMockDevice, neoDevice->getExecutionEnvironment()); - ze_command_list_desc_t desc = {}; - desc.flags = ZE_COMMAND_LIST_FLAG_COPY_ONLY; - auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY; - bool useBliter = false; - ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag); - EXPECT_TRUE(useBliter); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); -} - -TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsSetToZeroThenUseBliterIsFalseAndSuccessIsReturned) { - DebugManagerStateRestore dbgRestore; - DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.set(0); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); - hwInfo.capabilityTable.blitterOperationsSupported = true; - auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, rootDeviceIndex); - Mock l0Device(neoMockDevice, neoDevice->getExecutionEnvironment()); - ze_command_list_desc_t desc = {}; - desc.flags = ZE_COMMAND_LIST_FLAG_COPY_ONLY; - auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY; - bool useBliter = true; - ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag); - EXPECT_FALSE(useBliter); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); -} - -TEST_F(DeviceTest, givenBlitterSupportAndCopyOnlyFlagWhenCopyOnlyDebugFlagIsSetToOneThenUseBliterIsTrueAndSuccessIsReturned) { - DebugManagerStateRestore dbgRestore; - DebugManager.flags.EnableCopyOnlyCommandListsAndCommandQueues.set(1); - NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); - hwInfo.capabilityTable.blitterOperationsSupported = true; - auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo, rootDeviceIndex); - Mock l0Device(neoMockDevice, neoDevice->getExecutionEnvironment()); - ze_command_list_desc_t desc = {}; - desc.flags = ZE_COMMAND_LIST_FLAG_COPY_ONLY; - auto flag = ZE_COMMAND_LIST_FLAG_COPY_ONLY; - bool useBliter = false; - ze_result_t res = l0Device.isCreatedCommandListCopyOnly(&desc, &useBliter, flag); - EXPECT_TRUE(useBliter); - EXPECT_EQ(ZE_RESULT_SUCCESS, res); -} - TEST_F(DeviceTest, givenNoActiveSourceLevelDebuggerWhenGetIsCalledThenNullptrIsReturned) { EXPECT_EQ(nullptr, device->getSourceLevelDebugger()); } diff --git a/level_zero/core/test/unit_tests/sources/event/test_event.cpp b/level_zero/core/test/unit_tests/sources/event/test_event.cpp index 44136598bf..79e48adf6a 100644 --- a/level_zero/core/test/unit_tests/sources/event/test_event.cpp +++ b/level_zero/core/test/unit_tests/sources/event/test_event.cpp @@ -14,13 +14,13 @@ namespace L0 { namespace ult { - using EventPoolCreate = Test; using EventCreate = Test; TEST_F(EventPoolCreate, allocationContainsAtLeast16Bytes) { ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, + ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, + nullptr, ZE_EVENT_POOL_FLAG_HOST_VISIBLE, 1}; @@ -35,10 +35,9 @@ TEST_F(EventPoolCreate, allocationContainsAtLeast16Bytes) { } TEST_F(EventPoolCreate, givenTimestampEventsThenEventSizeSufficientForAllKernelTimestamps) { - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; std::unique_ptr eventPool(EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); ASSERT_NE(nullptr, eventPool); @@ -49,15 +48,14 @@ TEST_F(EventPoolCreate, givenTimestampEventsThenEventSizeSufficientForAllKernelT } TEST_F(EventPoolCreate, givenAnEventIsCreatedFromThisEventPoolThenEventContainsDeviceCommandStreamReceiver) { - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_HOST_VISIBLE, - 1}; - const ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_HOST, - ZE_EVENT_SCOPE_FLAG_HOST}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; + + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; + eventDesc.signal = ZE_EVENT_SCOPE_FLAG_HOST; + eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; ze_event_handle_t event = nullptr; @@ -73,11 +71,13 @@ TEST_F(EventPoolCreate, givenAnEventIsCreatedFromThisEventPoolThenEventContainsD TEST_F(EventCreate, givenAnEventCreatedThenTheEventHasTheDeviceCommandStreamReceiverSet) { ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, + ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, + nullptr, ZE_EVENT_POOL_FLAG_HOST_VISIBLE, 1}; const ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, + ZE_STRUCTURE_TYPE_EVENT_DESC, + nullptr, 0, ZE_EVENT_SCOPE_FLAG_DEVICE, ZE_EVENT_SCOPE_FLAG_DEVICE}; @@ -93,12 +93,14 @@ TEST_F(EventCreate, givenAnEventCreatedThenTheEventHasTheDeviceCommandStreamRece TEST_F(EventCreate, givenAnEventCreateWithInvalidIndexUsingThisEventPoolThenErrorIsReturned) { ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, + ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, + nullptr, ZE_EVENT_POOL_FLAG_HOST_VISIBLE, 1}; const ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 1, + ZE_STRUCTURE_TYPE_EVENT_DESC, + nullptr, + 2, ZE_EVENT_SCOPE_FLAG_DEVICE, ZE_EVENT_SCOPE_FLAG_DEVICE}; @@ -115,7 +117,8 @@ TEST_F(EventCreate, givenAnEventCreateWithInvalidIndexUsingThisEventPoolThenErro TEST_F(EventPoolCreate, returnsSuccessFromCreateEventPoolWithNoDevice) { ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, + ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, + nullptr, ZE_EVENT_POOL_FLAG_HOST_VISIBLE, 4}; @@ -127,7 +130,8 @@ TEST_F(EventPoolCreate, returnsSuccessFromCreateEventPoolWithNoDevice) { TEST_F(EventPoolCreate, returnsSuccessFromCreateEventPoolWithDevice) { ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, + ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, + nullptr, ZE_EVENT_POOL_FLAG_HOST_VISIBLE, 4}; @@ -163,7 +167,8 @@ struct EventCreateAllocationResidencyTest : public ::testing::Test { TEST_F(EventCreateAllocationResidencyTest, givenEventCreateAndEventDestroyCallsThenMakeResidentAndEvictAreCalled) { ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, + ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, + nullptr, ZE_EVENT_POOL_FLAG_HOST_VISIBLE, 1}; @@ -171,11 +176,12 @@ TEST_F(EventCreateAllocationResidencyTest, auto eventPool = EventPool::create(driverHandle.get(), 1, &deviceHandle, &eventPoolDesc); ASSERT_NE(nullptr, eventPool); - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, + const ze_event_desc_t eventDesc = { + ZE_STRUCTURE_TYPE_EVENT_DESC, + nullptr, 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ZE_EVENT_SCOPE_FLAG_DEVICE, + ZE_EVENT_SCOPE_FLAG_DEVICE}; EXPECT_CALL(*mockMemoryOperationsHandler, makeResident).Times(1); auto event = L0::Event::create(eventPool, &eventDesc, device); @@ -195,16 +201,14 @@ class TimestampEventCreate : public Test { public: void SetUp() override { DeviceFixture::SetUp(); - ze_event_pool_desc_t eventPoolDesc = { - ZE_EVENT_POOL_DESC_VERSION_CURRENT, - ZE_EVENT_POOL_FLAG_TIMESTAMP, - 1}; + ze_event_pool_desc_t eventPoolDesc = {}; + eventPoolDesc.count = 1; + eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP; - ze_event_desc_t eventDesc = { - ZE_EVENT_DESC_VERSION_CURRENT, - 0, - ZE_EVENT_SCOPE_FLAG_NONE, - ZE_EVENT_SCOPE_FLAG_NONE}; + ze_event_desc_t eventDesc = {}; + eventDesc.index = 0; + eventDesc.signal = 0; + eventDesc.wait = 0; eventPool = std::unique_ptr(L0::EventPool::create(driverHandle.get(), 0, nullptr, &eventPoolDesc)); ASSERT_NE(nullptr, eventPool); @@ -224,20 +228,6 @@ TEST_F(TimestampEventCreate, givenEventCreatedWithTimestampThenIsTimestampEventF EXPECT_TRUE(event->isTimestampEvent); } -TEST_F(TimestampEventCreate, givenEventTimestampsNotTriggeredThenValuesInInitialState) { - uint64_t globalStart, globalEnd, contextStart, contextEnd; - - event->getTimestamp(ZE_EVENT_TIMESTAMP_GLOBAL_START, &globalStart); - event->getTimestamp(ZE_EVENT_TIMESTAMP_GLOBAL_END, &globalEnd); - event->getTimestamp(ZE_EVENT_TIMESTAMP_CONTEXT_START, &contextStart); - event->getTimestamp(ZE_EVENT_TIMESTAMP_CONTEXT_END, &contextEnd); - - EXPECT_EQ(static_cast(Event::STATE_CLEARED), globalStart); - EXPECT_EQ(static_cast(Event::STATE_CLEARED), globalEnd); - EXPECT_EQ(static_cast(Event::STATE_CLEARED), contextStart); - EXPECT_EQ(static_cast(Event::STATE_CLEARED), contextEnd); -} - TEST_F(TimestampEventCreate, givenSingleTimestampEventThenAllocationSizeCreatedForAllTimestamps) { auto allocation = &eventPool->getAllocation(); ASSERT_NE(nullptr, allocation); diff --git a/level_zero/core/test/unit_tests/sources/image/test_image.cpp b/level_zero/core/test/unit_tests/sources/image/test_image.cpp index c6a60f6453..1a77f0805d 100644 --- a/level_zero/core/test/unit_tests/sources/image/test_image.cpp +++ b/level_zero/core/test/unit_tests/sources/image/test_image.cpp @@ -81,8 +81,7 @@ HWTEST2_F(ImageCreate, givenValidImageDescriptionWhenImageCreateThenImageIsCreat zeDesc.width = 1u; zeDesc.miplevels = 1u; zeDesc.type = ZE_IMAGE_TYPE_2DARRAY; - zeDesc.version = ZE_IMAGE_DESC_VERSION_CURRENT; - zeDesc.flags = ZE_IMAGE_FLAG_PROGRAM_READ; + zeDesc.flags = ZE_IMAGE_FLAG_BIAS_UNCACHED; zeDesc.format = {ZE_IMAGE_FORMAT_LAYOUT_32, ZE_IMAGE_FORMAT_TYPE_UINT, @@ -174,15 +173,15 @@ HWTEST2_P(TestImageFormats, givenValidLayoutAndTypeWhenCreateImageCoreFamilyThen zeDesc.width = 10u; zeDesc.miplevels = 1u; zeDesc.type = ZE_IMAGE_TYPE_2D; - zeDesc.version = ZE_IMAGE_DESC_VERSION_CURRENT; - zeDesc.flags = ZE_IMAGE_FLAG_PROGRAM_READ; + zeDesc.flags = ZE_IMAGE_FLAG_KERNEL_WRITE; - zeDesc.format = {params.first, - params.second, - ZE_IMAGE_FORMAT_SWIZZLE_R, - ZE_IMAGE_FORMAT_SWIZZLE_G, - ZE_IMAGE_FORMAT_SWIZZLE_B, - ZE_IMAGE_FORMAT_SWIZZLE_A}; + zeDesc.format = {}; + zeDesc.format.layout = params.first; + zeDesc.format.type = params.second; + zeDesc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_R; + zeDesc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_G; + zeDesc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_B; + zeDesc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_A; auto imageHW = std::make_unique>>(); @@ -394,7 +393,7 @@ TEST(ImageFormatDescHelperTest, givenSwizzlesThenEqualityIsProperlyDetermined) { } TEST(ImageFormatDescHelperTest, givenSupportedSwizzlesThenProperClEnumIsReturned) { - ze_image_format_desc_t format{}; + ze_image_format_t format{}; format.x = ZE_IMAGE_FORMAT_SWIZZLE_R; format.y = ZE_IMAGE_FORMAT_SWIZZLE_0; diff --git a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp index 2c631d471e..9601aae4e9 100644 --- a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp +++ b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp @@ -208,8 +208,6 @@ class KernelPropertiesTests : public ModuleFixture, public ::testing::Test { ModuleFixture::SetUp(); ze_kernel_desc_t kernelDesc = {}; - kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT; - kernelDesc.flags = ZE_KERNEL_FLAG_NONE; kernelDesc.pKernelName = kernelName.c_str(); ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle); @@ -248,14 +246,14 @@ HWTEST_F(KernelPropertiesTests, givenKernelThenCorrectNameIsRetrieved) { } HWTEST_F(KernelPropertiesTests, givenInvalidKernelThenUnitializedIsReturned) { - ze_kernel_propertiesExt_t kernelProperties = {}; + ze_kernel_properties_t kernelProperties = {}; std::vector prevKernelInfos; L0::ModuleImp *moduleImp = reinterpret_cast(module.get()); moduleImp->getTranslationUnit()->programInfo.kernelInfos.swap(prevKernelInfos); EXPECT_EQ(0u, moduleImp->getTranslationUnit()->programInfo.kernelInfos.size()); - ze_result_t res = kernel->getPropertiesExt(&kernelProperties); + ze_result_t res = kernel->getProperties(&kernelProperties); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, res); prevKernelInfos.swap(moduleImp->getTranslationUnit()->programInfo.kernelInfos); @@ -263,7 +261,7 @@ HWTEST_F(KernelPropertiesTests, givenInvalidKernelThenUnitializedIsReturned) { } HWTEST_F(KernelPropertiesTests, givenValidKernelThenPropertiesAreRetrieved) { - ze_kernel_propertiesExt_t kernelProperties = {}; + ze_kernel_properties_t kernelProperties = {}; kernelProperties.requiredNumSubGroups = std::numeric_limits::max(); kernelProperties.requiredSubgroupSize = std::numeric_limits::max(); @@ -278,14 +276,12 @@ HWTEST_F(KernelPropertiesTests, givenValidKernelThenPropertiesAreRetrieved) { memset(&kernelProperties.uuid.mid, std::numeric_limits::max(), sizeof(kernelProperties.uuid.mid)); - ze_kernel_propertiesExt_t kernelPropertiesBefore = {}; + ze_kernel_properties_t kernelPropertiesBefore = {}; kernelPropertiesBefore = kernelProperties; - ze_result_t res = kernel->getPropertiesExt(&kernelProperties); + ze_result_t res = kernel->getProperties(&kernelProperties); EXPECT_EQ(ZE_RESULT_SUCCESS, res); - EXPECT_EQ(0, strncmp(kernelName.c_str(), kernelProperties.name, - sizeof(kernelProperties.name))); EXPECT_EQ(numKernelArguments, kernelProperties.numKernelArgs); L0::ModuleImp *moduleImp = reinterpret_cast(module.get()); @@ -334,14 +330,14 @@ HWTEST_F(KernelPropertiesTests, givenValidKernelThenPropertiesAreRetrieved) { } HWTEST_F(KernelPropertiesTests, givenValidKernelAndNoMediavfestateThenSpillMemSizeIsZero) { - ze_kernel_propertiesExt_t kernelProperties = {}; + ze_kernel_properties_t kernelProperties = {}; kernelProperties.spillMemSize = std::numeric_limits::max(); - ze_kernel_propertiesExt_t kernelPropertiesBefore = {}; + ze_kernel_properties_t kernelPropertiesBefore = {}; kernelPropertiesBefore = kernelProperties; - ze_result_t res = kernel->getPropertiesExt(&kernelProperties); + ze_result_t res = kernel->getProperties(&kernelProperties); EXPECT_EQ(ZE_RESULT_SUCCESS, res); L0::ModuleImp *moduleImp = reinterpret_cast(module.get()); @@ -358,14 +354,14 @@ HWTEST_F(KernelPropertiesTests, givenValidKernelAndNoMediavfestateThenSpillMemSi } HWTEST_F(KernelPropertiesTests, givenValidKernelAndNollocateStatelessPrivateSurfaceThenPrivateMemSizeIsZero) { - ze_kernel_propertiesExt_t kernelProperties = {}; + ze_kernel_properties_t kernelProperties = {}; kernelProperties.spillMemSize = std::numeric_limits::max(); - ze_kernel_propertiesExt_t kernelPropertiesBefore = {}; + ze_kernel_properties_t kernelPropertiesBefore = {}; kernelPropertiesBefore = kernelProperties; - ze_result_t res = kernel->getPropertiesExt(&kernelProperties); + ze_result_t res = kernel->getProperties(&kernelProperties); EXPECT_EQ(ZE_RESULT_SUCCESS, res); L0::ModuleImp *moduleImp = reinterpret_cast(module.get()); diff --git a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp index d6cd2e9a21..aceeb1f535 100644 --- a/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp +++ b/level_zero/core/test/unit_tests/sources/memory/test_memory.cpp @@ -23,13 +23,12 @@ TEST_F(MemoryTest, givenDevicePointerThenDriverGetAllocPropertiesReturnsDeviceHa void *ptr = nullptr; ze_result_t result = driverHandle->allocDeviceMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + 0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, ptr); ze_memory_allocation_properties_t memoryProperties = {}; - memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT; ze_device_handle_t deviceHandle; result = driverHandle->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle); @@ -50,7 +49,7 @@ TEST_F(DeviceMemorySizeTest, givenSizeGreaterThanLimitThenDeviceAllocationFails) void *ptr = nullptr; ze_result_t result = driverHandle->allocDeviceMem(nullptr, - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + 0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_SIZE, result); } @@ -61,14 +60,13 @@ TEST_F(MemoryTest, givenSharedPointerThenDriverGetAllocPropertiesReturnsDeviceHa void *ptr = nullptr; ze_result_t result = driverHandle->allocSharedMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, - ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + 0u, + 0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, ptr); ze_memory_allocation_properties_t memoryProperties = {}; - memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT; ze_device_handle_t deviceHandle; result = driverHandle->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle); @@ -86,13 +84,12 @@ TEST_F(MemoryTest, givenHostPointerThenDriverGetAllocPropertiesReturnsNullDevice size_t alignment = 1u; void *ptr = nullptr; - ze_result_t result = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + ze_result_t result = driverHandle->allocHostMem(0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, ptr); ze_memory_allocation_properties_t memoryProperties = {}; - memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT; ze_device_handle_t deviceHandle; result = driverHandle->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle); @@ -110,7 +107,6 @@ TEST_F(MemoryTest, givenSystemAllocatedPointerThenDriverGetAllocPropertiesReturn int *ptr = new int[size]; ze_memory_allocation_properties_t memoryProperties = {}; - memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT; ze_device_handle_t deviceHandle; ze_result_t result = driverHandle->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle); @@ -127,8 +123,8 @@ TEST_F(MemoryTest, givenSharedPointerAndDeviceHandleAsNullThenDriverReturnsSucce ASSERT_NE(nullptr, device->toHandle()); ze_result_t result = driverHandle->allocSharedMem(nullptr, - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, - ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + 0u, + 0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, ptr); @@ -144,8 +140,8 @@ TEST_F(MemoryTest, givenNoDeviceWhenAllocatingSharedMemoryThenDeviceInAllocation ASSERT_NE(nullptr, device->toHandle()); ze_result_t result = driverHandle->allocSharedMem(nullptr, - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, - ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + 0u, + 0u, size, alignment, &ptr); auto alloc = driverHandle->svmAllocsManager->getSVMAlloc(ptr); EXPECT_EQ(alloc->device, nullptr); @@ -193,14 +189,13 @@ struct MemoryBitfieldTest : testing::Test { TEST_F(MemoryBitfieldTest, givenDeviceWithValidBitfieldWhenAllocatingDeviceMemoryThenPassProperBitfield) { auto result = driverHandle->allocDeviceMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + 0u, size, alignment, &ptr); EXPECT_EQ(neoDevice->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, ptr); } - TEST(MemoryBitfieldTests, givenDeviceWithValidBitfieldWhenAllocatingSharedMemoryThenPassProperBitfield) { DebugManagerStateRestore restorer; size_t size = 10; @@ -229,8 +224,8 @@ TEST(MemoryBitfieldTests, givenDeviceWithValidBitfieldWhenAllocatingSharedMemory EXPECT_NE(neoDevice0->getDeviceBitfield(), neoDevice1->getDeviceBitfield()); EXPECT_NE(neoDevice0->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield); auto result = driverHandle->allocSharedMem(nullptr, - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, - ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + ZE_DEVICE_MEMORY_PROPERTY_FLAG_TBD, + 0u, size, alignment, &ptr); EXPECT_EQ(neoDevice0->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield); @@ -242,8 +237,8 @@ TEST(MemoryBitfieldTests, givenDeviceWithValidBitfieldWhenAllocatingSharedMemory memoryManager->recentlyPassedDeviceBitfield = {}; EXPECT_NE(neoDevice1->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield); result = driverHandle->allocSharedMem(driverHandle->devices[1]->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, - ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + ZE_DEVICE_MEMORY_PROPERTY_FLAG_TBD, + 0u, size, alignment, &ptr); EXPECT_EQ(neoDevice1->getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield); @@ -310,7 +305,7 @@ TEST_F(AllocHostMemoryTest, whenCallingAllocHostMemThenAllocateGraphicsMemoryWithPropertiesIsCalledTheNumberOfTimesOfRootDevices) { void *ptr = nullptr; - ze_result_t result = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + ze_result_t result = driverHandle->allocHostMem(0u, 4096u, 0u, &ptr); EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, numRootDevices); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -326,7 +321,7 @@ TEST_F(AllocHostMemoryTest, void *ptr = nullptr; - ze_result_t result = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + ze_result_t result = driverHandle->allocHostMem(0u, 4096u, 0u, &ptr); EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, 1u); EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY, result); @@ -340,7 +335,7 @@ TEST_F(AllocHostMemoryTest, void *ptr = nullptr; - ze_result_t result = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + ze_result_t result = driverHandle->allocHostMem(0u, 4096u, 0u, &ptr); EXPECT_EQ(memoryManager->allocateGraphicsMemoryWithPropertiesCount, numRootDevices); EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY, result); @@ -355,8 +350,8 @@ TEST_F(ContextMemoryTest, whenAllocatingSharedAllocationFromContextThenAllocatio void *ptr = nullptr; ze_result_t result = context->allocSharedMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, - ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + 0u, + 0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, ptr); @@ -370,7 +365,7 @@ TEST_F(ContextMemoryTest, whenAllocatingHostAllocationFromContextThenAllocationS size_t alignment = 1u; void *ptr = nullptr; - ze_result_t result = context->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, + ze_result_t result = context->allocHostMem(0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, ptr); @@ -385,7 +380,7 @@ TEST_F(ContextMemoryTest, whenAllocatingDeviceAllocationFromContextThenAllocatio void *ptr = nullptr; ze_result_t result = context->allocDeviceMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + 0u, size, alignment, &ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, ptr); @@ -400,7 +395,7 @@ TEST_F(ContextMemoryTest, whenRetrievingAddressRangeForDeviceAllocationThenRange void *allocPtr = nullptr; ze_result_t result = context->allocDeviceMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + 0u, allocSize, alignment, &allocPtr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_NE(nullptr, allocPtr); @@ -422,7 +417,6 @@ TEST_F(ContextMemoryTest, givenSystemAllocatedPointerThenGetAllocPropertiesRetur int *ptr = new int[size]; ze_memory_allocation_properties_t memoryProperties = {}; - memoryProperties.version = ZE_MEMORY_ALLOCATION_PROPERTIES_VERSION_CURRENT; ze_device_handle_t deviceHandle; ze_result_t result = context->getMemAllocProperties(ptr, &memoryProperties, &deviceHandle); diff --git a/level_zero/core/test/unit_tests/sources/module/test_module.cpp b/level_zero/core/test/unit_tests/sources/module/test_module.cpp index ab3a210dfb..d36d663cdb 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module.cpp @@ -37,8 +37,6 @@ HWTEST_F(ModuleTest, givenKernelCreateReturnsSuccess) { ze_kernel_handle_t kernelHandle; ze_kernel_desc_t kernelDesc = {}; - kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT; - kernelDesc.flags = ZE_KERNEL_FLAG_NONE; kernelDesc.pKernelName = kernelName.c_str(); ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle); @@ -55,8 +53,6 @@ HWTEST2_F(ModuleTest, givenNonPatchedTokenThenSurfaceBaseAddressIsCorrectlySet, ze_kernel_handle_t kernelHandle; ze_kernel_desc_t kernelDesc = {}; - kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT; - kernelDesc.flags = ZE_KERNEL_FLAG_NONE; kernelDesc.pKernelName = kernelName.c_str(); ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle); @@ -67,7 +63,7 @@ HWTEST2_F(ModuleTest, givenNonPatchedTokenThenSurfaceBaseAddressIsCorrectlySet, void *devicePtr = nullptr; res = device->getDriverHandle()->allocDeviceMem(device->toHandle(), - ZE_DEVICE_MEM_ALLOC_FLAG_DEFAULT, + 0u, 16384u, 0u, &devicePtr); @@ -93,8 +89,6 @@ HWTEST_F(ModuleTest, givenKernelCreateWithIncorrectKernelNameReturnsFailure) { ze_kernel_handle_t kernelHandle; ze_kernel_desc_t kernelDesc = {}; - kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT; - kernelDesc.flags = ZE_KERNEL_FLAG_NONE; kernelDesc.pKernelName = "nonexistent_function"; ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle); @@ -120,7 +114,7 @@ struct ModuleSpecConstantsTests : public DeviceFixture, const uint32_t moduleNumSpecConstants = 4; ze_module_constants_t specConstants; - std::vector specConstantsPointerValues; + std::vector specConstantsPointerValues; const std::string binaryFilename = "test_kernel"; const std::string kernelName = "test"; @@ -138,14 +132,14 @@ HWTEST_F(ModuleSpecConstantsTests, givenSpecializationConstantsSetInDescriptorTh ASSERT_NE(0u, size); ASSERT_NE(nullptr, src); - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV; moduleDesc.pInputModule = reinterpret_cast(src.get()); moduleDesc.inputSize = size; specConstants.numConstants = mockCompiler->moduleNumSpecConstants; for (uint32_t i = 0; i < mockCompiler->moduleNumSpecConstants; i++) { - specConstantsPointerValues.push_back(reinterpret_cast(&mockCompiler->moduleSpecConstantsValues[i])); + specConstantsPointerValues.push_back(&mockCompiler->moduleSpecConstantsValues[i]); } specConstants.pConstantIds = mockCompiler->moduleSpecConstantsIds.data(); @@ -175,7 +169,7 @@ HWTEST_F(ModuleLinkingTest, givenFailureDuringLinkingWhenCreatingModuleThenModul mockTranslationUnit->programInfo.linkerInput = std::move(linkerInput); uint8_t spirvData{}; - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV; moduleDesc.pInputModule = &spirvData; moduleDesc.inputSize = sizeof(spirvData); @@ -204,7 +198,7 @@ HWTEST_F(ModuleLinkingTest, givenRemainingUnresolvedSymbolsDuringLinkingWhenCrea mockTranslationUnit->programInfo.linkerInput = std::move(linkerInput); uint8_t spirvData{}; - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV; moduleDesc.pInputModule = &spirvData; moduleDesc.inputSize = sizeof(spirvData); @@ -237,7 +231,6 @@ HWTEST_F(ModuleDynamicLinkTests, givenCallToDynamicLinkThenUnsupportedFeatureIsR delete module0; delete module1; } - class MultiDeviceModuleSetArgBufferTest : public MultiDeviceModuleFixture, public ::testing::Test { public: void SetUp() override { @@ -250,13 +243,11 @@ class MultiDeviceModuleSetArgBufferTest : public MultiDeviceModuleFixture, publi void createKernelAndAllocMemory(uint32_t rootDeviceIndex, void **ptr, ze_kernel_handle_t *kernelHandle) { ze_kernel_desc_t kernelDesc = {}; - kernelDesc.version = ZE_KERNEL_DESC_VERSION_CURRENT; - kernelDesc.flags = ZE_KERNEL_FLAG_NONE; kernelDesc.pKernelName = kernelName.c_str(); ze_result_t res = modules[rootDeviceIndex].get()->createKernel(&kernelDesc, kernelHandle); EXPECT_EQ(ZE_RESULT_SUCCESS, res); - res = driverHandle->allocHostMem(ZE_HOST_MEM_ALLOC_FLAG_DEFAULT, 4096u, rootDeviceIndex, ptr); + res = driverHandle->allocHostMem(0u, 4096u, rootDeviceIndex, ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, res); } }; @@ -297,7 +288,7 @@ HWTEST_F(ContextModuleCreateTest, givenCallToCreateModuleThenModuleIsReturned) { ASSERT_NE(0u, size); ASSERT_NE(nullptr, src); - ze_module_desc_t moduleDesc = {ZE_MODULE_DESC_VERSION_CURRENT}; + ze_module_desc_t moduleDesc = {}; moduleDesc.format = ZE_MODULE_FORMAT_NATIVE; moduleDesc.pInputModule = reinterpret_cast(src.get()); moduleDesc.inputSize = size; diff --git a/level_zero/core/test/unit_tests/sources/sampler/test_sampler.cpp b/level_zero/core/test/unit_tests/sources/sampler/test_sampler.cpp index 752a46a28a..97816f9a47 100644 --- a/level_zero/core/test/unit_tests/sources/sampler/test_sampler.cpp +++ b/level_zero/core/test/unit_tests/sources/sampler/test_sampler.cpp @@ -55,7 +55,6 @@ HWTEST2_P(SamplerCreateTest, givenDifferentDescriptorValuesThenSamplerIsCorrectl ze_bool_t isNormalized = std::get<2>(GetParam()); ze_sampler_desc_t desc = {}; - desc.version = ZE_SAMPLER_DESC_VERSION_CURRENT; desc.addressMode = addressMode; desc.filterMode = filterMode; desc.isNormalized = isNormalized; @@ -159,7 +158,6 @@ HWTEST2_F(ContextCreateSamplerTest, givenDifferentDescriptorValuesThenSamplerIsC ze_bool_t isNormalized = false; ze_sampler_desc_t desc = {}; - desc.version = ZE_SAMPLER_DESC_VERSION_CURRENT; desc.addressMode = addressMode; desc.filterMode = filterMode; desc.isNormalized = isNormalized; diff --git a/level_zero/ddi/ze_ddi_tables.h b/level_zero/ddi/ze_ddi_tables.h index 1868f6aa3b..da59ed8353 100644 --- a/level_zero/ddi/ze_ddi_tables.h +++ b/level_zero/ddi/ze_ddi_tables.h @@ -7,6 +7,9 @@ #pragma once #include +#include +#include +#include #include #include @@ -18,6 +21,7 @@ typedef struct _ze_gpu_driver_dditable_t { ze_dditable_t core_ddiTable; ze_dditable_t tracing_ddiTable; zet_dditable_t tools_ddiTable; + zes_dditable_t sysman_ddiTable; ze_api_version_t version = ZE_API_VERSION_1_0; diff --git a/level_zero/experimental/source/tracing/CMakeLists.txt b/level_zero/experimental/source/tracing/CMakeLists.txt index da9cd86081..4361359d8a 100644 --- a/level_zero/experimental/source/tracing/CMakeLists.txt +++ b/level_zero/experimental/source/tracing/CMakeLists.txt @@ -5,39 +5,37 @@ # set(L0_SRCS_EXPERIMENTAL_TRACING - ${CMAKE_CURRENT_SOURCE_DIR}/tracing.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_barrier_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_barrier_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cmdlist_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cmdlist_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cmdqueue_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cmdqueue_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cl_interop_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cl_interop_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_copy_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_copy_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_device_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_device_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_driver_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_driver_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_event_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_event_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_fence_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_fence_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_global_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_global_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_sampler_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_sampler_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_residency_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_residency_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_image_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_image_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_memory_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_memory_imp.h - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_module_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracing_module_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_barrier_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_barrier_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cmdlist_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cmdlist_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cmdqueue_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_cmdqueue_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_copy_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_copy_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_device_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_device_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_driver_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_driver_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_event_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_event_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_fence_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_fence_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_global_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_global_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_sampler_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_sampler_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_residency_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_residency_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_image_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_image_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_memory_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_memory_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_module_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/tracing_module_imp.h ) target_sources(${L0_STATIC_LIB_NAME} diff --git a/level_zero/experimental/source/tracing/tracing.h b/level_zero/experimental/source/tracing/tracing.h index b83876817e..7f29180266 100644 --- a/level_zero/experimental/source/tracing/tracing.h +++ b/level_zero/experimental/source/tracing/tracing.h @@ -6,25 +6,25 @@ */ #pragma once -#include -#include -struct _zet_tracer_handle_t {}; +#include + +struct _zet_tracer_exp_handle_t {}; namespace L0 { -struct APITracer : _zet_tracer_handle_t { +struct APITracer : _zet_tracer_exp_handle_t { static APITracer *create(); virtual ~APITracer() = default; - static APITracer *fromHandle(zet_tracer_handle_t handle) { return static_cast(handle); } - inline zet_tracer_handle_t toHandle() { return this; } - virtual ze_result_t destroyTracer(zet_tracer_handle_t phTracer) = 0; + static APITracer *fromHandle(zet_tracer_exp_handle_t handle) { return static_cast(handle); } + inline zet_tracer_exp_handle_t toHandle() { return this; } + virtual ze_result_t destroyTracer(zet_tracer_exp_handle_t phTracer) = 0; virtual ze_result_t setPrologues(zet_core_callbacks_t *pCoreCbs) = 0; virtual ze_result_t setEpilogues(zet_core_callbacks_t *pCoreCbs) = 0; virtual ze_result_t enableTracer(ze_bool_t enable) = 0; }; -ze_result_t createAPITracer(zet_driver_handle_t hDriver, const zet_tracer_desc_t *desc, zet_tracer_handle_t *phTracer); +ze_result_t createAPITracer(zet_context_handle_t hContext, const zet_tracer_exp_desc_t *desc, zet_tracer_exp_handle_t *phTracer); struct APITracerContext { virtual ~APITracerContext() = default; diff --git a/level_zero/experimental/source/tracing/tracing_barrier_imp.cpp b/level_zero/experimental/source/tracing/tracing_barrier_imp.cpp index 622ce835ce..94c17fb1e3 100644 --- a/level_zero/experimental/source/tracing/tracing_barrier_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_barrier_imp.cpp @@ -84,24 +84,3 @@ zeCommandListAppendMemoryRangesBarrier_Tracing(ze_command_list_handle_t hCommand *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceSystemBarrier_Tracing(ze_device_handle_t hDevice) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnSystemBarrier, - hDevice); - - ze_device_system_barrier_params_t tracerParams; - tracerParams.phDevice = &hDevice; - - L0::APITracerCallbackDataImp apiCallbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceSystemBarrierCb_t, Device, pfnSystemBarrierCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnSystemBarrier, - &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, - *tracerParams.phDevice); -} diff --git a/level_zero/experimental/source/tracing/tracing_barrier_imp.h b/level_zero/experimental/source/tracing/tracing_barrier_imp.h index 420a10b783..d689b12113 100644 --- a/level_zero/experimental/source/tracing/tracing_barrier_imp.h +++ b/level_zero/experimental/source/tracing/tracing_barrier_imp.h @@ -7,8 +7,6 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL @@ -16,6 +14,7 @@ zeCommandListAppendBarrier_Tracing(ze_command_list_handle_t hCommandList, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents); + ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier_Tracing(ze_command_list_handle_t hCommandList, uint32_t numRanges, @@ -24,6 +23,4 @@ zeCommandListAppendMemoryRangesBarrier_Tracing(ze_command_list_handle_t hCommand ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents); -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceSystemBarrier_Tracing(ze_device_handle_t hDevice); } diff --git a/level_zero/experimental/source/tracing/tracing_cl_interop_imp.cpp b/level_zero/experimental/source/tracing/tracing_cl_interop_imp.cpp deleted file mode 100644 index 0fffdeb511..0000000000 --- a/level_zero/experimental/source/tracing/tracing_cl_interop_imp.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "level_zero/experimental/source/tracing/tracing_imp.h" - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLMemory_Tracing(ze_device_handle_t hDevice, - cl_context context, - cl_mem mem, - void **ptr) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnRegisterCLMemory, - hDevice, - context, - mem, - ptr); - - ze_device_register_cl_memory_params_t tracerParams; - tracerParams.phDevice = &hDevice; - tracerParams.pcontext = &context; - tracerParams.pmem = &mem; - tracerParams.pptr = &ptr; - - L0::APITracerCallbackDataImp apiCallbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceRegisterCLMemoryCb_t, Device, pfnRegisterCLMemoryCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnRegisterCLMemory, - &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, - *tracerParams.phDevice, - *tracerParams.pcontext, - *tracerParams.pmem, - *tracerParams.pptr); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLProgram_Tracing(ze_device_handle_t hDevice, - cl_context context, - cl_program program, - ze_module_handle_t *phModule) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnRegisterCLProgram, - hDevice, - context, - program, - phModule); - - ze_device_register_cl_program_params_t tracerParams; - tracerParams.phDevice = &hDevice; - tracerParams.pcontext = &context; - tracerParams.pprogram = &program; - tracerParams.pphModule = &phModule; - - L0::APITracerCallbackDataImp apiCallbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceRegisterCLProgramCb_t, Device, pfnRegisterCLProgramCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnRegisterCLProgram, - &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, - *tracerParams.phDevice, - *tracerParams.pcontext, - *tracerParams.pprogram, - *tracerParams.pphModule); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLCommandQueue_Tracing(ze_device_handle_t hDevice, - cl_context context, - cl_command_queue commandQueue, - ze_command_queue_handle_t *phCommandQueue) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnRegisterCLCommandQueue, - hDevice, - context, - commandQueue, - phCommandQueue); - - ze_device_register_cl_command_queue_params_t tracerParams; - tracerParams.phDevice = &hDevice; - tracerParams.pcontext = &context; - tracerParams.pcommand_queue = &commandQueue; - tracerParams.pphCommandQueue = &phCommandQueue; - - L0::APITracerCallbackDataImp apiCallbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceRegisterCLCommandQueueCb_t, Device, pfnRegisterCLCommandQueueCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnRegisterCLCommandQueue, - &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, - *tracerParams.phDevice, - *tracerParams.pcontext, - *tracerParams.pcommand_queue, - *tracerParams.pphCommandQueue); -} diff --git a/level_zero/experimental/source/tracing/tracing_cl_interop_imp.h b/level_zero/experimental/source/tracing/tracing_cl_interop_imp.h deleted file mode 100644 index cc6cb55a23..0000000000 --- a/level_zero/experimental/source/tracing/tracing_cl_interop_imp.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2019-2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#pragma once - -#include "third_party/level_zero/ze_api_ext.h" - -extern "C" { - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLMemory_Tracing(ze_device_handle_t hDevice, - cl_context context, - cl_mem mem, - void **ptr); - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLProgram_Tracing(ze_device_handle_t hDevice, - cl_context context, - cl_program program, - ze_module_handle_t *phModule); - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceRegisterCLCommandQueue_Tracing(ze_device_handle_t hDevice, - cl_context context, - cl_command_queue commandQueue, - ze_command_queue_handle_t *phCommandQueue); -} diff --git a/level_zero/experimental/source/tracing/tracing_cmdlist_imp.cpp b/level_zero/experimental/source/tracing/tracing_cmdlist_imp.cpp index c5d445968a..8fa85846b3 100644 --- a/level_zero/experimental/source/tracing/tracing_cmdlist_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_cmdlist_imp.cpp @@ -8,16 +8,19 @@ #include "level_zero/experimental/source/tracing/tracing_imp.h" ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListCreate_Tracing(ze_device_handle_t hDevice, +zeCommandListCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_command_list_desc_t *desc, ze_command_list_handle_t *phCommandList) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnCreate, + hContext, hDevice, desc, phCommandList); ze_command_list_create_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.pdesc = &desc; tracerParams.pphCommandList = &phCommandList; @@ -31,23 +34,26 @@ zeCommandListCreate_Tracing(ze_device_handle_t hDevice, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphCommandList); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListCreateImmediate_Tracing( - ze_device_handle_t hDevice, - const ze_command_queue_desc_t *altdesc, - ze_command_list_handle_t *phCommandList) { +zeCommandListCreateImmediate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + const ze_command_queue_desc_t *altdesc, + ze_command_list_handle_t *phCommandList) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnCreateImmediate, + hContext, hDevice, altdesc, phCommandList); ze_command_list_create_immediate_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.paltdesc = &altdesc; tracerParams.pphCommandList = &phCommandList; @@ -61,6 +67,7 @@ zeCommandListCreateImmediate_Tracing( apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.paltdesc, *tracerParams.pphCommandList); diff --git a/level_zero/experimental/source/tracing/tracing_cmdlist_imp.h b/level_zero/experimental/source/tracing/tracing_cmdlist_imp.h index d77d9101bf..9f65eb95ce 100644 --- a/level_zero/experimental/source/tracing/tracing_cmdlist_imp.h +++ b/level_zero/experimental/source/tracing/tracing_cmdlist_imp.h @@ -7,17 +7,17 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListCreate_Tracing(ze_device_handle_t hDevice, +zeCommandListCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_command_list_desc_t *desc, ze_command_list_handle_t *phCommandList); ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListCreateImmediate_Tracing(ze_device_handle_t hDevice, +zeCommandListCreateImmediate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_command_queue_desc_t *altdesc, ze_command_list_handle_t *phCommandList); @@ -29,7 +29,4 @@ zeCommandListClose_Tracing(ze_command_list_handle_t hCommandList); ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListReset_Tracing(ze_command_list_handle_t hCommandList); - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListResetParameters_Tracing(ze_command_list_handle_t hCommandList); } diff --git a/level_zero/experimental/source/tracing/tracing_cmdqueue_imp.cpp b/level_zero/experimental/source/tracing/tracing_cmdqueue_imp.cpp index c551c3af37..66b96022a6 100644 --- a/level_zero/experimental/source/tracing/tracing_cmdqueue_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_cmdqueue_imp.cpp @@ -8,16 +8,19 @@ #include "level_zero/experimental/source/tracing/tracing_imp.h" ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandQueueCreate_Tracing(ze_device_handle_t hDevice, +zeCommandQueueCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_command_queue_desc_t *desc, ze_command_queue_handle_t *phCommandQueue) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandQueue.pfnCreate, + hContext, hDevice, desc, phCommandQueue); ze_command_queue_create_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.pdesc = &desc; tracerParams.pphCommandQueue = &phCommandQueue; @@ -30,10 +33,12 @@ zeCommandQueueCreate_Tracing(ze_device_handle_t hDevice, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphCommandQueue); } + ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueDestroy_Tracing(ze_command_queue_handle_t hCommandQueue) { @@ -85,9 +90,10 @@ zeCommandQueueExecuteCommandLists_Tracing(ze_command_queue_handle_t hCommandQueu *tracerParams.pphCommandLists, *tracerParams.phFence); } + ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueSynchronize_Tracing(ze_command_queue_handle_t hCommandQueue, - uint32_t timeout) { + uint64_t timeout) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandQueue.pfnSynchronize, hCommandQueue, diff --git a/level_zero/experimental/source/tracing/tracing_cmdqueue_imp.h b/level_zero/experimental/source/tracing/tracing_cmdqueue_imp.h index 894bbf2ba0..1a27edb2fe 100644 --- a/level_zero/experimental/source/tracing/tracing_cmdqueue_imp.h +++ b/level_zero/experimental/source/tracing/tracing_cmdqueue_imp.h @@ -7,8 +7,6 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL diff --git a/level_zero/experimental/source/tracing/tracing_copy_imp.cpp b/level_zero/experimental/source/tracing/tracing_copy_imp.cpp index 32f4f5426e..63ac13367a 100644 --- a/level_zero/experimental/source/tracing/tracing_copy_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_copy_imp.cpp @@ -12,21 +12,27 @@ zeCommandListAppendMemoryCopy_Tracing(ze_command_list_handle_t hCommandList, void *dstptr, const void *srcptr, size_t size, - ze_event_handle_t hEvent) { + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryCopy, hCommandList, dstptr, srcptr, size, - hEvent); + hSignalEvent, + numWaitEvents, + phWaitEvents); ze_command_list_append_memory_copy_params_t tracerParams; tracerParams.phCommandList = &hCommandList; tracerParams.pdstptr = &dstptr; tracerParams.psrcptr = &srcptr; tracerParams.psize = &size; - tracerParams.phEvent = &hEvent; + tracerParams.phSignalEvent = &hSignalEvent; + tracerParams.pnumWaitEvents = &numWaitEvents; + tracerParams.pphWaitEvents = &phWaitEvents; L0::APITracerCallbackDataImp api_callbackData; @@ -41,7 +47,9 @@ zeCommandListAppendMemoryCopy_Tracing(ze_command_list_handle_t hCommandList, *tracerParams.pdstptr, *tracerParams.psrcptr, *tracerParams.psize, - *tracerParams.phEvent); + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -50,7 +58,9 @@ zeCommandListAppendMemoryFill_Tracing(ze_command_list_handle_t hCommandList, const void *pattern, size_t patternSize, size_t size, - ze_event_handle_t hEvent) { + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryFill, hCommandList, @@ -58,7 +68,9 @@ zeCommandListAppendMemoryFill_Tracing(ze_command_list_handle_t hCommandList, pattern, patternSize, size, - hEvent); + hSignalEvent, + numWaitEvents, + phWaitEvents); ze_command_list_append_memory_fill_params_t tracerParams; tracerParams.phCommandList = &hCommandList; @@ -66,7 +78,9 @@ zeCommandListAppendMemoryFill_Tracing(ze_command_list_handle_t hCommandList, tracerParams.ppattern = &pattern; tracerParams.ppattern_size = &patternSize; tracerParams.psize = &size; - tracerParams.phEvent = &hEvent; + tracerParams.phSignalEvent = &hSignalEvent; + tracerParams.pnumWaitEvents = &numWaitEvents; + tracerParams.pphWaitEvents = &phWaitEvents; L0::APITracerCallbackDataImp api_callbackData; @@ -82,7 +96,9 @@ zeCommandListAppendMemoryFill_Tracing(ze_command_list_handle_t hCommandList, *tracerParams.ppattern, *tracerParams.ppattern_size, *tracerParams.psize, - *tracerParams.phEvent); + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -95,7 +111,9 @@ zeCommandListAppendMemoryCopyRegion_Tracing(ze_command_list_handle_t hCommandLis const ze_copy_region_t *srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, - ze_event_handle_t hEvent) { + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryCopyRegion, hCommandList, @@ -107,7 +125,9 @@ zeCommandListAppendMemoryCopyRegion_Tracing(ze_command_list_handle_t hCommandLis srcRegion, srcPitch, srcSlicePitch, - hEvent); + hSignalEvent, + numWaitEvents, + phWaitEvents); ze_command_list_append_memory_copy_region_params_t tracerParams; tracerParams.phCommandList = &hCommandList; @@ -119,7 +139,9 @@ zeCommandListAppendMemoryCopyRegion_Tracing(ze_command_list_handle_t hCommandLis tracerParams.psrcRegion = &srcRegion; tracerParams.psrcPitch = &srcPitch; tracerParams.psrcSlicePitch = &srcSlicePitch; - tracerParams.phEvent = &hEvent; + tracerParams.phSignalEvent = &hSignalEvent; + tracerParams.pnumWaitEvents = &numWaitEvents; + tracerParams.pphWaitEvents = &phWaitEvents; L0::APITracerCallbackDataImp api_callbackData; @@ -139,26 +161,83 @@ zeCommandListAppendMemoryCopyRegion_Tracing(ze_command_list_handle_t hCommandLis *tracerParams.psrcRegion, *tracerParams.psrcPitch, *tracerParams.psrcSlicePitch, - *tracerParams.phEvent); + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zeCommandListAppendMemoryCopyFromContext_Tracing(ze_command_list_handle_t hCommandList, + void *dstptr, + ze_context_handle_t hContextSrc, + const void *srcptr, + size_t size, + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { + + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryCopyFromContext, + hCommandList, + dstptr, + hContextSrc, + srcptr, + size, + hSignalEvent, + numWaitEvents, + phWaitEvents); + + ze_command_list_append_memory_copy_from_context_params_t tracerParams; + tracerParams.phCommandList = &hCommandList; + tracerParams.pdstptr = &dstptr; + tracerParams.phContextSrc = &hContextSrc, + tracerParams.psrcptr = &srcptr, + tracerParams.psize = &size, + tracerParams.phSignalEvent = &hSignalEvent; + tracerParams.pnumWaitEvents = &numWaitEvents; + tracerParams.pphWaitEvents = &phWaitEvents; + + L0::APITracerCallbackDataImp api_callbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnCommandListAppendMemoryCopyFromContextCb_t, CommandList, pfnAppendMemoryCopyFromContextCb); + + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.CommandList.pfnAppendMemoryCopyFromContext, + &tracerParams, + api_callbackData.apiOrdinal, + api_callbackData.prologCallbacks, + api_callbackData.epilogCallbacks, + *tracerParams.phCommandList, + *tracerParams.pdstptr, + *tracerParams.phContextSrc, + *tracerParams.psrcptr, + *tracerParams.psize, + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopy_Tracing(ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, - ze_event_handle_t hEvent) { + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnAppendImageCopy, hCommandList, hDstImage, hSrcImage, - hEvent); + hSignalEvent, + numWaitEvents, + phWaitEvents); ze_command_list_append_image_copy_params_t tracerParams; tracerParams.phCommandList = &hCommandList; tracerParams.phDstImage = &hDstImage; tracerParams.phSrcImage = &hSrcImage; - tracerParams.phEvent = &hEvent; + tracerParams.phSignalEvent = &hSignalEvent; + tracerParams.pnumWaitEvents = &numWaitEvents; + tracerParams.pphWaitEvents = &phWaitEvents; L0::APITracerCallbackDataImp api_callbackData; @@ -172,17 +251,20 @@ zeCommandListAppendImageCopy_Tracing(ze_command_list_handle_t hCommandList, *tracerParams.phCommandList, *tracerParams.phDstImage, *tracerParams.phSrcImage, - *tracerParams.phEvent); + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListAppendImageCopyRegion_Tracing( - ze_command_list_handle_t hCommandList, - ze_image_handle_t hDstImage, - ze_image_handle_t hSrcImage, - const ze_image_region_t *pDstRegion, - const ze_image_region_t *pSrcRegion, - ze_event_handle_t hEvent) { +zeCommandListAppendImageCopyRegion_Tracing(ze_command_list_handle_t hCommandList, + ze_image_handle_t hDstImage, + ze_image_handle_t hSrcImage, + const ze_image_region_t *pDstRegion, + const ze_image_region_t *pSrcRegion, + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnAppendImageCopyRegion, hCommandList, @@ -190,7 +272,9 @@ zeCommandListAppendImageCopyRegion_Tracing( hSrcImage, pDstRegion, pSrcRegion, - hEvent); + hSignalEvent, + numWaitEvents, + phWaitEvents); ze_command_list_append_image_copy_region_params_t tracerParams; tracerParams.phCommandList = &hCommandList; @@ -198,7 +282,9 @@ zeCommandListAppendImageCopyRegion_Tracing( tracerParams.phSrcImage = &hSrcImage; tracerParams.ppDstRegion = &pDstRegion; tracerParams.ppSrcRegion = &pSrcRegion; - tracerParams.phEvent = &hEvent; + tracerParams.phSignalEvent = &hSignalEvent; + tracerParams.pnumWaitEvents = &numWaitEvents; + tracerParams.pphWaitEvents = &phWaitEvents; L0::APITracerCallbackDataImp api_callbackData; @@ -214,7 +300,9 @@ zeCommandListAppendImageCopyRegion_Tracing( *tracerParams.phSrcImage, *tracerParams.ppDstRegion, *tracerParams.ppSrcRegion, - *tracerParams.phEvent); + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -222,21 +310,27 @@ zeCommandListAppendImageCopyToMemory_Tracing(ze_command_list_handle_t hCommandLi void *dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t *pSrcRegion, - ze_event_handle_t hEvent) { + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnAppendImageCopyToMemory, hCommandList, dstptr, hSrcImage, pSrcRegion, - hEvent); + hSignalEvent, + numWaitEvents, + phWaitEvents); ze_command_list_append_image_copy_to_memory_params_t tracerParams; tracerParams.phCommandList = &hCommandList; tracerParams.pdstptr = &dstptr; tracerParams.phSrcImage = &hSrcImage; tracerParams.ppSrcRegion = &pSrcRegion; - tracerParams.phEvent = &hEvent; + tracerParams.phSignalEvent = &hSignalEvent; + tracerParams.pnumWaitEvents = &numWaitEvents; + tracerParams.pphWaitEvents = &phWaitEvents; L0::APITracerCallbackDataImp api_callbackData; @@ -251,7 +345,9 @@ zeCommandListAppendImageCopyToMemory_Tracing(ze_command_list_handle_t hCommandLi *tracerParams.pdstptr, *tracerParams.phSrcImage, *tracerParams.ppSrcRegion, - *tracerParams.phEvent); + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -259,21 +355,27 @@ zeCommandListAppendImageCopyFromMemory_Tracing(ze_command_list_handle_t hCommand ze_image_handle_t hDstImage, const void *srcptr, const ze_image_region_t *pDstRegion, - ze_event_handle_t hEvent) { + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.CommandList.pfnAppendImageCopyFromMemory, hCommandList, hDstImage, srcptr, pDstRegion, - hEvent); + hSignalEvent, + numWaitEvents, + phWaitEvents); ze_command_list_append_image_copy_from_memory_params_t tracerParams; tracerParams.phCommandList = &hCommandList; tracerParams.phDstImage = &hDstImage; tracerParams.psrcptr = &srcptr; tracerParams.ppDstRegion = &pDstRegion; - tracerParams.phEvent = &hEvent; + tracerParams.phSignalEvent = &hSignalEvent; + tracerParams.pnumWaitEvents = &numWaitEvents; + tracerParams.pphWaitEvents = &phWaitEvents; L0::APITracerCallbackDataImp api_callbackData; @@ -288,7 +390,9 @@ zeCommandListAppendImageCopyFromMemory_Tracing(ze_command_list_handle_t hCommand *tracerParams.phDstImage, *tracerParams.psrcptr, *tracerParams.ppDstRegion, - *tracerParams.phEvent); + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); } ZE_APIEXPORT ze_result_t ZE_APICALL @@ -355,4 +459,4 @@ zeCommandListAppendMemAdvise_Tracing(ze_command_list_handle_t hCommandList, *tracerParams.pptr, *tracerParams.psize, *tracerParams.padvice); -} \ No newline at end of file +} diff --git a/level_zero/experimental/source/tracing/tracing_copy_imp.h b/level_zero/experimental/source/tracing/tracing_copy_imp.h index 30186c9a4b..d82f7a231a 100644 --- a/level_zero/experimental/source/tracing/tracing_copy_imp.h +++ b/level_zero/experimental/source/tracing/tracing_copy_imp.h @@ -7,8 +7,6 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL @@ -16,7 +14,9 @@ zeCommandListAppendMemoryCopy_Tracing(ze_command_list_handle_t hCommandList, void *dstptr, const void *srcptr, size_t size, - ze_event_handle_t hEvent); + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents); ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryFill_Tracing(ze_command_list_handle_t hCommandList, @@ -24,7 +24,9 @@ zeCommandListAppendMemoryFill_Tracing(ze_command_list_handle_t hCommandList, const void *pattern, size_t patternSize, size_t size, - ze_event_handle_t hEvent); + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents); ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyRegion_Tracing(ze_command_list_handle_t hCommandList, @@ -36,13 +38,27 @@ zeCommandListAppendMemoryCopyRegion_Tracing(ze_command_list_handle_t hCommandLis const ze_copy_region_t *srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, - ze_event_handle_t hEvent); + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents); + +ZE_APIEXPORT ze_result_t ZE_APICALL +zeCommandListAppendMemoryCopyFromContext_Tracing(ze_command_list_handle_t hCommandList, + void *dstptr, + ze_context_handle_t hContextSrc, + const void *srcptr, + size_t size, + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents); ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopy_Tracing(ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, - ze_event_handle_t hEvent); + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents); ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopyRegion_Tracing(ze_command_list_handle_t hCommandList, @@ -50,7 +66,9 @@ zeCommandListAppendImageCopyRegion_Tracing(ze_command_list_handle_t hCommandList ze_image_handle_t hSrcImage, const ze_image_region_t *pDstRegion, const ze_image_region_t *pSrcRegion, - ze_event_handle_t hEvent); + ze_event_handle_t hSignalEvent, + uint32_t numWaitEvents, + ze_event_handle_t *phWaitEvents); ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemory_Tracing(ze_command_list_handle_t hCommandList, diff --git a/level_zero/experimental/source/tracing/tracing_device_imp.cpp b/level_zero/experimental/source/tracing/tracing_device_imp.cpp index be2eb9d72c..f327aa3fda 100644 --- a/level_zero/experimental/source/tracing/tracing_device_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_device_imp.cpp @@ -117,14 +117,17 @@ zeDeviceGetMemoryProperties_Tracing(ze_device_handle_t hDevice, ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetCacheProperties_Tracing(ze_device_handle_t hDevice, + uint32_t *pCount, ze_device_cache_properties_t *pCacheProperties) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnGetCacheProperties, hDevice, + pCount, pCacheProperties); ze_device_get_cache_properties_params_t tracerParams; tracerParams.phDevice = &hDevice; + tracerParams.ppCount = &pCount; tracerParams.ppCacheProperties = &pCacheProperties; L0::APITracerCallbackDataImp api_callbackData; @@ -137,6 +140,7 @@ zeDeviceGetCacheProperties_Tracing(ze_device_handle_t hDevice, api_callbackData.prologCallbacks, api_callbackData.epilogCallbacks, *tracerParams.phDevice, + *tracerParams.ppCount, *tracerParams.ppCacheProperties); } @@ -253,79 +257,28 @@ zeDeviceCanAccessPeer_Tracing(ze_device_handle_t hDevice, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelSetIntermediateCacheConfig_Tracing(ze_kernel_handle_t hKernel, - ze_cache_config_t cacheConfig) { +zeKernelSetCacheConfig_Tracing(ze_kernel_handle_t hKernel, + ze_cache_config_flags_t flags) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Kernel.pfnSetIntermediateCacheConfig, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Kernel.pfnSetCacheConfig, hKernel, - cacheConfig); + flags); - ze_kernel_set_intermediate_cache_config_params_t tracerParams; + ze_kernel_set_cache_config_params_t tracerParams; tracerParams.phKernel = &hKernel; - tracerParams.pCacheConfig = &cacheConfig; + tracerParams.pflags = &flags; - L0::APITracerCallbackDataImp api_callbackData; + L0::APITracerCallbackDataImp api_callbackData; - ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnKernelSetIntermediateCacheConfigCb_t, Kernel, pfnSetIntermediateCacheConfigCb); + ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnKernelSetCacheConfigCb_t, Kernel, pfnSetCacheConfigCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Kernel.pfnSetIntermediateCacheConfig, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Kernel.pfnSetCacheConfig, &tracerParams, api_callbackData.apiOrdinal, api_callbackData.prologCallbacks, api_callbackData.epilogCallbacks, *tracerParams.phKernel, - *tracerParams.pCacheConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceSetLastLevelCacheConfig_Tracing(ze_device_handle_t hDevice, - ze_cache_config_t cacheConfig) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnSetLastLevelCacheConfig, - hDevice, - cacheConfig); - - ze_device_set_last_level_cache_config_params_t tracerParams; - tracerParams.phDevice = &hDevice; - tracerParams.pCacheConfig = &cacheConfig; - - L0::APITracerCallbackDataImp api_callbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnDeviceSetLastLevelCacheConfigCb_t, Device, pfnSetLastLevelCacheConfigCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnSetLastLevelCacheConfig, - &tracerParams, - api_callbackData.apiOrdinal, - api_callbackData.prologCallbacks, - api_callbackData.epilogCallbacks, - *tracerParams.phDevice, - *tracerParams.pCacheConfig); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceGetKernelProperties_Tracing(ze_device_handle_t hDevice, - ze_device_kernel_properties_t *pKernelProperties) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnGetKernelProperties, - hDevice, - pKernelProperties); - - ze_device_get_kernel_properties_params_t tracerParams; - tracerParams.phDevice = &hDevice; - tracerParams.ppKernelProperties = &pKernelProperties; - - L0::APITracerCallbackDataImp api_callbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnDeviceGetKernelPropertiesCb_t, Device, - pfnGetKernelPropertiesCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnGetKernelProperties, - &tracerParams, - api_callbackData.apiOrdinal, - api_callbackData.prologCallbacks, - api_callbackData.epilogCallbacks, - *tracerParams.phDevice, - *tracerParams.ppKernelProperties); + *tracerParams.pflags); } ZE_APIEXPORT ze_result_t ZE_APICALL diff --git a/level_zero/experimental/source/tracing/tracing_device_imp.h b/level_zero/experimental/source/tracing/tracing_device_imp.h index 979403e9e3..f8941ee39c 100644 --- a/level_zero/experimental/source/tracing/tracing_device_imp.h +++ b/level_zero/experimental/source/tracing/tracing_device_imp.h @@ -7,8 +7,6 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL @@ -31,6 +29,7 @@ zeDeviceGetMemoryProperties_Tracing(ze_device_handle_t hDevice, ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetCacheProperties_Tracing(ze_device_handle_t hDevice, + uint32_t pCount, ze_device_cache_properties_t *pCacheProperties); ZE_APIEXPORT ze_result_t ZE_APICALL @@ -53,18 +52,10 @@ zeDeviceCanAccessPeer_Tracing(ze_device_handle_t hDevice, ze_bool_t *value); ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelSetIntermediateCacheConfig_Tracing(ze_kernel_handle_t hKernel, - ze_cache_config_t cacheConfig); - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceSetLastLevelCacheConfig_Tracing(ze_device_handle_t hDevice, - ze_cache_config_t cacheConfig); - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceGetKernelProperties_Tracing(ze_device_handle_t hDevice, - ze_device_kernel_properties_t *pKernelProperties); +zeKernelSetCacheConfig_Tracing(ze_kernel_handle_t hKernel, + ze_cache_config_flags_t flags); ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetMemoryAccessProperties_Tracing(ze_device_handle_t hDevice, - ze_device_memory_access_properties_t *pMemAccessProperties); + ze_memory_access_cap_flags_t *pMemAccessProperties); } diff --git a/level_zero/experimental/source/tracing/tracing_driver_imp.cpp b/level_zero/experimental/source/tracing/tracing_driver_imp.cpp index 967cc69277..0c17a6c301 100644 --- a/level_zero/experimental/source/tracing/tracing_driver_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_driver_imp.cpp @@ -80,55 +80,55 @@ zeDriverGetApiVersion_Tracing(ze_driver_handle_t hDrivers, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetIPCProperties_Tracing(ze_driver_handle_t hDriver, - ze_driver_ipc_properties_t *pIPCProperties) { +zeDriverGetIpcProperties_Tracing(ze_driver_handle_t hDriver, + ze_driver_ipc_properties_t *pIpcProperties) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnGetIPCProperties, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnGetIpcProperties, hDriver, - pIPCProperties); + pIpcProperties); ze_driver_get_ipc_properties_params_t tracerParams; tracerParams.phDriver = &hDriver; - tracerParams.ppIPCProperties = &pIPCProperties; + tracerParams.ppIpcProperties = &pIpcProperties; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetIPCPropertiesCb_t, Driver, pfnGetIPCPropertiesCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetIpcPropertiesCb_t, Driver, pfnGetIpcPropertiesCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnGetIPCProperties, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnGetIpcProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, - *tracerParams.ppIPCProperties); + *tracerParams.ppIpcProperties); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetExtensionFunctionAddress_Tracing(ze_driver_handle_t hDriver, - const char *pFuncName, - void **pfunc) { +zeDriverGetExtensionProperties_Tracing(ze_driver_handle_t hDriver, + uint32_t *pCount, + ze_driver_extension_properties_t *pExtensionProperties) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnGetExtensionFunctionAddress, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnGetExtensionProperties, hDriver, - pFuncName, - pfunc); + pCount, + pExtensionProperties); - ze_driver_get_extension_function_address_params_t tracerParams; + ze_driver_get_extension_properties_params_t tracerParams; tracerParams.phDriver = &hDriver; - tracerParams.ppFuncName = &pFuncName; - tracerParams.ppfunc = &pfunc; + tracerParams.ppCount = &pCount; + tracerParams.ppExtensionProperties = &pExtensionProperties; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetExtensionFunctionAddressCb_t, Driver, pfnGetExtensionFunctionAddressCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetExtensionPropertiesCb_t, Driver, pfnGetExtensionPropertiesCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnGetExtensionFunctionAddress, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnGetExtensionProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, - *tracerParams.ppFuncName, - *tracerParams.ppfunc); + *tracerParams.ppCount, + *tracerParams.ppExtensionProperties); } diff --git a/level_zero/experimental/source/tracing/tracing_driver_imp.h b/level_zero/experimental/source/tracing/tracing_driver_imp.h index 3a180eb605..8b9e94302e 100644 --- a/level_zero/experimental/source/tracing/tracing_driver_imp.h +++ b/level_zero/experimental/source/tracing/tracing_driver_imp.h @@ -7,8 +7,6 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL @@ -24,11 +22,11 @@ zeDriverGetApiVersion_Tracing(ze_driver_handle_t hDrivers, ze_api_version_t *version); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetIPCProperties_Tracing(ze_driver_handle_t hDriver, - ze_driver_ipc_properties_t *pIPCProperties); +zeDriverGetIpcProperties_Tracing(ze_driver_handle_t hDriver, + ze_driver_ipc_properties_t *pIpcProperties); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetExtensionFunctionAddress_Tracing(ze_driver_handle_t hDriver, - const char *pFuncName, - void **pfunc); +zeDriverGetExtensionProperties_Tracing(ze_driver_handle_t hDriver, + uint32_t *pCount, + ze_driver_extension_properties_t *pExtensionProperties); } diff --git a/level_zero/experimental/source/tracing/tracing_event_imp.cpp b/level_zero/experimental/source/tracing/tracing_event_imp.cpp index f0ae404648..695975303d 100644 --- a/level_zero/experimental/source/tracing/tracing_event_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_event_imp.cpp @@ -8,21 +8,21 @@ #include "level_zero/experimental/source/tracing/tracing_imp.h" ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventPoolCreate_Tracing(ze_driver_handle_t hDriver, +zeEventPoolCreate_Tracing(ze_context_handle_t hContext, const ze_event_pool_desc_t *desc, uint32_t numDevices, ze_device_handle_t *phDevices, ze_event_pool_handle_t *phEventPool) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.EventPool.pfnCreate, - hDriver, + hContext, desc, numDevices, phDevices, phEventPool); ze_event_pool_create_params_t tracerParams; - tracerParams.phDriver = &hDriver; + tracerParams.phContext = &hContext; tracerParams.pdesc = &desc; tracerParams.pnumDevices = &numDevices; tracerParams.pphDevices = &phDevices; @@ -37,7 +37,7 @@ zeEventPoolCreate_Tracing(ze_driver_handle_t hDriver, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.pdesc, *tracerParams.pnumDevices, *tracerParams.pphDevices, @@ -141,17 +141,17 @@ zeEventPoolGetIpcHandle_Tracing(ze_event_pool_handle_t hEventPool, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventPoolOpenIpcHandle_Tracing(ze_driver_handle_t hDriver, +zeEventPoolOpenIpcHandle_Tracing(ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc, ze_event_pool_handle_t *phEventPool) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.EventPool.pfnOpenIpcHandle, - hDriver, + hContext, hIpc, phEventPool); ze_event_pool_open_ipc_handle_params_t tracerParams; - tracerParams.phDriver = &hDriver; + tracerParams.phContext = &hContext; tracerParams.phIpc = &hIpc; tracerParams.pphEventPool = &phEventPool; @@ -164,7 +164,7 @@ zeEventPoolOpenIpcHandle_Tracing(ze_driver_handle_t hDriver, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.phIpc, *tracerParams.pphEventPool); } @@ -267,7 +267,7 @@ zeEventHostSignal_Tracing(ze_event_handle_t hEvent) { ZE_APIEXPORT ze_result_t ZE_APICALL zeEventHostSynchronize_Tracing(ze_event_handle_t hEvent, - uint32_t timeout) { + uint64_t timeout) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Event.pfnHostSynchronize, hEvent, @@ -359,30 +359,26 @@ zeCommandListAppendEventReset_Tracing(ze_command_list_handle_t hCommandList, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventGetTimestamp_Tracing(ze_event_handle_t hEvent, - ze_event_timestamp_type_t timestampType, - void *dstptr) { +zeEventQueryKernelTimestamp_Tracing(ze_event_handle_t hEvent, + ze_kernel_timestamp_result_t *dstptr) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Event.pfnGetTimestamp, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Event.pfnQueryKernelTimestamp, hEvent, - timestampType, dstptr); - ze_event_get_timestamp_params_t tracerParams; + ze_event_query_kernel_timestamp_params_t tracerParams; tracerParams.phEvent = &hEvent; - tracerParams.ptimestampType = ×tampType; tracerParams.pdstptr = &dstptr; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventGetTimestampCb_t, Event, pfnGetTimestampCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventQueryKernelTimestampCb_t, Event, pfnQueryKernelTimestampCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Event.pfnGetTimestamp, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Event.pfnQueryKernelTimestamp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent, - *tracerParams.ptimestampType, *tracerParams.pdstptr); } diff --git a/level_zero/experimental/source/tracing/tracing_event_imp.h b/level_zero/experimental/source/tracing/tracing_event_imp.h index 7b516a3bf6..18ae1ca8b7 100644 --- a/level_zero/experimental/source/tracing/tracing_event_imp.h +++ b/level_zero/experimental/source/tracing/tracing_event_imp.h @@ -7,12 +7,10 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventPoolCreate_Tracing(ze_driver_handle_t hDriver, +zeEventPoolCreate_Tracing(ze_context_handle_t hContext, const ze_event_pool_desc_t *desc, uint32_t numDevices, ze_device_handle_t *phDevices, @@ -34,7 +32,7 @@ zeEventPoolGetIpcHandle_Tracing(ze_event_pool_handle_t hEventPool, ze_ipc_event_pool_handle_t *phIpc); ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventPoolOpenIpcHandle_Tracing(ze_driver_handle_t hDriver, +zeEventPoolOpenIpcHandle_Tracing(ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc, ze_event_pool_handle_t *phEventPool); @@ -55,7 +53,7 @@ zeEventHostSignal_Tracing(ze_event_handle_t hEvent); ZE_APIEXPORT ze_result_t ZE_APICALL zeEventHostSynchronize_Tracing(ze_event_handle_t hEvent, - uint32_t timeout); + uint64_t timeout); ZE_APIEXPORT ze_result_t ZE_APICALL zeEventQueryStatus_Tracing(ze_event_handle_t hEvent); @@ -68,7 +66,6 @@ zeCommandListAppendEventReset_Tracing(ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent); ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventGetTimestamp_Tracing(ze_event_handle_t hEvent, - ze_event_timestamp_type_t timestampType, - void *dstptr); +zeEventQueryKernelTimestamp_Tracing(ze_event_handle_t hEvent, + ze_kernel_timestamp_result_t *dstptr); } diff --git a/level_zero/experimental/source/tracing/tracing_fence_imp.cpp b/level_zero/experimental/source/tracing/tracing_fence_imp.cpp index 87f10ce7a1..39289a583d 100644 --- a/level_zero/experimental/source/tracing/tracing_fence_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_fence_imp.cpp @@ -59,7 +59,7 @@ zeFenceDestroy_Tracing(ze_fence_handle_t hFence) { ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceHostSynchronize_Tracing(ze_fence_handle_t hFence, - uint32_t timeout) { + uint64_t timeout) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Fence.pfnHostSynchronize, hFence, diff --git a/level_zero/experimental/source/tracing/tracing_fence_imp.h b/level_zero/experimental/source/tracing/tracing_fence_imp.h index 10049cdcdb..cc36b70982 100644 --- a/level_zero/experimental/source/tracing/tracing_fence_imp.h +++ b/level_zero/experimental/source/tracing/tracing_fence_imp.h @@ -7,8 +7,6 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL @@ -21,7 +19,7 @@ zeFenceDestroy_Tracing(ze_fence_handle_t hFence); ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceHostSynchronize_Tracing(ze_fence_handle_t hFence, - uint32_t timeout); + uint64_t timeout); ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceQueryStatus_Tracing(ze_fence_handle_t hFence); diff --git a/level_zero/experimental/source/tracing/tracing_global_imp.cpp b/level_zero/experimental/source/tracing/tracing_global_imp.cpp index ba55e7b053..91f400433f 100644 --- a/level_zero/experimental/source/tracing/tracing_global_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_global_imp.cpp @@ -8,7 +8,7 @@ #include "level_zero/experimental/source/tracing/tracing_imp.h" ZE_APIEXPORT ze_result_t ZE_APICALL -zeInit_Tracing(ze_init_flag_t flags) { +zeInit_Tracing(ze_init_flags_t flags) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Global.pfnInit, flags); diff --git a/level_zero/experimental/source/tracing/tracing_global_imp.h b/level_zero/experimental/source/tracing/tracing_global_imp.h index f1804c8749..92c57823e7 100644 --- a/level_zero/experimental/source/tracing/tracing_global_imp.h +++ b/level_zero/experimental/source/tracing/tracing_global_imp.h @@ -7,10 +7,8 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL -zeInit_Tracing(ze_init_flag_t flags); +zeInit_Tracing(ze_init_flags_t flags); } diff --git a/level_zero/experimental/source/tracing/tracing_image_imp.cpp b/level_zero/experimental/source/tracing/tracing_image_imp.cpp index 6b6d8cb7e2..dc282f5043 100644 --- a/level_zero/experimental/source/tracing/tracing_image_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_image_imp.cpp @@ -37,16 +37,19 @@ zeImageGetProperties_Tracing(ze_device_handle_t hDevice, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeImageCreate_Tracing(ze_device_handle_t hDevice, +zeImageCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_image_desc_t *desc, ze_image_handle_t *phImage) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Image.pfnCreate, + hContext, hDevice, desc, phImage); ze_image_create_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.pdesc = &desc; tracerParams.pphImage = &phImage; @@ -60,6 +63,7 @@ zeImageCreate_Tracing(ze_device_handle_t hDevice, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphImage); diff --git a/level_zero/experimental/source/tracing/tracing_image_imp.h b/level_zero/experimental/source/tracing/tracing_image_imp.h index b6225a8e89..0402d53e42 100644 --- a/level_zero/experimental/source/tracing/tracing_image_imp.h +++ b/level_zero/experimental/source/tracing/tracing_image_imp.h @@ -7,8 +7,6 @@ #pragma once -#include "third_party/level_zero/ze_api_ext.h" - extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL @@ -17,7 +15,8 @@ zeImageGetProperties_Tracing(ze_device_handle_t hDevice, ze_image_properties_t *pImageProperties); ZE_APIEXPORT ze_result_t ZE_APICALL -zeImageCreate_Tracing(ze_device_handle_t hDevice, +zeImageCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_image_desc_t *desc, ze_image_handle_t *phImage); diff --git a/level_zero/experimental/source/tracing/tracing_imp.cpp b/level_zero/experimental/source/tracing/tracing_imp.cpp index ef12d7f50b..d14c35e986 100644 --- a/level_zero/experimental/source/tracing/tracing_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_imp.cpp @@ -24,7 +24,7 @@ APITracer *APITracer::create() { return tracer; } -ze_result_t createAPITracer(zet_driver_handle_t hDriver, const zet_tracer_desc_t *desc, zet_tracer_handle_t *phTracer) { +ze_result_t createAPITracer(zet_context_handle_t hContext, const zet_tracer_exp_desc_t *desc, zet_tracer_exp_handle_t *phTracer) { if (!PGLOBAL_APITracerContextImp->isTracingEnabled()) { return ZE_RESULT_ERROR_UNINITIALIZED; @@ -38,7 +38,7 @@ ze_result_t createAPITracer(zet_driver_handle_t hDriver, const zet_tracer_desc_t return ZE_RESULT_SUCCESS; } -ze_result_t APITracerImp::destroyTracer(zet_tracer_handle_t phTracer) { +ze_result_t APITracerImp::destroyTracer(zet_tracer_exp_handle_t phTracer) { APITracerImp *tracer = static_cast(phTracer); diff --git a/level_zero/experimental/source/tracing/tracing_imp.h b/level_zero/experimental/source/tracing/tracing_imp.h index 7badb730a4..254f8366eb 100644 --- a/level_zero/experimental/source/tracing/tracing_imp.h +++ b/level_zero/experimental/source/tracing/tracing_imp.h @@ -9,7 +9,6 @@ #include "level_zero/experimental/source/tracing/tracing.h" #include "level_zero/experimental/source/tracing/tracing_barrier_imp.h" -#include "level_zero/experimental/source/tracing/tracing_cl_interop_imp.h" #include "level_zero/experimental/source/tracing/tracing_cmdlist_imp.h" #include "level_zero/experimental/source/tracing/tracing_cmdqueue_imp.h" #include "level_zero/experimental/source/tracing/tracing_copy_imp.h" @@ -26,7 +25,6 @@ #include #include -#include "third_party/level_zero/ze_api_ext.h" #include "ze_ddi_tables.h" #include @@ -82,7 +80,7 @@ typedef enum tracingState { } tracingState_t; struct APITracerImp : APITracer { - ze_result_t destroyTracer(zet_tracer_handle_t phTracer) override; + ze_result_t destroyTracer(zet_tracer_exp_handle_t phTracer) override; ze_result_t setPrologues(zet_core_callbacks_t *pCoreCbs) override; ze_result_t setEpilogues(zet_core_callbacks_t *pCoreCbs) override; ze_result_t enableTracer(ze_bool_t enable) override; diff --git a/level_zero/experimental/source/tracing/tracing_memory_imp.cpp b/level_zero/experimental/source/tracing/tracing_memory_imp.cpp index 8c5e0e906c..cf35c7ec93 100644 --- a/level_zero/experimental/source/tracing/tracing_memory_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_memory_imp.cpp @@ -8,16 +8,16 @@ #include "level_zero/experimental/source/tracing/tracing_imp.h" ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocSharedMem_Tracing(ze_driver_handle_t hDriver, - const ze_device_mem_alloc_desc_t *deviceDesc, - const ze_host_mem_alloc_desc_t *hostDesc, - size_t size, - size_t alignment, - ze_device_handle_t hDevice, - void **pptr) { +zeMemAllocShared_Tracing(ze_context_handle_t hContext, + const ze_device_mem_alloc_desc_t *deviceDesc, + const ze_host_mem_alloc_desc_t *hostDesc, + size_t size, + size_t alignment, + ze_device_handle_t hDevice, + void **pptr) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnAllocSharedMem, - hDriver, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnAllocShared, + hContext, deviceDesc, hostDesc, size, @@ -25,8 +25,8 @@ zeDriverAllocSharedMem_Tracing(ze_driver_handle_t hDriver, hDevice, pptr); - ze_driver_alloc_shared_mem_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_alloc_shared_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.pdevice_desc = &deviceDesc; tracerParams.phost_desc = &hostDesc; tracerParams.psize = &size; @@ -34,16 +34,16 @@ zeDriverAllocSharedMem_Tracing(ze_driver_handle_t hDriver, tracerParams.phDevice = &hDevice; tracerParams.ppptr = &pptr; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverAllocSharedMemCb_t, Driver, pfnAllocSharedMemCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemAllocSharedCb_t, Mem, pfnAllocSharedCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnAllocSharedMem, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnAllocShared, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.pdevice_desc, *tracerParams.phost_desc, *tracerParams.psize, @@ -53,39 +53,39 @@ zeDriverAllocSharedMem_Tracing(ze_driver_handle_t hDriver, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocDeviceMem_Tracing(ze_driver_handle_t hDriver, - const ze_device_mem_alloc_desc_t *deviceDesc, - size_t size, - size_t alignment, - ze_device_handle_t hDevice, - void **pptr) { +zeMemAllocDevice_Tracing(ze_context_handle_t hContext, + const ze_device_mem_alloc_desc_t *deviceDesc, + size_t size, + size_t alignment, + ze_device_handle_t hDevice, + void **pptr) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnAllocDeviceMem, - hDriver, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnAllocDevice, + hContext, deviceDesc, size, alignment, hDevice, pptr); - ze_driver_alloc_device_mem_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_alloc_device_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.pdevice_desc = &deviceDesc; tracerParams.psize = &size; tracerParams.palignment = &alignment; tracerParams.phDevice = &hDevice; tracerParams.ppptr = &pptr; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverAllocDeviceMemCb_t, Driver, pfnAllocDeviceMemCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemAllocDeviceCb_t, Mem, pfnAllocDeviceCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnAllocDeviceMem, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnAllocDevice, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.pdevice_desc, *tracerParams.psize, *tracerParams.palignment, @@ -94,36 +94,36 @@ zeDriverAllocDeviceMem_Tracing(ze_driver_handle_t hDriver, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocHostMem_Tracing(ze_driver_handle_t hDriver, - const ze_host_mem_alloc_desc_t *hostDesc, - size_t size, - size_t alignment, - void **pptr) { +zeMemAllocHost_Tracing(ze_context_handle_t hContext, + const ze_host_mem_alloc_desc_t *hostDesc, + size_t size, + size_t alignment, + void **pptr) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnAllocHostMem, - hDriver, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnAllocHost, + hContext, hostDesc, size, alignment, pptr); - ze_driver_alloc_host_mem_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_alloc_host_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phost_desc = &hostDesc; tracerParams.psize = &size; tracerParams.palignment = &alignment; tracerParams.ppptr = &pptr; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverAllocHostMemCb_t, Driver, pfnAllocHostMemCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemAllocHostCb_t, Mem, pfnAllocHostCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnAllocHostMem, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnAllocHost, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.phost_desc, *tracerParams.psize, *tracerParams.palignment, @@ -131,151 +131,156 @@ zeDriverAllocHostMem_Tracing(ze_driver_handle_t hDriver, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverFreeMem_Tracing(ze_driver_handle_t hDriver, - void *ptr) { +zeMemFree_Tracing(ze_context_handle_t hContext, + void *ptr) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnFreeMem, - hDriver, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnFree, + hContext, ptr); - ze_driver_free_mem_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_free_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.pptr = &ptr; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverFreeMemCb_t, Driver, pfnFreeMemCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemFreeCb_t, Mem, pfnFreeCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnFreeMem, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnFree, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.pptr); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemAllocProperties_Tracing(ze_driver_handle_t hDriver, - const void *ptr, - ze_memory_allocation_properties_t *pMemAllocProperties, - ze_device_handle_t *phDevice) { +zeMemGetAllocProperties_Tracing(ze_context_handle_t hContext, + const void *ptr, + ze_memory_allocation_properties_t *pMemAllocProperties, + ze_device_handle_t *phDevice) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnGetMemAllocProperties, - hDriver, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnGetAllocProperties, + hContext, ptr, pMemAllocProperties, phDevice); - ze_driver_get_mem_alloc_properties_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_get_alloc_properties_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.pptr = &ptr; tracerParams.ppMemAllocProperties = &pMemAllocProperties; tracerParams.pphDevice = &phDevice; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetMemAllocPropertiesCb_t, Driver, pfnGetMemAllocPropertiesCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetAllocPropertiesCb_t, Mem, pfnGetAllocPropertiesCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnGetMemAllocProperties, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnGetAllocProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.pptr, *tracerParams.ppMemAllocProperties, *tracerParams.pphDevice); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemAddressRange_Tracing(ze_driver_handle_t hDriver, - const void *ptr, - void **pBase, - size_t *pSize) { +zeMemGetAddressRange_Tracing(ze_context_handle_t hContext, + const void *ptr, + void **pBase, + size_t *pSize) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnGetMemAddressRange, - hDriver, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnGetAddressRange, + hContext, ptr, pBase, pSize); - ze_driver_get_mem_address_range_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_get_address_range_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.pptr = &ptr; tracerParams.ppBase = &pBase; tracerParams.ppSize = &pSize; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetMemAddressRangeCb_t, Driver, pfnGetMemAddressRangeCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetAddressRangeCb_t, Mem, pfnGetAddressRangeCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnGetMemAddressRange, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnGetAddressRange, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.pptr, *tracerParams.ppBase, *tracerParams.ppSize); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemIpcHandle_Tracing(ze_driver_handle_t hDriver, - const void *ptr, - ze_ipc_mem_handle_t *pIpcHandle) { +zeMemGetIpcHandle_Tracing(ze_context_handle_t hContext, + const void *ptr, + ze_ipc_mem_handle_t *pIpcHandle) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnGetMemIpcHandle, - hDriver, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnGetIpcHandle, + hContext, ptr, pIpcHandle); - ze_driver_get_mem_ipc_handle_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_get_ipc_handle_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.pptr = &ptr; tracerParams.ppIpcHandle = &pIpcHandle; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetMemIpcHandleCb_t, Driver, pfnGetMemIpcHandleCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetIpcHandleCb_t, Mem, pfnGetIpcHandleCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnGetMemIpcHandle, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnGetIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.pptr, *tracerParams.ppIpcHandle); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverOpenMemIpcHandle_Tracing(ze_driver_handle_t hDriver, - ze_device_handle_t hDevice, - ze_ipc_mem_handle_t handle, - ze_ipc_memory_flag_t flags, - void **pptr) { +zeMemOpenIpcHandle_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + ze_ipc_mem_handle_t handle, + ze_ipc_memory_flags_t flags, + void **pptr) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnOpenMemIpcHandle, hDriver, hDevice, handle, flags, pptr); + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnOpenIpcHandle, + hContext, + hDevice, + handle, + flags, + pptr); - ze_driver_open_mem_ipc_handle_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_open_ipc_handle_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.phandle = &handle; tracerParams.pflags = &flags; tracerParams.ppptr = &pptr; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverOpenMemIpcHandleCb_t, Driver, pfnOpenMemIpcHandleCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemOpenIpcHandleCb_t, Mem, pfnOpenIpcHandleCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnOpenMemIpcHandle, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnOpenIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.phandle, *tracerParams.pflags, @@ -283,26 +288,26 @@ zeDriverOpenMemIpcHandle_Tracing(ze_driver_handle_t hDriver, } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverCloseMemIpcHandle_Tracing(ze_driver_handle_t hDriver, - const void *ptr) { +zeMemCloseIpcHandle_Tracing(ze_context_handle_t hContext, + const void *ptr) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Driver.pfnCloseMemIpcHandle, - hDriver, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Mem.pfnCloseIpcHandle, + hContext, ptr); - ze_driver_close_mem_ipc_handle_params_t tracerParams; - tracerParams.phDriver = &hDriver; + ze_mem_close_ipc_handle_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.pptr = &ptr; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp apiCallbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverCloseMemIpcHandleCb_t, Driver, pfnCloseMemIpcHandleCb); + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemCloseIpcHandleCb_t, Mem, pfnCloseIpcHandleCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Driver.pfnCloseMemIpcHandle, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Mem.pfnCloseIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, - *tracerParams.phDriver, + *tracerParams.phContext, *tracerParams.pptr); } diff --git a/level_zero/experimental/source/tracing/tracing_memory_imp.h b/level_zero/experimental/source/tracing/tracing_memory_imp.h index d6a9bfd08d..6174a726e8 100644 --- a/level_zero/experimental/source/tracing/tracing_memory_imp.h +++ b/level_zero/experimental/source/tracing/tracing_memory_imp.h @@ -10,58 +10,58 @@ extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocSharedMem_Tracing(ze_driver_handle_t hDriver, - const ze_device_mem_alloc_desc_t *deviceDesc, - const ze_host_mem_alloc_desc_t *hostDesc, - size_t size, - size_t alignment, - ze_device_handle_t hDevice, - void **pptr); +zeMemAllocShared_Tracing(ze_context_handle_t hContext, + const ze_device_mem_alloc_desc_t *deviceDesc, + const ze_host_mem_alloc_desc_t *hostDesc, + size_t size, + size_t alignment, + ze_device_handle_t hDevice, + void **pptr); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocDeviceMem_Tracing(ze_driver_handle_t hDriver, - const ze_device_mem_alloc_desc_t *deviceDesc, - size_t size, - size_t alignment, - ze_device_handle_t hDevice, - void **pptr); +zeMemAllocDevice_Tracing(ze_context_handle_t hContext, + const ze_device_mem_alloc_desc_t *deviceDesc, + size_t size, + size_t alignment, + ze_device_handle_t hDevice, + void **pptr); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverAllocHostMem_Tracing(ze_driver_handle_t hDriver, - const ze_host_mem_alloc_desc_t *hostDesc, - size_t size, - size_t alignment, - void **pptr); +zeMemAllocHost_Tracing(ze_context_handle_t hContext, + const ze_host_mem_alloc_desc_t *hostDesc, + size_t size, + size_t alignment, + void **pptr); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverFreeMem_Tracing(ze_driver_handle_t hDriver, - void *ptr); +zeMemFree_Tracing(ze_context_handle_t hContext, + void *ptr); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemAllocProperties_Tracing(ze_driver_handle_t hDriver, - const void *ptr, - ze_memory_allocation_properties_t *pMemAllocProperties, - ze_device_handle_t *phDevice); - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemAddressRange_Tracing(ze_driver_handle_t hDriver, - const void *ptr, - void **pBase, - size_t *pSize); - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetMemIpcHandle_Tracing(ze_driver_handle_t hDriver, +zeMemGetAllocProperties_Tracing(ze_context_handle_t hContext, const void *ptr, - ze_ipc_mem_handle_t *pIpcHandle); + ze_memory_allocation_properties_t *pMemAllocProperties, + ze_device_handle_t *phDevice); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverOpenMemIpcHandle_Tracing(ze_driver_handle_t hDriver, - ze_device_handle_t hDevice, - ze_ipc_mem_handle_t handle, - ze_ipc_memory_flag_t flags, - void **pptr); +zeMemGetAddressRange_Tracing(ze_context_handle_t hContext, + const void *ptr, + void **pBase, + size_t *pSize); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverCloseMemIpcHandle_Tracing(ze_driver_handle_t hDriver, - const void *ptr); +zeMemGetIpcHandle_Tracing(ze_context_handle_t hContext, + const void *ptr, + ze_ipc_mem_handle_t *pIpcHandle); + +ZE_APIEXPORT ze_result_t ZE_APICALL +zeMemOpenIpcHandle_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + ze_ipc_mem_handle_t handle, + ze_ipc_memory_flags_t flags, + void **pptr); + +ZE_APIEXPORT ze_result_t ZE_APICALL +zeMemCloseIpcHandle_Tracing(ze_context_handle_t hContext, + const void *ptr); } diff --git a/level_zero/experimental/source/tracing/tracing_module_imp.cpp b/level_zero/experimental/source/tracing/tracing_module_imp.cpp index 811cafd026..789c4bd1c7 100644 --- a/level_zero/experimental/source/tracing/tracing_module_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_module_imp.cpp @@ -8,18 +8,21 @@ #include "level_zero/experimental/source/tracing/tracing_imp.h" ZE_APIEXPORT ze_result_t ZE_APICALL -zeModuleCreate_Tracing(ze_device_handle_t hDevice, +zeModuleCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_module_desc_t *desc, ze_module_handle_t *phModule, ze_module_build_log_handle_t *phBuildLog) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Module.pfnCreate, + hContext, hDevice, desc, phModule, phBuildLog); ze_module_create_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.pdesc = &desc; tracerParams.pphModule = &phModule; @@ -34,6 +37,7 @@ zeModuleCreate_Tracing(ze_device_handle_t hDevice, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphModule, @@ -143,16 +147,19 @@ zeModuleGetNativeBinary_Tracing(ze_module_handle_t hModule, ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleGetGlobalPointer_Tracing(ze_module_handle_t hModule, const char *pGlobalName, + size_t *pSize, void **pptr) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Module.pfnGetGlobalPointer, hModule, pGlobalName, + pSize, pptr); ze_module_get_global_pointer_params_t tracerParams; tracerParams.phModule = &hModule; tracerParams.ppGlobalName = &pGlobalName; + tracerParams.ppSize = &pSize; tracerParams.ppptr = &pptr; L0::APITracerCallbackDataImp apiCallbackData; @@ -166,6 +173,7 @@ zeModuleGetGlobalPointer_Tracing(ze_module_handle_t hModule, apiCallbackData.epilogCallbacks, *tracerParams.phModule, *tracerParams.ppGlobalName, + *tracerParams.ppSize, *tracerParams.ppptr); } @@ -359,39 +367,6 @@ zeKernelSetArgumentValue_Tracing(ze_kernel_handle_t hKernel, *tracerParams.ppArgValue); } -ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelSetAttribute_Tracing(ze_kernel_handle_t hKernel, - ze_kernel_attribute_t attr, - uint32_t size, - const void *pValue) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Kernel.pfnSetAttribute, - hKernel, - attr, - size, - pValue); - - ze_kernel_set_attribute_params_t tracerParams; - tracerParams.phKernel = &hKernel; - tracerParams.pattr = &attr; - tracerParams.psize = &size; - tracerParams.ppValue = &pValue; - - L0::APITracerCallbackDataImp apiCallbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSetAttributeCb_t, Kernel, pfnSetAttributeCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Kernel.pfnSetAttribute, - &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, - *tracerParams.phKernel, - *tracerParams.pattr, - *tracerParams.psize, - *tracerParams.ppValue); -} - ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelGetProperties_Tracing(ze_kernel_handle_t hKernel, ze_kernel_properties_t *pKernelProperties) { @@ -650,36 +625,3 @@ zeKernelSuggestMaxCooperativeGroupCount_Tracing(ze_kernel_handle_t hKernel, *tracerParams.phKernel, *tracerParams.ptotalGroupCount); } - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelGetAttribute_Tracing(ze_kernel_handle_t hKernel, - ze_kernel_attribute_t attr, - uint32_t *pSize, - void *pValue) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Kernel.pfnGetAttribute, - hKernel, - attr, - pSize, - pValue); - - ze_kernel_get_attribute_params_t tracerParams; - tracerParams.phKernel = &hKernel; - tracerParams.pattr = &attr; - tracerParams.ppSize = &pSize; - tracerParams.ppValue = &pValue; - - L0::APITracerCallbackDataImp apiCallbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelGetAttributeCb_t, Kernel, pfnGetAttributeCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Kernel.pfnGetAttribute, - &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, - *tracerParams.phKernel, - *tracerParams.pattr, - *tracerParams.ppSize, - *tracerParams.ppValue); -} diff --git a/level_zero/experimental/source/tracing/tracing_module_imp.h b/level_zero/experimental/source/tracing/tracing_module_imp.h index 3cafd658eb..d74aa536a0 100644 --- a/level_zero/experimental/source/tracing/tracing_module_imp.h +++ b/level_zero/experimental/source/tracing/tracing_module_imp.h @@ -10,7 +10,8 @@ extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL -zeModuleCreate_Tracing(ze_device_handle_t hDevice, +zeModuleCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_module_desc_t *desc, ze_module_handle_t *phModule, ze_module_build_log_handle_t *phBuildLog); @@ -34,6 +35,7 @@ zeModuleGetNativeBinary_Tracing(ze_module_handle_t hModule, ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleGetGlobalPointer_Tracing(ze_module_handle_t hModule, const char *pGlobalName, + size_t *pSize, void **pptr); ZE_APIEXPORT ze_result_t ZE_APICALL @@ -70,12 +72,6 @@ zeKernelSetArgumentValue_Tracing(ze_kernel_handle_t hKernel, size_t argSize, const void *pArgValue); -ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelSetAttribute_Tracing(ze_kernel_handle_t hKernel, - ze_kernel_attribute_t attr, - uint32_t size, - const void *pValue); - ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelGetProperties_Tracing(ze_kernel_handle_t hKernel, ze_kernel_properties_t *pKernelProperties); @@ -122,10 +118,4 @@ zeModuleGetKernelNames_Tracing(ze_module_handle_t hModule, ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSuggestMaxCooperativeGroupCount_Tracing(ze_kernel_handle_t hKernel, uint32_t *totalGroupCount); - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelGetAttribute_Tracing(ze_kernel_handle_t hKernel, - ze_kernel_attribute_t attr, - uint32_t *pSize, - void *pValue); } diff --git a/level_zero/experimental/source/tracing/tracing_residency_imp.cpp b/level_zero/experimental/source/tracing/tracing_residency_imp.cpp index 9ea99a6253..ea2daf0f69 100644 --- a/level_zero/experimental/source/tracing/tracing_residency_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_residency_imp.cpp @@ -8,107 +8,125 @@ #include "level_zero/experimental/source/tracing/tracing_imp.h" ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceMakeMemoryResident_Tracing(ze_device_handle_t hDevice, - void *ptr, - size_t size) { +zeContextMakeMemoryResident_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + void *ptr, + size_t size) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnMakeMemoryResident, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Context.pfnMakeMemoryResident, + hContext, hDevice, ptr, size); - ze_device_make_memory_resident_params_t tracerParams; + ze_context_make_memory_resident_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.pptr = &ptr; tracerParams.psize = &size; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp api_callbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceMakeMemoryResidentCb_t, Device, pfnMakeMemoryResidentCb); + ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnContextMakeMemoryResidentCb_t, Context, pfnMakeMemoryResidentCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnMakeMemoryResident, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Context.pfnMakeMemoryResident, &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, + api_callbackData.apiOrdinal, + api_callbackData.prologCallbacks, + api_callbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pptr, *tracerParams.psize); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceEvictMemory_Tracing(ze_device_handle_t hDevice, - void *ptr, - size_t size) { +zeContextEvictMemory_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + void *ptr, + size_t size) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnEvictMemory, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Context.pfnEvictMemory, + hContext, hDevice, ptr, size); - ze_device_evict_memory_params_t tracerParams; + ze_context_evict_memory_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.pptr = &ptr; tracerParams.psize = &size; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp api_callbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceEvictMemoryCb_t, Device, pfnEvictMemoryCb); + ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnContextEvictMemoryCb_t, Context, pfnEvictMemoryCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnEvictMemory, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Context.pfnEvictMemory, &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, + api_callbackData.apiOrdinal, + api_callbackData.prologCallbacks, + api_callbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pptr, *tracerParams.psize); } ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceMakeImageResident_Tracing(ze_device_handle_t hDevice, - ze_image_handle_t hImage) { +zeContextMakeImageResident_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + ze_image_handle_t hImage) { - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnMakeImageResident, hDevice, hImage); - - ze_device_make_image_resident_params_t tracerParams; - tracerParams.phDevice = &hDevice; - tracerParams.phImage = &hImage; - - L0::APITracerCallbackDataImp apiCallbackData; - - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceMakeImageResidentCb_t, Device, pfnMakeImageResidentCb); - - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnMakeImageResident, - &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, - *tracerParams.phDevice, - *tracerParams.phImage); -} - -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceEvictImage_Tracing(ze_device_handle_t hDevice, - ze_image_handle_t hImage) { - - ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Device.pfnEvictImage, + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Context.pfnMakeImageResident, + hContext, hDevice, hImage); - ze_device_evict_image_params_t tracerParams; + ze_context_make_image_resident_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.phImage = &hImage; - L0::APITracerCallbackDataImp apiCallbackData; + L0::APITracerCallbackDataImp api_callbackData; - ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceEvictImageCb_t, Device, pfnEvictImageCb); + ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnContextMakeImageResidentCb_t, Context, pfnMakeImageResidentCb); - return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Device.pfnEvictImage, + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Context.pfnMakeImageResident, &tracerParams, - apiCallbackData.apiOrdinal, - apiCallbackData.prologCallbacks, - apiCallbackData.epilogCallbacks, + api_callbackData.apiOrdinal, + api_callbackData.prologCallbacks, + api_callbackData.epilogCallbacks, + *tracerParams.phContext, + *tracerParams.phDevice, + *tracerParams.phImage); +} + +ZE_APIEXPORT ze_result_t ZE_APICALL +zeContextEvictImage_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + ze_image_handle_t hImage) { + + ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Context.pfnEvictImage, + hContext, + hDevice, + hImage); + + ze_context_evict_image_params_t tracerParams; + tracerParams.phContext = &hContext; + tracerParams.phDevice = &hDevice; + tracerParams.phImage = &hImage; + + L0::APITracerCallbackDataImp api_callbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(api_callbackData, ze_pfnContextEvictImageCb_t, Context, pfnEvictImageCb); + + return L0::APITracerWrapperImp(driver_ddiTable.core_ddiTable.Context.pfnEvictImage, + &tracerParams, + api_callbackData.apiOrdinal, + api_callbackData.prologCallbacks, + api_callbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.phImage); } diff --git a/level_zero/experimental/source/tracing/tracing_residency_imp.h b/level_zero/experimental/source/tracing/tracing_residency_imp.h index ca6677de4c..73750f5068 100644 --- a/level_zero/experimental/source/tracing/tracing_residency_imp.h +++ b/level_zero/experimental/source/tracing/tracing_residency_imp.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,21 +10,25 @@ extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceMakeMemoryResident_Tracing(ze_device_handle_t hDevice, - void *ptr, - size_t size); +zeContextMakeMemoryResident_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + void *ptr, + size_t size); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceEvictMemory_Tracing(ze_device_handle_t hDevice, - void *ptr, - size_t size); +zeContextEvictMemory_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + void *ptr, + size_t size); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceMakeImageResident_Tracing(ze_device_handle_t hDevice, - ze_image_handle_t hImage); +zeContextMakeImageResident_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + ze_image_handle_t hImage); ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceEvictImage_Tracing(ze_device_handle_t hDevice, - ze_image_handle_t hImage); +zeContextEvictImage_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, + ze_image_handle_t hImage); } // extern "C" diff --git a/level_zero/experimental/source/tracing/tracing_sampler_imp.cpp b/level_zero/experimental/source/tracing/tracing_sampler_imp.cpp index d7ec354152..f1c2a90a3e 100644 --- a/level_zero/experimental/source/tracing/tracing_sampler_imp.cpp +++ b/level_zero/experimental/source/tracing/tracing_sampler_imp.cpp @@ -8,16 +8,19 @@ #include "level_zero/experimental/source/tracing/tracing_imp.h" ZE_APIEXPORT ze_result_t ZE_APICALL -zeSamplerCreate_Tracing(ze_device_handle_t hDevice, +zeSamplerCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_sampler_desc_t *pDesc, ze_sampler_handle_t *phSampler) { ZE_HANDLE_TRACER_RECURSION(driver_ddiTable.core_ddiTable.Sampler.pfnCreate, + hContext, hDevice, pDesc, phSampler); ze_sampler_create_params_t tracerParams; + tracerParams.phContext = &hContext; tracerParams.phDevice = &hDevice; tracerParams.pdesc = &pDesc; tracerParams.pphSampler = &phSampler; @@ -31,6 +34,7 @@ zeSamplerCreate_Tracing(ze_device_handle_t hDevice, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, + *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphSampler); diff --git a/level_zero/experimental/source/tracing/tracing_sampler_imp.h b/level_zero/experimental/source/tracing/tracing_sampler_imp.h index 0bc258ec69..655806aba3 100644 --- a/level_zero/experimental/source/tracing/tracing_sampler_imp.h +++ b/level_zero/experimental/source/tracing/tracing_sampler_imp.h @@ -10,7 +10,8 @@ extern "C" { ZE_APIEXPORT ze_result_t ZE_APICALL -zeSamplerCreate_Tracing(ze_device_handle_t hDevice, +zeSamplerCreate_Tracing(ze_context_handle_t hContext, + ze_device_handle_t hDevice, const ze_sampler_desc_t *desc, ze_sampler_handle_t *phSampler); diff --git a/level_zero/source/inc/ze_intel_gpu.h b/level_zero/source/inc/ze_intel_gpu.h index 71a59e93c1..e8b2dca245 100644 --- a/level_zero/source/inc/ze_intel_gpu.h +++ b/level_zero/source/inc/ze_intel_gpu.h @@ -15,7 +15,7 @@ #if defined(__linux__) #include #define HMODULE void * -#define MAKE_VERSION() L0_PROJECT_VERSION_MAJOR "." L0_PROJECT_VERSION_MINOR +#define MAKE_VERSION() L0_PROJECT_VERSION_MAJOR "." L0_PROJECT_VERSION_MINOR "." L0_PROJECT_VERSION_PATCH #define MAKE_LIBRARY_NAME(NAME, VERSION) "lib" NAME ".so." VERSION #define LOAD_DRIVER_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY | RTLD_LOCAL) #define FREE_DRIVER_LIBRARY(LIB) \ diff --git a/level_zero/tools/source/metrics/metric.cpp b/level_zero/tools/source/metrics/metric.cpp index c89b93b8cc..29a95d5ad0 100644 --- a/level_zero/tools/source/metrics/metric.cpp +++ b/level_zero/tools/source/metrics/metric.cpp @@ -351,22 +351,7 @@ ze_result_t metricStreamerOpen(zet_context_handle_t hContext, zet_device_handle_ zet_metric_streamer_desc_t *pDesc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t *phMetricStreamer) { - return MetricStreamer::open(hDevice, hMetricGroup, *pDesc, hNotificationEvent, phMetricStreamer); -} - -ze_result_t metricTracerOpen(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, - zet_metric_tracer_desc_t *pDesc, ze_event_handle_t hNotificationEvent, - zet_metric_tracer_handle_t *phMetricTracer) { - - zet_metric_streamer_handle_t *phMetricStreamer = reinterpret_cast(phMetricTracer); - zet_metric_streamer_desc_t metricStreamerDesc = {}; - - metricStreamerDesc.notifyEveryNReports = pDesc->notifyEveryNReports; - metricStreamerDesc.samplingPeriod = pDesc->samplingPeriod; - metricStreamerDesc.stype = ZET_STRUCTURE_TYPE_METRIC_STREAMER_DESC; - metricStreamerDesc.pNext = nullptr; - - return MetricStreamer::open(hDevice, hMetricGroup, metricStreamerDesc, hNotificationEvent, phMetricStreamer); + return MetricStreamer::open(hContext, hDevice, hMetricGroup, *pDesc, hNotificationEvent, phMetricStreamer); } } // namespace L0 diff --git a/level_zero/tools/source/metrics/metric.h b/level_zero/tools/source/metrics/metric.h index c388b4a1d7..d5715a43d8 100644 --- a/level_zero/tools/source/metrics/metric.h +++ b/level_zero/tools/source/metrics/metric.h @@ -9,14 +9,11 @@ #include "level_zero/core/source/event/event.h" #include -#include "third_party/level_zero/zet_api_ext.h" - #include struct _zet_metric_group_handle_t {}; struct _zet_metric_handle_t {}; struct _zet_metric_streamer_handle_t {}; -struct _zet_metric_tracer_handle_t {}; struct _zet_metric_query_pool_handle_t {}; struct _zet_metric_query_handle_t {}; @@ -63,9 +60,8 @@ struct Metric : _zet_metric_handle_t { virtual ~Metric() = default; virtual ze_result_t getProperties(zet_metric_properties_t *pProperties) = 0; - virtual ze_result_t getPropertiesExt(zet_metric_properties_ext_t *pProperties) = 0; - static Metric *create(zet_metric_properties_ext_t &properties); + static Metric *create(zet_metric_properties_t &properties); static Metric *fromHandle(zet_metric_handle_t handle) { return static_cast(handle); } inline zet_metric_handle_t toHandle() { return this; } }; @@ -74,20 +70,19 @@ struct MetricGroup : _zet_metric_group_handle_t { virtual ~MetricGroup() = default; virtual ze_result_t getProperties(zet_metric_group_properties_t *pProperties) = 0; - virtual ze_result_t getPropertiesExt(zet_metric_group_properties_ext_t *pProperties) = 0; virtual ze_result_t getMetric(uint32_t *pCount, zet_metric_handle_t *phMetrics) = 0; virtual ze_result_t calculateMetricValues(const zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t *pRawData, uint32_t *pMetricValueCount, zet_typed_value_t *pMetricValues) = 0; - static MetricGroup *create(zet_metric_group_properties_ext_t &properties, + static MetricGroup *create(zet_metric_group_properties_t &properties, MetricsDiscovery::IMetricSet_1_5 &metricSet, MetricsDiscovery::IConcurrentGroup_1_5 &concurrentGroup, const std::vector &metrics); static MetricGroup *fromHandle(zet_metric_group_handle_t handle) { return static_cast(handle); } - static zet_metric_group_properties_ext_t getProperties(const zet_metric_group_handle_t handle); + static zet_metric_group_properties_t getProperties(const zet_metric_group_handle_t handle); zet_metric_group_handle_t toHandle() { return this; } @@ -109,7 +104,7 @@ struct MetricStreamer : _zet_metric_streamer_handle_t { uint8_t *pRawData) = 0; virtual ze_result_t close() = 0; - static ze_result_t open(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, + static ze_result_t open(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, zet_metric_streamer_desc_t &desc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t *phMetricStreamer); static MetricStreamer *fromHandle(zet_metric_streamer_handle_t handle) { return static_cast(handle); @@ -119,14 +114,6 @@ struct MetricStreamer : _zet_metric_streamer_handle_t { inline zet_metric_streamer_handle_t toHandle() { return this; } }; -struct MetricTracer : _zet_metric_tracer_handle_t { - virtual ~MetricTracer() = default; - - static MetricStreamer *fromHandle(zet_metric_tracer_handle_t handle) { - return MetricStreamer::fromHandle(reinterpret_cast(handle)); - } -}; - struct MetricQueryPool : _zet_metric_query_pool_handle_t { virtual ~MetricQueryPool() = default; @@ -134,7 +121,7 @@ struct MetricQueryPool : _zet_metric_query_pool_handle_t { virtual ze_result_t createMetricQuery(uint32_t index, zet_metric_query_handle_t *phMetricQuery) = 0; - static MetricQueryPool *create(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_ext_t &desc); + static MetricQueryPool *create(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t &desc); static MetricQueryPool *fromHandle(zet_metric_query_pool_handle_t handle); zet_metric_query_pool_handle_t toHandle(); @@ -169,14 +156,8 @@ ze_result_t metricStreamerOpen(zet_context_handle_t hContext, zet_device_handle_ zet_metric_streamer_desc_t *pDesc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t *phMetricStreamer); -ze_result_t metricTracerOpen(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, - zet_metric_tracer_desc_t *pDesc, ze_event_handle_t hNotificationEvent, - zet_metric_tracer_handle_t *phMetricTracer); - // MetricQueryPool. -ze_result_t metricQueryPoolCreate(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t *pDesc, - zet_metric_query_pool_handle_t *phMetricQueryPool); -ze_result_t metricQueryPoolCreateExt(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, - const zet_metric_query_pool_desc_ext_t *pDesc, zet_metric_query_pool_handle_t *phMetricQueryPool); +ze_result_t metricQueryPoolCreate(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, + const zet_metric_query_pool_desc_t *pDesc, zet_metric_query_pool_handle_t *phMetricQueryPool); } // namespace L0 diff --git a/level_zero/tools/source/metrics/metric_enumeration_imp.cpp b/level_zero/tools/source/metrics/metric_enumeration_imp.cpp index 9bc0853dfb..ad39920482 100644 --- a/level_zero/tools/source/metrics/metric_enumeration_imp.cpp +++ b/level_zero/tools/source/metrics/metric_enumeration_imp.cpp @@ -194,7 +194,7 @@ MetricEnumeration::cacheMetricGroup(MetricsDiscovery::IMetricSet_1_5 &metricSet, // Obtain params once again - updated after SetApiFiltering pMetricSetParams = metricSet.GetParams(); - zet_metric_group_properties_ext_t properties = {}; + zet_metric_group_properties_t properties = {}; properties.stype = ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES; snprintf(properties.name, sizeof(properties.name), "%s", pMetricSetParams->SymbolName); // To always have null-terminated string @@ -235,7 +235,7 @@ ze_result_t MetricEnumeration::createMetrics(MetricsDiscovery::IMetricSet_1_5 &m MetricsDiscovery::TMetricParams_1_0 *pSourceMetricParams = pSourceMetric->GetParams(); DEBUG_BREAK_IF(pSourceMetricParams == nullptr); - zet_metric_properties_ext_t properties = {}; + zet_metric_properties_t properties = {}; properties.stype = ZET_STRUCTURE_TYPE_METRIC_PROPERTIES; snprintf(properties.name, sizeof(properties.name), "%s", pSourceMetricParams->SymbolName); // To always have a null-terminated string @@ -264,7 +264,7 @@ ze_result_t MetricEnumeration::createMetrics(MetricsDiscovery::IMetricSet_1_5 &m pSourceInformation->GetParams(); DEBUG_BREAK_IF(pSourceInformationParams == nullptr); - zet_metric_properties_ext_t properties = {}; + zet_metric_properties_t properties = {}; properties.stype = ZET_STRUCTURE_TYPE_METRIC_PROPERTIES; snprintf(properties.name, sizeof(properties.name), "%s", pSourceInformationParams->SymbolName); // To always have a null-terminated string @@ -378,32 +378,16 @@ MetricGroupImp ::~MetricGroupImp() { }; ze_result_t MetricGroupImp::getProperties(zet_metric_group_properties_t *pProperties) { - - pProperties->version = zet_metric_group_properties_version_t::ZET_METRIC_GROUP_PROPERTIES_VERSION_CURRENT; - pProperties->domain = properties.domain; - pProperties->maxCommandQueueOrdinal = 0xFFFFFFFF; - pProperties->metricCount = properties.metricCount; - pProperties->samplingType = static_cast(properties.samplingType); - - memcpy(pProperties->name, - properties.name, sizeof(pProperties->name)); - memcpy(pProperties->description, - properties.description, sizeof(pProperties->description)); - - return ZE_RESULT_SUCCESS; -} - -ze_result_t MetricGroupImp::getPropertiesExt(zet_metric_group_properties_ext_t *pProperties) { copyProperties(properties, *pProperties); return ZE_RESULT_SUCCESS; } -zet_metric_group_properties_ext_t MetricGroup::getProperties(const zet_metric_group_handle_t handle) { +zet_metric_group_properties_t MetricGroup::getProperties(const zet_metric_group_handle_t handle) { auto metricGroup = MetricGroup::fromHandle(handle); UNRECOVERABLE_IF(!metricGroup); - zet_metric_group_properties_ext_t properties = {ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES}; - metricGroup->getPropertiesExt(&properties); + zet_metric_group_properties_t properties = {ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES}; + metricGroup->getProperties(&properties); return properties; } @@ -573,7 +557,7 @@ bool MetricGroupImp::getCalculatedMetricValues(const zet_metric_group_calculatio return result; } -ze_result_t MetricGroupImp::initialize(const zet_metric_group_properties_ext_t &sourceProperties, +ze_result_t MetricGroupImp::initialize(const zet_metric_group_properties_t &sourceProperties, MetricsDiscovery::IMetricSet_1_5 &metricSet, MetricsDiscovery::IConcurrentGroup_1_5 &concurrentGroup, const std::vector &groupMetrics) { @@ -592,8 +576,8 @@ uint32_t MetricGroupImp::getRawReportSize() { : pMetricSetParams->QueryReportSize; } -void MetricGroupImp::copyProperties(const zet_metric_group_properties_ext_t &source, - zet_metric_group_properties_ext_t &destination) { +void MetricGroupImp::copyProperties(const zet_metric_group_properties_t &source, + zet_metric_group_properties_t &destination) { destination = source; memcpy_s(destination.name, sizeof(destination.name), source.name, sizeof(destination.name)); @@ -636,32 +620,17 @@ void MetricGroupImp::copyValue(const MetricsDiscovery::TTypedValue_1_0 &source, } ze_result_t MetricImp::getProperties(zet_metric_properties_t *pProperties) { - - pProperties->version = ZET_METRIC_PROPERTIES_VERSION_CURRENT; - pProperties->tierNumber = properties.tierNumber; - pProperties->metricType = properties.metricType; - pProperties->resultType = properties.resultType; - - memcpy(pProperties->name, properties.name, sizeof(pProperties->name)); - memcpy(pProperties->description, properties.description, sizeof(pProperties->description)); - memcpy(pProperties->component, properties.component, sizeof(pProperties->component)); - memcpy(pProperties->resultUnits, properties.resultUnits, sizeof(pProperties->resultUnits)); - - return ZE_RESULT_SUCCESS; -} - -ze_result_t MetricImp::getPropertiesExt(zet_metric_properties_ext_t *pProperties) { copyProperties(properties, *pProperties); return ZE_RESULT_SUCCESS; } -ze_result_t MetricImp::initialize(const zet_metric_properties_ext_t &sourceProperties) { +ze_result_t MetricImp::initialize(const zet_metric_properties_t &sourceProperties) { copyProperties(sourceProperties, properties); return ZE_RESULT_SUCCESS; } -void MetricImp::copyProperties(const zet_metric_properties_ext_t &source, - zet_metric_properties_ext_t &destination) { +void MetricImp::copyProperties(const zet_metric_properties_t &source, + zet_metric_properties_t &destination) { destination = source; memcpy_s(destination.name, sizeof(destination.name), source.name, sizeof(destination.name)); @@ -673,7 +642,7 @@ void MetricImp::copyProperties(const zet_metric_properties_ext_t &source, source.resultUnits, sizeof(destination.resultUnits)); } -MetricGroup *MetricGroup::create(zet_metric_group_properties_ext_t &properties, +MetricGroup *MetricGroup::create(zet_metric_group_properties_t &properties, MetricsDiscovery::IMetricSet_1_5 &metricSet, MetricsDiscovery::IConcurrentGroup_1_5 &concurrentGroup, const std::vector &metrics) { @@ -683,7 +652,7 @@ MetricGroup *MetricGroup::create(zet_metric_group_properties_ext_t &properties, return pMetricGroup; } -Metric *Metric::create(zet_metric_properties_ext_t &properties) { +Metric *Metric::create(zet_metric_properties_t &properties) { auto pMetric = new MetricImp(); UNRECOVERABLE_IF(pMetric == nullptr); pMetric->initialize(properties); diff --git a/level_zero/tools/source/metrics/metric_enumeration_imp.h b/level_zero/tools/source/metrics/metric_enumeration_imp.h index 3a82ebf8ed..90ce49e1bc 100644 --- a/level_zero/tools/source/metrics/metric_enumeration_imp.h +++ b/level_zero/tools/source/metrics/metric_enumeration_imp.h @@ -73,13 +73,12 @@ struct MetricGroupImp : MetricGroup { ~MetricGroupImp() override; ze_result_t getProperties(zet_metric_group_properties_t *pProperties) override; - ze_result_t getPropertiesExt(zet_metric_group_properties_ext_t *pProperties) override; ze_result_t getMetric(uint32_t *pCount, zet_metric_handle_t *phMetrics) override; ze_result_t calculateMetricValues(const zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t *pRawData, uint32_t *pMetricValueCount, zet_typed_value_t *pCalculatedData) override; - ze_result_t initialize(const zet_metric_group_properties_ext_t &sourceProperties, + ze_result_t initialize(const zet_metric_group_properties_t &sourceProperties, MetricsDiscovery::IMetricSet_1_5 &metricSet, MetricsDiscovery::IConcurrentGroup_1_5 &concurrentGroup, const std::vector &groupMetrics); @@ -98,8 +97,8 @@ struct MetricGroupImp : MetricGroup { ze_result_t closeIoStream() override; protected: - void copyProperties(const zet_metric_group_properties_ext_t &source, - zet_metric_group_properties_ext_t &destination); + void copyProperties(const zet_metric_group_properties_t &source, + zet_metric_group_properties_t &destination); void copyValue(const MetricsDiscovery::TTypedValue_1_0 &source, zet_typed_value_t &destination) const; @@ -112,7 +111,7 @@ struct MetricGroupImp : MetricGroup { // Cached metrics. std::vector metrics; - zet_metric_group_properties_ext_t properties{ + zet_metric_group_properties_t properties{ ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES, }; MetricsDiscovery::IMetricSet_1_5 *pReferenceMetricSet = nullptr; @@ -123,15 +122,14 @@ struct MetricImp : Metric { ~MetricImp() override{}; ze_result_t getProperties(zet_metric_properties_t *pProperties) override; - ze_result_t getPropertiesExt(zet_metric_properties_ext_t *pProperties) override; - ze_result_t initialize(const zet_metric_properties_ext_t &sourceProperties); + ze_result_t initialize(const zet_metric_properties_t &sourceProperties); protected: - void copyProperties(const zet_metric_properties_ext_t &source, - zet_metric_properties_ext_t &destination); + void copyProperties(const zet_metric_properties_t &source, + zet_metric_properties_t &destination); - zet_metric_properties_ext_t properties{ + zet_metric_properties_t properties{ ZET_STRUCTURE_TYPE_METRIC_PROPERTIES}; }; diff --git a/level_zero/tools/source/metrics/metric_query_imp.cpp b/level_zero/tools/source/metrics/metric_query_imp.cpp index 7dd829aa8c..4f7e278405 100644 --- a/level_zero/tools/source/metrics/metric_query_imp.cpp +++ b/level_zero/tools/source/metrics/metric_query_imp.cpp @@ -303,7 +303,7 @@ bool MetricsLibrary::getGpuCommands(CommandList &commandList, ConfigurationHandle_1_0 MetricsLibrary::createConfiguration(const zet_metric_group_handle_t metricGroupHandle, - const zet_metric_group_properties_ext_t properties) { + const zet_metric_group_properties_t properties) { // Metric group internal data. auto metricGroup = MetricGroup::fromHandle(metricGroupHandle); auto metricGroupDummy = ConfigurationHandle_1_0{}; @@ -376,21 +376,8 @@ void MetricsLibrary::deleteAllConfigurations() { configurations.clear(); } -ze_result_t metricQueryPoolCreate(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t *pDesc, - zet_metric_query_pool_handle_t *phMetricQueryPool) { - - zet_metric_query_pool_desc_ext_t descExt = {}; - descExt.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; - descExt.type = (pDesc->flags == ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE) - ? ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE - : ZET_METRIC_QUERY_POOL_TYPE_EXECUTION; - descExt.count = pDesc->count; - - return metricQueryPoolCreateExt(nullptr, hDevice, hMetricGroup, &descExt, phMetricQueryPool); -} - -ze_result_t metricQueryPoolCreateExt(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, - const zet_metric_query_pool_desc_ext_t *pDesc, zet_metric_query_pool_handle_t *phMetricQueryPool) { +ze_result_t metricQueryPoolCreate(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, + const zet_metric_query_pool_desc_t *pDesc, zet_metric_query_pool_handle_t *phMetricQueryPool) { auto device = Device::fromHandle(hDevice); auto &metricContext = device->getMetricContext(); @@ -410,7 +397,7 @@ ze_result_t metricQueryPoolCreateExt(zet_context_handle_t hContext, zet_device_h MetricQueryPool *MetricQueryPool::create(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, - const zet_metric_query_pool_desc_ext_t &desc) { + const zet_metric_query_pool_desc_t &desc) { auto device = Device::fromHandle(hDevice); auto metricPoolImp = new MetricQueryPoolImp(device->getMetricContext(), hMetricGroup, desc); @@ -424,7 +411,7 @@ MetricQueryPool *MetricQueryPool::create(zet_device_handle_t hDevice, MetricQueryPoolImp::MetricQueryPoolImp(MetricContext &metricContextInput, zet_metric_group_handle_t hEventMetricGroupInput, - const zet_metric_query_pool_desc_ext_t &poolDescription) + const zet_metric_query_pool_desc_t &poolDescription) : metricContext(metricContextInput), metricsLibrary(metricContext.getMetricsLibrary()), description(poolDescription), hMetricGroup(hEventMetricGroupInput) {} @@ -499,7 +486,6 @@ MetricQueryImp::MetricQueryImp(MetricContext &metricContextInput, MetricQueryPoo pool(poolInput), slot(slotInput) {} ze_result_t MetricQueryImp::appendBegin(CommandList &commandList) { - switch (pool.description.type) { case ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE: return writeMetricQuery(commandList, nullptr, 0, nullptr, true); diff --git a/level_zero/tools/source/metrics/metric_query_imp.h b/level_zero/tools/source/metrics/metric_query_imp.h index 8e70e8ae81..713ea6c7cc 100644 --- a/level_zero/tools/source/metrics/metric_query_imp.h +++ b/level_zero/tools/source/metrics/metric_query_imp.h @@ -74,7 +74,7 @@ struct MetricsLibrary { virtual bool getContextData(Device &device, ContextCreateData_1_0 &contextData); ConfigurationHandle_1_0 createConfiguration(const zet_metric_group_handle_t metricGroup, - const zet_metric_group_properties_ext_t properties); + const zet_metric_group_properties_t properties); ConfigurationHandle_1_0 addConfiguration(const zet_metric_group_handle_t metricGroup); ClientGen getGenType(const uint32_t gen) const; @@ -123,7 +123,7 @@ struct MetricQueryImp : MetricQuery { struct MetricQueryPoolImp : MetricQueryPool { public: - MetricQueryPoolImp(MetricContext &metricContext, zet_metric_group_handle_t hEventMetricGroup, const zet_metric_query_pool_desc_ext_t &poolDescription); + MetricQueryPoolImp(MetricContext &metricContext, zet_metric_group_handle_t hEventMetricGroup, const zet_metric_query_pool_desc_t &poolDescription); bool create(); ze_result_t destroy() override; @@ -138,7 +138,7 @@ struct MetricQueryPoolImp : MetricQueryPool { MetricsLibrary &metricsLibrary; std::vector pool; NEO::GraphicsAllocation *pAllocation = nullptr; - zet_metric_query_pool_desc_ext_t description = {}; + zet_metric_query_pool_desc_t description = {}; zet_metric_group_handle_t hMetricGroup = nullptr; QueryHandle_1_0 query = {}; }; diff --git a/level_zero/tools/source/metrics/metric_streamer_imp.cpp b/level_zero/tools/source/metrics/metric_streamer_imp.cpp index 0abc121b8d..0e29c39bff 100644 --- a/level_zero/tools/source/metrics/metric_streamer_imp.cpp +++ b/level_zero/tools/source/metrics/metric_streamer_imp.cpp @@ -147,7 +147,7 @@ uint32_t MetricStreamerImp::getRequiredBufferSize(const uint32_t maxReportCount) : maxReportCount * rawReportSize; } -ze_result_t MetricStreamer::open(zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, +ze_result_t MetricStreamer::open(zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, zet_metric_streamer_desc_t &desc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t *phMetricStreamer) { auto pDevice = Device::fromHandle(hDevice); diff --git a/level_zero/tools/source/sysman/engine/engine.cpp b/level_zero/tools/source/sysman/engine/engine.cpp index c93f19d386..c4c6db3657 100644 --- a/level_zero/tools/source/sysman/engine/engine.cpp +++ b/level_zero/tools/source/sysman/engine/engine.cpp @@ -19,15 +19,6 @@ EngineHandleContext::~EngineHandleContext() { } } -void EngineHandleContext::createHandle(zet_engine_group_t type) { - Engine *pEngine = new EngineImp(pOsSysman, type); - if (pEngine->initSuccess == true) { - handleList.push_back(pEngine); - } else { - delete pEngine; - } -} - void EngineHandleContext::createHandle(zes_engine_group_t type) { Engine *pEngine = new EngineImp(pOsSysman, type); if (pEngine->initSuccess == true) { @@ -46,21 +37,7 @@ void EngineHandleContext::init() { } return; } - createHandle(ZET_ENGINE_GROUP_COMPUTE_ALL); -} - -ze_result_t EngineHandleContext::engineGet(uint32_t *pCount, zet_sysman_engine_handle_t *phEngine) { - uint32_t handleListSize = static_cast(handleList.size()); - uint32_t numToCopy = std::min(*pCount, handleListSize); - if (0 == *pCount || *pCount > handleListSize) { - *pCount = handleListSize; - } - if (nullptr != phEngine) { - for (uint32_t i = 0; i < numToCopy; i++) { - phEngine[i] = handleList[i]->toZetHandle(); - } - } - return ZE_RESULT_SUCCESS; + createHandle(ZES_ENGINE_GROUP_COMPUTE_ALL); } ze_result_t EngineHandleContext::engineGet(uint32_t *pCount, zes_engine_handle_t *phEngine) { diff --git a/level_zero/tools/source/sysman/engine/engine.h b/level_zero/tools/source/sysman/engine/engine.h index 9402e5f3f5..ad84a1ca0f 100644 --- a/level_zero/tools/source/sysman/engine/engine.h +++ b/level_zero/tools/source/sysman/engine/engine.h @@ -6,16 +6,10 @@ */ #pragma once -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include #include -struct _zet_sysman_engine_handle_t { - virtual ~_zet_sysman_engine_handle_t() = default; -}; - struct _zes_engine_handle_t { virtual ~_zes_engine_handle_t() = default; }; @@ -24,21 +18,14 @@ namespace L0 { struct OsSysman; -class Engine : _zet_sysman_engine_handle_t, _zes_engine_handle_t { +class Engine : _zes_engine_handle_t { public: - virtual ze_result_t engineGetProperties(zet_engine_properties_t *pProperties) = 0; - virtual ze_result_t engineGetActivity(zet_engine_stats_t *pStats) = 0; - virtual ze_result_t engineGetProperties(zes_engine_properties_t *pProperties) = 0; virtual ze_result_t engineGetActivity(zes_engine_stats_t *pStats) = 0; - static Engine *fromHandle(zet_sysman_engine_handle_t handle) { - return static_cast(handle); - } static Engine *fromHandle(zes_engine_handle_t handle) { return static_cast(handle); } - inline zet_sysman_engine_handle_t toZetHandle() { return this; } inline zes_engine_handle_t toHandle() { return this; } bool initSuccess = false; }; @@ -49,14 +36,12 @@ struct EngineHandleContext { void init(); - ze_result_t engineGet(uint32_t *pCount, zet_sysman_engine_handle_t *phEngine); ze_result_t engineGet(uint32_t *pCount, zes_engine_handle_t *phEngine); OsSysman *pOsSysman = nullptr; std::vector handleList = {}; private: - void createHandle(zet_engine_group_t type); void createHandle(zes_engine_group_t type); }; diff --git a/level_zero/tools/source/sysman/engine/engine_imp.cpp b/level_zero/tools/source/sysman/engine/engine_imp.cpp index a127899c85..dc4dadfc4f 100644 --- a/level_zero/tools/source/sysman/engine/engine_imp.cpp +++ b/level_zero/tools/source/sysman/engine/engine_imp.cpp @@ -11,14 +11,6 @@ namespace L0 { -ze_result_t EngineImp::engineGetActivity(zet_engine_stats_t *pStats) { - ze_result_t result = pOsEngine->getActiveTime(pStats->activeTime); - if (result != ZE_RESULT_SUCCESS) { - return result; - } - return pOsEngine->getTimeStamp(pStats->timestamp); -} - ze_result_t EngineImp::engineGetActivity(zes_engine_stats_t *pStats) { ze_result_t result = pOsEngine->getActiveTime(pStats->activeTime); if (result != ZE_RESULT_SUCCESS) { @@ -27,27 +19,11 @@ ze_result_t EngineImp::engineGetActivity(zes_engine_stats_t *pStats) { return pOsEngine->getTimeStamp(pStats->timestamp); } -ze_result_t EngineImp::engineGetProperties(zet_engine_properties_t *pProperties) { - *pProperties = zetEngineProperties; - return ZE_RESULT_SUCCESS; -} - ze_result_t EngineImp::engineGetProperties(zes_engine_properties_t *pProperties) { *pProperties = engineProperties; return ZE_RESULT_SUCCESS; } -void EngineImp::init(zet_engine_group_t type) { - if (pOsEngine->getEngineGroup(type) == ZE_RESULT_SUCCESS) { - this->initSuccess = true; - } else { - this->initSuccess = false; - } - zetEngineProperties.type = type; - zetEngineProperties.onSubdevice = false; - zetEngineProperties.subdeviceId = 0; -} - void EngineImp::init(zes_engine_group_t type) { if (pOsEngine->getEngineGroup(type) == ZE_RESULT_SUCCESS) { this->initSuccess = true; @@ -59,11 +35,6 @@ void EngineImp::init(zes_engine_group_t type) { engineProperties.subdeviceId = 0; } -EngineImp::EngineImp(OsSysman *pOsSysman, zet_engine_group_t type) { - pOsEngine = OsEngine::create(pOsSysman); - init(type); -} - EngineImp::EngineImp(OsSysman *pOsSysman, zes_engine_group_t type) { pOsEngine = OsEngine::create(pOsSysman); init(type); diff --git a/level_zero/tools/source/sysman/engine/engine_imp.h b/level_zero/tools/source/sysman/engine/engine_imp.h index d3a821f1b1..5e27814e96 100644 --- a/level_zero/tools/source/sysman/engine/engine_imp.h +++ b/level_zero/tools/source/sysman/engine/engine_imp.h @@ -11,27 +11,21 @@ #include "level_zero/tools/source/sysman/engine/engine.h" #include "level_zero/tools/source/sysman/engine/os_engine.h" -#include +#include namespace L0 { class EngineImp : public Engine, NEO::NonCopyableOrMovableClass { public: - ze_result_t engineGetProperties(zet_engine_properties_t *pProperties) override; - ze_result_t engineGetActivity(zet_engine_stats_t *pStats) override; - ze_result_t engineGetProperties(zes_engine_properties_t *pProperties) override; ze_result_t engineGetActivity(zes_engine_stats_t *pStats) override; EngineImp() = default; - EngineImp(OsSysman *pOsSysman, zet_engine_group_t type); EngineImp(OsSysman *pOsSysman, zes_engine_group_t type); ~EngineImp() override; OsEngine *pOsEngine = nullptr; - void init(zet_engine_group_t type); void init(zes_engine_group_t type); private: - zet_engine_properties_t zetEngineProperties = {}; zes_engine_properties_t engineProperties = {}; }; } // namespace L0 diff --git a/level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp b/level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp index 8f20a226c2..47da72fc1e 100644 --- a/level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp +++ b/level_zero/tools/source/sysman/engine/linux/os_engine_imp.cpp @@ -24,22 +24,6 @@ ze_result_t LinuxEngineImp::getTimeStamp(uint64_t &timeStamp) { return ZE_RESULT_SUCCESS; } -ze_result_t LinuxEngineImp::getEngineGroup(zet_engine_group_t &engineGroup) { - std::string strVal; - ze_result_t result = pSysfsAccess->read(computeEngineGroupFile, strVal); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - - if (strVal.compare(computeEngineGroupName) == 0) { - engineGroup = ZET_ENGINE_GROUP_COMPUTE_ALL; - } else { - engineGroup = ZET_ENGINE_GROUP_ALL; - return ZE_RESULT_ERROR_UNKNOWN; - } - return result; -} - ze_result_t LinuxEngineImp::getEngineGroup(zes_engine_group_t &engineGroup) { std::string strVal; ze_result_t result = pSysfsAccess->read(computeEngineGroupFile, strVal); diff --git a/level_zero/tools/source/sysman/engine/linux/os_engine_imp.h b/level_zero/tools/source/sysman/engine/linux/os_engine_imp.h index cc00991dea..087f3f8f56 100644 --- a/level_zero/tools/source/sysman/engine/linux/os_engine_imp.h +++ b/level_zero/tools/source/sysman/engine/linux/os_engine_imp.h @@ -16,7 +16,6 @@ class LinuxEngineImp : public OsEngine, NEO::NonCopyableOrMovableClass { public: ze_result_t getActiveTime(uint64_t &activeTime) override; ze_result_t getTimeStamp(uint64_t &timeStamp) override; - ze_result_t getEngineGroup(zet_engine_group_t &engineGroup) override; ze_result_t getEngineGroup(zes_engine_group_t &engineGroup) override; LinuxEngineImp() = default; LinuxEngineImp(OsSysman *pOsSysman); diff --git a/level_zero/tools/source/sysman/engine/os_engine.h b/level_zero/tools/source/sysman/engine/os_engine.h index e0a599adce..19e59850de 100644 --- a/level_zero/tools/source/sysman/engine/os_engine.h +++ b/level_zero/tools/source/sysman/engine/os_engine.h @@ -7,9 +7,7 @@ #pragma once -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include namespace L0 { @@ -18,7 +16,6 @@ class OsEngine { public: virtual ze_result_t getActiveTime(uint64_t &activeTime) = 0; virtual ze_result_t getTimeStamp(uint64_t &timeStamp) = 0; - virtual ze_result_t getEngineGroup(zet_engine_group_t &engineGroup) = 0; virtual ze_result_t getEngineGroup(zes_engine_group_t &engineGroup) = 0; static OsEngine *create(OsSysman *pOsSysman); virtual ~OsEngine() = default; diff --git a/level_zero/tools/source/sysman/engine/windows/os_engine_imp.cpp b/level_zero/tools/source/sysman/engine/windows/os_engine_imp.cpp index 62205e8570..482da2c3fe 100644 --- a/level_zero/tools/source/sysman/engine/windows/os_engine_imp.cpp +++ b/level_zero/tools/source/sysman/engine/windows/os_engine_imp.cpp @@ -13,7 +13,6 @@ class WddmEngineImp : public OsEngine { public: ze_result_t getActiveTime(uint64_t &activeTime) override; ze_result_t getTimeStamp(uint64_t &timeStamp) override; - ze_result_t getEngineGroup(zet_engine_group_t &engineGroup) override; ze_result_t getEngineGroup(zes_engine_group_t &engineGroup) override; }; @@ -25,10 +24,6 @@ ze_result_t WddmEngineImp::getTimeStamp(uint64_t &timeStamp) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t WddmEngineImp::getEngineGroup(zet_engine_group_t &engineGroup) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - ze_result_t WddmEngineImp::getEngineGroup(zes_engine_group_t &engineGroup) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/tools/source/sysman/fabric_port/fabric_port.cpp b/level_zero/tools/source/sysman/fabric_port/fabric_port.cpp index cdafe59ae6..37924cf0c5 100644 --- a/level_zero/tools/source/sysman/fabric_port/fabric_port.cpp +++ b/level_zero/tools/source/sysman/fabric_port/fabric_port.cpp @@ -56,18 +56,4 @@ ze_result_t FabricPortHandleContext::fabricPortGet(uint32_t *pCount, zes_fabric_ return ZE_RESULT_SUCCESS; } -ze_result_t FabricPortHandleContext::fabricPortGet(uint32_t *pCount, zet_sysman_fabric_port_handle_t *phPort) { - uint32_t handleListSize = static_cast(handleList.size()); - uint32_t numToCopy = std::min(*pCount, handleListSize); - if (0 == *pCount || *pCount > handleListSize) { - *pCount = handleListSize; - } - if (nullptr != phPort) { - for (uint32_t i = 0; i < numToCopy; i++) { - phPort[i] = handleList[i]->toHandle(); - } - } - return ZE_RESULT_SUCCESS; -} - } // namespace L0 diff --git a/level_zero/tools/source/sysman/fabric_port/fabric_port.h b/level_zero/tools/source/sysman/fabric_port/fabric_port.h index a50baf679a..15b6cc3252 100644 --- a/level_zero/tools/source/sysman/fabric_port/fabric_port.h +++ b/level_zero/tools/source/sysman/fabric_port/fabric_port.h @@ -8,15 +8,10 @@ #pragma once #include "shared/source/helpers/non_copyable_or_moveable.h" -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include #include -struct _zet_sysman_fabric_port_handle_t { - virtual ~_zet_sysman_fabric_port_handle_t() = default; -}; struct _zes_fabric_port_handle_t { virtual ~_zes_fabric_port_handle_t() = default; }; @@ -33,7 +28,7 @@ class FabricDevice { virtual uint32_t getNumPorts() = 0; }; -class FabricPort : _zet_sysman_fabric_port_handle_t, _zes_fabric_port_handle_t { +class FabricPort : _zes_fabric_port_handle_t { public: virtual ~FabricPort() = default; virtual ze_result_t fabricPortGetProperties(zes_fabric_port_properties_t *pProperties) = 0; @@ -43,20 +38,8 @@ class FabricPort : _zet_sysman_fabric_port_handle_t, _zes_fabric_port_handle_t { virtual ze_result_t fabricPortGetState(zes_fabric_port_state_t *pState) = 0; virtual ze_result_t fabricPortGetThroughput(zes_fabric_port_throughput_t *pThroughput) = 0; - virtual ze_result_t fabricPortGetProperties(zet_fabric_port_properties_t *pProperties) = 0; - virtual ze_result_t fabricPortGetLinkType(ze_bool_t verbose, zet_fabric_link_type_t *pLinkType) = 0; - virtual ze_result_t fabricPortGetConfig(zet_fabric_port_config_t *pConfig) = 0; - virtual ze_result_t fabricPortSetConfig(const zet_fabric_port_config_t *pConfig) = 0; - virtual ze_result_t fabricPortGetState(zet_fabric_port_state_t *pState) = 0; - virtual ze_result_t fabricPortGetThroughput(zet_fabric_port_throughput_t *pThroughput) = 0; - - inline zet_sysman_fabric_port_handle_t toHandle() { return this; } inline zes_fabric_port_handle_t toZesHandle() { return this; } - static FabricPort *fromHandle(zet_sysman_fabric_port_handle_t handle) { - return static_cast(handle); - } - static FabricPort *fromHandle(zes_fabric_port_handle_t handle) { return static_cast(handle); } @@ -69,7 +52,6 @@ struct FabricPortHandleContext : NEO::NonCopyableOrMovableClass { ze_result_t init(); ze_result_t fabricPortGet(uint32_t *pCount, zes_fabric_port_handle_t *phPort); - ze_result_t fabricPortGet(uint32_t *pCount, zet_sysman_fabric_port_handle_t *phPort); FabricDevice *pFabricDevice = nullptr; std::vector handleList = {}; diff --git a/level_zero/tools/source/sysman/fabric_port/fabric_port_imp.cpp b/level_zero/tools/source/sysman/fabric_port/fabric_port_imp.cpp index 641bfaa078..9d48cf5b88 100644 --- a/level_zero/tools/source/sysman/fabric_port/fabric_port_imp.cpp +++ b/level_zero/tools/source/sysman/fabric_port/fabric_port_imp.cpp @@ -65,37 +65,6 @@ ze_result_t FabricPortImp::fabricPortGetThroughput(zes_fabric_port_throughput_t return pOsFabricPort->getThroughput(pThroughput); } -ze_result_t FabricPortImp::fabricPortGetProperties(zet_fabric_port_properties_t *pProperties) { - pOsFabricPort->getModel(pProperties->model); - pProperties->onSubdevice = onSubdevice; - pProperties->subdeviceId = subdeviceId; - pOsFabricPort->getPortUuid(pProperties->portUuid); - pOsFabricPort->getMaxRxSpeed(pProperties->maxRxSpeed); - pOsFabricPort->getMaxTxSpeed(pProperties->maxTxSpeed); - return ZE_RESULT_SUCCESS; -} - -ze_result_t FabricPortImp::fabricPortGetLinkType(ze_bool_t verbose, zet_fabric_link_type_t *pLinkType) { - return pOsFabricPort->getLinkType(verbose, pLinkType); -} - -ze_result_t FabricPortImp::fabricPortGetConfig(zet_fabric_port_config_t *pConfig) { - return pOsFabricPort->getConfig(pConfig); -} - -ze_result_t FabricPortImp::fabricPortSetConfig(const zet_fabric_port_config_t *pConfig) { - return pOsFabricPort->setConfig(pConfig); -} - -ze_result_t FabricPortImp::fabricPortGetState(zet_fabric_port_state_t *pState) { - return pOsFabricPort->getState(pState); -} - -ze_result_t FabricPortImp::fabricPortGetThroughput(zet_fabric_port_throughput_t *pThroughput) { - fabricPortGetTimestamp(pThroughput->timestamp); - return pOsFabricPort->getThroughput(pThroughput); -} - void FabricPortImp::init() { onSubdevice = false; subdeviceId = 0L; diff --git a/level_zero/tools/source/sysman/fabric_port/fabric_port_imp.h b/level_zero/tools/source/sysman/fabric_port/fabric_port_imp.h index ec0499c07b..2a3e4f1cb6 100644 --- a/level_zero/tools/source/sysman/fabric_port/fabric_port_imp.h +++ b/level_zero/tools/source/sysman/fabric_port/fabric_port_imp.h @@ -11,9 +11,7 @@ #include "level_zero/tools/source/sysman/fabric_port/fabric_port.h" #include "level_zero/tools/source/sysman/fabric_port/os_fabric_port.h" -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include namespace L0 { @@ -38,13 +36,6 @@ class FabricPortImp : public FabricPort, NEO::NonCopyableOrMovableClass { ze_result_t fabricPortGetState(zes_fabric_port_state_t *pState) override; ze_result_t fabricPortGetThroughput(zes_fabric_port_throughput_t *pThroughput) override; - ze_result_t fabricPortGetProperties(zet_fabric_port_properties_t *pProperties) override; - ze_result_t fabricPortGetLinkType(ze_bool_t verbose, zet_fabric_link_type_t *pLinkType) override; - ze_result_t fabricPortGetConfig(zet_fabric_port_config_t *pConfig) override; - ze_result_t fabricPortSetConfig(const zet_fabric_port_config_t *pConfig) override; - ze_result_t fabricPortGetState(zet_fabric_port_state_t *pState) override; - ze_result_t fabricPortGetThroughput(zet_fabric_port_throughput_t *pThroughput) override; - FabricPortImp() = delete; FabricPortImp(FabricDevice *pFabricDevice, uint32_t portNum); ~FabricPortImp() override; diff --git a/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp.cpp b/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp.cpp index c64c184045..e67ceecea6 100644 --- a/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp.cpp +++ b/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp.cpp @@ -22,7 +22,7 @@ LinuxFabricDeviceImp::~LinuxFabricDeviceImp() { } ze_result_t LinuxFabricPortImp::getLinkType(zes_fabric_link_type_t *pLinkType) { - ::snprintf(pLinkType->desc, ZET_MAX_FABRIC_LINK_TYPE_SIZE, "%s", "SAMPLE LINK, VERBOSE"); + ::snprintf(pLinkType->desc, ZES_MAX_FABRIC_LINK_TYPE_SIZE, "%s", "SAMPLE LINK, VERBOSE"); return ZE_RESULT_SUCCESS; } @@ -57,7 +57,6 @@ ze_result_t LinuxFabricPortImp::getThroughput(zes_fabric_port_throughput_t *pThr } void LinuxFabricPortImp::getModel(char *model) { - ::snprintf(model, ZET_MAX_FABRIC_PORT_MODEL_SIZE, "%s", this->model.c_str()); } void LinuxFabricPortImp::getPortId(zes_fabric_port_id_t &portId) { @@ -72,66 +71,9 @@ void LinuxFabricPortImp::getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) { maxTxSpeed = this->maxTxSpeed; } -ze_result_t LinuxFabricPortImp::getLinkType(ze_bool_t verbose, zet_fabric_link_type_t *pLinkType) { - if (verbose) { - ::snprintf(reinterpret_cast(pLinkType->desc), ZET_MAX_FABRIC_LINK_TYPE_SIZE, "%s", "SAMPLE LINK, VERBOSE"); - } else { - ::snprintf(reinterpret_cast(pLinkType->desc), ZET_MAX_FABRIC_LINK_TYPE_SIZE, "%s", "SAMPLE LINK"); - } - return ZE_RESULT_SUCCESS; -} - -ze_result_t LinuxFabricPortImp::getConfig(zet_fabric_port_config_t *pConfig) { - *pConfig = zetConfig; - return ZE_RESULT_SUCCESS; -} - -ze_result_t LinuxFabricPortImp::setConfig(const zet_fabric_port_config_t *pConfig) { - zetConfig = *pConfig; - return ZE_RESULT_SUCCESS; -} - -ze_result_t LinuxFabricPortImp::getState(zet_fabric_port_state_t *pState) { - pState->status = ZET_FABRIC_PORT_STATUS_BLACK; - pState->qualityIssues = ZET_FABRIC_PORT_QUAL_ISSUES_NONE; - pState->stabilityIssues = ZET_FABRIC_PORT_STAB_ISSUES_NONE; - pState->rxSpeed.bitRate = 0LU; - pState->rxSpeed.width = 0U; - pState->rxSpeed.maxBandwidth = 0LU; - pState->txSpeed.bitRate = 0LU; - pState->txSpeed.width = 0U; - pState->txSpeed.maxBandwidth = 0LU; - return ZE_RESULT_SUCCESS; -} - -ze_result_t LinuxFabricPortImp::getThroughput(zet_fabric_port_throughput_t *pThroughput) { - pThroughput->rxCounter = 0LU; - pThroughput->txCounter = 0LU; - pThroughput->rxMaxBandwidth = 0LU; - pThroughput->txMaxBandwidth = 0LU; - return ZE_RESULT_SUCCESS; -} - -void LinuxFabricPortImp::getModel(int8_t *model) { - ::snprintf(reinterpret_cast(model), ZET_MAX_FABRIC_PORT_MODEL_SIZE, "%s", this->zetModel.c_str()); -} - -void LinuxFabricPortImp::getPortUuid(zet_fabric_port_uuid_t &portUuid) { - portUuid = this->zetPortUuid; -} - -void LinuxFabricPortImp::getMaxRxSpeed(zet_fabric_port_speed_t &maxRxSpeed) { - maxRxSpeed = this->zetMaxRxSpeed; -} - -void LinuxFabricPortImp::getMaxTxSpeed(zet_fabric_port_speed_t &maxTxSpeed) { - maxTxSpeed = this->zetMaxTxSpeed; -} - LinuxFabricPortImp::LinuxFabricPortImp(OsFabricDevice *pOsFabricDevice, uint32_t portNum) { this->portNum = portNum; model = std::string("EXAMPLE"); - zetModel = std::string("EXAMPLE"); } LinuxFabricPortImp::~LinuxFabricPortImp() { diff --git a/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp.h b/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp.h index f30a2a8f7b..5e58d054d3 100644 --- a/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp.h +++ b/level_zero/tools/source/sysman/fabric_port/linux/os_fabric_port_imp.h @@ -38,16 +38,6 @@ class LinuxFabricPortImp : public OsFabricPort, NEO::NonCopyableOrMovableClass { void getMaxRxSpeed(zes_fabric_port_speed_t &maxRxSpeed) override; void getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) override; - ze_result_t getLinkType(ze_bool_t verbose, zet_fabric_link_type_t *pLinkType) override; - ze_result_t getConfig(zet_fabric_port_config_t *pConfig) override; - ze_result_t setConfig(const zet_fabric_port_config_t *pConfig) override; - ze_result_t getState(zet_fabric_port_state_t *pState) override; - ze_result_t getThroughput(zet_fabric_port_throughput_t *pThroughput) override; - void getModel(int8_t *model) override; - void getPortUuid(zet_fabric_port_uuid_t &portUuid) override; - void getMaxRxSpeed(zet_fabric_port_speed_t &maxRxSpeed) override; - void getMaxTxSpeed(zet_fabric_port_speed_t &maxTxSpeed) override; - LinuxFabricPortImp() = delete; LinuxFabricPortImp(OsFabricDevice *pOsFabricDevice, uint32_t portNum); ~LinuxFabricPortImp() override; @@ -59,12 +49,6 @@ class LinuxFabricPortImp : public OsFabricPort, NEO::NonCopyableOrMovableClass { zes_fabric_port_speed_t maxRxSpeed = {}; zes_fabric_port_speed_t maxTxSpeed = {}; zes_fabric_port_config_t config = {}; - - std::string zetModel = ""; - zet_fabric_port_uuid_t zetPortUuid = {}; - zet_fabric_port_speed_t zetMaxRxSpeed = {}; - zet_fabric_port_speed_t zetMaxTxSpeed = {}; - zet_fabric_port_config_t zetConfig = {}; }; } // namespace L0 diff --git a/level_zero/tools/source/sysman/fabric_port/os_fabric_port.h b/level_zero/tools/source/sysman/fabric_port/os_fabric_port.h index e52df9f73b..d052a99f42 100644 --- a/level_zero/tools/source/sysman/fabric_port/os_fabric_port.h +++ b/level_zero/tools/source/sysman/fabric_port/os_fabric_port.h @@ -8,9 +8,7 @@ #pragma once #include "level_zero/tools/source/sysman/os_sysman.h" -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include namespace L0 { @@ -35,16 +33,6 @@ class OsFabricPort { virtual void getMaxRxSpeed(zes_fabric_port_speed_t &maxRxSpeed) = 0; virtual void getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) = 0; - virtual ze_result_t getLinkType(ze_bool_t verbose, zet_fabric_link_type_t *pLinkType) = 0; - virtual ze_result_t getConfig(zet_fabric_port_config_t *pConfig) = 0; - virtual ze_result_t setConfig(const zet_fabric_port_config_t *pConfig) = 0; - virtual ze_result_t getState(zet_fabric_port_state_t *pState) = 0; - virtual ze_result_t getThroughput(zet_fabric_port_throughput_t *pThroughput) = 0; - virtual void getModel(int8_t *model) = 0; - virtual void getPortUuid(zet_fabric_port_uuid_t &portUuid) = 0; - virtual void getMaxRxSpeed(zet_fabric_port_speed_t &maxRxSpeed) = 0; - virtual void getMaxTxSpeed(zet_fabric_port_speed_t &maxTxSpeed) = 0; - static OsFabricPort *create(OsFabricDevice *pOsFabricDevice, uint32_t portNum); virtual ~OsFabricPort() = default; diff --git a/level_zero/tools/source/sysman/fabric_port/windows/CMakeLists.txt b/level_zero/tools/source/sysman/fabric_port/windows/CMakeLists.txt index 380e44ed82..f50cd87514 100644 --- a/level_zero/tools/source/sysman/fabric_port/windows/CMakeLists.txt +++ b/level_zero/tools/source/sysman/fabric_port/windows/CMakeLists.txt @@ -5,17 +5,17 @@ # set(L0_SRCS_TOOLS_SYSMAN_FABRICPORT_WINDOWS - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ${CMAKE_CURRENT_SOURCE_DIR}/os_fabric_port_imp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/os_fabric_port_imp.h + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/os_fabric_port_imp.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/os_fabric_port_imp.h ) if(WIN32) target_sources(${L0_STATIC_LIB_NAME} - PRIVATE - ${L0_SRCS_TOOLS_SYSMAN_FABRICPORT_WINDOWS} + PRIVATE + ${L0_SRCS_TOOLS_SYSMAN_FABRICPORT_WINDOWS} ) endif() -# Make our source files visible to parent +## Make our source files visible to parent set_property(GLOBAL PROPERTY L0_SRCS_TOOLS_SYSMAN_FABRICPORT_WINDOWS ${L0_SRCS_TOOLS_SYSMAN_FABRICPORT_WINDOWS}) diff --git a/level_zero/tools/source/sysman/fabric_port/windows/os_fabric_port_imp.cpp b/level_zero/tools/source/sysman/fabric_port/windows/os_fabric_port_imp.cpp index 49f01807a6..56ae398c8b 100644 --- a/level_zero/tools/source/sysman/fabric_port/windows/os_fabric_port_imp.cpp +++ b/level_zero/tools/source/sysman/fabric_port/windows/os_fabric_port_imp.cpp @@ -57,42 +57,6 @@ void WddmFabricPortImp::getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) { ::memset(&maxTxSpeed, '\0', sizeof(maxTxSpeed)); } -ze_result_t WddmFabricPortImp::getLinkType(ze_bool_t verbose, zet_fabric_link_type_t *pLinkType) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t WddmFabricPortImp::getConfig(zet_fabric_port_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t WddmFabricPortImp::setConfig(const zet_fabric_port_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t WddmFabricPortImp::getState(zet_fabric_port_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t WddmFabricPortImp::getThroughput(zet_fabric_port_throughput_t *pThroughput) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -void WddmFabricPortImp::getModel(int8_t *model) { - ::memset(model, '\0', ZET_MAX_FABRIC_PORT_MODEL_SIZE); -} - -void WddmFabricPortImp::getPortUuid(zet_fabric_port_uuid_t &portUuid) { - ::memset(&portUuid, '\0', sizeof(portUuid)); -} - -void WddmFabricPortImp::getMaxRxSpeed(zet_fabric_port_speed_t &maxRxSpeed) { - ::memset(&maxRxSpeed, '\0', sizeof(maxRxSpeed)); -} - -void WddmFabricPortImp::getMaxTxSpeed(zet_fabric_port_speed_t &maxTxSpeed) { - ::memset(&maxTxSpeed, '\0', sizeof(maxTxSpeed)); -} - WddmFabricPortImp::WddmFabricPortImp(OsFabricDevice *pOsFabricDevice, uint32_t portNum) { } diff --git a/level_zero/tools/source/sysman/fabric_port/windows/os_fabric_port_imp.h b/level_zero/tools/source/sysman/fabric_port/windows/os_fabric_port_imp.h index d664774703..d74c349c29 100644 --- a/level_zero/tools/source/sysman/fabric_port/windows/os_fabric_port_imp.h +++ b/level_zero/tools/source/sysman/fabric_port/windows/os_fabric_port_imp.h @@ -39,16 +39,6 @@ class WddmFabricPortImp : public OsFabricPort, NEO::NonCopyableOrMovableClass { void getMaxRxSpeed(zes_fabric_port_speed_t &maxRxSpeed) override; void getMaxTxSpeed(zes_fabric_port_speed_t &maxTxSpeed) override; - ze_result_t getLinkType(ze_bool_t verbose, zet_fabric_link_type_t *pLinkType) override; - ze_result_t getConfig(zet_fabric_port_config_t *pConfig) override; - ze_result_t setConfig(const zet_fabric_port_config_t *pConfig) override; - ze_result_t getState(zet_fabric_port_state_t *pState) override; - ze_result_t getThroughput(zet_fabric_port_throughput_t *pThroughput) override; - void getModel(int8_t *model) override; - void getPortUuid(zet_fabric_port_uuid_t &portUuid) override; - void getMaxRxSpeed(zet_fabric_port_speed_t &maxRxSpeed) override; - void getMaxTxSpeed(zet_fabric_port_speed_t &maxTxSpeed) override; - WddmFabricPortImp() = delete; WddmFabricPortImp(OsFabricDevice *pOsFabricDevice, uint32_t portNum); ~WddmFabricPortImp() override; diff --git a/level_zero/tools/source/sysman/frequency/frequency.cpp b/level_zero/tools/source/sysman/frequency/frequency.cpp index 79e4269109..3cec31e51b 100644 --- a/level_zero/tools/source/sysman/frequency/frequency.cpp +++ b/level_zero/tools/source/sysman/frequency/frequency.cpp @@ -25,20 +25,6 @@ ze_result_t FrequencyHandleContext::init() { return ZE_RESULT_SUCCESS; } -ze_result_t FrequencyHandleContext::frequencyGet(uint32_t *pCount, zet_sysman_freq_handle_t *phFrequency) { - uint32_t handleListSize = static_cast(handleList.size()); - uint32_t numToCopy = std::min(*pCount, handleListSize); - if (0 == *pCount || *pCount > handleListSize) { - *pCount = handleListSize; - } - if (nullptr != phFrequency) { - for (uint32_t i = 0; i < numToCopy; i++) { - phFrequency[i] = handleList[i]->toHandle(); - } - } - return ZE_RESULT_SUCCESS; -} - ze_result_t FrequencyHandleContext::frequencyGet(uint32_t *pCount, zes_freq_handle_t *phFrequency) { uint32_t handleListSize = static_cast(handleList.size()); uint32_t numToCopy = std::min(*pCount, handleListSize); diff --git a/level_zero/tools/source/sysman/frequency/frequency.h b/level_zero/tools/source/sysman/frequency/frequency.h index 291f0e7087..9678150c25 100644 --- a/level_zero/tools/source/sysman/frequency/frequency.h +++ b/level_zero/tools/source/sysman/frequency/frequency.h @@ -6,16 +6,10 @@ */ #pragma once -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include #include -struct _zet_sysman_freq_handle_t { - virtual ~_zet_sysman_freq_handle_t() = default; -}; - struct _zes_freq_handle_t { virtual ~_zes_freq_handle_t() = default; }; @@ -24,14 +18,9 @@ namespace L0 { struct OsSysman; -class Frequency : _zet_sysman_freq_handle_t, _zes_freq_handle_t { +class Frequency : _zes_freq_handle_t { public: virtual ~Frequency() {} - virtual ze_result_t frequencyGetProperties(zet_freq_properties_t *pProperties) = 0; - virtual ze_result_t frequencyGetAvailableClocks(uint32_t *pCount, double *phFrequency) = 0; - virtual ze_result_t frequencyGetRange(zet_freq_range_t *pLimits) = 0; - virtual ze_result_t frequencySetRange(const zet_freq_range_t *pLimits) = 0; - virtual ze_result_t frequencyGetState(zet_freq_state_t *pState) = 0; virtual ze_result_t frequencyGetProperties(zes_freq_properties_t *pProperties) = 0; virtual ze_result_t frequencyGetRange(zes_freq_range_t *pLimits) = 0; @@ -39,13 +28,9 @@ class Frequency : _zet_sysman_freq_handle_t, _zes_freq_handle_t { virtual ze_result_t frequencyGetState(zes_freq_state_t *pState) = 0; virtual ze_result_t frequencyGetThrottleTime(zes_freq_throttle_time_t *pThrottleTime) = 0; - static Frequency *fromHandle(zet_sysman_freq_handle_t handle) { - return static_cast(handle); - } static Frequency *fromHandle(zes_freq_handle_t handle) { return static_cast(handle); } - inline zet_sysman_freq_handle_t toHandle() { return this; } inline zes_freq_handle_t toZesFreqHandle() { return this; } }; @@ -55,7 +40,6 @@ struct FrequencyHandleContext { ze_result_t init(); - ze_result_t frequencyGet(uint32_t *pCount, zet_sysman_freq_handle_t *phFrequency); ze_result_t frequencyGet(uint32_t *pCount, zes_freq_handle_t *phFrequency); OsSysman *pOsSysman; diff --git a/level_zero/tools/source/sysman/frequency/frequency_imp.cpp b/level_zero/tools/source/sysman/frequency/frequency_imp.cpp index 7981c72e35..094eda1043 100644 --- a/level_zero/tools/source/sysman/frequency/frequency_imp.cpp +++ b/level_zero/tools/source/sysman/frequency/frequency_imp.cpp @@ -98,124 +98,7 @@ ze_result_t FrequencyImp::frequencyGetThrottleTime(zes_freq_throttle_time_t *pTh return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t FrequencyImp::frequencyGetProperties(zet_freq_properties_t *pProperties) { - *pProperties = frequencyProperties; - return ZE_RESULT_SUCCESS; -} - -ze_result_t FrequencyImp::frequencyGetAvailableClocks(uint32_t *pCount, double *phFrequency) { - if (*pCount == 0) { - *pCount = numClocks; - return ZE_RESULT_SUCCESS; - } - if (*pCount > numClocks) { - *pCount = numClocks; - } - if (phFrequency != nullptr) { - for (unsigned int i = 0; i < *pCount; i++) { - phFrequency[i] = pClocks[i]; - } - } - return ZE_RESULT_SUCCESS; -} - -ze_result_t FrequencyImp::frequencyGetRange(zet_freq_range_t *pLimits) { - ze_result_t result = pOsFrequency->getMax(pLimits->max); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - return pOsFrequency->getMin(pLimits->min); -} - -ze_result_t FrequencyImp::frequencySetRange(const zet_freq_range_t *pLimits) { - double newMin = round(pLimits->min); - double newMax = round(pLimits->max); - bool newMinValid = false, newMaxValid = false; - for (unsigned int i = 0; i < numClocks; i++) { - if (newMin == pClocks[i]) { - newMinValid = true; - } - if (newMax == pClocks[i]) { - newMaxValid = true; - } - } - if (newMin > newMax || !newMinValid || !newMaxValid) { - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - } - double currentMax; - pOsFrequency->getMax(currentMax); - if (newMin > currentMax) { - // set the max first - ze_result_t result = pOsFrequency->setMax(newMax); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - - return pOsFrequency->setMin(newMin); - } - - // set the min first - ze_result_t result = pOsFrequency->setMin(newMin); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - return pOsFrequency->setMax(newMax); -} - -ze_result_t FrequencyImp::frequencyGetState(zet_freq_state_t *pState) { - ze_result_t result; - - result = pOsFrequency->getRequest(pState->request); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - - result = pOsFrequency->getTdp(pState->tdp); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - - result = pOsFrequency->getEfficient(pState->efficient); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - - result = pOsFrequency->getActual(pState->actual); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - - result = pOsFrequency->getThrottleReasons(pState->throttleReasons); - if (ZE_RESULT_ERROR_UNKNOWN == result) { - // Throttle Reason is optional, set to none for now. - pState->throttleReasons = ZET_FREQ_THROTTLE_REASONS_NONE; - result = ZE_RESULT_SUCCESS; - } - return result; -} - void FrequencyImp::init() { - frequencyProperties.type = ZET_FREQ_DOMAIN_GPU; - frequencyProperties.onSubdevice = false; - frequencyProperties.subdeviceId = 0; - frequencyProperties.canControl = canControl; - ze_result_t result1 = pOsFrequency->getMinVal(frequencyProperties.min); - ze_result_t result2 = pOsFrequency->getMaxVal(frequencyProperties.max); - // If can't figure out the valid range, then can't control it. - if (ZE_RESULT_SUCCESS != result1 || ZE_RESULT_SUCCESS != result2) { - frequencyProperties.canControl = false; - frequencyProperties.min = 0.0; - frequencyProperties.max = 0.0; - } - frequencyProperties.step = step; - double freqRange = frequencyProperties.max - frequencyProperties.min; - numClocks = static_cast(round(freqRange / frequencyProperties.step)) + 1; - pClocks = new double[numClocks]; - for (unsigned int i = 0; i < numClocks; i++) { - pClocks[i] = round(frequencyProperties.min + (frequencyProperties.step * i)); - } - frequencyProperties.isThrottleEventSupported = false; - zesFrequencyProperties.stype = ZES_STRUCTURE_TYPE_FREQ_PROPERTIES; zesFrequencyProperties.pNext = nullptr; zesFrequencyProperties.type = ZES_FREQ_DOMAIN_GPU; diff --git a/level_zero/tools/source/sysman/frequency/frequency_imp.h b/level_zero/tools/source/sysman/frequency/frequency_imp.h index 7a3bca0953..936b12ae18 100644 --- a/level_zero/tools/source/sysman/frequency/frequency_imp.h +++ b/level_zero/tools/source/sysman/frequency/frequency_imp.h @@ -11,18 +11,12 @@ #include "level_zero/tools/source/sysman/frequency/frequency.h" #include "level_zero/tools/source/sysman/frequency/os_frequency.h" -#include +#include namespace L0 { class FrequencyImp : public Frequency, NEO::NonCopyableOrMovableClass { public: - ze_result_t frequencyGetProperties(zet_freq_properties_t *pProperties) override; - ze_result_t frequencyGetAvailableClocks(uint32_t *pCount, double *phFrequency) override; - ze_result_t frequencyGetRange(zet_freq_range_t *pLimits) override; - ze_result_t frequencySetRange(const zet_freq_range_t *pLimits) override; - ze_result_t frequencyGetState(zet_freq_state_t *pState) override; - ze_result_t frequencyGetProperties(zes_freq_properties_t *pProperties) override; ze_result_t frequencyGetRange(zes_freq_range_t *pLimits) override; ze_result_t frequencySetRange(const zes_freq_range_t *pLimits) override; @@ -39,7 +33,6 @@ class FrequencyImp : public Frequency, NEO::NonCopyableOrMovableClass { static const double step; static const bool canControl; - zet_freq_properties_t frequencyProperties = {}; zes_freq_properties_t zesFrequencyProperties = {}; double *pClocks = nullptr; uint32_t numClocks = 0; diff --git a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp index 56f6635ff5..f5ed97ea97 100644 --- a/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp +++ b/level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.cpp @@ -125,7 +125,7 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) { } ze_result_t LinuxFrequencyImp::getThrottleReasons(uint32_t &throttleReasons) { - throttleReasons = ZET_FREQ_THROTTLE_REASONS_NONE; + throttleReasons = 0u; return ZE_RESULT_SUCCESS; } diff --git a/level_zero/tools/source/sysman/frequency/os_frequency.h b/level_zero/tools/source/sysman/frequency/os_frequency.h index d66d2b32e9..e646216b3e 100644 --- a/level_zero/tools/source/sysman/frequency/os_frequency.h +++ b/level_zero/tools/source/sysman/frequency/os_frequency.h @@ -8,7 +8,6 @@ #pragma once #include "level_zero/tools/source/sysman/os_sysman.h" -#include namespace L0 { diff --git a/level_zero/tools/source/sysman/global_operations/global_operations.h b/level_zero/tools/source/sysman/global_operations/global_operations.h index c7dc1ebf55..d49c3ceb2c 100644 --- a/level_zero/tools/source/sysman/global_operations/global_operations.h +++ b/level_zero/tools/source/sysman/global_operations/global_operations.h @@ -6,16 +6,15 @@ */ #pragma once -#include +#include namespace L0 { class GlobalOperations { public: virtual ~GlobalOperations(){}; - virtual ze_result_t deviceGetProperties(zet_sysman_properties_t *pProperties) = 0; virtual ze_result_t reset() = 0; - virtual ze_result_t processesGetState(uint32_t *pCount, zet_process_state_t *pProcesses) = 0; + virtual ze_result_t processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) = 0; virtual void init() = 0; }; diff --git a/level_zero/tools/source/sysman/global_operations/global_operations_imp.cpp b/level_zero/tools/source/sysman/global_operations/global_operations_imp.cpp index 09fdb466bb..17b587bc92 100644 --- a/level_zero/tools/source/sysman/global_operations/global_operations_imp.cpp +++ b/level_zero/tools/source/sysman/global_operations/global_operations_imp.cpp @@ -14,8 +14,8 @@ namespace L0 { -ze_result_t GlobalOperationsImp::processesGetState(uint32_t *pCount, zet_process_state_t *pProcesses) { - std::vector pProcessList; +ze_result_t GlobalOperationsImp::processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) { + std::vector pProcessList; ze_result_t result = pOsGlobalOperations->scanProcessesState(pProcessList); if (result != ZE_RESULT_SUCCESS) { return result; @@ -37,19 +37,6 @@ ze_result_t GlobalOperationsImp::processesGetState(uint32_t *pCount, zet_process return result; } -ze_result_t GlobalOperationsImp::deviceGetProperties(zet_sysman_properties_t *pProperties) { - Device *device = L0::Device::fromHandle(hCoreDevice); - ze_device_properties_t deviceProperties; - device->getProperties(&deviceProperties); - sysmanProperties.core = deviceProperties; - uint32_t count = 0; - device->getSubDevices(&count, nullptr); - sysmanProperties.numSubdevices = count; - - *pProperties = sysmanProperties; - return ZE_RESULT_SUCCESS; -} - ze_result_t GlobalOperationsImp::reset() { return pOsGlobalOperations->reset(); } @@ -59,12 +46,6 @@ void GlobalOperationsImp::init() { pOsGlobalOperations = OsGlobalOperations::create(pOsSysman); } UNRECOVERABLE_IF(nullptr == pOsGlobalOperations); - pOsGlobalOperations->getVendorName(sysmanProperties.vendorName); - pOsGlobalOperations->getDriverVersion(sysmanProperties.driverVersion); - pOsGlobalOperations->getModelName(sysmanProperties.modelName); - pOsGlobalOperations->getBrandName(sysmanProperties.brandName); - pOsGlobalOperations->getBoardNumber(sysmanProperties.boardNumber); - pOsGlobalOperations->getSerialNumber(sysmanProperties.serialNumber); } GlobalOperationsImp::~GlobalOperationsImp() { diff --git a/level_zero/tools/source/sysman/global_operations/global_operations_imp.h b/level_zero/tools/source/sysman/global_operations/global_operations_imp.h index 1aea429d75..2307f317e0 100644 --- a/level_zero/tools/source/sysman/global_operations/global_operations_imp.h +++ b/level_zero/tools/source/sysman/global_operations/global_operations_imp.h @@ -20,9 +20,8 @@ namespace L0 { class GlobalOperationsImp : public GlobalOperations, NEO::NonCopyableOrMovableClass { public: void init() override; - ze_result_t deviceGetProperties(zet_sysman_properties_t *pProperties) override; ze_result_t reset() override; - ze_result_t processesGetState(uint32_t *pCount, zet_process_state_t *pProcesses) override; + ze_result_t processesGetState(uint32_t *pCount, zes_process_state_t *pProcesses) override; OsGlobalOperations *pOsGlobalOperations = nullptr; ze_device_handle_t hCoreDevice = {}; @@ -34,7 +33,6 @@ class GlobalOperationsImp : public GlobalOperations, NEO::NonCopyableOrMovableCl private: OsSysman *pOsSysman = nullptr; - zet_sysman_properties_t sysmanProperties = {}; }; } // namespace L0 diff --git a/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.cpp b/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.cpp index 515fd58f12..d4d6072743 100644 --- a/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.cpp +++ b/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.cpp @@ -31,24 +31,24 @@ const std::string LinuxGlobalOperationsImp::clientsDir("clients"); // with engine enum defined in leve-zero spec // Note that entries with int 2 and 3(represented by i915 as CLASS_VIDEO and CLASS_VIDEO_ENHANCE) // are both mapped to MEDIA, as CLASS_VIDEO represents any media fixed-function hardware. -const std::map engineMap = { - {0, ZET_ENGINE_TYPE_3D}, - {1, ZET_ENGINE_TYPE_DMA}, - {2, ZET_ENGINE_TYPE_MEDIA}, - {3, ZET_ENGINE_TYPE_MEDIA}, - {4, ZET_ENGINE_TYPE_COMPUTE}}; +const std::map engineMap = { + {0, ZES_ENGINE_TYPE_FLAG_3D}, + {1, ZES_ENGINE_TYPE_FLAG_DMA}, + {2, ZES_ENGINE_TYPE_FLAG_MEDIA}, + {3, ZES_ENGINE_TYPE_FLAG_MEDIA}, + {4, ZES_ENGINE_TYPE_FLAG_COMPUTE}}; -void LinuxGlobalOperationsImp::getSerialNumber(int8_t (&serialNumber)[ZET_STRING_PROPERTY_SIZE]) { +void LinuxGlobalOperationsImp::getSerialNumber(int8_t (&serialNumber)[ZES_STRING_PROPERTY_SIZE]) { std::copy(unknown.begin(), unknown.end(), serialNumber); serialNumber[unknown.size()] = '\0'; } -void LinuxGlobalOperationsImp::getBoardNumber(int8_t (&boardNumber)[ZET_STRING_PROPERTY_SIZE]) { +void LinuxGlobalOperationsImp::getBoardNumber(int8_t (&boardNumber)[ZES_STRING_PROPERTY_SIZE]) { std::copy(unknown.begin(), unknown.end(), boardNumber); boardNumber[unknown.size()] = '\0'; } -void LinuxGlobalOperationsImp::getBrandName(int8_t (&brandName)[ZET_STRING_PROPERTY_SIZE]) { +void LinuxGlobalOperationsImp::getBrandName(int8_t (&brandName)[ZES_STRING_PROPERTY_SIZE]) { std::string strVal; ze_result_t result = pSysfsAccess->read(subsystemVendorFile, strVal); if (ZE_RESULT_SUCCESS != result) { @@ -65,7 +65,7 @@ void LinuxGlobalOperationsImp::getBrandName(int8_t (&brandName)[ZET_STRING_PROPE brandName[unknown.size()] = '\0'; } -void LinuxGlobalOperationsImp::getModelName(int8_t (&modelName)[ZET_STRING_PROPERTY_SIZE]) { +void LinuxGlobalOperationsImp::getModelName(int8_t (&modelName)[ZES_STRING_PROPERTY_SIZE]) { std::string strVal; ze_result_t result = pSysfsAccess->read(deviceFile, strVal); if (ZE_RESULT_SUCCESS != result) { @@ -78,7 +78,7 @@ void LinuxGlobalOperationsImp::getModelName(int8_t (&modelName)[ZET_STRING_PROPE modelName[strVal.size()] = '\0'; } -void LinuxGlobalOperationsImp::getVendorName(int8_t (&vendorName)[ZET_STRING_PROPERTY_SIZE]) { +void LinuxGlobalOperationsImp::getVendorName(int8_t (&vendorName)[ZES_STRING_PROPERTY_SIZE]) { std::string strVal; ze_result_t result = pSysfsAccess->read(vendorFile, strVal); if (ZE_RESULT_SUCCESS != result) { @@ -95,7 +95,7 @@ void LinuxGlobalOperationsImp::getVendorName(int8_t (&vendorName)[ZET_STRING_PRO vendorName[unknown.size()] = '\0'; } -void LinuxGlobalOperationsImp::getDriverVersion(int8_t (&driverVersion)[ZET_STRING_PROPERTY_SIZE]) { +void LinuxGlobalOperationsImp::getDriverVersion(int8_t (&driverVersion)[ZES_STRING_PROPERTY_SIZE]) { std::copy(unknown.begin(), unknown.end(), driverVersion); driverVersion[unknown.size()] = '\0'; } @@ -228,7 +228,7 @@ ze_result_t LinuxGlobalOperationsImp::reset() { // accumulated nanoseconds each client spent on engines. // Thus we traverse each file in busy dir for non-zero time and if we find that file say 0,then we could say that // this engine 0 is used by process. -ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vector &pProcessList) { +ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vector &pProcessList) { std::vector clientIds; struct engineMemoryPairType { int64_t engineTypeField; @@ -282,7 +282,7 @@ ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vector 0) { int i915EnginNumber = stoi(engineNum); auto i915MapToL0EngineType = engineMap.find(i915EnginNumber); - zet_engine_type_t val = ZET_ENGINE_TYPE_OTHER; + zes_engine_type_flags_t val = ZES_ENGINE_TYPE_FLAG_OTHER; if (i915MapToL0EngineType != engineMap.end()) { // Found a valid map val = i915MapToL0EngineType->second; @@ -320,10 +320,10 @@ ze_result_t LinuxGlobalOperationsImp::scanProcessesState(std::vector(itr->first); process.memSize = itr->second.deviceMemorySizeField; - process.engines = itr->second.engineTypeField; + process.engines = static_cast(itr->second.engineTypeField); pProcessList.push_back(process); } return result; diff --git a/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.h b/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.h index 185010a44e..0f6be63a57 100644 --- a/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.h +++ b/level_zero/tools/source/sysman/global_operations/linux/os_global_operations_imp.h @@ -14,14 +14,14 @@ class SysfsAccess; class LinuxGlobalOperationsImp : public OsGlobalOperations, NEO::NonCopyableOrMovableClass { public: - void getSerialNumber(int8_t (&serialNumber)[ZET_STRING_PROPERTY_SIZE]) override; - void getBoardNumber(int8_t (&boardNumber)[ZET_STRING_PROPERTY_SIZE]) override; - void getBrandName(int8_t (&brandName)[ZET_STRING_PROPERTY_SIZE]) override; - void getModelName(int8_t (&modelName)[ZET_STRING_PROPERTY_SIZE]) override; - void getVendorName(int8_t (&vendorName)[ZET_STRING_PROPERTY_SIZE]) override; - void getDriverVersion(int8_t (&driverVersion)[ZET_STRING_PROPERTY_SIZE]) override; + void getSerialNumber(int8_t (&serialNumber)[ZES_STRING_PROPERTY_SIZE]) override; + void getBoardNumber(int8_t (&boardNumber)[ZES_STRING_PROPERTY_SIZE]) override; + void getBrandName(int8_t (&brandName)[ZES_STRING_PROPERTY_SIZE]) override; + void getModelName(int8_t (&modelName)[ZES_STRING_PROPERTY_SIZE]) override; + void getVendorName(int8_t (&vendorName)[ZES_STRING_PROPERTY_SIZE]) override; + void getDriverVersion(int8_t (&driverVersion)[ZES_STRING_PROPERTY_SIZE]) override; ze_result_t reset() override; - ze_result_t scanProcessesState(std::vector &pProcessList) override; + ze_result_t scanProcessesState(std::vector &pProcessList) override; LinuxGlobalOperationsImp() = default; LinuxGlobalOperationsImp(OsSysman *pOsSysman); ~LinuxGlobalOperationsImp() override = default; diff --git a/level_zero/tools/source/sysman/global_operations/os_global_operations.h b/level_zero/tools/source/sysman/global_operations/os_global_operations.h index ee747a38f1..ce440af70e 100644 --- a/level_zero/tools/source/sysman/global_operations/os_global_operations.h +++ b/level_zero/tools/source/sysman/global_operations/os_global_operations.h @@ -8,7 +8,7 @@ #pragma once #include "level_zero/tools/source/sysman/os_sysman.h" -#include +#include #include #include @@ -17,14 +17,14 @@ namespace L0 { class OsGlobalOperations { public: - virtual void getSerialNumber(int8_t (&serialNumber)[ZET_STRING_PROPERTY_SIZE]) = 0; - virtual void getBoardNumber(int8_t (&boardNumber)[ZET_STRING_PROPERTY_SIZE]) = 0; - virtual void getBrandName(int8_t (&brandName)[ZET_STRING_PROPERTY_SIZE]) = 0; - virtual void getModelName(int8_t (&modelName)[ZET_STRING_PROPERTY_SIZE]) = 0; - virtual void getVendorName(int8_t (&vendorName)[ZET_STRING_PROPERTY_SIZE]) = 0; - virtual void getDriverVersion(int8_t (&driverVersion)[ZET_STRING_PROPERTY_SIZE]) = 0; + virtual void getSerialNumber(int8_t (&serialNumber)[ZES_STRING_PROPERTY_SIZE]) = 0; + virtual void getBoardNumber(int8_t (&boardNumber)[ZES_STRING_PROPERTY_SIZE]) = 0; + virtual void getBrandName(int8_t (&brandName)[ZES_STRING_PROPERTY_SIZE]) = 0; + virtual void getModelName(int8_t (&modelName)[ZES_STRING_PROPERTY_SIZE]) = 0; + virtual void getVendorName(int8_t (&vendorName)[ZES_STRING_PROPERTY_SIZE]) = 0; + virtual void getDriverVersion(int8_t (&driverVersion)[ZES_STRING_PROPERTY_SIZE]) = 0; virtual ze_result_t reset() = 0; - virtual ze_result_t scanProcessesState(std::vector &pProcessList) = 0; + virtual ze_result_t scanProcessesState(std::vector &pProcessList) = 0; static OsGlobalOperations *create(OsSysman *pOsSysman); virtual ~OsGlobalOperations() {} }; diff --git a/level_zero/tools/source/sysman/global_operations/windows/os_global_operations_imp.cpp b/level_zero/tools/source/sysman/global_operations/windows/os_global_operations_imp.cpp index 5a6230ab0a..5b311c102b 100644 --- a/level_zero/tools/source/sysman/global_operations/windows/os_global_operations_imp.cpp +++ b/level_zero/tools/source/sysman/global_operations/windows/os_global_operations_imp.cpp @@ -12,14 +12,14 @@ namespace L0 { class WddmGlobalOperationsImp : public OsGlobalOperations { public: - void getSerialNumber(int8_t (&serialNumber)[ZET_STRING_PROPERTY_SIZE]) override; - void getBoardNumber(int8_t (&boardNumber)[ZET_STRING_PROPERTY_SIZE]) override; - void getBrandName(int8_t (&brandName)[ZET_STRING_PROPERTY_SIZE]) override; - void getModelName(int8_t (&modelName)[ZET_STRING_PROPERTY_SIZE]) override; - void getVendorName(int8_t (&vendorName)[ZET_STRING_PROPERTY_SIZE]) override; - void getDriverVersion(int8_t (&driverVersion)[ZET_STRING_PROPERTY_SIZE]) override; + void getSerialNumber(int8_t (&serialNumber)[ZES_STRING_PROPERTY_SIZE]) override; + void getBoardNumber(int8_t (&boardNumber)[ZES_STRING_PROPERTY_SIZE]) override; + void getBrandName(int8_t (&brandName)[ZES_STRING_PROPERTY_SIZE]) override; + void getModelName(int8_t (&modelName)[ZES_STRING_PROPERTY_SIZE]) override; + void getVendorName(int8_t (&vendorName)[ZES_STRING_PROPERTY_SIZE]) override; + void getDriverVersion(int8_t (&driverVersion)[ZES_STRING_PROPERTY_SIZE]) override; ze_result_t reset() override; - ze_result_t scanProcessesState(std::vector &pProcessList) override; + ze_result_t scanProcessesState(std::vector &pProcessList) override; WddmGlobalOperationsImp(OsSysman *pOsSysman); ~WddmGlobalOperationsImp() = default; @@ -29,29 +29,29 @@ class WddmGlobalOperationsImp : public OsGlobalOperations { WddmGlobalOperationsImp &operator=(const WddmGlobalOperationsImp &obj) = delete; }; -void WddmGlobalOperationsImp::getSerialNumber(int8_t (&serialNumber)[ZET_STRING_PROPERTY_SIZE]) { +void WddmGlobalOperationsImp::getSerialNumber(int8_t (&serialNumber)[ZES_STRING_PROPERTY_SIZE]) { } -void WddmGlobalOperationsImp::getBoardNumber(int8_t (&boardNumber)[ZET_STRING_PROPERTY_SIZE]) { +void WddmGlobalOperationsImp::getBoardNumber(int8_t (&boardNumber)[ZES_STRING_PROPERTY_SIZE]) { } -void WddmGlobalOperationsImp::getBrandName(int8_t (&brandName)[ZET_STRING_PROPERTY_SIZE]) { +void WddmGlobalOperationsImp::getBrandName(int8_t (&brandName)[ZES_STRING_PROPERTY_SIZE]) { } -void WddmGlobalOperationsImp::getModelName(int8_t (&modelName)[ZET_STRING_PROPERTY_SIZE]) { +void WddmGlobalOperationsImp::getModelName(int8_t (&modelName)[ZES_STRING_PROPERTY_SIZE]) { } -void WddmGlobalOperationsImp::getVendorName(int8_t (&vendorName)[ZET_STRING_PROPERTY_SIZE]) { +void WddmGlobalOperationsImp::getVendorName(int8_t (&vendorName)[ZES_STRING_PROPERTY_SIZE]) { } -void WddmGlobalOperationsImp::getDriverVersion(int8_t (&driverVersion)[ZET_STRING_PROPERTY_SIZE]) { +void WddmGlobalOperationsImp::getDriverVersion(int8_t (&driverVersion)[ZES_STRING_PROPERTY_SIZE]) { } ze_result_t WddmGlobalOperationsImp::reset() { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t WddmGlobalOperationsImp::scanProcessesState(std::vector &pProcessList) { +ze_result_t WddmGlobalOperationsImp::scanProcessesState(std::vector &pProcessList) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp b/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp index def932e5da..c9123bc3d9 100644 --- a/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp +++ b/level_zero/tools/source/sysman/linux/os_sysman_imp.cpp @@ -21,9 +21,7 @@ ze_result_t LinuxSysmanImp::init() { UNRECOVERABLE_IF(nullptr == pProcfsAccess); Device *pDevice = nullptr; - if (pParentSysmanImp != nullptr) { - pDevice = Device::fromHandle(pParentSysmanImp->hCoreDevice); - } else if (pParentSysmanDeviceImp != nullptr) { + if (pParentSysmanDeviceImp != nullptr) { pDevice = Device::fromHandle(pParentSysmanDeviceImp->hCoreDevice); } else { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; @@ -77,10 +75,6 @@ PlatformMonitoringTech &LinuxSysmanImp::getPlatformMonitoringTechAccess() { return *pPmt; } -LinuxSysmanImp::LinuxSysmanImp(SysmanImp *pParentSysmanImp) { - this->pParentSysmanImp = pParentSysmanImp; -} - LinuxSysmanImp::LinuxSysmanImp(SysmanDeviceImp *pParentSysmanDeviceImp) { this->pParentSysmanDeviceImp = pParentSysmanDeviceImp; } @@ -108,11 +102,6 @@ LinuxSysmanImp::~LinuxSysmanImp() { } } -OsSysman *OsSysman::create(SysmanImp *pParentSysmanImp) { - LinuxSysmanImp *pLinuxSysmanImp = new LinuxSysmanImp(pParentSysmanImp); - return static_cast(pLinuxSysmanImp); -} - OsSysman *OsSysman::create(SysmanDeviceImp *pParentSysmanDeviceImp) { LinuxSysmanImp *pLinuxSysmanImp = new LinuxSysmanImp(pParentSysmanDeviceImp); return static_cast(pLinuxSysmanImp); diff --git a/level_zero/tools/source/sysman/linux/os_sysman_imp.h b/level_zero/tools/source/sysman/linux/os_sysman_imp.h index 975049cfde..71f5e1f827 100644 --- a/level_zero/tools/source/sysman/linux/os_sysman_imp.h +++ b/level_zero/tools/source/sysman/linux/os_sysman_imp.h @@ -20,7 +20,6 @@ namespace L0 { class LinuxSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass { public: - LinuxSysmanImp(SysmanImp *pParentSysmanImp); LinuxSysmanImp(SysmanDeviceImp *pParentSysmanDeviceImp); ~LinuxSysmanImp() override; @@ -42,7 +41,6 @@ class LinuxSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass { private: LinuxSysmanImp() = delete; - SysmanImp *pParentSysmanImp = nullptr; SysmanDeviceImp *pParentSysmanDeviceImp = nullptr; NEO::Drm *pDrm = nullptr; }; diff --git a/level_zero/tools/source/sysman/memory/linux/dg1/os_memory_imp.cpp b/level_zero/tools/source/sysman/memory/linux/dg1/os_memory_imp.cpp index 5d21f8c080..331f813b82 100644 --- a/level_zero/tools/source/sysman/memory/linux/dg1/os_memory_imp.cpp +++ b/level_zero/tools/source/sysman/memory/linux/dg1/os_memory_imp.cpp @@ -35,8 +35,8 @@ ze_result_t LinuxMemoryImp::getMemorySize(uint64_t &maxSize, uint64_t &allocSize return ZE_RESULT_SUCCESS; } -ze_result_t LinuxMemoryImp::getMemHealth(zet_mem_health_t &memHealth) { - memHealth = ZET_MEM_HEALTH_OK; +ze_result_t LinuxMemoryImp::getMemHealth(zes_mem_health_t &memHealth) { + memHealth = ZES_MEM_HEALTH_OK; return ZE_RESULT_SUCCESS; } diff --git a/level_zero/tools/source/sysman/memory/linux/dg1/os_memory_imp.h b/level_zero/tools/source/sysman/memory/linux/dg1/os_memory_imp.h index 01e2046267..c3222c5229 100644 --- a/level_zero/tools/source/sysman/memory/linux/dg1/os_memory_imp.h +++ b/level_zero/tools/source/sysman/memory/linux/dg1/os_memory_imp.h @@ -18,7 +18,7 @@ class SysfsAccess; class LinuxMemoryImp : public OsMemory, NEO::NonCopyableOrMovableClass { public: ze_result_t getMemorySize(uint64_t &maxSize, uint64_t &allocSize) override; - ze_result_t getMemHealth(zet_mem_health_t &memHealth) override; + ze_result_t getMemHealth(zes_mem_health_t &memHealth) override; LinuxMemoryImp(OsSysman *pOsSysman); LinuxMemoryImp() = default; ~LinuxMemoryImp() override = default; diff --git a/level_zero/tools/source/sysman/memory/linux/os_memory_imp.cpp b/level_zero/tools/source/sysman/memory/linux/os_memory_imp.cpp index 49e91cf51c..0fbde2339f 100644 --- a/level_zero/tools/source/sysman/memory/linux/os_memory_imp.cpp +++ b/level_zero/tools/source/sysman/memory/linux/os_memory_imp.cpp @@ -13,7 +13,7 @@ ze_result_t LinuxMemoryImp::getMemorySize(uint64_t &maxSize, uint64_t &allocSize return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t LinuxMemoryImp::getMemHealth(zet_mem_health_t &memHealth) { +ze_result_t LinuxMemoryImp::getMemHealth(zes_mem_health_t &memHealth) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/tools/source/sysman/memory/linux/os_memory_imp.h b/level_zero/tools/source/sysman/memory/linux/os_memory_imp.h index b2d5a6545a..dd04595227 100644 --- a/level_zero/tools/source/sysman/memory/linux/os_memory_imp.h +++ b/level_zero/tools/source/sysman/memory/linux/os_memory_imp.h @@ -17,7 +17,7 @@ class SysfsAccess; class LinuxMemoryImp : public OsMemory, NEO::NonCopyableOrMovableClass { public: ze_result_t getMemorySize(uint64_t &maxSize, uint64_t &allocSize) override; - ze_result_t getMemHealth(zet_mem_health_t &memHealth) override; + ze_result_t getMemHealth(zes_mem_health_t &memHealth) override; LinuxMemoryImp(OsSysman *pOsSysman); LinuxMemoryImp() = default; ~LinuxMemoryImp() override = default; diff --git a/level_zero/tools/source/sysman/memory/memory.cpp b/level_zero/tools/source/sysman/memory/memory.cpp index 0c18eb6fec..8173d93fc9 100644 --- a/level_zero/tools/source/sysman/memory/memory.cpp +++ b/level_zero/tools/source/sysman/memory/memory.cpp @@ -31,7 +31,7 @@ ze_result_t MemoryHandleContext::init() { return ZE_RESULT_SUCCESS; } -ze_result_t MemoryHandleContext::memoryGet(uint32_t *pCount, zet_sysman_mem_handle_t *phMemory) { +ze_result_t MemoryHandleContext::memoryGet(uint32_t *pCount, zes_mem_handle_t *phMemory) { uint32_t handleListSize = static_cast(handleList.size()); uint32_t numToCopy = std::min(*pCount, handleListSize); if (0 == *pCount || *pCount > handleListSize) { diff --git a/level_zero/tools/source/sysman/memory/memory.h b/level_zero/tools/source/sysman/memory/memory.h index ad589dccb6..a7818b5b43 100644 --- a/level_zero/tools/source/sysman/memory/memory.h +++ b/level_zero/tools/source/sysman/memory/memory.h @@ -6,28 +6,28 @@ */ #pragma once -#include +#include #include -struct _zet_sysman_mem_handle_t { - virtual ~_zet_sysman_mem_handle_t() = default; +struct _zes_mem_handle_t { + virtual ~_zes_mem_handle_t() = default; }; namespace L0 { struct OsSysman; -class Memory : _zet_sysman_mem_handle_t { +class Memory : _zes_mem_handle_t { public: - virtual ze_result_t memoryGetProperties(zet_mem_properties_t *pProperties) = 0; - virtual ze_result_t memoryGetBandwidth(zet_mem_bandwidth_t *pBandwidth) = 0; - virtual ze_result_t memoryGetState(zet_mem_state_t *pState) = 0; + virtual ze_result_t memoryGetProperties(zes_mem_properties_t *pProperties) = 0; + virtual ze_result_t memoryGetBandwidth(zes_mem_bandwidth_t *pBandwidth) = 0; + virtual ze_result_t memoryGetState(zes_mem_state_t *pState) = 0; - static Memory *fromHandle(zet_sysman_mem_handle_t handle) { + static Memory *fromHandle(zes_mem_handle_t handle) { return static_cast(handle); } - inline zet_sysman_mem_handle_t toHandle() { return this; } + inline zes_mem_handle_t toHandle() { return this; } }; struct MemoryHandleContext { @@ -36,7 +36,7 @@ struct MemoryHandleContext { ze_result_t init(); - ze_result_t memoryGet(uint32_t *pCount, zet_sysman_mem_handle_t *phMemory); + ze_result_t memoryGet(uint32_t *pCount, zes_mem_handle_t *phMemory); OsSysman *pOsSysman = nullptr; bool isLmemSupported = false; diff --git a/level_zero/tools/source/sysman/memory/memory_imp.cpp b/level_zero/tools/source/sysman/memory/memory_imp.cpp index 99be4408b1..35fad6f626 100644 --- a/level_zero/tools/source/sysman/memory/memory_imp.cpp +++ b/level_zero/tools/source/sysman/memory/memory_imp.cpp @@ -9,25 +9,25 @@ namespace L0 { -ze_result_t MemoryImp::memoryGetBandwidth(zet_mem_bandwidth_t *pBandwidth) { +ze_result_t MemoryImp::memoryGetBandwidth(zes_mem_bandwidth_t *pBandwidth) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t MemoryImp::memoryGetState(zet_mem_state_t *pState) { - ze_result_t result = pOsMemory->getMemorySize(pState->maxSize, pState->allocatedSize); +ze_result_t MemoryImp::memoryGetState(zes_mem_state_t *pState) { + ze_result_t result = pOsMemory->getMemorySize(pState->size, pState->size); if (ZE_RESULT_SUCCESS != result) { return result; } return pOsMemory->getMemHealth(pState->health); } -ze_result_t MemoryImp::memoryGetProperties(zet_mem_properties_t *pProperties) { +ze_result_t MemoryImp::memoryGetProperties(zes_mem_properties_t *pProperties) { *pProperties = memoryProperties; return ZE_RESULT_SUCCESS; } void MemoryImp::init() { - memoryProperties.type = ZET_MEM_TYPE_DDR; + memoryProperties.type = ZES_MEM_TYPE_DDR; memoryProperties.onSubdevice = false; memoryProperties.subdeviceId = 0; memoryProperties.physicalSize = 0; diff --git a/level_zero/tools/source/sysman/memory/memory_imp.h b/level_zero/tools/source/sysman/memory/memory_imp.h index 2cc6f43684..4d3c9e9971 100644 --- a/level_zero/tools/source/sysman/memory/memory_imp.h +++ b/level_zero/tools/source/sysman/memory/memory_imp.h @@ -10,15 +10,15 @@ #include "level_zero/tools/source/sysman/memory/memory.h" #include "level_zero/tools/source/sysman/memory/os_memory.h" -#include +#include namespace L0 { class MemoryImp : public Memory, NEO::NonCopyableOrMovableClass { public: - ze_result_t memoryGetProperties(zet_mem_properties_t *pProperties) override; - ze_result_t memoryGetBandwidth(zet_mem_bandwidth_t *pBandwidth) override; - ze_result_t memoryGetState(zet_mem_state_t *pState) override; + ze_result_t memoryGetProperties(zes_mem_properties_t *pProperties) override; + ze_result_t memoryGetBandwidth(zes_mem_bandwidth_t *pBandwidth) override; + ze_result_t memoryGetState(zes_mem_state_t *pState) override; MemoryImp(OsSysman *pOsSysman, ze_device_handle_t hDevice); ~MemoryImp() override; @@ -28,7 +28,7 @@ class MemoryImp : public Memory, NEO::NonCopyableOrMovableClass { OsMemory *pOsMemory = nullptr; private: - zet_mem_properties_t memoryProperties = {}; + zes_mem_properties_t memoryProperties = {}; ze_device_handle_t hCoreDevice = {}; }; diff --git a/level_zero/tools/source/sysman/memory/os_memory.h b/level_zero/tools/source/sysman/memory/os_memory.h index e2079320b4..e8b3caae17 100644 --- a/level_zero/tools/source/sysman/memory/os_memory.h +++ b/level_zero/tools/source/sysman/memory/os_memory.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace L0 { @@ -15,7 +15,7 @@ struct OsSysman; class OsMemory { public: virtual ze_result_t getMemorySize(uint64_t &maxSize, uint64_t &allocSize) = 0; - virtual ze_result_t getMemHealth(zet_mem_health_t &memHealth) = 0; + virtual ze_result_t getMemHealth(zes_mem_health_t &memHealth) = 0; static OsMemory *create(OsSysman *pOsSysman); virtual ~OsMemory() {} }; diff --git a/level_zero/tools/source/sysman/memory/windows/os_memory_imp.cpp b/level_zero/tools/source/sysman/memory/windows/os_memory_imp.cpp index 0b01f88414..84c1af6485 100644 --- a/level_zero/tools/source/sysman/memory/windows/os_memory_imp.cpp +++ b/level_zero/tools/source/sysman/memory/windows/os_memory_imp.cpp @@ -13,14 +13,14 @@ class WddmMemoryImp : public OsMemory { public: ze_result_t getMemorySize(uint64_t &maxSize, uint64_t &allocSize) override; - ze_result_t getMemHealth(zet_mem_health_t &memHealth) override; + ze_result_t getMemHealth(zes_mem_health_t &memHealth) override; }; ze_result_t WddmMemoryImp::getMemorySize(uint64_t &maxSize, uint64_t &allocSize) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t WddmMemoryImp::getMemHealth(zet_mem_health_t &memHealth) { +ze_result_t WddmMemoryImp::getMemHealth(zes_mem_health_t &memHealth) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/tools/source/sysman/os_sysman.h b/level_zero/tools/source/sysman/os_sysman.h index 1d0705c276..74a83eef1b 100644 --- a/level_zero/tools/source/sysman/os_sysman.h +++ b/level_zero/tools/source/sysman/os_sysman.h @@ -6,18 +6,15 @@ */ #pragma once -#include - +#include namespace L0 { -struct SysmanImp; struct SysmanDeviceImp; struct OsSysman { virtual ~OsSysman(){}; virtual ze_result_t init() = 0; - static OsSysman *create(SysmanImp *pSysmanImp); static OsSysman *create(SysmanDeviceImp *pSysmanImp); }; diff --git a/level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp b/level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp index 1a329cdcd2..afc8f3425c 100644 --- a/level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp +++ b/level_zero/tools/source/sysman/pci/linux/os_pci_imp.cpp @@ -143,7 +143,7 @@ void getBarBaseAndSize(std::string readBytes, uint64_t &baseAddr, uint64_t &barS barSize = end - start + 1; } -ze_result_t LinuxPciImp::initializeBarProperties(std::vector &pBarProperties) { +ze_result_t LinuxPciImp::initializeBarProperties(std::vector &pBarProperties) { std::vector ReadBytes; ze_result_t result = pSysfsAccess->read(resourceFile, ReadBytes); if (result != ZE_RESULT_SUCCESS) { @@ -153,7 +153,7 @@ ze_result_t LinuxPciImp::initializeBarProperties(std::vectorindex = i; pBarProp->base = baseAddr; pBarProp->size = barSize; @@ -163,9 +163,9 @@ ze_result_t LinuxPciImp::initializeBarProperties(std::vector 64bit BAR*/ - pBarProp->type = (barFlags & 0x1) ? ZET_PCI_BAR_TYPE_VGA_IO : ZET_PCI_BAR_TYPE_MMIO; + pBarProp->type = ZES_PCI_BAR_TYPE_MMIO; if (i == 6) { // the 7th entry of resource file is expected to be ROM BAR - pBarProp->type = ZET_PCI_BAR_TYPE_ROM; + pBarProp->type = ZES_PCI_BAR_TYPE_ROM; } pBarProperties.push_back(pBarProp); } diff --git a/level_zero/tools/source/sysman/pci/linux/os_pci_imp.h b/level_zero/tools/source/sysman/pci/linux/os_pci_imp.h index d07efbaf47..d71c60085e 100644 --- a/level_zero/tools/source/sysman/pci/linux/os_pci_imp.h +++ b/level_zero/tools/source/sysman/pci/linux/os_pci_imp.h @@ -22,7 +22,7 @@ class LinuxPciImp : public OsPci, NEO::NonCopyableOrMovableClass { ze_result_t getMaxLinkWidth(uint32_t &maxLinkwidth) override; ze_result_t getLinkGen(uint32_t &linkGen) override; void setLmemSupport(bool val) override; - ze_result_t initializeBarProperties(std::vector &pBarProperties) override; + ze_result_t initializeBarProperties(std::vector &pBarProperties) override; LinuxPciImp() = default; LinuxPciImp(OsSysman *pOsSysman); ~LinuxPciImp() override = default; diff --git a/level_zero/tools/source/sysman/pci/os_pci.h b/level_zero/tools/source/sysman/pci/os_pci.h index 6ef4827c38..51d0d3992a 100644 --- a/level_zero/tools/source/sysman/pci/os_pci.h +++ b/level_zero/tools/source/sysman/pci/os_pci.h @@ -22,7 +22,7 @@ class OsPci { virtual ze_result_t getMaxLinkWidth(uint32_t &maxLinkWidth) = 0; virtual ze_result_t getLinkGen(uint32_t &linkGen) = 0; virtual void setLmemSupport(bool val) = 0; - virtual ze_result_t initializeBarProperties(std::vector &pBarProperties) = 0; + virtual ze_result_t initializeBarProperties(std::vector &pBarProperties) = 0; static OsPci *create(OsSysman *pOsSysman); virtual ~OsPci() = default; }; diff --git a/level_zero/tools/source/sysman/pci/pci.h b/level_zero/tools/source/sysman/pci/pci.h index eebf0141f2..c60e7ea58b 100644 --- a/level_zero/tools/source/sysman/pci/pci.h +++ b/level_zero/tools/source/sysman/pci/pci.h @@ -6,15 +6,15 @@ */ #pragma once -#include +#include namespace L0 { class Pci { public: virtual ~Pci(){}; - virtual ze_result_t pciStaticProperties(zet_pci_properties_t *pProperties) = 0; - virtual ze_result_t pciGetInitializedBars(uint32_t *pCount, zet_pci_bar_properties_t *pProperties) = 0; + virtual ze_result_t pciStaticProperties(zes_pci_properties_t *pProperties) = 0; + virtual ze_result_t pciGetInitializedBars(uint32_t *pCount, zes_pci_bar_properties_t *pProperties) = 0; virtual void init() = 0; }; diff --git a/level_zero/tools/source/sysman/pci/pci_imp.cpp b/level_zero/tools/source/sysman/pci/pci_imp.cpp index 3bdf8b21cd..f5e802ee3d 100644 --- a/level_zero/tools/source/sysman/pci/pci_imp.cpp +++ b/level_zero/tools/source/sysman/pci/pci_imp.cpp @@ -42,12 +42,12 @@ uint64_t convertPcieSpeedFromGTsToBs(double maxLinkSpeedInGt) { return static_cast(pcieSpeedWithEnc); } -ze_result_t PciImp::pciStaticProperties(zet_pci_properties_t *pProperties) { +ze_result_t PciImp::pciStaticProperties(zes_pci_properties_t *pProperties) { *pProperties = pciProperties; return ZE_RESULT_SUCCESS; } -ze_result_t PciImp::pciGetInitializedBars(uint32_t *pCount, zet_pci_bar_properties_t *pProperties) { +ze_result_t PciImp::pciGetInitializedBars(uint32_t *pCount, zes_pci_bar_properties_t *pProperties) { if (pProperties == nullptr) { *pCount = static_cast(pciBarProperties.size()); return ZE_RESULT_SUCCESS; @@ -95,7 +95,7 @@ void PciImp::init() { } PciImp::~PciImp() { - for (zet_pci_bar_properties_t *pProperties : pciBarProperties) { + for (zes_pci_bar_properties_t *pProperties : pciBarProperties) { delete pProperties; pProperties = nullptr; } diff --git a/level_zero/tools/source/sysman/pci/pci_imp.h b/level_zero/tools/source/sysman/pci/pci_imp.h index cab5289576..e8d6d41c5f 100644 --- a/level_zero/tools/source/sysman/pci/pci_imp.h +++ b/level_zero/tools/source/sysman/pci/pci_imp.h @@ -22,8 +22,8 @@ namespace L0 { class PciImp : public Pci, NEO::NonCopyableOrMovableClass { public: void init() override; - ze_result_t pciStaticProperties(zet_pci_properties_t *pProperties) override; - ze_result_t pciGetInitializedBars(uint32_t *pCount, zet_pci_bar_properties_t *pProperties) override; + ze_result_t pciStaticProperties(zes_pci_properties_t *pProperties) override; + ze_result_t pciGetInitializedBars(uint32_t *pCount, zes_pci_bar_properties_t *pProperties) override; PciImp() = default; PciImp(OsSysman *pOsSysman, ze_device_handle_t hDevice) : pOsSysman(pOsSysman) { @@ -36,8 +36,8 @@ class PciImp : public Pci, NEO::NonCopyableOrMovableClass { private: OsSysman *pOsSysman = nullptr; - zet_pci_properties_t pciProperties = {}; - std::vector pciBarProperties = {}; + zes_pci_properties_t pciProperties = {}; + std::vector pciBarProperties = {}; }; } // namespace L0 diff --git a/level_zero/tools/source/sysman/pci/windows/os_pci_imp.cpp b/level_zero/tools/source/sysman/pci/windows/os_pci_imp.cpp index 8b4eb9833e..1088c7301a 100644 --- a/level_zero/tools/source/sysman/pci/windows/os_pci_imp.cpp +++ b/level_zero/tools/source/sysman/pci/windows/os_pci_imp.cpp @@ -17,7 +17,7 @@ class WddmPciImp : public OsPci { ze_result_t getMaxLinkWidth(uint32_t &maxLinkwidth) override; ze_result_t getLinkGen(uint32_t &linkGen) override; void setLmemSupport(bool val) override; - ze_result_t initializeBarProperties(std::vector &pBarProperties) override; + ze_result_t initializeBarProperties(std::vector &pBarProperties) override; ~WddmPciImp() override = default; }; @@ -39,7 +39,7 @@ ze_result_t WddmPciImp::getLinkGen(uint32_t &linkGen) { void WddmPciImp::setLmemSupport(bool val) {} -ze_result_t WddmPciImp::initializeBarProperties(std::vector &pBarProperties) { +ze_result_t WddmPciImp::initializeBarProperties(std::vector &pBarProperties) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } diff --git a/level_zero/tools/source/sysman/power/linux/os_power_imp.cpp b/level_zero/tools/source/sysman/power/linux/os_power_imp.cpp index 6dc8b5e9b8..829b395296 100644 --- a/level_zero/tools/source/sysman/power/linux/os_power_imp.cpp +++ b/level_zero/tools/source/sysman/power/linux/os_power_imp.cpp @@ -13,10 +13,6 @@ namespace L0 { constexpr uint64_t convertJouleToMicroJoule = 1000000u; -ze_result_t LinuxPowerImp::getEnergyThreshold(zet_energy_threshold_t *pThreshold) { - - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} ze_result_t LinuxPowerImp::getEnergyThreshold(zes_energy_threshold_t *pThreshold) { diff --git a/level_zero/tools/source/sysman/power/linux/os_power_imp.h b/level_zero/tools/source/sysman/power/linux/os_power_imp.h index 7465d24231..168ec3e743 100644 --- a/level_zero/tools/source/sysman/power/linux/os_power_imp.h +++ b/level_zero/tools/source/sysman/power/linux/os_power_imp.h @@ -17,7 +17,6 @@ class PlatformMonitoringTech; class LinuxPowerImp : public OsPower, NEO::NonCopyableOrMovableClass { public: ze_result_t getEnergyCounter(uint64_t &energy) override; - ze_result_t getEnergyThreshold(zet_energy_threshold_t *pThreshold) override; ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) override; ze_result_t setEnergyThreshold(double threshold) override; bool isPowerModuleSupported() override; diff --git a/level_zero/tools/source/sysman/power/os_power.h b/level_zero/tools/source/sysman/power/os_power.h index 1ee8950565..a45df96d3b 100644 --- a/level_zero/tools/source/sysman/power/os_power.h +++ b/level_zero/tools/source/sysman/power/os_power.h @@ -7,9 +7,7 @@ #pragma once -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include namespace L0 { @@ -17,9 +15,8 @@ struct OsSysman; class OsPower { public: virtual ze_result_t getEnergyCounter(uint64_t &energy) = 0; - virtual ze_result_t getEnergyThreshold(zet_energy_threshold_t *pThreshold) = 0; - virtual ze_result_t setEnergyThreshold(double threshold) = 0; virtual ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) = 0; + virtual ze_result_t setEnergyThreshold(double threshold) = 0; virtual bool isPowerModuleSupported() = 0; static OsPower *create(OsSysman *pOsSysman); virtual ~OsPower() = default; diff --git a/level_zero/tools/source/sysman/power/power.cpp b/level_zero/tools/source/sysman/power/power.cpp index 821a72f99f..0d707a2a7a 100644 --- a/level_zero/tools/source/sysman/power/power.cpp +++ b/level_zero/tools/source/sysman/power/power.cpp @@ -28,7 +28,7 @@ void PowerHandleContext::init() { } } -ze_result_t PowerHandleContext::powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower) { +ze_result_t PowerHandleContext::powerGet(uint32_t *pCount, zes_pwr_handle_t *phPower) { uint32_t handleListSize = static_cast(handleList.size()); uint32_t numToCopy = std::min(*pCount, handleListSize); if (0 == *pCount || *pCount > handleListSize) { @@ -42,18 +42,4 @@ ze_result_t PowerHandleContext::powerGet(uint32_t *pCount, zet_sysman_pwr_handle return ZE_RESULT_SUCCESS; } -ze_result_t PowerHandleContext::powerGet(uint32_t *pCount, zes_pwr_handle_t *phPower) { - uint32_t handleListSize = static_cast(handleList.size()); - uint32_t numToCopy = std::min(*pCount, handleListSize); - if (0 == *pCount || *pCount > handleListSize) { - *pCount = handleListSize; - } - if (nullptr != phPower) { - for (uint32_t i = 0; i < numToCopy; i++) { - phPower[i] = handleList[i]->toZesPwrHandle(); - } - } - return ZE_RESULT_SUCCESS; -} - } // namespace L0 diff --git a/level_zero/tools/source/sysman/power/power.h b/level_zero/tools/source/sysman/power/power.h index 3d3acbf389..ca251e5749 100644 --- a/level_zero/tools/source/sysman/power/power.h +++ b/level_zero/tools/source/sysman/power/power.h @@ -6,9 +6,7 @@ */ #pragma once -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include #include @@ -25,27 +23,17 @@ namespace L0 { struct OsSysman; class Power : _zet_sysman_pwr_handle_t, _zes_pwr_handle_t { public: - virtual ze_result_t powerGetProperties(zet_power_properties_t *pProperties) = 0; - virtual ze_result_t powerGetEnergyCounter(zet_power_energy_counter_t *pEnergy) = 0; - virtual ze_result_t powerGetLimits(zet_power_sustained_limit_t *pSustained, zet_power_burst_limit_t *pBurst, zet_power_peak_limit_t *pPeak) = 0; - virtual ze_result_t powerSetLimits(const zet_power_sustained_limit_t *pSustained, const zet_power_burst_limit_t *pBurst, const zet_power_peak_limit_t *pPeak) = 0; - virtual ze_result_t powerGetEnergyThreshold(zet_energy_threshold_t *pThreshold) = 0; - virtual ze_result_t powerSetEnergyThreshold(double threshold) = 0; - virtual ze_result_t powerGetProperties(zes_power_properties_t *pProperties) = 0; virtual ze_result_t powerGetEnergyCounter(zes_power_energy_counter_t *pEnergy) = 0; virtual ze_result_t powerGetLimits(zes_power_sustained_limit_t *pSustained, zes_power_burst_limit_t *pBurst, zes_power_peak_limit_t *pPeak) = 0; virtual ze_result_t powerSetLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) = 0; virtual ze_result_t powerGetEnergyThreshold(zes_energy_threshold_t *pThreshold) = 0; + virtual ze_result_t powerSetEnergyThreshold(double threshold) = 0; - static Power *fromHandle(zet_sysman_pwr_handle_t handle) { - return static_cast(handle); - } static Power *fromHandle(zes_pwr_handle_t handle) { return static_cast(handle); } - inline zet_sysman_pwr_handle_t toHandle() { return this; } - inline zes_pwr_handle_t toZesPwrHandle() { return this; } + inline zes_pwr_handle_t toHandle() { return this; } bool initSuccess = false; }; struct PowerHandleContext { @@ -54,7 +42,6 @@ struct PowerHandleContext { void init(); - ze_result_t powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower); ze_result_t powerGet(uint32_t *pCount, zes_pwr_handle_t *phPower); OsSysman *pOsSysman = nullptr; diff --git a/level_zero/tools/source/sysman/power/power_imp.cpp b/level_zero/tools/source/sysman/power/power_imp.cpp index 26100216fc..563ea22929 100644 --- a/level_zero/tools/source/sysman/power/power_imp.cpp +++ b/level_zero/tools/source/sysman/power/power_imp.cpp @@ -20,33 +20,6 @@ void powerGetTimestamp(uint64_t ×tamp) { timestamp = std::chrono::duration_cast(ts.time_since_epoch()).count(); } -ze_result_t PowerImp::powerGetProperties(zet_power_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t PowerImp::powerGetEnergyCounter(zet_power_energy_counter_t *pEnergy) { - - ze_result_t result = pOsPower->getEnergyCounter(pEnergy->energy); - - if (result != ZE_RESULT_SUCCESS) { - return result; - } - - powerGetTimestamp(pEnergy->timestamp); - - return result; -} - -ze_result_t PowerImp::powerGetLimits(zet_power_sustained_limit_t *pSustained, zet_power_burst_limit_t *pBurst, zet_power_peak_limit_t *pPeak) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t PowerImp::powerSetLimits(const zet_power_sustained_limit_t *pSustained, const zet_power_burst_limit_t *pBurst, const zet_power_peak_limit_t *pPeak) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} -ze_result_t PowerImp::powerGetEnergyThreshold(zet_energy_threshold_t *pThreshold) { - return (pOsPower->getEnergyThreshold(pThreshold)); -} ze_result_t PowerImp::powerSetEnergyThreshold(double threshold) { return (pOsPower->setEnergyThreshold(threshold)); } diff --git a/level_zero/tools/source/sysman/power/power_imp.h b/level_zero/tools/source/sysman/power/power_imp.h index 19c8d1e881..9d6137d7ad 100644 --- a/level_zero/tools/source/sysman/power/power_imp.h +++ b/level_zero/tools/source/sysman/power/power_imp.h @@ -15,11 +15,6 @@ namespace L0 { class PowerImp : public Power, NEO::NonCopyableOrMovableClass { public: - ze_result_t powerGetProperties(zet_power_properties_t *pProperties) override; - ze_result_t powerGetEnergyCounter(zet_power_energy_counter_t *pEnergy) override; - ze_result_t powerGetLimits(zet_power_sustained_limit_t *pSustained, zet_power_burst_limit_t *pBurst, zet_power_peak_limit_t *pPeak) override; - ze_result_t powerSetLimits(const zet_power_sustained_limit_t *pSustained, const zet_power_burst_limit_t *pBurst, const zet_power_peak_limit_t *pPeak) override; - ze_result_t powerGetEnergyThreshold(zet_energy_threshold_t *pThreshold) override; ze_result_t powerSetEnergyThreshold(double threshold) override; ze_result_t powerGetProperties(zes_power_properties_t *pProperties) override; diff --git a/level_zero/tools/source/sysman/power/windows/os_power_imp.cpp b/level_zero/tools/source/sysman/power/windows/os_power_imp.cpp index ad5cea80e6..38c8e6cd5d 100644 --- a/level_zero/tools/source/sysman/power/windows/os_power_imp.cpp +++ b/level_zero/tools/source/sysman/power/windows/os_power_imp.cpp @@ -12,7 +12,6 @@ namespace L0 { class WddmPowerImp : public OsPower { public: ze_result_t getEnergyCounter(uint64_t &energy) override; - ze_result_t getEnergyThreshold(zet_energy_threshold_t *pThreshold) override; ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) override; ze_result_t setEnergyThreshold(double threshold) override; bool isPowerModuleSupported() override; @@ -23,11 +22,6 @@ ze_result_t WddmPowerImp::getEnergyCounter(uint64_t &energy) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t WddmPowerImp::getEnergyThreshold(zet_energy_threshold_t *pThreshold) { - - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - ze_result_t WddmPowerImp::getEnergyThreshold(zes_energy_threshold_t *pThreshold) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; diff --git a/level_zero/tools/source/sysman/ras/linux/os_ras_imp.cpp b/level_zero/tools/source/sysman/ras/linux/os_ras_imp.cpp index 4e939cc17c..9041e21f58 100644 --- a/level_zero/tools/source/sysman/ras/linux/os_ras_imp.cpp +++ b/level_zero/tools/source/sysman/ras/linux/os_ras_imp.cpp @@ -15,14 +15,14 @@ const std::string LinuxRasImp::rasCounterDir("/var/lib/libze_intel_gpu/"); const std::string LinuxRasImp::resetCounter("ras_reset_count"); const std::string LinuxRasImp::resetCounterFile = rasCounterDir + resetCounter; -void LinuxRasImp::setRasErrorType(zet_ras_error_type_t type) { +void LinuxRasImp::setRasErrorType(zes_ras_error_type_t type) { osRasErrorType = type; } bool LinuxRasImp::isRasSupported(void) { if (false == pFsAccess->fileExists(rasCounterDir)) { return false; } - if (osRasErrorType == ZET_RAS_ERROR_TYPE_CORRECTABLE) { + if (osRasErrorType == ZES_RAS_ERROR_TYPE_CORRECTABLE) { return false; } else { // i915 support for UNCORRECTABLE errors is assumed true @@ -30,20 +30,11 @@ bool LinuxRasImp::isRasSupported(void) { return true; } } -ze_result_t LinuxRasImp::getCounterValues(zet_ras_details_t *pDetails) { - uint64_t counterValue = 0; - ze_result_t result = pFsAccess->read(resetCounterFile, counterValue); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - pDetails->numResets = counterValue; - return result; -} LinuxRasImp::LinuxRasImp(OsSysman *pOsSysman) { LinuxSysmanImp *pLinuxSysmanImp = static_cast(pOsSysman); pFsAccess = &pLinuxSysmanImp->getFsAccess(); - osRasErrorType = ZET_RAS_ERROR_TYPE_UNCORRECTABLE; + osRasErrorType = ZES_RAS_ERROR_TYPE_UNCORRECTABLE; } OsRas *OsRas::create(OsSysman *pOsSysman) { diff --git a/level_zero/tools/source/sysman/ras/linux/os_ras_imp.h b/level_zero/tools/source/sysman/ras/linux/os_ras_imp.h index 7dafc87a06..9646a293b9 100644 --- a/level_zero/tools/source/sysman/ras/linux/os_ras_imp.h +++ b/level_zero/tools/source/sysman/ras/linux/os_ras_imp.h @@ -21,13 +21,12 @@ class LinuxRasImp : public OsRas, NEO::NonCopyableOrMovableClass { LinuxRasImp(OsSysman *pOsSysman); LinuxRasImp() = default; ~LinuxRasImp() override = default; - ze_result_t getCounterValues(zet_ras_details_t *pDetails) override; bool isRasSupported(void) override; - void setRasErrorType(zet_ras_error_type_t rasErrorType) override; + void setRasErrorType(zes_ras_error_type_t rasErrorType) override; protected: FsAccess *pFsAccess = nullptr; - zet_ras_error_type_t osRasErrorType; + zes_ras_error_type_t osRasErrorType; private: static const std::string rasCounterDir; diff --git a/level_zero/tools/source/sysman/ras/os_ras.h b/level_zero/tools/source/sysman/ras/os_ras.h index 905fc4ab59..bd7df0cb60 100644 --- a/level_zero/tools/source/sysman/ras/os_ras.h +++ b/level_zero/tools/source/sysman/ras/os_ras.h @@ -7,16 +7,15 @@ #pragma once -#include +#include namespace L0 { struct OsSysman; class OsRas { public: - virtual ze_result_t getCounterValues(zet_ras_details_t *pDetails) = 0; virtual bool isRasSupported(void) = 0; - virtual void setRasErrorType(zet_ras_error_type_t type) = 0; + virtual void setRasErrorType(zes_ras_error_type_t type) = 0; static OsRas *create(OsSysman *pOsSysman); virtual ~OsRas() = default; }; diff --git a/level_zero/tools/source/sysman/ras/ras.cpp b/level_zero/tools/source/sysman/ras/ras.cpp index 6625607ef6..8eafca4090 100644 --- a/level_zero/tools/source/sysman/ras/ras.cpp +++ b/level_zero/tools/source/sysman/ras/ras.cpp @@ -16,7 +16,7 @@ RasHandleContext::~RasHandleContext() { delete pRas; } } -void RasHandleContext::createHandle(zet_ras_error_type_t type) { +void RasHandleContext::createHandle(zes_ras_error_type_t type) { Ras *pRas = new RasImp(pOsSysman, type); if (pRas->isRasErrorSupported == true) { handleList.push_back(pRas); @@ -25,11 +25,11 @@ void RasHandleContext::createHandle(zet_ras_error_type_t type) { } } void RasHandleContext::init() { - createHandle(ZET_RAS_ERROR_TYPE_UNCORRECTABLE); - createHandle(ZET_RAS_ERROR_TYPE_CORRECTABLE); + createHandle(ZES_RAS_ERROR_TYPE_UNCORRECTABLE); + createHandle(ZES_RAS_ERROR_TYPE_CORRECTABLE); } ze_result_t RasHandleContext::rasGet(uint32_t *pCount, - zet_sysman_ras_handle_t *phRas) { + zes_ras_handle_t *phRas) { uint32_t handleListSize = static_cast(handleList.size()); uint32_t numToCopy = std::min(*pCount, handleListSize); if (0 == *pCount || *pCount > handleListSize) { diff --git a/level_zero/tools/source/sysman/ras/ras.h b/level_zero/tools/source/sysman/ras/ras.h index 44d1ebf4e3..ac1451f3ab 100644 --- a/level_zero/tools/source/sysman/ras/ras.h +++ b/level_zero/tools/source/sysman/ras/ras.h @@ -6,31 +6,30 @@ */ #pragma once -#include +#include #include -struct _zet_sysman_ras_handle_t { - virtual ~_zet_sysman_ras_handle_t() = default; +struct _zes_ras_handle_t { + virtual ~_zes_ras_handle_t() = default; }; namespace L0 { struct OsSysman; -class Ras : _zet_sysman_ras_handle_t { +class Ras : _zes_ras_handle_t { public: - virtual ze_result_t rasGetProperties(zet_ras_properties_t *pProperties) = 0; - virtual ze_result_t rasGetConfig(zet_ras_config_t *pConfig) = 0; - virtual ze_result_t rasSetConfig(const zet_ras_config_t *pConfig) = 0; - virtual ze_result_t rasGetState(ze_bool_t clear, uint64_t *pTotalErrors, zet_ras_details_t *pDetails) = 0; + virtual ze_result_t rasGetProperties(zes_ras_properties_t *pProperties) = 0; + virtual ze_result_t rasGetConfig(zes_ras_config_t *pConfig) = 0; + virtual ze_result_t rasSetConfig(const zes_ras_config_t *pConfig) = 0; - static Ras *fromHandle(zet_sysman_ras_handle_t handle) { + static Ras *fromHandle(zes_ras_handle_t handle) { return static_cast(handle); } - inline zet_sysman_ras_handle_t toHandle() { return this; } + inline zes_ras_handle_t toHandle() { return this; } bool isRasErrorSupported = false; - zet_ras_error_type_t rasErrorType; + zes_ras_error_type_t rasErrorType; }; struct RasHandleContext { @@ -39,13 +38,13 @@ struct RasHandleContext { void init(); - ze_result_t rasGet(uint32_t *pCount, zet_sysman_ras_handle_t *phRas); + ze_result_t rasGet(uint32_t *pCount, zes_ras_handle_t *phRas); OsSysman *pOsSysman = nullptr; std::vector handleList = {}; private: - void createHandle(zet_ras_error_type_t type); + void createHandle(zes_ras_error_type_t type); }; } // namespace L0 diff --git a/level_zero/tools/source/sysman/ras/ras_imp.cpp b/level_zero/tools/source/sysman/ras/ras_imp.cpp index daaa716e8f..207e46fe24 100644 --- a/level_zero/tools/source/sysman/ras/ras_imp.cpp +++ b/level_zero/tools/source/sysman/ras/ras_imp.cpp @@ -14,17 +14,7 @@ namespace L0 { -uint64_t getTotalErrors(zet_ras_details_t pDetails) { - return (pDetails.numResets + - pDetails.numProgrammingErrors + - pDetails.numNonComputeErrors + - pDetails.numComputeErrors + - pDetails.numDriverErrors + - pDetails.numDisplayErrors + - pDetails.numCacheErrors); -} - -ze_result_t RasImp::rasGetProperties(zet_ras_properties_t *pProperties) { +ze_result_t RasImp::rasGetProperties(zes_ras_properties_t *pProperties) { rasProperties.type = this->rasErrorType; rasProperties.onSubdevice = false; rasProperties.subdeviceId = 0; @@ -32,34 +22,20 @@ ze_result_t RasImp::rasGetProperties(zet_ras_properties_t *pProperties) { return ZE_RESULT_SUCCESS; } -ze_result_t RasImp::rasGetConfig(zet_ras_config_t *pConfig) { +ze_result_t RasImp::rasGetConfig(zes_ras_config_t *pConfig) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t RasImp::rasSetConfig(const zet_ras_config_t *pConfig) { +ze_result_t RasImp::rasSetConfig(const zes_ras_config_t *pConfig) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t RasImp::rasGetState(ze_bool_t clear, uint64_t *pTotalErrors, zet_ras_details_t *pDetails) { - zet_ras_details_t pDetailsInternal; - memset(&pDetailsInternal, 0, sizeof(zet_ras_details_t)); - ze_result_t result = pOsRas->getCounterValues(&pDetailsInternal); - if (result != ZE_RESULT_SUCCESS) { - return result; - } - *pTotalErrors = getTotalErrors(pDetailsInternal); - if (pDetails != nullptr) { - memcpy_s(pDetails, sizeof(zet_ras_details_t), &pDetailsInternal, sizeof(zet_ras_details_t)); - } - return result; -} - void RasImp::init() { pOsRas->setRasErrorType(this->rasErrorType); isRasErrorSupported = pOsRas->isRasSupported(); } -RasImp::RasImp(OsSysman *pOsSysman, zet_ras_error_type_t type) { +RasImp::RasImp(OsSysman *pOsSysman, zes_ras_error_type_t type) { pOsRas = OsRas::create(pOsSysman); this->rasErrorType = type; init(); diff --git a/level_zero/tools/source/sysman/ras/ras_imp.h b/level_zero/tools/source/sysman/ras/ras_imp.h index e04d07ce30..33980e3bdc 100644 --- a/level_zero/tools/source/sysman/ras/ras_imp.h +++ b/level_zero/tools/source/sysman/ras/ras_imp.h @@ -16,20 +16,19 @@ namespace L0 { class RasImp : public Ras, NEO::NonCopyableOrMovableClass { public: - ze_result_t rasGetProperties(zet_ras_properties_t *pProperties) override; - ze_result_t rasGetConfig(zet_ras_config_t *pConfig) override; - ze_result_t rasSetConfig(const zet_ras_config_t *pConfig) override; - ze_result_t rasGetState(ze_bool_t clear, uint64_t *pTotalErrors, zet_ras_details_t *pDetails) override; + ze_result_t rasGetProperties(zes_ras_properties_t *pProperties) override; + ze_result_t rasGetConfig(zes_ras_config_t *pConfig) override; + ze_result_t rasSetConfig(const zes_ras_config_t *pConfig) override; RasImp() = default; - RasImp(OsSysman *pOsSysman, zet_ras_error_type_t type); + RasImp(OsSysman *pOsSysman, zes_ras_error_type_t type); ~RasImp() override; OsRas *pOsRas = nullptr; void init(); private: - zet_ras_properties_t rasProperties = {}; + zes_ras_properties_t rasProperties = {}; }; } // namespace L0 diff --git a/level_zero/tools/source/sysman/ras/windows/os_ras_imp.cpp b/level_zero/tools/source/sysman/ras/windows/os_ras_imp.cpp index 0c0a155362..b037865781 100644 --- a/level_zero/tools/source/sysman/ras/windows/os_ras_imp.cpp +++ b/level_zero/tools/source/sysman/ras/windows/os_ras_imp.cpp @@ -10,20 +10,15 @@ namespace L0 { class WddmRasImp : public OsRas { - ze_result_t getCounterValues(zet_ras_details_t *pDetails) override; bool isRasSupported(void) override; - void setRasErrorType(zet_ras_error_type_t type) override; + void setRasErrorType(zes_ras_error_type_t type) override; }; -ze_result_t WddmRasImp::getCounterValues(zet_ras_details_t *pDetails) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - bool WddmRasImp::isRasSupported(void) { return false; } -void WddmRasImp::setRasErrorType(zet_ras_error_type_t type) {} +void WddmRasImp::setRasErrorType(zes_ras_error_type_t type) {} OsRas *OsRas::create(OsSysman *pOsSysman) { WddmRasImp *pWddmRasImp = new WddmRasImp(); diff --git a/level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.h b/level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.h index 69d31fdb67..169c69d9a0 100644 --- a/level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.h +++ b/level_zero/tools/source/sysman/scheduler/linux/os_scheduler_imp.h @@ -14,9 +14,9 @@ namespace L0 { class SysfsAccess; // Following below mappings of scheduler properties with sysfs nodes -// zet_sched_timeslice_properties_t.interval = timeslice_duration_ms -// zet_sched_timeslice_properties_t.yieldTimeout = preempt_timeout_ms -// zet_sched_timeout_properties_t. watchdogTimeout = heartbeat_interval_ms +// zes_sched_timeslice_properties_t.interval = timeslice_duration_ms +// zes_sched_timeslice_properties_t.yieldTimeout = preempt_timeout_ms +// zes_sched_timeout_properties_t. watchdogTimeout = heartbeat_interval_ms class LinuxSchedulerImp : public OsScheduler, NEO::NonCopyableOrMovableClass { public: ze_result_t getPreemptTimeout(uint64_t &timeout, ze_bool_t getDefault) override; diff --git a/level_zero/tools/source/sysman/scheduler/scheduler.h b/level_zero/tools/source/sysman/scheduler/scheduler.h index f472456ac4..52bdb7d1e5 100644 --- a/level_zero/tools/source/sysman/scheduler/scheduler.h +++ b/level_zero/tools/source/sysman/scheduler/scheduler.h @@ -6,18 +6,18 @@ */ #pragma once -#include +#include namespace L0 { class Scheduler { public: virtual ~Scheduler(){}; - virtual ze_result_t getCurrentMode(zet_sched_mode_t *pMode) = 0; - virtual ze_result_t getTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) = 0; - virtual ze_result_t getTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) = 0; - virtual ze_result_t setTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) = 0; - virtual ze_result_t setTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) = 0; + virtual ze_result_t getCurrentMode(zes_sched_mode_t *pMode) = 0; + virtual ze_result_t getTimeoutModeProperties(ze_bool_t getDefaults, zes_sched_timeout_properties_t *pConfig) = 0; + virtual ze_result_t getTimesliceModeProperties(ze_bool_t getDefaults, zes_sched_timeslice_properties_t *pConfig) = 0; + virtual ze_result_t setTimeoutMode(zes_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) = 0; + virtual ze_result_t setTimesliceMode(zes_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) = 0; virtual ze_result_t setExclusiveMode(ze_bool_t *pNeedReboot) = 0; virtual ze_result_t setComputeUnitDebugMode(ze_bool_t *pNeedReboot) = 0; virtual void init() = 0; diff --git a/level_zero/tools/source/sysman/scheduler/scheduler_imp.cpp b/level_zero/tools/source/sysman/scheduler/scheduler_imp.cpp index 18408b6640..35278027ad 100644 --- a/level_zero/tools/source/sysman/scheduler/scheduler_imp.cpp +++ b/level_zero/tools/source/sysman/scheduler/scheduler_imp.cpp @@ -14,7 +14,7 @@ namespace L0 { constexpr uint64_t minTimeoutModeHeartbeat = 5000u; constexpr uint64_t minTimeoutInMicroSeconds = 1000u; -ze_result_t SchedulerImp::getCurrentMode(zet_sched_mode_t *pMode) { +ze_result_t SchedulerImp::getCurrentMode(zes_sched_mode_t *pMode) { uint64_t timeout = 0; uint64_t timeslice = 0; ze_result_t result = pOsScheduler->getPreemptTimeout(timeout, false); @@ -26,18 +26,18 @@ ze_result_t SchedulerImp::getCurrentMode(zet_sched_mode_t *pMode) { return result; } if (timeslice > 0) { - *pMode = ZET_SCHED_MODE_TIMESLICE; + *pMode = ZES_SCHED_MODE_TIMESLICE; } else { if (timeout > 0) { - *pMode = ZET_SCHED_MODE_TIMEOUT; + *pMode = ZES_SCHED_MODE_TIMEOUT; } else { - *pMode = ZET_SCHED_MODE_EXCLUSIVE; + *pMode = ZES_SCHED_MODE_EXCLUSIVE; } } return result; } -ze_result_t SchedulerImp::getTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) { +ze_result_t SchedulerImp::getTimeoutModeProperties(ze_bool_t getDefaults, zes_sched_timeout_properties_t *pConfig) { uint64_t heartbeat = 0; ze_result_t result = pOsScheduler->getHeartbeatInterval(heartbeat, getDefaults); if (result != ZE_RESULT_SUCCESS) { @@ -48,7 +48,7 @@ ze_result_t SchedulerImp::getTimeoutModeProperties(ze_bool_t getDefaults, zet_sc return result; } -ze_result_t SchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) { +ze_result_t SchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, zes_sched_timeslice_properties_t *pConfig) { uint64_t timeout = 0, timeslice = 0; ze_result_t result = pOsScheduler->getPreemptTimeout(timeout, getDefaults); if (result != ZE_RESULT_SUCCESS) { @@ -63,8 +63,8 @@ ze_result_t SchedulerImp::getTimesliceModeProperties(ze_bool_t getDefaults, zet_ return result; } -ze_result_t SchedulerImp::setTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) { - zet_sched_mode_t currMode; +ze_result_t SchedulerImp::setTimeoutMode(zes_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) { + zes_sched_mode_t currMode; ze_result_t result = getCurrentMode(&currMode); if (result != ZE_RESULT_SUCCESS) { return result; @@ -78,7 +78,7 @@ ze_result_t SchedulerImp::setTimeoutMode(zet_sched_timeout_properties_t *pProper } *pNeedReboot = false; result = pOsScheduler->setHeartbeatInterval(pProperties->watchdogTimeout); - if ((currMode == ZET_SCHED_MODE_TIMEOUT) || (result != ZE_RESULT_SUCCESS)) { + if ((currMode == ZES_SCHED_MODE_TIMEOUT) || (result != ZE_RESULT_SUCCESS)) { return result; } @@ -96,7 +96,7 @@ ze_result_t SchedulerImp::setTimeoutMode(zet_sched_timeout_properties_t *pProper return result; } -ze_result_t SchedulerImp::setTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) { +ze_result_t SchedulerImp::setTimesliceMode(zes_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) { if (pProperties->interval < minTimeoutInMicroSeconds) { // interval(in usec) less than 1000 would be computed to // 0 milli seconds interval. diff --git a/level_zero/tools/source/sysman/scheduler/scheduler_imp.h b/level_zero/tools/source/sysman/scheduler/scheduler_imp.h index 28be1922dc..05874a249b 100644 --- a/level_zero/tools/source/sysman/scheduler/scheduler_imp.h +++ b/level_zero/tools/source/sysman/scheduler/scheduler_imp.h @@ -8,7 +8,7 @@ #pragma once #include "shared/source/helpers/non_copyable_or_moveable.h" -#include +#include #include "os_scheduler.h" #include "scheduler.h" @@ -18,11 +18,11 @@ namespace L0 { class SchedulerImp : public Scheduler, NEO::NonCopyableOrMovableClass { public: void init() override; - ze_result_t getCurrentMode(zet_sched_mode_t *pMode) override; - ze_result_t getTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) override; - ze_result_t getTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) override; - ze_result_t setTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) override; - ze_result_t setTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) override; + ze_result_t getCurrentMode(zes_sched_mode_t *pMode) override; + ze_result_t getTimeoutModeProperties(ze_bool_t getDefaults, zes_sched_timeout_properties_t *pConfig) override; + ze_result_t getTimesliceModeProperties(ze_bool_t getDefaults, zes_sched_timeslice_properties_t *pConfig) override; + ze_result_t setTimeoutMode(zes_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) override; + ze_result_t setTimesliceMode(zes_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) override; ze_result_t setExclusiveMode(ze_bool_t *pNeedReboot) override; ze_result_t setComputeUnitDebugMode(ze_bool_t *pNeedReboot) override; diff --git a/level_zero/tools/source/sysman/standby/linux/os_standby_imp.cpp b/level_zero/tools/source/sysman/standby/linux/os_standby_imp.cpp index fb850436ba..0d363e2da9 100644 --- a/level_zero/tools/source/sysman/standby/linux/os_standby_imp.cpp +++ b/level_zero/tools/source/sysman/standby/linux/os_standby_imp.cpp @@ -18,29 +18,6 @@ bool LinuxStandbyImp::isStandbySupported(void) { return false; } } -ze_result_t LinuxStandbyImp::getMode(zet_standby_promo_mode_t &mode) { - int currentMode = -1; - ze_result_t result = pSysfsAccess->read(standbyModeFile, currentMode); - if (ZE_RESULT_SUCCESS != result) { - return result; - } - if (standbyModeDefault == currentMode) { - mode = ZET_STANDBY_PROMO_MODE_DEFAULT; - } else if (standbyModeNever == currentMode) { - mode = ZET_STANDBY_PROMO_MODE_NEVER; - } else { - result = ZE_RESULT_ERROR_UNKNOWN; - } - return result; -} -ze_result_t LinuxStandbyImp::setMode(zet_standby_promo_mode_t mode) { - // standbyModeFile is not writable. - // Mode cannot be set from L0. - // To set the mode, user must reload - // the i915 module and set module parameter - // enable_rc6 appropriately. - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} ze_result_t LinuxStandbyImp::getMode(zes_standby_promo_mode_t &mode) { int currentMode = -1; diff --git a/level_zero/tools/source/sysman/standby/linux/os_standby_imp.h b/level_zero/tools/source/sysman/standby/linux/os_standby_imp.h index 0026a0eaf7..7ab4f28238 100644 --- a/level_zero/tools/source/sysman/standby/linux/os_standby_imp.h +++ b/level_zero/tools/source/sysman/standby/linux/os_standby_imp.h @@ -16,9 +16,6 @@ namespace L0 { class LinuxStandbyImp : public OsStandby, NEO::NonCopyableOrMovableClass { public: - ze_result_t getMode(zet_standby_promo_mode_t &mode) override; - ze_result_t setMode(zet_standby_promo_mode_t mode) override; - ze_result_t getMode(zes_standby_promo_mode_t &mode) override; ze_result_t setMode(zes_standby_promo_mode_t mode) override; diff --git a/level_zero/tools/source/sysman/standby/os_standby.h b/level_zero/tools/source/sysman/standby/os_standby.h index ff1ddeaeac..1c974f181c 100644 --- a/level_zero/tools/source/sysman/standby/os_standby.h +++ b/level_zero/tools/source/sysman/standby/os_standby.h @@ -8,17 +8,12 @@ #pragma once #include "level_zero/tools/source/sysman/os_sysman.h" -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include namespace L0 { class OsStandby { public: - virtual ze_result_t getMode(zet_standby_promo_mode_t &mode) = 0; - virtual ze_result_t setMode(zet_standby_promo_mode_t mode) = 0; - virtual ze_result_t getMode(zes_standby_promo_mode_t &mode) = 0; virtual ze_result_t setMode(zes_standby_promo_mode_t mode) = 0; diff --git a/level_zero/tools/source/sysman/standby/standby.cpp b/level_zero/tools/source/sysman/standby/standby.cpp index 6051958ef3..1f3cc9030c 100644 --- a/level_zero/tools/source/sysman/standby/standby.cpp +++ b/level_zero/tools/source/sysman/standby/standby.cpp @@ -28,20 +28,6 @@ void StandbyHandleContext::init() { } } -ze_result_t StandbyHandleContext::standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby) { - uint32_t handleListSize = static_cast(handleList.size()); - uint32_t numToCopy = std::min(*pCount, handleListSize); - if (0 == *pCount || *pCount > handleListSize) { - *pCount = handleListSize; - } - if (nullptr != phStandby) { - for (uint32_t i = 0; i < numToCopy; i++) { - phStandby[i] = handleList[i]->toHandle(); - } - } - return ZE_RESULT_SUCCESS; -} - ze_result_t StandbyHandleContext::standbyGet(uint32_t *pCount, zes_standby_handle_t *phStandby) { uint32_t handleListSize = static_cast(handleList.size()); uint32_t numToCopy = std::min(*pCount, handleListSize); diff --git a/level_zero/tools/source/sysman/standby/standby.h b/level_zero/tools/source/sysman/standby/standby.h index cbb62687c8..acfd458b23 100644 --- a/level_zero/tools/source/sysman/standby/standby.h +++ b/level_zero/tools/source/sysman/standby/standby.h @@ -6,15 +6,10 @@ */ #pragma once -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include #include -struct _zet_sysman_standby_handle_t { - virtual ~_zet_sysman_standby_handle_t() = default; -}; struct _zes_standby_handle_t { virtual ~_zes_standby_handle_t() = default; }; @@ -23,24 +18,15 @@ namespace L0 { struct OsSysman; -class Standby : _zet_sysman_standby_handle_t, _zes_standby_handle_t { +class Standby : _zes_standby_handle_t { public: virtual ~Standby() {} - virtual ze_result_t standbyGetProperties(zet_standby_properties_t *pProperties) = 0; - virtual ze_result_t standbyGetMode(zet_standby_promo_mode_t *pMode) = 0; - virtual ze_result_t standbySetMode(const zet_standby_promo_mode_t mode) = 0; - virtual ze_result_t standbyGetProperties(zes_standby_properties_t *pProperties) = 0; virtual ze_result_t standbyGetMode(zes_standby_promo_mode_t *pMode) = 0; virtual ze_result_t standbySetMode(const zes_standby_promo_mode_t mode) = 0; - inline zet_sysman_standby_handle_t toHandle() { return this; } inline zes_standby_handle_t toStandbyHandle() { return this; } - static Standby *fromHandle(zet_sysman_standby_handle_t handle) { - return static_cast(handle); - } - static Standby *fromHandle(zes_standby_handle_t handle) { return static_cast(handle); } @@ -53,7 +39,6 @@ struct StandbyHandleContext { void init(); - ze_result_t standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby); ze_result_t standbyGet(uint32_t *pCount, zes_standby_handle_t *phStandby); OsSysman *pOsSysman; diff --git a/level_zero/tools/source/sysman/standby/standby_imp.cpp b/level_zero/tools/source/sysman/standby/standby_imp.cpp index 439ae3434e..8af3061338 100644 --- a/level_zero/tools/source/sysman/standby/standby_imp.cpp +++ b/level_zero/tools/source/sysman/standby/standby_imp.cpp @@ -13,21 +13,8 @@ namespace L0 { -ze_result_t StandbyImp::standbyGetProperties(zet_standby_properties_t *pProperties) { - *pProperties = standbyProperties; - return ZE_RESULT_SUCCESS; -} - -ze_result_t StandbyImp::standbyGetMode(zet_standby_promo_mode_t *pMode) { - return pOsStandby->getMode(*pMode); -} - -ze_result_t StandbyImp::standbySetMode(const zet_standby_promo_mode_t mode) { - return pOsStandby->setMode(mode); -} - ze_result_t StandbyImp::standbyGetProperties(zes_standby_properties_t *pProperties) { - *pProperties = zesStandbyProperties; + *pProperties = standbyProperties; return ZE_RESULT_SUCCESS; } @@ -40,13 +27,9 @@ ze_result_t StandbyImp::standbySetMode(const zes_standby_promo_mode_t mode) { } void StandbyImp::init() { - standbyProperties.type = ZET_STANDBY_TYPE_GLOBAL; // Currently the only defined type + standbyProperties.type = ZES_STANDBY_TYPE_GLOBAL; // Currently the only defined type standbyProperties.onSubdevice = false; standbyProperties.subdeviceId = 0; - zesStandbyProperties.type = ZES_STANDBY_TYPE_GLOBAL; - zesStandbyProperties.onSubdevice = false; - zesStandbyProperties.subdeviceId = 0; - zesStandbyProperties.pNext = nullptr; this->isStandbyEnabled = pOsStandby->isStandbySupported(); } diff --git a/level_zero/tools/source/sysman/standby/standby_imp.h b/level_zero/tools/source/sysman/standby/standby_imp.h index 14bbe55551..b77d606e91 100644 --- a/level_zero/tools/source/sysman/standby/standby_imp.h +++ b/level_zero/tools/source/sysman/standby/standby_imp.h @@ -8,20 +8,15 @@ #pragma once #include "shared/source/helpers/non_copyable_or_moveable.h" -#include +#include #include "os_standby.h" #include "standby.h" -#include "third_party/level_zero/zes_api_ext.h" namespace L0 { class StandbyImp : public Standby, NEO::NonCopyableOrMovableClass { public: - ze_result_t standbyGetProperties(zet_standby_properties_t *pProperties) override; - ze_result_t standbyGetMode(zet_standby_promo_mode_t *pMode) override; - ze_result_t standbySetMode(const zet_standby_promo_mode_t mode) override; - ze_result_t standbyGetProperties(zes_standby_properties_t *pProperties) override; ze_result_t standbyGetMode(zes_standby_promo_mode_t *pMode) override; ze_result_t standbySetMode(const zes_standby_promo_mode_t mode) override; @@ -34,8 +29,7 @@ class StandbyImp : public Standby, NEO::NonCopyableOrMovableClass { void init(); private: - zet_standby_properties_t standbyProperties = {}; - zes_standby_properties_t zesStandbyProperties = {}; + zes_standby_properties_t standbyProperties = {}; }; } // namespace L0 diff --git a/level_zero/tools/source/sysman/standby/windows/os_standby_imp.cpp b/level_zero/tools/source/sysman/standby/windows/os_standby_imp.cpp index c2ffc3e20b..9e20567703 100644 --- a/level_zero/tools/source/sysman/standby/windows/os_standby_imp.cpp +++ b/level_zero/tools/source/sysman/standby/windows/os_standby_imp.cpp @@ -11,18 +11,12 @@ namespace L0 { class WddmStandbyImp : public OsStandby { public: - ze_result_t getMode(zet_standby_promo_mode_t &mode) override; - ze_result_t setMode(zet_standby_promo_mode_t mode) override; ze_result_t getMode(zes_standby_promo_mode_t &mode) override; ze_result_t setMode(zes_standby_promo_mode_t mode) override; bool isStandbySupported(void) override; }; -ze_result_t WddmStandbyImp::getMode(zet_standby_promo_mode_t &mode) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t WddmStandbyImp::setMode(zet_standby_promo_mode_t mode) { +ze_result_t WddmStandbyImp::setMode(zes_standby_promo_mode_t mode) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -30,10 +24,6 @@ ze_result_t WddmStandbyImp::getMode(zes_standby_promo_mode_t &mode) { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t WddmStandbyImp::setMode(zes_standby_promo_mode_t mode) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - bool WddmStandbyImp::isStandbySupported(void) { return false; } diff --git a/level_zero/tools/source/sysman/sysman.cpp b/level_zero/tools/source/sysman/sysman.cpp index 6f48bb5b1a..a1eba8b75b 100644 --- a/level_zero/tools/source/sysman/sysman.cpp +++ b/level_zero/tools/source/sysman/sysman.cpp @@ -16,42 +16,6 @@ namespace L0 { -static SysmanHandleContext *SysmanHandleContextInstance = nullptr; - -void SysmanHandleContext::init(ze_init_flag_t flag) { - if (SysmanHandleContextInstance == nullptr) { - SysmanHandleContextInstance = new SysmanHandleContext(); - } -} - -SysmanHandleContext::SysmanHandleContext() { - DriverHandle *dH = L0::DriverHandle::fromHandle(GlobalDriverHandle); - uint32_t count = 0; - dH->getDevice(&count, nullptr); - std::vector devices(count); - dH->getDevice(&count, devices.data()); - - for (auto device : devices) { - SysmanImp *sysman = new SysmanImp(device); - UNRECOVERABLE_IF(!sysman); - sysman->init(); - handle_map[device] = sysman; - } -} - -ze_result_t SysmanHandleContext::sysmanGet(zet_device_handle_t hDevice, zet_sysman_handle_t *phSysman) { - - if (SysmanHandleContextInstance == nullptr) { - return ZE_RESULT_ERROR_UNINITIALIZED; - } - auto got = SysmanHandleContextInstance->handle_map.find(hDevice); - if (got == SysmanHandleContextInstance->handle_map.end()) { - return ZE_RESULT_ERROR_INVALID_ARGUMENT; - } - *phSysman = got->second; - return ZE_RESULT_SUCCESS; -} - SysmanDevice *SysmanDeviceHandleContext::init(ze_device_handle_t device) { auto isSysmanEnabled = getenv("ZES_ENABLE_SYSMAN"); if ((isSysmanEnabled == nullptr) || (device == nullptr)) { diff --git a/level_zero/tools/source/sysman/sysman.h b/level_zero/tools/source/sysman/sysman.h index 28f63f12dd..0ba2fc3722 100644 --- a/level_zero/tools/source/sysman/sysman.h +++ b/level_zero/tools/source/sysman/sysman.h @@ -18,10 +18,8 @@ #include "level_zero/tools/source/sysman/scheduler/scheduler.h" #include "level_zero/tools/source/sysman/standby/standby.h" #include "level_zero/tools/source/sysman/temperature/temperature.h" +#include #include -#include - -#include "third_party/level_zero/zes_api_ext.h" #include @@ -29,54 +27,6 @@ struct _zet_sysman_handle_t {}; namespace L0 { -struct Sysman : _zet_sysman_handle_t { - - static Sysman *fromHandle(zet_sysman_handle_t handle) { return static_cast(handle); } - inline zet_sysman_handle_t toHandle() { return this; } - - virtual ze_result_t deviceGetProperties(zet_sysman_properties_t *pProperties) = 0; - virtual ze_result_t schedulerGetCurrentMode(zet_sched_mode_t *pMode) = 0; - virtual ze_result_t schedulerGetTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) = 0; - virtual ze_result_t schedulerGetTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) = 0; - virtual ze_result_t schedulerSetTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) = 0; - virtual ze_result_t schedulerSetTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) = 0; - virtual ze_result_t schedulerSetExclusiveMode(ze_bool_t *pNeedReboot) = 0; - virtual ze_result_t schedulerSetComputeUnitDebugMode(ze_bool_t *pNeedReboot) = 0; - virtual ze_result_t processesGetState(uint32_t *pCount, zet_process_state_t *pProcesses) = 0; - virtual ze_result_t deviceReset() = 0; - virtual ze_result_t deviceGetRepairStatus(zet_repair_status_t *pRepairStatus) = 0; - virtual ze_result_t pciGetProperties(zet_pci_properties_t *pProperties) = 0; - virtual ze_result_t pciGetState(zet_pci_state_t *pState) = 0; - virtual ze_result_t pciGetBars(uint32_t *pCount, zet_pci_bar_properties_t *pProperties) = 0; - virtual ze_result_t pciGetStats(zet_pci_stats_t *pStats) = 0; - virtual ze_result_t powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower) = 0; - virtual ze_result_t frequencyGet(uint32_t *pCount, zet_sysman_freq_handle_t *phFrequency) = 0; - virtual ze_result_t engineGet(uint32_t *pCount, zet_sysman_engine_handle_t *phEngine) = 0; - virtual ze_result_t standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby) = 0; - virtual ze_result_t firmwareGet(uint32_t *pCount, zet_sysman_firmware_handle_t *phFirmware) = 0; - virtual ze_result_t memoryGet(uint32_t *pCount, zet_sysman_mem_handle_t *phMemory) = 0; - virtual ze_result_t fabricPortGet(uint32_t *pCount, zet_sysman_fabric_port_handle_t *phPort) = 0; - virtual ze_result_t temperatureGet(uint32_t *pCount, zet_sysman_temp_handle_t *phTemperature) = 0; - virtual ze_result_t psuGet(uint32_t *pCount, zet_sysman_psu_handle_t *phPsu) = 0; - virtual ze_result_t fanGet(uint32_t *pCount, zet_sysman_fan_handle_t *phFan) = 0; - virtual ze_result_t ledGet(uint32_t *pCount, zet_sysman_led_handle_t *phLed) = 0; - virtual ze_result_t rasGet(uint32_t *pCount, zet_sysman_ras_handle_t *phRas) = 0; - virtual ze_result_t eventGet(zet_sysman_event_handle_t *phEvent) = 0; - virtual ze_result_t diagnosticsGet(uint32_t *pCount, zet_sysman_diag_handle_t *phDiagnostics) = 0; - - virtual ~Sysman() = default; -}; - -class SysmanHandleContext { - public: - SysmanHandleContext(); - static void init(ze_init_flag_t flag); - static ze_result_t sysmanGet(zet_device_handle_t hDevice, zet_sysman_handle_t *phSysman); - - private: - std::unordered_map handle_map; -}; - struct SysmanDevice : _ze_device_handle_t { static SysmanDevice *fromHandle(zes_device_handle_t handle) { return Device::fromHandle(handle)->getSysmanHandle(); } diff --git a/level_zero/tools/source/sysman/sysman_imp.cpp b/level_zero/tools/source/sysman/sysman_imp.cpp index c72c82a88f..545db69aee 100644 --- a/level_zero/tools/source/sysman/sysman_imp.cpp +++ b/level_zero/tools/source/sysman/sysman_imp.cpp @@ -62,234 +62,28 @@ void SysmanDeviceImp::init() { } } -SysmanImp::SysmanImp(ze_device_handle_t hDevice) { - hCoreDevice = hDevice; - pOsSysman = OsSysman::create(this); - UNRECOVERABLE_IF(nullptr == pOsSysman); - pPci = new PciImp(pOsSysman, hCoreDevice); - pSched = new SchedulerImp(pOsSysman); - pGlobalOperations = new GlobalOperationsImp(pOsSysman, hCoreDevice); - pFrequencyHandleContext = new FrequencyHandleContext(pOsSysman); - pStandbyHandleContext = new StandbyHandleContext(pOsSysman); - pMemoryHandleContext = new MemoryHandleContext(pOsSysman, hCoreDevice); - pEngineHandleContext = new EngineHandleContext(pOsSysman); - pRasHandleContext = new RasHandleContext(pOsSysman); - pTempHandleContext = new TemperatureHandleContext(pOsSysman); - pPowerHandleContext = new PowerHandleContext(pOsSysman); - pFabricPortHandleContext = new FabricPortHandleContext(pOsSysman); -} - -SysmanImp::~SysmanImp() { - freeResource(pFabricPortHandleContext); - freeResource(pPowerHandleContext); - freeResource(pTempHandleContext); - freeResource(pRasHandleContext); - freeResource(pEngineHandleContext); - freeResource(pMemoryHandleContext); - freeResource(pStandbyHandleContext); - freeResource(pFrequencyHandleContext); - freeResource(pGlobalOperations); - freeResource(pPci); - freeResource(pSched); - freeResource(pOsSysman); -} - -void SysmanImp::init() { - pOsSysman->init(); - if (pFrequencyHandleContext) { - pFrequencyHandleContext->init(); - } - if (pStandbyHandleContext) { - pStandbyHandleContext->init(); - } - if (pMemoryHandleContext) { - pMemoryHandleContext->init(); - } - if (pEngineHandleContext) { - pEngineHandleContext->init(); - } - if (pRasHandleContext) { - pRasHandleContext->init(); - } - if (pTempHandleContext) { - pTempHandleContext->init(); - } - if (pPowerHandleContext) { - pPowerHandleContext->init(); - } - if (pFabricPortHandleContext) { - pFabricPortHandleContext->init(); - } - if (pPci) { - pPci->init(); - } - if (pSched) { - pSched->init(); - } - if (pGlobalOperations) { - pGlobalOperations->init(); - } -} - -ze_result_t SysmanImp::deviceGetProperties(zet_sysman_properties_t *pProperties) { - return pGlobalOperations->deviceGetProperties(pProperties); -} - -ze_result_t SysmanImp::schedulerGetCurrentMode(zet_sched_mode_t *pMode) { - if (pSched) { - return pSched->getCurrentMode(pMode); - } - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::schedulerGetTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) { - if (pSched) { - return pSched->getTimeoutModeProperties(getDefaults, pConfig); - } - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::schedulerGetTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) { - if (pSched) { - return pSched->getTimesliceModeProperties(getDefaults, pConfig); - } - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::schedulerSetTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) { - if (pSched) { - return pSched->setTimeoutMode(pProperties, pNeedReboot); - } - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::schedulerSetTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) { - if (pSched) { - return pSched->setTimesliceMode(pProperties, pNeedReboot); - } - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::schedulerSetExclusiveMode(ze_bool_t *pNeedReboot) { - if (pSched) { - return pSched->setExclusiveMode(pNeedReboot); - } - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::schedulerSetComputeUnitDebugMode(ze_bool_t *pNeedReboot) { - if (pSched) { - return pSched->setComputeUnitDebugMode(pNeedReboot); - } - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::processesGetState(uint32_t *pCount, zet_process_state_t *pProcesses) { - return pGlobalOperations->processesGetState(pCount, pProcesses); -} - -ze_result_t SysmanImp::deviceReset() { - return pGlobalOperations->reset(); -} - -ze_result_t SysmanImp::deviceGetRepairStatus(zet_repair_status_t *pRepairStatus) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::pciGetProperties(zet_pci_properties_t *pProperties) { - return pPci->pciStaticProperties(pProperties); -} - -ze_result_t SysmanImp::pciGetState(zet_pci_state_t *pState) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::pciGetBars(uint32_t *pCount, zet_pci_bar_properties_t *pProperties) { - return pPci->pciGetInitializedBars(pCount, pProperties); -} - -ze_result_t SysmanImp::pciGetStats(zet_pci_stats_t *pStats) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower) { - return pPowerHandleContext->powerGet(pCount, phPower); +ze_result_t SysmanDeviceImp::frequencyGet(uint32_t *pCount, zes_freq_handle_t *phFrequency) { + return pFrequencyHandleContext->frequencyGet(pCount, phFrequency); } ze_result_t SysmanDeviceImp::powerGet(uint32_t *pCount, zes_pwr_handle_t *phPower) { return pPowerHandleContext->powerGet(pCount, phPower); } -ze_result_t SysmanImp::frequencyGet(uint32_t *pCount, zet_sysman_freq_handle_t *phFrequency) { - return pFrequencyHandleContext->frequencyGet(pCount, phFrequency); -} - -ze_result_t SysmanDeviceImp::frequencyGet(uint32_t *pCount, zes_freq_handle_t *phFrequency) { - return pFrequencyHandleContext->frequencyGet(pCount, phFrequency); -} - -ze_result_t SysmanImp::engineGet(uint32_t *pCount, zet_sysman_engine_handle_t *phEngine) { - return pEngineHandleContext->engineGet(pCount, phEngine); -} - ze_result_t SysmanDeviceImp::engineGet(uint32_t *pCount, zes_engine_handle_t *phEngine) { return pEngineHandleContext->engineGet(pCount, phEngine); } -ze_result_t SysmanImp::standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby) { - return pStandbyHandleContext->standbyGet(pCount, phStandby); -} - ze_result_t SysmanDeviceImp::standbyGet(uint32_t *pCount, zes_standby_handle_t *phStandby) { return pStandbyHandleContext->standbyGet(pCount, phStandby); } -ze_result_t SysmanImp::firmwareGet(uint32_t *pCount, zet_sysman_firmware_handle_t *phFirmware) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::memoryGet(uint32_t *pCount, zet_sysman_mem_handle_t *phMemory) { - return pMemoryHandleContext->memoryGet(pCount, phMemory); -} - ze_result_t SysmanDeviceImp::fabricPortGet(uint32_t *pCount, zes_fabric_port_handle_t *phPort) { return pFabricPortHandleContext->fabricPortGet(pCount, phPort); } -ze_result_t SysmanImp::fabricPortGet(uint32_t *pCount, zet_sysman_fabric_port_handle_t *phPort) { - return pFabricPortHandleContext->fabricPortGet(pCount, phPort); -} - ze_result_t SysmanDeviceImp::temperatureGet(uint32_t *pCount, zes_temp_handle_t *phTemperature) { return pTempHandleContext->temperatureGet(pCount, phTemperature); } -ze_result_t SysmanImp::temperatureGet(uint32_t *pCount, zet_sysman_temp_handle_t *phTemperature) { - return pTempHandleContext->temperatureGet(pCount, phTemperature); -} - -ze_result_t SysmanImp::psuGet(uint32_t *pCount, zet_sysman_psu_handle_t *phPsu) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::fanGet(uint32_t *pCount, zet_sysman_fan_handle_t *phFan) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::ledGet(uint32_t *pCount, zet_sysman_led_handle_t *phLed) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::rasGet(uint32_t *pCount, zet_sysman_ras_handle_t *phRas) { - return pRasHandleContext->rasGet(pCount, phRas); -} - -ze_result_t SysmanImp::eventGet(zet_sysman_event_handle_t *phEvent) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t SysmanImp::diagnosticsGet(uint32_t *pCount, zet_sysman_diag_handle_t *phDiagnostics) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - } // namespace L0 diff --git a/level_zero/tools/source/sysman/sysman_imp.h b/level_zero/tools/source/sysman/sysman_imp.h index 538ad49729..30bf56a3db 100644 --- a/level_zero/tools/source/sysman/sysman_imp.h +++ b/level_zero/tools/source/sysman/sysman_imp.h @@ -10,77 +10,12 @@ #include "level_zero/tools/source/sysman/os_sysman.h" #include "level_zero/tools/source/sysman/sysman.h" -#include -#include +#include #include namespace L0 { -struct SysmanImp : Sysman, NEO::NonCopyableOrMovableClass { - - SysmanImp(ze_device_handle_t hDevice); - ~SysmanImp() override; - - SysmanImp() = delete; - - void init(); - - ze_device_handle_t hCoreDevice; - - OsSysman *pOsSysman = nullptr; - Pci *pPci = nullptr; - Scheduler *pSched = nullptr; - GlobalOperations *pGlobalOperations = nullptr; - FrequencyHandleContext *pFrequencyHandleContext = nullptr; - StandbyHandleContext *pStandbyHandleContext = nullptr; - MemoryHandleContext *pMemoryHandleContext = nullptr; - EngineHandleContext *pEngineHandleContext = nullptr; - RasHandleContext *pRasHandleContext = nullptr; - TemperatureHandleContext *pTempHandleContext = nullptr; - PowerHandleContext *pPowerHandleContext = nullptr; - FabricPortHandleContext *pFabricPortHandleContext = nullptr; - - ze_result_t deviceGetProperties(zet_sysman_properties_t *pProperties) override; - ze_result_t schedulerGetCurrentMode(zet_sched_mode_t *pMode) override; - ze_result_t schedulerGetTimeoutModeProperties(ze_bool_t getDefaults, zet_sched_timeout_properties_t *pConfig) override; - ze_result_t schedulerGetTimesliceModeProperties(ze_bool_t getDefaults, zet_sched_timeslice_properties_t *pConfig) override; - ze_result_t schedulerSetTimeoutMode(zet_sched_timeout_properties_t *pProperties, ze_bool_t *pNeedReboot) override; - ze_result_t schedulerSetTimesliceMode(zet_sched_timeslice_properties_t *pProperties, ze_bool_t *pNeedReboot) override; - ze_result_t schedulerSetExclusiveMode(ze_bool_t *pNeedReboot) override; - ze_result_t schedulerSetComputeUnitDebugMode(ze_bool_t *pNeedReboot) override; - ze_result_t processesGetState(uint32_t *pCount, zet_process_state_t *pProcesses) override; - ze_result_t deviceReset() override; - ze_result_t deviceGetRepairStatus(zet_repair_status_t *pRepairStatus) override; - ze_result_t pciGetProperties(zet_pci_properties_t *pProperties) override; - ze_result_t pciGetState(zet_pci_state_t *pState) override; - ze_result_t pciGetBars(uint32_t *pCount, zet_pci_bar_properties_t *pProperties) override; - ze_result_t pciGetStats(zet_pci_stats_t *pStats) override; - ze_result_t powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower) override; - ze_result_t frequencyGet(uint32_t *pCount, zet_sysman_freq_handle_t *phFrequency) override; - ze_result_t engineGet(uint32_t *pCount, zet_sysman_engine_handle_t *phEngine) override; - ze_result_t standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby) override; - ze_result_t firmwareGet(uint32_t *pCount, zet_sysman_firmware_handle_t *phFirmware) override; - ze_result_t memoryGet(uint32_t *pCount, zet_sysman_mem_handle_t *phMemory) override; - ze_result_t fabricPortGet(uint32_t *pCount, zet_sysman_fabric_port_handle_t *phPort) override; - ze_result_t temperatureGet(uint32_t *pCount, zet_sysman_temp_handle_t *phTemperature) override; - ze_result_t psuGet(uint32_t *pCount, zet_sysman_psu_handle_t *phPsu) override; - ze_result_t fanGet(uint32_t *pCount, zet_sysman_fan_handle_t *phFan) override; - ze_result_t ledGet(uint32_t *pCount, zet_sysman_led_handle_t *phLed) override; - ze_result_t rasGet(uint32_t *pCount, zet_sysman_ras_handle_t *phRas) override; - ze_result_t eventGet(zet_sysman_event_handle_t *phEvent) override; - ze_result_t diagnosticsGet(uint32_t *pCount, zet_sysman_diag_handle_t *phDiagnostics) override; - - private: - template - void inline freeResource(T *&resource) { - if (resource) { - delete resource; - resource = nullptr; - } - } -}; - struct SysmanDeviceImp : SysmanDevice, NEO::NonCopyableOrMovableClass { SysmanDeviceImp(ze_device_handle_t hDevice); diff --git a/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.cpp b/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.cpp index 9e0504ad63..af0aa09496 100644 --- a/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.cpp +++ b/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.cpp @@ -27,9 +27,9 @@ ze_result_t LinuxTemperatureImp::getSensorTemperature(double *pTemperature) { // GT temperature could be read via 8th to 15th bit in the value read in temperature computeTemperature = (computeTemperature >> 8) & 0xff; - if ((zetType == ZET_TEMP_SENSORS_GPU) || (type == ZES_TEMP_SENSORS_GPU)) { + if ((zetType == ZES_TEMP_SENSORS_GPU) || (type == ZES_TEMP_SENSORS_GPU)) { *pTemperature = static_cast(computeTemperature); - } else if ((zetType == ZET_TEMP_SENSORS_GLOBAL) || (type == ZES_TEMP_SENSORS_GLOBAL)) { + } else if ((zetType == ZES_TEMP_SENSORS_GLOBAL) || (type == ZES_TEMP_SENSORS_GLOBAL)) { key = "SOC_TEMPERATURES"; result = pPmt->readValue(key, socTemperature); if (result != ZE_RESULT_SUCCESS) { @@ -70,10 +70,6 @@ bool LinuxTemperatureImp::isTempModuleSupported() { return pPmt->isPmtSupported(); } -void LinuxTemperatureImp::setSensorType(zet_temp_sensors_t sensorType) { - zetType = sensorType; -} - void LinuxTemperatureImp::setSensorType(zes_temp_sensors_t sensorType) { type = sensorType; } @@ -83,12 +79,6 @@ LinuxTemperatureImp::LinuxTemperatureImp(OsSysman *pOsSysman) { pPmt = &pLinuxSysmanImp->getPlatformMonitoringTechAccess(); } -OsTemperature *OsTemperature::create(OsSysman *pOsSysman, zet_temp_sensors_t sensorType) { - LinuxTemperatureImp *pLinuxTemperatureImp = new LinuxTemperatureImp(pOsSysman); - pLinuxTemperatureImp->setSensorType(sensorType); - return static_cast(pLinuxTemperatureImp); -} - OsTemperature *OsTemperature::create(OsSysman *pOsSysman, zes_temp_sensors_t sensorType) { LinuxTemperatureImp *pLinuxTemperatureImp = new LinuxTemperatureImp(pOsSysman); pLinuxTemperatureImp->setSensorType(sensorType); diff --git a/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.h b/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.h index 03a47ae05d..f0c212ff06 100644 --- a/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.h +++ b/level_zero/tools/source/sysman/temperature/linux/os_temperature_imp.h @@ -18,7 +18,6 @@ class LinuxTemperatureImp : public OsTemperature, NEO::NonCopyableOrMovableClass public: ze_result_t getSensorTemperature(double *pTemperature) override; bool isTempModuleSupported() override; - void setSensorType(zet_temp_sensors_t sensorType); void setSensorType(zes_temp_sensors_t sensorType); LinuxTemperatureImp(OsSysman *pOsSysman); LinuxTemperatureImp() = default; @@ -27,6 +26,6 @@ class LinuxTemperatureImp : public OsTemperature, NEO::NonCopyableOrMovableClass protected: PlatformMonitoringTech *pPmt = nullptr; int zetType = 0x7fffffff; - zes_temp_sensors_t type = ZES_TEMP_SENSORS_FORCE_UINT32; + zes_temp_sensors_t type = ZES_TEMP_SENSORS_GLOBAL; }; } // namespace L0 diff --git a/level_zero/tools/source/sysman/temperature/os_temperature.h b/level_zero/tools/source/sysman/temperature/os_temperature.h index 5f691ccec5..2989867280 100644 --- a/level_zero/tools/source/sysman/temperature/os_temperature.h +++ b/level_zero/tools/source/sysman/temperature/os_temperature.h @@ -7,9 +7,7 @@ #pragma once -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include namespace L0 { @@ -18,7 +16,6 @@ class OsTemperature { public: virtual ze_result_t getSensorTemperature(double *pTemperature) = 0; virtual bool isTempModuleSupported() = 0; - static OsTemperature *create(OsSysman *pOsSysman, zet_temp_sensors_t sensorType); static OsTemperature *create(OsSysman *pOsSysman, zes_temp_sensors_t sensorType); virtual ~OsTemperature() = default; }; diff --git a/level_zero/tools/source/sysman/temperature/temperature.cpp b/level_zero/tools/source/sysman/temperature/temperature.cpp index 36831ce5e5..fd51ed4dc6 100644 --- a/level_zero/tools/source/sysman/temperature/temperature.cpp +++ b/level_zero/tools/source/sysman/temperature/temperature.cpp @@ -17,15 +17,6 @@ TemperatureHandleContext::~TemperatureHandleContext() { } } -void TemperatureHandleContext::createHandle(zet_temp_sensors_t type) { - Temperature *pTemperature = new TemperatureImp(pOsSysman, type); - if (pTemperature->initSuccess == true) { - handleList.push_back(pTemperature); - } else { - delete pTemperature; - } -} - void TemperatureHandleContext::createHandle(zes_temp_sensors_t type) { Temperature *pTemperature = new TemperatureImp(pOsSysman, type); if (pTemperature->initSuccess == true) { @@ -45,22 +36,8 @@ void TemperatureHandleContext::init() { } return; } - createHandle(ZET_TEMP_SENSORS_GLOBAL); - createHandle(ZET_TEMP_SENSORS_GPU); -} - -ze_result_t TemperatureHandleContext::temperatureGet(uint32_t *pCount, zet_sysman_temp_handle_t *phTemperature) { - uint32_t handleListSize = static_cast(handleList.size()); - uint32_t numToCopy = std::min(*pCount, handleListSize); - if (0 == *pCount || *pCount > handleListSize) { - *pCount = handleListSize; - } - if (nullptr != phTemperature) { - for (uint32_t i = 0; i < numToCopy; i++) { - phTemperature[i] = handleList[i]->toZetHandle(); - } - } - return ZE_RESULT_SUCCESS; + createHandle(ZES_TEMP_SENSORS_GLOBAL); + createHandle(ZES_TEMP_SENSORS_GPU); } ze_result_t TemperatureHandleContext::temperatureGet(uint32_t *pCount, zes_temp_handle_t *phTemperature) { diff --git a/level_zero/tools/source/sysman/temperature/temperature.h b/level_zero/tools/source/sysman/temperature/temperature.h index dd355e724f..55c3add394 100644 --- a/level_zero/tools/source/sysman/temperature/temperature.h +++ b/level_zero/tools/source/sysman/temperature/temperature.h @@ -6,16 +6,10 @@ */ #pragma once -#include - -#include "third_party/level_zero/zes_api_ext.h" +#include #include -struct _zet_sysman_temp_handle_t { - virtual ~_zet_sysman_temp_handle_t() = default; -}; - struct _zes_temp_handle_t { virtual ~_zes_temp_handle_t() = default; }; @@ -23,24 +17,16 @@ struct _zes_temp_handle_t { namespace L0 { struct OsSysman; -class Temperature : _zet_sysman_temp_handle_t, _zes_temp_handle_t { +class Temperature : _zes_temp_handle_t { public: - virtual ze_result_t temperatureGetProperties(zet_temp_properties_t *pProperties) = 0; - virtual ze_result_t temperatureGetConfig(zet_temp_config_t *pConfig) = 0; - virtual ze_result_t temperatureSetConfig(const zet_temp_config_t *pConfig) = 0; - virtual ze_result_t temperatureGetState(double *pTemperature) = 0; - virtual ze_result_t temperatureGetProperties(zes_temp_properties_t *pProperties) = 0; virtual ze_result_t temperatureGetConfig(zes_temp_config_t *pConfig) = 0; virtual ze_result_t temperatureSetConfig(const zes_temp_config_t *pConfig) = 0; + virtual ze_result_t temperatureGetState(double *pTemperature) = 0; - static Temperature *fromHandle(zet_sysman_temp_handle_t handle) { - return static_cast(handle); - } static Temperature *fromHandle(zes_temp_handle_t handle) { return static_cast(handle); } - inline zet_sysman_temp_handle_t toZetHandle() { return this; } inline zes_temp_handle_t toHandle() { return this; } bool initSuccess = false; }; @@ -51,14 +37,12 @@ struct TemperatureHandleContext { void init(); - ze_result_t temperatureGet(uint32_t *pCount, zet_sysman_temp_handle_t *phTemperature); ze_result_t temperatureGet(uint32_t *pCount, zes_temp_handle_t *phTemperature); OsSysman *pOsSysman = nullptr; std::vector handleList = {}; private: - void createHandle(zet_temp_sensors_t type); void createHandle(zes_temp_sensors_t type); }; diff --git a/level_zero/tools/source/sysman/temperature/temperature_imp.cpp b/level_zero/tools/source/sysman/temperature/temperature_imp.cpp index 8438894356..c49a2e33f6 100644 --- a/level_zero/tools/source/sysman/temperature/temperature_imp.cpp +++ b/level_zero/tools/source/sysman/temperature/temperature_imp.cpp @@ -23,18 +23,6 @@ ze_result_t TemperatureImp::temperatureSetConfig(const zes_temp_config_t *pConfi return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } -ze_result_t TemperatureImp::temperatureGetProperties(zet_temp_properties_t *pProperties) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t TemperatureImp::temperatureGetConfig(zet_temp_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - -ze_result_t TemperatureImp::temperatureSetConfig(const zet_temp_config_t *pConfig) { - return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; -} - ze_result_t TemperatureImp::temperatureGetState(double *pTemperature) { return pOsTemperature->getSensorTemperature(pTemperature); } @@ -43,11 +31,6 @@ void TemperatureImp::init() { this->initSuccess = pOsTemperature->isTempModuleSupported(); } -TemperatureImp::TemperatureImp(OsSysman *pOsSysman, zet_temp_sensors_t type) { - pOsTemperature = OsTemperature::create(pOsSysman, type); - init(); -} - TemperatureImp::TemperatureImp(OsSysman *pOsSysman, zes_temp_sensors_t type) { pOsTemperature = OsTemperature::create(pOsSysman, type); init(); diff --git a/level_zero/tools/source/sysman/temperature/temperature_imp.h b/level_zero/tools/source/sysman/temperature/temperature_imp.h index 9789490309..c703e27e22 100644 --- a/level_zero/tools/source/sysman/temperature/temperature_imp.h +++ b/level_zero/tools/source/sysman/temperature/temperature_imp.h @@ -14,17 +14,12 @@ namespace L0 { class TemperatureImp : public Temperature, NEO::NonCopyableOrMovableClass { public: - ze_result_t temperatureGetProperties(zet_temp_properties_t *pProperties) override; - ze_result_t temperatureGetConfig(zet_temp_config_t *pConfig) override; - ze_result_t temperatureSetConfig(const zet_temp_config_t *pConfig) override; - ze_result_t temperatureGetProperties(zes_temp_properties_t *pProperties) override; ze_result_t temperatureGetConfig(zes_temp_config_t *pConfig) override; ze_result_t temperatureSetConfig(const zes_temp_config_t *pConfig) override; ze_result_t temperatureGetState(double *pTemperature) override; TemperatureImp() = default; - TemperatureImp(OsSysman *pOsSysman, zet_temp_sensors_t type); TemperatureImp(OsSysman *pOsSysman, zes_temp_sensors_t type); ~TemperatureImp() override; diff --git a/level_zero/tools/source/sysman/temperature/windows/os_temperature_imp.cpp b/level_zero/tools/source/sysman/temperature/windows/os_temperature_imp.cpp index 2b8af03f98..f51ee78fe5 100644 --- a/level_zero/tools/source/sysman/temperature/windows/os_temperature_imp.cpp +++ b/level_zero/tools/source/sysman/temperature/windows/os_temperature_imp.cpp @@ -23,11 +23,6 @@ bool WddmTemperatureImp::isTempModuleSupported() { return false; } -OsTemperature *OsTemperature::create(OsSysman *pOsSysman, zet_temp_sensors_t sensorType) { - WddmTemperatureImp *pWddmTemperatureImp = new WddmTemperatureImp(); - return static_cast(pWddmTemperatureImp); -} - OsTemperature *OsTemperature::create(OsSysman *pOsSysman, zes_temp_sensors_t sensorType) { WddmTemperatureImp *pWddmTemperatureImp = new WddmTemperatureImp(); return static_cast(pWddmTemperatureImp); diff --git a/level_zero/tools/source/sysman/windows/os_sysman_imp.cpp b/level_zero/tools/source/sysman/windows/os_sysman_imp.cpp index 74eb3e683a..4acb6ece26 100644 --- a/level_zero/tools/source/sysman/windows/os_sysman_imp.cpp +++ b/level_zero/tools/source/sysman/windows/os_sysman_imp.cpp @@ -11,9 +11,7 @@ namespace L0 { ze_result_t WddmSysmanImp::init() { Device *pDevice = nullptr; - if (pParentSysmanImp != nullptr) { - pDevice = Device::fromHandle(pParentSysmanImp->hCoreDevice); - } else if (pParentSysmanDeviceImp != nullptr) { + if (pParentSysmanDeviceImp != nullptr) { pDevice = Device::fromHandle(pParentSysmanDeviceImp->hCoreDevice); } else { return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; @@ -45,11 +43,6 @@ WddmSysmanImp::~WddmSysmanImp() { } } -OsSysman *OsSysman::create(SysmanImp *pParentSysmanImp) { - WddmSysmanImp *pWddmSysmanImp = new WddmSysmanImp(pParentSysmanImp); - return static_cast(pWddmSysmanImp); -} - OsSysman *OsSysman::create(SysmanDeviceImp *pParentSysmanDeviceImp) { WddmSysmanImp *pWddmSysmanImp = new WddmSysmanImp(pParentSysmanDeviceImp); return static_cast(pWddmSysmanImp); diff --git a/level_zero/tools/source/sysman/windows/os_sysman_imp.h b/level_zero/tools/source/sysman/windows/os_sysman_imp.h index 848d57c06c..244385badd 100644 --- a/level_zero/tools/source/sysman/windows/os_sysman_imp.h +++ b/level_zero/tools/source/sysman/windows/os_sysman_imp.h @@ -19,7 +19,6 @@ namespace L0 { class WddmSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass { public: WddmSysmanImp() = default; - WddmSysmanImp(SysmanImp *pParentSysmanImp) : pParentSysmanImp(pParentSysmanImp){}; WddmSysmanImp(SysmanDeviceImp *pParentSysmanDeviceImp) : pParentSysmanDeviceImp(pParentSysmanDeviceImp){}; ~WddmSysmanImp() override; @@ -32,7 +31,6 @@ class WddmSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass { KmdSysManager *pKmdSysManager = nullptr; private: - SysmanImp *pParentSysmanImp = nullptr; SysmanDeviceImp *pParentSysmanDeviceImp = nullptr; NEO::Wddm *pWddm = nullptr; }; diff --git a/level_zero/tools/source/tools_init_imp.cpp b/level_zero/tools/source/tools_init_imp.cpp index 2b694d27c0..a6009162af 100644 --- a/level_zero/tools/source/tools_init_imp.cpp +++ b/level_zero/tools/source/tools_init_imp.cpp @@ -7,7 +7,7 @@ #include "level_zero/tools/source/tools_init_imp.h" -#include "level_zero/tools/source/sysman/sysman.h" +//#include "level_zero/tools/source/sysman/sysman.h" #include "level_zero/tools/source/tools_init.h" #include @@ -16,7 +16,6 @@ namespace L0 { static void enableTools(ze_result_t &result, ze_init_flag_t flag, bool *ptoolsAreEnabled) { - SysmanHandleContext::init(flag); *ptoolsAreEnabled = true; } diff --git a/level_zero/tools/test/unit_tests/CMakeLists.txt b/level_zero/tools/test/unit_tests/CMakeLists.txt index 45d0be8c0d..b5eaf43e13 100644 --- a/level_zero/tools/test/unit_tests/CMakeLists.txt +++ b/level_zero/tools/test/unit_tests/CMakeLists.txt @@ -63,7 +63,9 @@ endif() set_target_properties(${TARGET_NAME} PROPERTIES FOLDER ${TARGET_NAME_L0}) -add_subdirectoriesL0(${CMAKE_CURRENT_SOURCE_DIR} "*") +# add_subdirectoriesL0(${CMAKE_CURRENT_SOURCE_DIR} "*") +add_subdirectory(sources/metrics) +add_subdirectory(gens) target_compile_definitions(${TARGET_NAME} PRIVATE $) diff --git a/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_enumeration.h b/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_enumeration.h index ed7c1c67ae..aebc34c4a1 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_enumeration.h +++ b/level_zero/tools/test/unit_tests/sources/metrics/mock_metric_enumeration.h @@ -137,7 +137,6 @@ struct Mock : public MetricGroup { MOCK_METHOD(ze_result_t, getMetric, (uint32_t *, zet_metric_handle_t *), (override)); MOCK_METHOD(ze_result_t, calculateMetricValues, (const zet_metric_group_calculation_type_t, size_t, const uint8_t *, uint32_t *, zet_typed_value_t *), (override)); MOCK_METHOD(ze_result_t, getProperties, (zet_metric_group_properties_t * properties), (override)); - MOCK_METHOD(ze_result_t, getPropertiesExt, (zet_metric_group_properties_ext_t * properties), (override)); MOCK_METHOD(uint32_t, getRawReportSize, (), (override)); MOCK_METHOD(bool, activate, (), (override)); MOCK_METHOD(bool, deactivate, (), (override)); diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_enumeration.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_enumeration.cpp index 8cf248fbd9..0b7598f043 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_enumeration.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_enumeration.cpp @@ -233,7 +233,7 @@ TEST_F(MetricEnumerationTest, givenValidArgumentsWhenZetGetMetricGroupProperties // One api: metric group handle. zet_metric_group_handle_t metricGroupHandle = {}; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; EXPECT_CALL(*mockMetricEnumeration, loadMetricsDiscovery()) .Times(0); @@ -277,7 +277,7 @@ TEST_F(MetricEnumerationTest, givenValidArgumentsWhenZetGetMetricGroupProperties EXPECT_NE(metricGroupHandle, nullptr); // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); @@ -733,7 +733,7 @@ TEST_F(MetricEnumerationTest, givenValidArgumentsWhenZetMetricGetPropertiestIsCa metricParams.LongName = "Metric long name"; metricParams.ResultType = MetricsDiscovery::TMetricResultType::RESULT_UINT64; metricParams.MetricType = MetricsDiscovery::TMetricType::METRIC_TYPE_RATIO; - zet_metric_properties_ext_t metricProperties = {}; + zet_metric_properties_t metricProperties = {}; // One api: metric group handle. zet_metric_group_handle_t metricGroupHandle = {}; @@ -796,14 +796,14 @@ TEST_F(MetricEnumerationTest, givenValidArgumentsWhenZetMetricGetPropertiestIsCa EXPECT_NE(metricHandle, nullptr); // Obtain metric params. - EXPECT_EQ(zetMetricGetPropertiesExt(metricHandle, &metricProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGetProperties(metricHandle, &metricProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(strcmp(metricProperties.name, metricParams.SymbolName), 0); EXPECT_EQ(strcmp(metricProperties.description, metricParams.LongName), 0); EXPECT_EQ(metricProperties.metricType, ZET_METRIC_TYPE_RATIO); EXPECT_EQ(metricProperties.resultType, ZET_VALUE_TYPE_UINT64); } -TEST_F(MetricEnumerationTest, givenInvalidArgumentsWhenZetDeviceActivateMetricGroupsIsCalledThenReturnsFail) { +TEST_F(MetricEnumerationTest, givenInvalidArgumentsWhenzetContextActivateMetricGroupsIsCalledThenReturnsFail) { // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -886,7 +886,7 @@ TEST_F(MetricEnumerationTest, givenInvalidArgumentsWhenZetDeviceActivateMetricGr EXPECT_NE(metricGroupHandle, nullptr); } -TEST_F(MetricEnumerationTest, givenValidEventBasedMetricGroupWhenZetDeviceActivateMetricGroupsIsCalledThenReturnsSuccess) { +TEST_F(MetricEnumerationTest, givenValidEventBasedMetricGroupWhenzetContextActivateMetricGroupsIsCalledThenReturnsSuccess) { // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -969,7 +969,7 @@ TEST_F(MetricEnumerationTest, givenValidEventBasedMetricGroupWhenZetDeviceActiva EXPECT_NE(metricGroupHandle, nullptr); // Activate metric group. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); } TEST_F(MetricEnumerationTest, givenValidEventBasedMetricGroupWhenZetContextActivateMetricGroupsIsCalledThenReturnsSuccess) { @@ -1058,7 +1058,7 @@ TEST_F(MetricEnumerationTest, givenValidEventBasedMetricGroupWhenZetContextActiv EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricEnumerationTest, givenValidTimeBasedMetricGroupWhenZetDeviceActivateMetricGroupsIsCalledThenReturnsSuccess) { +TEST_F(MetricEnumerationTest, givenValidTimeBasedMetricGroupWhenzetContextActivateMetricGroupsIsCalledThenReturnsSuccess) { // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -1141,10 +1141,10 @@ TEST_F(MetricEnumerationTest, givenValidTimeBasedMetricGroupWhenZetDeviceActivat EXPECT_NE(metricGroupHandle, nullptr); // Activate metric group. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricEnumerationTest, givenActivateTheSameMetricGroupTwiceWhenZetDeviceActivateMetricGroupsIsCalledThenReturnsSuccess) { +TEST_F(MetricEnumerationTest, givenActivateTheSameMetricGroupTwiceWhenzetContextActivateMetricGroupsIsCalledThenReturnsSuccess) { // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -1227,11 +1227,11 @@ TEST_F(MetricEnumerationTest, givenActivateTheSameMetricGroupTwiceWhenZetDeviceA EXPECT_NE(metricGroupHandle, nullptr); // Activate metric group. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithDifferentDomainsWhenZetDeviceActivateMetricGroupsIsCalledThenReturnsSuccess) { +TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithDifferentDomainsWhenzetContextActivateMetricGroupsIsCalledThenReturnsSuccess) { // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 2; @@ -1306,11 +1306,11 @@ TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithDifferentDomainsWh EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle[1], &metricGroupProperties[1]), ZE_RESULT_SUCCESS); // Activate two metric groups with a different domains. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle[0]), ZE_RESULT_SUCCESS); - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle[1]), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle[0]), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle[1]), ZE_RESULT_SUCCESS); } -TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithDifferentDomainsAtOnceWhenZetDeviceActivateMetricGroupsIsCalledThenReturnsSuccess) { +TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithDifferentDomainsAtOnceWhenzetContextActivateMetricGroupsIsCalledThenReturnsSuccess) { // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 2; @@ -1385,10 +1385,10 @@ TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithDifferentDomainsAt EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle[1], &metricGroupProperties[1]), ZE_RESULT_SUCCESS); // Activate two metric groups with a different domains. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 2, metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 2, metricGroupHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithTheSameDomainsWhenZetDeviceActivateMetricGroupsIsCalledThenReturnsFail) { +TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithTheSameDomainsWhenzetContextActivateMetricGroupsIsCalledThenReturnsFail) { // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -1462,12 +1462,12 @@ TEST_F(MetricEnumerationTest, givenActivateTwoMetricGroupsWithTheSameDomainsWhen EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle[1], &metricGroupProperties[1]), ZE_RESULT_SUCCESS); // Activate two metric groups with a different domains. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle[0]), ZE_RESULT_SUCCESS); - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle[1]), ZE_RESULT_ERROR_UNKNOWN); - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 2, metricGroupHandle), ZE_RESULT_ERROR_UNKNOWN); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle[0]), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle[1]), ZE_RESULT_ERROR_UNKNOWN); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 2, metricGroupHandle), ZE_RESULT_ERROR_UNKNOWN); } -TEST_F(MetricEnumerationTest, givenDeactivateTestsWhenZetDeviceActivateMetricGroupsIsCalledThenReturnsApropriateResults) { +TEST_F(MetricEnumerationTest, givenDeactivateTestsWhenzetContextActivateMetricGroupsIsCalledThenReturnsApropriateResults) { // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -1541,24 +1541,24 @@ TEST_F(MetricEnumerationTest, givenDeactivateTestsWhenZetDeviceActivateMetricGro EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle[1], &metricGroupProperties[1]), ZE_RESULT_SUCCESS); // Activate two metric groups with a different domains. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle[0]), ZE_RESULT_SUCCESS); - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, &metricGroupHandle[1]), ZE_RESULT_ERROR_UNKNOWN); - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 2, metricGroupHandle), ZE_RESULT_ERROR_UNKNOWN); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle[0]), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroupHandle[1]), ZE_RESULT_ERROR_UNKNOWN); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 2, metricGroupHandle), ZE_RESULT_ERROR_UNKNOWN); // Deactivate all. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 0, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 0, nullptr), ZE_RESULT_SUCCESS); // Activate two metric groups at once. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 2, metricGroupHandle), ZE_RESULT_ERROR_UNKNOWN); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 2, metricGroupHandle), ZE_RESULT_ERROR_UNKNOWN); // Deactivate all. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 0, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 0, nullptr), ZE_RESULT_SUCCESS); // Activate one domain. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 1, metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, metricGroupHandle), ZE_RESULT_SUCCESS); // Deactivate all. - EXPECT_EQ(zetDeviceActivateMetricGroups(device->toHandle(), 0, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 0, nullptr), ZE_RESULT_SUCCESS); } TEST_F(MetricEnumerationTest, givenInvalidArgumentsWhenZetMetricGroupCalculateMetricValuesIsCalledThenReturnsFail) { @@ -1684,12 +1684,12 @@ TEST_F(MetricEnumerationTest, givenIncorrectRawReportSizeWhenZetMetricGroupCalcu // Invalid raw buffer size provided by the user. uint32_t calculatedResults = 0; EXPECT_NE(metricsSetParams.QueryReportSize, rawResultsSize); - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults, &calculatedResults, nullptr), ZE_RESULT_ERROR_UNKNOWN); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults, &calculatedResults, nullptr), ZE_RESULT_ERROR_UNKNOWN); // Invalid raw buffer size provided by the driver. metricsSetParams.QueryReportSize = 0; EXPECT_NE(metricsSetParams.QueryReportSize, rawResultsSize); - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults, &calculatedResults, nullptr), ZE_RESULT_ERROR_UNKNOWN); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults, &calculatedResults, nullptr), ZE_RESULT_ERROR_UNKNOWN); } TEST_F(MetricEnumerationTest, givenCorrectRawReportSizeWhenZetMetricGroupCalculateMetricValuesIsCalledThenReturnsCorrectCalculatedReportCount) { @@ -1767,7 +1767,7 @@ TEST_F(MetricEnumerationTest, givenCorrectRawReportSizeWhenZetMetricGroupCalcula std::vector rawResults(rawResultsSize); uint32_t calculatedResults = 0; - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults.data(), &calculatedResults, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResults, nullptr), ZE_RESULT_SUCCESS); EXPECT_EQ(calculatedResults, metricsSetParams.MetricsCount); } @@ -1777,7 +1777,7 @@ TEST_F(MetricEnumerationTest, givenCorrectRawReportSizeWhenZetMetricGroupCalcula std::vector rawResults(rawResultsSize); uint32_t calculatedResults = 0; - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults.data(), &calculatedResults, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResults, nullptr), ZE_RESULT_SUCCESS); EXPECT_EQ(calculatedResults, 2 * metricsSetParams.MetricsCount); } } @@ -1861,13 +1861,13 @@ TEST_F(MetricEnumerationTest, givenCorrectRawReportSizeAndLowerProvidedCalculate std::vector rawResults(rawResultsSize); uint32_t calculatedResultsCount = 0; - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults.data(), &calculatedResultsCount, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, nullptr), ZE_RESULT_SUCCESS); EXPECT_EQ(calculatedResultsCount, metricsSetParams.MetricsCount); // Provide lower calculated report count than returned earlier from api. calculatedResultsCount = 2; std::vector caculatedrawResults(calculatedResultsCount); - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults.data(), &calculatedResultsCount, caculatedrawResults.data()), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, caculatedrawResults.data()), ZE_RESULT_SUCCESS); } TEST_F(MetricEnumerationTest, givenCorrectRawReportSizeAndCorrectCalculatedReportCountWhenZetMetricGroupCalculateMetricValuesIsCalledThenReturnsSuccess) { @@ -1948,12 +1948,12 @@ TEST_F(MetricEnumerationTest, givenCorrectRawReportSizeAndCorrectCalculatedRepor std::vector rawResults(rawResultsSize); uint32_t calculatedResultsCount = 0; - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults.data(), &calculatedResultsCount, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, nullptr), ZE_RESULT_SUCCESS); EXPECT_EQ(calculatedResultsCount, metricsSetParams.MetricsCount); // Provide incorrect calculated report buffer. std::vector caculatedrawResults(calculatedResultsCount); - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults.data(), &calculatedResultsCount, caculatedrawResults.data()), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, caculatedrawResults.data()), ZE_RESULT_SUCCESS); } TEST_F(MetricEnumerationTest, givenCorrectRawReportSizeAndCorrectCalculatedReportCountWhenZetMetricGroupCalculateMetricValuesIsCalledThenMaxValuesAreReturned) { @@ -2034,12 +2034,12 @@ TEST_F(MetricEnumerationTest, givenCorrectRawReportSizeAndCorrectCalculatedRepor std::vector rawResults(rawResultsSize); uint32_t calculatedResultsCount = 0; - EXPECT_EQ(zetMetricGroupCalculateMetricValuesExt(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, nullptr), ZE_RESULT_SUCCESS); EXPECT_EQ(calculatedResultsCount, metricsSetParams.MetricsCount); // Provide incorrect calculated report buffer. std::vector caculatedrawResults(calculatedResultsCount); - EXPECT_EQ(zetMetricGroupCalculateMetricValuesExt(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, caculatedrawResults.data()), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, caculatedrawResults.data()), ZE_RESULT_SUCCESS); } TEST_F(MetricEnumerationTest, givenIncorrectCalculationTypeWhenZetMetricGroupCalculateMetricValuesIsCalledThenMaxValuesAreReturned) { @@ -2102,10 +2102,6 @@ TEST_F(MetricEnumerationTest, givenIncorrectCalculationTypeWhenZetMetricGroupCal EXPECT_CALL(metricsSet, SetApiFiltering(_)) .WillRepeatedly(Return(TCompletionCode::CC_OK)); - EXPECT_CALL(metricsSet, CalculateMetrics(_, _, _, _, _, _, _)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - EXPECT_CALL(metric, GetParams()) .WillRepeatedly(Return(&metricParams)); @@ -2120,12 +2116,8 @@ TEST_F(MetricEnumerationTest, givenIncorrectCalculationTypeWhenZetMetricGroupCal std::vector rawResults(rawResultsSize); uint32_t calculatedResultsCount = 0; - EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, rawResultsSize, rawResults.data(), &calculatedResultsCount, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupCalculateMetricValues(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES, rawResultsSize, rawResults.data(), &calculatedResultsCount, nullptr), ZE_RESULT_SUCCESS); EXPECT_EQ(calculatedResultsCount, metricsSetParams.MetricsCount); - - // Provide incorrect calculated report buffer. - std::vector caculatedrawResults(calculatedResultsCount); - EXPECT_NE(zetMetricGroupCalculateMetricValuesExt(metricGroupHandle, ZET_METRIC_GROUP_CALCULATION_TYPE_FORCE_UINT32, rawResultsSize, rawResults.data(), &calculatedResultsCount, caculatedrawResults.data()), ZE_RESULT_SUCCESS); } } // namespace ult } // namespace L0 diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_1.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_1.cpp index 8d26a7e51b..31a1a25da3 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_1.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_1.cpp @@ -46,14 +46,14 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateIsC zet_device_handle_t metricDevice = device->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -73,7 +73,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateIsC EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -97,7 +97,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateIsC .Times(1) .WillOnce(Return(StatusCode::Success)); - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); EXPECT_EQ(zetMetricQueryPoolDestroy(poolHandle), ZE_RESULT_SUCCESS); } @@ -107,14 +107,14 @@ TEST_F(MetricQueryPoolTest, givenIncorrectMetricGroupTypeWhenZetMetricQueryPoolC zet_device_handle_t metricDevice = device->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -132,7 +132,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectMetricGroupTypeWhenZetMetricQueryPoolC EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -151,7 +151,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectMetricGroupTypeWhenZetMetricQueryPoolC EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockContextDelete(_)) .Times(0); - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_ERROR_INVALID_ARGUMENT); EXPECT_EQ(poolHandle, nullptr); } @@ -160,15 +160,16 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryCreateIsCalle zet_device_handle_t metricDevice = device->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -188,7 +189,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryCreateIsCalle EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -213,7 +214,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryCreateIsCalle .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -230,15 +231,15 @@ TEST_F(MetricQueryPoolTest, givenIncorrectSlotIndexWhenZetMetricQueryCreateIsCal zet_device_handle_t metricDevice = device->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -258,7 +259,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectSlotIndexWhenZetMetricQueryCreateIsCal EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -283,7 +284,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectSlotIndexWhenZetMetricQueryCreateIsCal .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -299,15 +300,16 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryResetIsCalled zet_device_handle_t metricDevice = device->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -327,7 +329,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryResetIsCalled EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -352,7 +354,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryResetIsCalled .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -372,15 +374,15 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri zet_device_handle_t metricDevice = device->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -400,7 +402,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -425,7 +427,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -448,15 +450,15 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ zet_command_list_handle_t commandListHandle = commandList->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -479,7 +481,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -512,7 +514,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -531,16 +533,14 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZeEventPoolCreateIsCalledTh zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); - ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Destroy event pool. @@ -550,16 +550,14 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZeEventPoolCreateIsCalledTh TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZeEventCreateIsCalledThenReturnsFail) { zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); - ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Destroy event and its pool. @@ -570,23 +568,21 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZeEventCreateIsCalledThenRe zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); - ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ze_event_handle_t eventHandle = {}; ze_event_desc_t eventDesc = {}; eventDesc.index = 0; - eventDesc.version = ZE_EVENT_DESC_VERSION_CURRENT; + eventDesc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Create event. @@ -601,7 +597,6 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZeEventCreateIsCalledThenRe TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetricQueryEndIsCalledThenReturnsFail) { zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); std::unique_ptr commandList(CommandList::create(productFamily, device, false)); zet_command_list_handle_t commandListHandle = commandList->toHandle(); @@ -609,26 +604,26 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ze_event_handle_t eventHandle = {}; ze_event_desc_t eventDesc = {}; eventDesc.index = 0; - eventDesc.version = ZE_EVENT_DESC_VERSION_CURRENT; + eventDesc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -651,7 +646,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -684,7 +679,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -692,7 +687,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri EXPECT_NE(queryHandle, nullptr); // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); // Create event. EXPECT_EQ(zeEventCreate(eventPoolHandle, &eventDesc, &eventHandle), ZE_RESULT_SUCCESS); @@ -712,7 +707,6 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetCommandListAppendMetri TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQueryEndIsCalledThenReturnsSuccess) { zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); std::unique_ptr commandList(CommandList::create(productFamily, device, false)); zet_command_list_handle_t commandListHandle = commandList->toHandle(); @@ -720,26 +714,27 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ze_event_handle_t eventHandle = {}; ze_event_desc_t eventDesc = {}; eventDesc.index = 0; - eventDesc.version = ZE_EVENT_DESC_VERSION_CURRENT; + eventDesc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -762,7 +757,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -795,7 +790,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -803,7 +798,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ EXPECT_NE(queryHandle, nullptr); // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Create event. @@ -814,7 +809,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ EXPECT_EQ(zetCommandListAppendMetricQueryBegin(commandListHandle, queryHandle), ZE_RESULT_SUCCESS); // Write END metric query to command list, use an event to determine if the data is available. - EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); // Destroy event and its pool. EXPECT_EQ(zeEventDestroy(eventHandle), ZE_RESULT_SUCCESS); @@ -828,7 +823,6 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCalledThenReturnsFail) { zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); std::unique_ptr commandList(CommandList::create(productFamily, device, false)); zet_command_list_handle_t commandListHandle = commandList->toHandle(); @@ -836,26 +830,26 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ze_event_handle_t eventHandle = {}; ze_event_desc_t eventDesc = {}; eventDesc.index = 0; - eventDesc.version = ZE_EVENT_DESC_VERSION_CURRENT; + eventDesc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -878,7 +872,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -911,7 +905,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -919,7 +913,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa EXPECT_NE(queryHandle, nullptr); // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Create event. @@ -930,7 +924,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa EXPECT_EQ(zetCommandListAppendMetricQueryBegin(commandListHandle, queryHandle), ZE_RESULT_SUCCESS); // Write END metric query to command list, use an event to determine if the data is available. - EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); // Destroy event and its pool. EXPECT_EQ(zeEventDestroy(eventHandle), ZE_RESULT_SUCCESS); @@ -944,7 +938,6 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCalledThenReturnsSuccess) { zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); std::unique_ptr commandList(CommandList::create(productFamily, device, false)); zet_command_list_handle_t commandListHandle = commandList->toHandle(); @@ -952,26 +945,26 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ze_event_handle_t eventHandle = {}; ze_event_desc_t eventDesc = {}; eventDesc.index = 0; - eventDesc.version = ZE_EVENT_DESC_VERSION_CURRENT; + eventDesc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -996,7 +989,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -1037,7 +1030,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -1045,7 +1038,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall EXPECT_NE(queryHandle, nullptr); // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Create event. @@ -1056,7 +1049,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall EXPECT_EQ(zetCommandListAppendMetricQueryBegin(commandListHandle, queryHandle), ZE_RESULT_SUCCESS); // Write END metric query to command list, use an event to determine if the data is available. - EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); // Get desired raw data size. size_t rawSize = 0; diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_2.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_2.cpp index d363fed824..446cf7013f 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_2.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_query_pool_2.cpp @@ -46,11 +46,12 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateExt zet_device_handle_t metricDevice = device->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_pool_handle_t poolHandle = {}; - zet_metric_query_pool_desc_ext_t poolDesc = {}; + zet_metric_query_pool_desc_t poolDesc = {}; poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; @@ -73,7 +74,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateExt EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -97,7 +98,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateExt .Times(1) .WillOnce(Return(StatusCode::Success)); - EXPECT_EQ(zetMetricQueryPoolCreateExt(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); EXPECT_EQ(zetMetricQueryPoolDestroy(poolHandle), ZE_RESULT_SUCCESS); } @@ -117,7 +118,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenStreamerIsOpenThenQueryPool Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -136,7 +137,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenStreamerIsOpenThenQueryPool metricsSetParams.RawReportSize = 256; zet_metric_query_pool_handle_t poolHandle = {}; - zet_metric_query_pool_desc_ext_t poolDesc = {}; + zet_metric_query_pool_desc_t poolDesc = {}; poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; @@ -198,19 +199,19 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenStreamerIsOpenThenQueryPool EXPECT_EQ(metricGroupCount, 1u); EXPECT_NE(metricGroupHandle, nullptr); - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); EXPECT_EQ(strcmp(metricGroupProperties.description, metricsSetParams.ShortName), 0); EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDevice, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), metricDevice, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); EXPECT_EQ(zetMetricStreamerOpen(context->toHandle(), metricDevice, metricGroupHandle, &streamerDesc, eventHandle, &streamerHandle), ZE_RESULT_SUCCESS); EXPECT_NE(streamerHandle, nullptr); - EXPECT_EQ(zetMetricQueryPoolCreateExt(context->toHandle(), metricDevice, metricGroupHandle, &poolDesc, &poolHandle), ZE_RESULT_ERROR_NOT_AVAILABLE); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroupHandle, &poolDesc, &poolHandle), ZE_RESULT_ERROR_NOT_AVAILABLE); EXPECT_EQ(zetMetricStreamerClose(streamerHandle), ZE_RESULT_SUCCESS); EXPECT_NE(streamerHandle, nullptr); @@ -221,11 +222,11 @@ TEST_F(MetricQueryPoolTest, givenIncorrectMetricGroupTypeWhenZetMetricQueryPoolC zet_device_handle_t metricDevice = device->toHandle(); Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED; zet_metric_query_pool_handle_t poolHandle = {}; - zet_metric_query_pool_desc_ext_t poolDesc = {}; + zet_metric_query_pool_desc_t poolDesc = {}; poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; @@ -246,7 +247,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectMetricGroupTypeWhenZetMetricQueryPoolC EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -265,14 +266,13 @@ TEST_F(MetricQueryPoolTest, givenIncorrectMetricGroupTypeWhenZetMetricQueryPoolC EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockContextDelete(_)) .Times(0); - EXPECT_EQ(zetMetricQueryPoolCreateExt(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_ERROR_INVALID_ARGUMENT); EXPECT_EQ(poolHandle, nullptr); } TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQueryEndExtIsCalledThenReturnsSuccess) { zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); std::unique_ptr commandList(CommandList::create(productFamily, device, false)); zet_command_list_handle_t commandListHandle = commandList->toHandle(); @@ -280,26 +280,26 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ze_event_handle_t eventHandle = {}; ze_event_desc_t eventDesc = {}; eventDesc.index = 0; - eventDesc.version = ZE_EVENT_DESC_VERSION_CURRENT; + eventDesc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -322,7 +322,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -355,7 +355,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -363,7 +363,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ EXPECT_NE(queryHandle, nullptr); // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Create event. @@ -374,7 +374,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ EXPECT_EQ(zetCommandListAppendMetricQueryBegin(commandListHandle, queryHandle), ZE_RESULT_SUCCESS); // Write END metric query to command list, use an event to determine if the data is available. - EXPECT_EQ(zetCommandListAppendMetricQueryEndExt(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); // Destroy event and its pool. EXPECT_EQ(zeEventDestroy(eventHandle), ZE_RESULT_SUCCESS); @@ -388,7 +388,6 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetCommandListAppendMetricQ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCalledThenReturnsFailExt) { zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); std::unique_ptr commandList(CommandList::create(productFamily, device, false)); zet_command_list_handle_t commandListHandle = commandList->toHandle(); @@ -396,26 +395,26 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ze_event_handle_t eventHandle = {}; ze_event_desc_t eventDesc = {}; eventDesc.index = 0; - eventDesc.version = ZE_EVENT_DESC_VERSION_CURRENT; + eventDesc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -438,7 +437,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -471,7 +470,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -479,7 +478,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa EXPECT_NE(queryHandle, nullptr); // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Create event. @@ -490,7 +489,7 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa EXPECT_EQ(zetCommandListAppendMetricQueryBegin(commandListHandle, queryHandle), ZE_RESULT_SUCCESS); // Write END metric query to command list, use an event to determine if the data is available. - EXPECT_EQ(zetCommandListAppendMetricQueryEndExt(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); // Destroy event and its pool. EXPECT_EQ(zeEventDestroy(eventHandle), ZE_RESULT_SUCCESS); @@ -504,7 +503,6 @@ TEST_F(MetricQueryPoolTest, givenIncorrectArgumentsWhenZetMetricQueryGetDataIsCa TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCalledThenReturnsSuccessExt) { zet_device_handle_t metricDevice = device->toHandle(); - zet_driver_handle_t driver = driverHandle->toHandle(); std::unique_ptr commandList(CommandList::create(productFamily, device, false)); zet_command_list_handle_t commandListHandle = commandList->toHandle(); @@ -512,26 +510,26 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall ze_event_pool_handle_t eventPoolHandle = {}; ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; - eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_DEFAULT; - eventPoolDesc.version = ZE_EVENT_POOL_DESC_VERSION_CURRENT; + eventPoolDesc.flags = 0; + eventPoolDesc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ze_event_handle_t eventHandle = {}; ze_event_desc_t eventDesc = {}; eventDesc.index = 0; - eventDesc.version = ZE_EVENT_DESC_VERSION_CURRENT; + eventDesc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; eventDesc.wait = ZE_EVENT_SCOPE_FLAG_HOST; eventDesc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; Mock metricGroup; - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; zet_metric_query_handle_t queryHandle = {}; zet_metric_query_pool_handle_t poolHandle = {}; zet_metric_query_pool_desc_t poolDesc = {}; - poolDesc.version = ZET_METRIC_QUERY_POOL_DESC_VERSION_CURRENT; + poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; - poolDesc.flags = ZET_METRIC_QUERY_POOL_FLAG_PERFORMANCE; + poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; TypedValue_1_0 value = {}; value.Type = ValueType::Uint32; @@ -556,7 +554,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -597,7 +595,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall .WillOnce(Return(StatusCode::Success)); // Create metric query pool. - EXPECT_EQ(zetMetricQueryPoolCreate(metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Create metric query. @@ -605,7 +603,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall EXPECT_NE(queryHandle, nullptr); // Create event pool. - EXPECT_EQ(zeEventPoolCreate(driver, &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zeEventPoolCreate(context->toHandle(), &eventPoolDesc, 1, &metricDevice, &eventPoolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(eventPoolHandle, nullptr); // Create event. @@ -616,7 +614,7 @@ TEST_F(MetricQueryPoolTest, givenCorrectArgumentsWhenZetMetricQueryGetDataIsCall EXPECT_EQ(zetCommandListAppendMetricQueryBegin(commandListHandle, queryHandle), ZE_RESULT_SUCCESS); // Write END metric query to command list, use an event to determine if the data is available. - EXPECT_EQ(zetCommandListAppendMetricQueryEndExt(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetCommandListAppendMetricQueryEnd(commandListHandle, queryHandle, eventHandle, 0, nullptr), ZE_RESULT_SUCCESS); // Get desired raw data size. size_t rawSize = 0; diff --git a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_streamer.cpp b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_streamer.cpp index 5a61f9dbbd..e6c082b016 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/test_metric_streamer.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/test_metric_streamer.cpp @@ -37,11 +37,11 @@ TEST_F(MetricStreamerTest, givenInvalidMetricGroupTypeWhenZetMetricStreamerOpenI // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -50,34 +50,6 @@ TEST_F(MetricStreamerTest, givenInvalidMetricGroupTypeWhenZetMetricStreamerOpenI EXPECT_EQ(streamerHandle, nullptr); } -TEST_F(MetricStreamerTest, zetMetricTracerOpen_InvalidMetricGroupType_ReturnsFail) { - - // One api: device handle. - zet_device_handle_t metricDeviceHandle = device->toHandle(); - - // One api: event handle. - ze_event_handle_t eventHandle = {}; - - // One api: tracer handle. - zet_metric_tracer_handle_t tracerHandle = {}; - zet_metric_tracer_desc_t tracerDesc = {}; - - // One api: metric group handle. - Mock metricGroup; - zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; - - metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; - - EXPECT_CALL(metricGroup, getPropertiesExt(_)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); - - // Metric tracer open. - EXPECT_EQ(zetMetricTracerOpen(metricDeviceHandle, metricGroupHandle, &tracerDesc, eventHandle, &tracerHandle), ZE_RESULT_ERROR_INVALID_ARGUMENT); - EXPECT_EQ(tracerHandle, nullptr); -} - TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledThenReturnsSuccess) { // One api: device handle. @@ -97,7 +69,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledT // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -168,7 +140,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledT EXPECT_NE(metricGroupHandle, nullptr); // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); @@ -176,7 +148,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledT EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); // Metric streamer open. EXPECT_EQ(zetMetricStreamerOpen(context->toHandle(), metricDeviceHandle, metricGroupHandle, &streamerDesc, eventHandle, &streamerHandle), ZE_RESULT_SUCCESS); @@ -187,115 +159,6 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledT EXPECT_NE(streamerHandle, nullptr); } -TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricTracerOpenIsCalledThenReturnsSuccess) { - - // One api: device handle. - zet_device_handle_t metricDeviceHandle = device->toHandle(); - - // One api: event handle. - ze_event_handle_t eventHandle = {}; - - // One api: tracer handle. - zet_metric_tracer_handle_t tracerHandle = {}; - zet_metric_tracer_desc_t tracerDesc = {}; - - tracerDesc.version = ZET_METRIC_TRACER_DESC_VERSION_CURRENT; - tracerDesc.notifyEveryNReports = 32768; - tracerDesc.samplingPeriod = 1000; - - // One api: metric group handle. - Mock metricGroup; - zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; - - // Metrics Discovery device. - metricsDeviceParams.ConcurrentGroupsCount = 1; - - // Metrics Discovery concurrent group. - Mock metricsConcurrentGroup; - TConcurrentGroupParams_1_0 metricsConcurrentGroupParams = {}; - metricsConcurrentGroupParams.MetricSetsCount = 1; - metricsConcurrentGroupParams.SymbolName = "OA"; - metricsConcurrentGroupParams.Description = "OA description"; - - // Metrics Discovery metric set. - Mock metricsSet; - MetricsDiscovery::TMetricSetParams_1_4 metricsSetParams = {}; - metricsSetParams.ApiMask = MetricsDiscovery::API_TYPE_IOSTREAM; - metricsSetParams.MetricsCount = 0; - metricsSetParams.SymbolName = "Metric set name"; - metricsSetParams.ShortName = "Metric set description"; - metricsSetParams.RawReportSize = 256; - - EXPECT_CALL(*mockMetricEnumeration, loadMetricsDiscovery()) - .Times(0); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockOpenMetricsDevice(_)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<0>(&metricsDevice), Return(TCompletionCode::CC_OK))); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockCloseMetricsDevice(_)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsDevice, GetParams()) - .WillRepeatedly(Return(&metricsDeviceParams)); - - EXPECT_CALL(metricsDevice, GetConcurrentGroup(_)) - .Times(1) - .WillOnce(Return(&metricsConcurrentGroup)); - - EXPECT_CALL(metricsConcurrentGroup, GetParams()) - .Times(1) - .WillRepeatedly(Return(&metricsConcurrentGroupParams)); - - EXPECT_CALL(metricsConcurrentGroup, GetMetricSet(_)) - .WillRepeatedly(Return(&metricsSet)); - - EXPECT_CALL(metricsSet, GetParams()) - .WillRepeatedly(Return(&metricsSetParams)); - - EXPECT_CALL(metricsSet, SetApiFiltering(_)) - .WillRepeatedly(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, OpenIoStream(_, _, _, _)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, CloseIoStream()) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - // Metric group count. - uint32_t metricGroupCount = 0; - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, nullptr), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - - // Metric group handle. - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, &metricGroupHandle), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - EXPECT_NE(metricGroupHandle, nullptr); - - // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupProperties.domain, 0u); - EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); - EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); - EXPECT_EQ(strcmp(metricGroupProperties.description, metricsSetParams.ShortName), 0); - EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); - - // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); - - // Metric tracer open. - EXPECT_EQ(zetMetricTracerOpen(metricDeviceHandle, metricGroupHandle, &tracerDesc, eventHandle, &tracerHandle), ZE_RESULT_SUCCESS); - EXPECT_NE(tracerHandle, nullptr); - - // Metric tracer close. - EXPECT_EQ(zetMetricTracerClose(tracerHandle), ZE_RESULT_SUCCESS); - EXPECT_NE(tracerHandle, nullptr); -} - TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledTwiceThenReturnsObjectInUse) { // One api: device handle. @@ -316,7 +179,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledT // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -387,7 +250,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledT EXPECT_NE(metricGroupHandle, nullptr); // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); @@ -395,7 +258,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerOpenIsCalledT EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); // Metric streamer open. EXPECT_EQ(zetMetricStreamerOpen(context->toHandle(), metricDeviceHandle, metricGroupHandle, &streamerDesc, eventHandle, &firstStreamerHandle), ZE_RESULT_SUCCESS); @@ -428,12 +291,12 @@ TEST_F(MetricStreamerTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateExtI // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED; // One api: query pool handle. zet_metric_query_pool_handle_t poolHandle = {}; - zet_metric_query_pool_desc_ext_t poolDesc = {}; + zet_metric_query_pool_desc_t poolDesc = {}; poolDesc.stype = ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC; poolDesc.count = 1; poolDesc.type = ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE; @@ -456,7 +319,7 @@ TEST_F(MetricStreamerTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateExtI EXPECT_CALL(*mockMetricsLibrary, load()) .Times(0); - EXPECT_CALL(metricGroup, getPropertiesExt(_)) + EXPECT_CALL(metricGroup, getProperties(_)) .Times(1) .WillOnce(DoAll(::testing::SetArgPointee<0>(metricGroupProperties), Return(ZE_RESULT_SUCCESS))); @@ -481,7 +344,7 @@ TEST_F(MetricStreamerTest, givenCorrectArgumentsWhenZetMetricQueryPoolCreateExtI .WillOnce(Return(StatusCode::Success)); // Metric query pool create. - EXPECT_EQ(zetMetricQueryPoolCreateExt(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricQueryPoolCreate(context->toHandle(), metricDevice, metricGroup.toHandle(), &poolDesc, &poolHandle), ZE_RESULT_SUCCESS); EXPECT_NE(poolHandle, nullptr); // Metric streamer open. @@ -511,7 +374,7 @@ TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetMetricStreamerReadDataIsC // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -582,7 +445,7 @@ TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetMetricStreamerReadDataIsC EXPECT_NE(metricGroupHandle, nullptr); // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); @@ -590,7 +453,7 @@ TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetMetricStreamerReadDataIsC EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); // Metric streamer open. EXPECT_EQ(zetMetricStreamerOpen(context->toHandle(), metricDeviceHandle, metricGroupHandle, &streamerDesc, eventHandle, &streamerHandle), ZE_RESULT_SUCCESS); @@ -600,114 +463,6 @@ TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetMetricStreamerReadDataIsC EXPECT_EQ(zetMetricStreamerClose(streamerHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetMetricTracerReadDataIsCalledThenReturnsFail) { - - // One api: device handle. - zet_device_handle_t metricDeviceHandle = device->toHandle(); - - // One api: event handle. - ze_event_handle_t eventHandle = {}; - - // One api: tracer handle. - zet_metric_tracer_handle_t tracerHandle = {}; - zet_metric_tracer_desc_t tracerDesc = {}; - - tracerDesc.version = ZET_METRIC_TRACER_DESC_VERSION_CURRENT; - tracerDesc.notifyEveryNReports = 32768; - tracerDesc.samplingPeriod = 1000; - - // One api: metric group handle. - Mock metricGroup; - zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; - - // Metrics Discovery device. - metricsDeviceParams.ConcurrentGroupsCount = 1; - - // Metrics Discovery concurrent group. - Mock metricsConcurrentGroup; - TConcurrentGroupParams_1_0 metricsConcurrentGroupParams = {}; - metricsConcurrentGroupParams.MetricSetsCount = 1; - metricsConcurrentGroupParams.SymbolName = "OA"; - metricsConcurrentGroupParams.Description = "OA description"; - - // Metrics Discovery metric set. - Mock metricsSet; - MetricsDiscovery::TMetricSetParams_1_4 metricsSetParams = {}; - metricsSetParams.ApiMask = MetricsDiscovery::API_TYPE_IOSTREAM; - metricsSetParams.MetricsCount = 0; - metricsSetParams.SymbolName = "Metric set name"; - metricsSetParams.ShortName = "Metric set description"; - metricsSetParams.RawReportSize = 256; - - EXPECT_CALL(*mockMetricEnumeration, loadMetricsDiscovery()) - .Times(0); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockOpenMetricsDevice(_)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<0>(&metricsDevice), Return(TCompletionCode::CC_OK))); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockCloseMetricsDevice(_)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsDevice, GetParams()) - .WillRepeatedly(Return(&metricsDeviceParams)); - - EXPECT_CALL(metricsDevice, GetConcurrentGroup(_)) - .Times(1) - .WillOnce(Return(&metricsConcurrentGroup)); - - EXPECT_CALL(metricsConcurrentGroup, GetParams()) - .Times(1) - .WillRepeatedly(Return(&metricsConcurrentGroupParams)); - - EXPECT_CALL(metricsConcurrentGroup, GetMetricSet(_)) - .WillRepeatedly(Return(&metricsSet)); - - EXPECT_CALL(metricsSet, GetParams()) - .WillRepeatedly(Return(&metricsSetParams)); - - EXPECT_CALL(metricsSet, SetApiFiltering(_)) - .WillRepeatedly(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, OpenIoStream(_, _, _, _)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, CloseIoStream()) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - // Metric group count. - uint32_t metricGroupCount = 0; - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, nullptr), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - - // Metric group handle. - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, &metricGroupHandle), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - EXPECT_NE(metricGroupHandle, nullptr); - - // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupProperties.domain, 0u); - EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); - EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); - EXPECT_EQ(strcmp(metricGroupProperties.description, metricsSetParams.ShortName), 0); - EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); - - // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); - - // Metric tracer open. - EXPECT_EQ(zetMetricTracerOpen(metricDeviceHandle, metricGroupHandle, &tracerDesc, eventHandle, &tracerHandle), ZE_RESULT_SUCCESS); - EXPECT_NE(tracerHandle, nullptr); - - // Metric tracer close. - EXPECT_EQ(zetMetricTracerClose(tracerHandle), ZE_RESULT_SUCCESS); -} - TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerReadDataIsCalledThenReturnsSuccess) { // One api: device handle. @@ -727,7 +482,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerReadDataIsCal // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -802,7 +557,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerReadDataIsCal EXPECT_NE(metricGroupHandle, nullptr); // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); @@ -810,7 +565,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerReadDataIsCal EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); // Metric streamer open. EXPECT_EQ(zetMetricStreamerOpen(context->toHandle(), metricDeviceHandle, metricGroupHandle, &streamerDesc, eventHandle, &streamerHandle), ZE_RESULT_SUCCESS); @@ -830,128 +585,6 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricStreamerReadDataIsCal EXPECT_EQ(zetMetricStreamerClose(streamerHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetMetricTracerReadDataIsCalledThenReturnsSuccess) { - - // One api: device handle. - zet_device_handle_t metricDeviceHandle = device->toHandle(); - - // One api: event handle. - ze_event_handle_t eventHandle = {}; - - // One api: tracer handle. - zet_metric_tracer_handle_t tracerHandle = {}; - zet_metric_tracer_desc_t tracerDesc = {}; - - tracerDesc.version = ZET_METRIC_TRACER_DESC_VERSION_CURRENT; - tracerDesc.notifyEveryNReports = 32768; - tracerDesc.samplingPeriod = 1000; - - // One api: metric group handle. - Mock metricGroup; - zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; - - // Metrics Discovery device. - metricsDeviceParams.ConcurrentGroupsCount = 1; - - // Metrics Discovery concurrent group. - Mock metricsConcurrentGroup; - TConcurrentGroupParams_1_0 metricsConcurrentGroupParams = {}; - metricsConcurrentGroupParams.MetricSetsCount = 1; - metricsConcurrentGroupParams.SymbolName = "OA"; - metricsConcurrentGroupParams.Description = "OA description"; - - // Metrics Discovery metric set. - Mock metricsSet; - MetricsDiscovery::TMetricSetParams_1_4 metricsSetParams = {}; - metricsSetParams.ApiMask = MetricsDiscovery::API_TYPE_IOSTREAM; - metricsSetParams.MetricsCount = 0; - metricsSetParams.SymbolName = "Metric set name"; - metricsSetParams.ShortName = "Metric set description"; - metricsSetParams.RawReportSize = 256; - - EXPECT_CALL(*mockMetricEnumeration, loadMetricsDiscovery()) - .Times(0); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockOpenMetricsDevice(_)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<0>(&metricsDevice), Return(TCompletionCode::CC_OK))); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockCloseMetricsDevice(_)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsDevice, GetParams()) - .WillRepeatedly(Return(&metricsDeviceParams)); - - EXPECT_CALL(metricsDevice, GetConcurrentGroup(_)) - .Times(1) - .WillOnce(Return(&metricsConcurrentGroup)); - - EXPECT_CALL(metricsConcurrentGroup, GetParams()) - .Times(1) - .WillRepeatedly(Return(&metricsConcurrentGroupParams)); - - EXPECT_CALL(metricsConcurrentGroup, GetMetricSet(_)) - .WillRepeatedly(Return(&metricsSet)); - - EXPECT_CALL(metricsSet, GetParams()) - .WillRepeatedly(Return(&metricsSetParams)); - - EXPECT_CALL(metricsSet, SetApiFiltering(_)) - .WillRepeatedly(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, OpenIoStream(_, _, _, _)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, ReadIoStream(_, _, _)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, CloseIoStream()) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - // Metric group count. - uint32_t metricGroupCount = 0; - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, nullptr), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - - // Metric group handle. - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, &metricGroupHandle), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - EXPECT_NE(metricGroupHandle, nullptr); - - // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupProperties.domain, 0u); - EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); - EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); - EXPECT_EQ(strcmp(metricGroupProperties.description, metricsSetParams.ShortName), 0); - EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); - - // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); - - // Metric tracer open. - EXPECT_EQ(zetMetricTracerOpen(metricDeviceHandle, metricGroupHandle, &tracerDesc, eventHandle, &tracerHandle), ZE_RESULT_SUCCESS); - EXPECT_NE(tracerHandle, nullptr); - - // Metric tracer: get desired raw data size. - size_t rawSize = 0; - uint32_t reportCount = 256; - EXPECT_EQ(zetMetricTracerReadData(tracerHandle, reportCount, &rawSize, nullptr), ZE_RESULT_SUCCESS); - - // Metric tracer: read the data. - std::vector rawData; - rawData.resize(rawSize); - EXPECT_EQ(zetMetricTracerReadData(tracerHandle, reportCount, &rawSize, rawData.data()), ZE_RESULT_SUCCESS); - - // Metric tracer close. - EXPECT_EQ(zetMetricTracerClose(tracerHandle), ZE_RESULT_SUCCESS); -} - TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetCommandListAppendMetricStreamerMarkerIsCalledThenReturnsFail) { // One api: device handle. @@ -971,7 +604,7 @@ TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetCommandListAppendMetricSt // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -1042,7 +675,7 @@ TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetCommandListAppendMetricSt EXPECT_NE(metricGroupHandle, nullptr); // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); @@ -1050,7 +683,7 @@ TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetCommandListAppendMetricSt EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); // Metric streamer open. EXPECT_EQ(zetMetricStreamerOpen(context->toHandle(), metricDeviceHandle, metricGroupHandle, &streamerDesc, eventHandle, &streamerHandle), ZE_RESULT_SUCCESS); @@ -1060,114 +693,6 @@ TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetCommandListAppendMetricSt EXPECT_EQ(zetMetricStreamerClose(streamerHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricStreamerTest, givenInvalidArgumentsWhenZetCommandListAppendMetricTracerMarkerIsCalledThenReturnsFail) { - - // One api: device handle. - zet_device_handle_t metricDeviceHandle = device->toHandle(); - - // One api: event handle. - ze_event_handle_t eventHandle = {}; - - // One api: tracer handle. - zet_metric_tracer_handle_t tracerHandle = {}; - zet_metric_tracer_desc_t tracerDesc = {}; - - tracerDesc.version = ZET_METRIC_TRACER_DESC_VERSION_CURRENT; - tracerDesc.notifyEveryNReports = 32768; - tracerDesc.samplingPeriod = 1000; - - // One api: metric group handle. - Mock metricGroup; - zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; - - // Metrics Discovery device. - metricsDeviceParams.ConcurrentGroupsCount = 1; - - // Metrics Discovery concurrent group. - Mock metricsConcurrentGroup; - TConcurrentGroupParams_1_0 metricsConcurrentGroupParams = {}; - metricsConcurrentGroupParams.MetricSetsCount = 1; - metricsConcurrentGroupParams.SymbolName = "OA"; - metricsConcurrentGroupParams.Description = "OA description"; - - // Metrics Discovery metric set. - Mock metricsSet; - MetricsDiscovery::TMetricSetParams_1_4 metricsSetParams = {}; - metricsSetParams.ApiMask = MetricsDiscovery::API_TYPE_IOSTREAM; - metricsSetParams.MetricsCount = 0; - metricsSetParams.SymbolName = "Metric set name"; - metricsSetParams.ShortName = "Metric set description"; - metricsSetParams.RawReportSize = 256; - - EXPECT_CALL(*mockMetricEnumeration, loadMetricsDiscovery()) - .Times(0); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockOpenMetricsDevice(_)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<0>(&metricsDevice), Return(TCompletionCode::CC_OK))); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockCloseMetricsDevice(_)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsDevice, GetParams()) - .WillRepeatedly(Return(&metricsDeviceParams)); - - EXPECT_CALL(metricsDevice, GetConcurrentGroup(_)) - .Times(1) - .WillOnce(Return(&metricsConcurrentGroup)); - - EXPECT_CALL(metricsConcurrentGroup, GetParams()) - .Times(1) - .WillRepeatedly(Return(&metricsConcurrentGroupParams)); - - EXPECT_CALL(metricsConcurrentGroup, GetMetricSet(_)) - .WillRepeatedly(Return(&metricsSet)); - - EXPECT_CALL(metricsSet, GetParams()) - .WillRepeatedly(Return(&metricsSetParams)); - - EXPECT_CALL(metricsSet, SetApiFiltering(_)) - .WillRepeatedly(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, OpenIoStream(_, _, _, _)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, CloseIoStream()) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - // Metric group count. - uint32_t metricGroupCount = 0; - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, nullptr), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - - // Metric group handle. - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, &metricGroupHandle), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - EXPECT_NE(metricGroupHandle, nullptr); - - // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupProperties.domain, 0u); - EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); - EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); - EXPECT_EQ(strcmp(metricGroupProperties.description, metricsSetParams.ShortName), 0); - EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); - - // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); - - // Metric tracer open. - EXPECT_EQ(zetMetricTracerOpen(metricDeviceHandle, metricGroupHandle, &tracerDesc, eventHandle, &tracerHandle), ZE_RESULT_SUCCESS); - EXPECT_NE(tracerHandle, nullptr); - - // Metric tracer close. - EXPECT_EQ(zetMetricTracerClose(tracerHandle), ZE_RESULT_SUCCESS); -} - TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetCommandListAppendMetricStreamerMarkerIsCalledThenReturnsSuccess) { // One api: device handle. @@ -1190,7 +715,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetCommandListAppendMetricStre // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -1294,7 +819,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetCommandListAppendMetricStre EXPECT_NE(metricGroupHandle, nullptr); // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); @@ -1302,7 +827,7 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetCommandListAppendMetricStre EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); // Metric streamer open. EXPECT_EQ(zetMetricStreamerOpen(context->toHandle(), metricDeviceHandle, metricGroupHandle, &streamerDesc, eventHandle, &streamerHandle), ZE_RESULT_SUCCESS); @@ -1316,154 +841,6 @@ TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetCommandListAppendMetricStre EXPECT_EQ(zetMetricStreamerClose(streamerHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricStreamerTest, givenValidArgumentsWhenZetCommandListAppendMetricTracerMarkerIsCalledThenReturnsSuccess) { - - // One api: device handle. - zet_device_handle_t metricDeviceHandle = device->toHandle(); - - // One api: event handle. - ze_event_handle_t eventHandle = {}; - - // One api: command list handle. - std::unique_ptr commandList(CommandList::create(productFamily, device, false)); - - // One api: tracer handle. - zet_metric_tracer_handle_t tracerHandle = {}; - zet_metric_tracer_desc_t tracerDesc = {}; - - tracerDesc.version = ZET_METRIC_TRACER_DESC_VERSION_CURRENT; - tracerDesc.notifyEveryNReports = 32768; - tracerDesc.samplingPeriod = 1000; - - // One api: metric group handle. - Mock metricGroup; - zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; - - // Metrics Discovery device. - metricsDeviceParams.ConcurrentGroupsCount = 1; - - // Metrics Discovery concurrent group. - Mock metricsConcurrentGroup; - TConcurrentGroupParams_1_0 metricsConcurrentGroupParams = {}; - metricsConcurrentGroupParams.MetricSetsCount = 1; - metricsConcurrentGroupParams.SymbolName = "OA"; - metricsConcurrentGroupParams.Description = "OA description"; - - // Metrics Discovery metric set. - Mock metricsSet; - MetricsDiscovery::TMetricSetParams_1_4 metricsSetParams = {}; - metricsSetParams.ApiMask = MetricsDiscovery::API_TYPE_IOSTREAM; - metricsSetParams.MetricsCount = 0; - metricsSetParams.SymbolName = "Metric set name"; - metricsSetParams.ShortName = "Metric set description"; - metricsSetParams.RawReportSize = 256; - - TypedValue_1_0 value = {}; - value.Type = ValueType::Uint32; - value.ValueUInt32 = 64; - - ContextHandle_1_0 contextHandle = {&value}; - - CommandBufferSize_1_0 commandBufferSize = {}; - commandBufferSize.GpuMemorySize = 100; - - EXPECT_CALL(*mockMetricEnumeration, loadMetricsDiscovery()) - .Times(0); - - EXPECT_CALL(*mockMetricEnumeration, isInitialized()) - .Times(1) - .WillOnce(Return(true)); - - EXPECT_CALL(*mockMetricsLibrary, getContextData(_, _)) - .Times(1) - .WillOnce(Return(true)); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockOpenMetricsDevice(_)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<0>(&metricsDevice), Return(TCompletionCode::CC_OK))); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockCloseMetricsDevice(_)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockContextCreate(_, _, _)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<2>(contextHandle), Return(StatusCode::Success))); - - EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockContextDelete(_)) - .Times(1) - .WillOnce(Return(StatusCode::Success)); - - EXPECT_CALL(metricsDevice, GetParams()) - .WillRepeatedly(Return(&metricsDeviceParams)); - - EXPECT_CALL(metricsDevice, GetConcurrentGroup(_)) - .Times(1) - .WillOnce(Return(&metricsConcurrentGroup)); - - EXPECT_CALL(metricsConcurrentGroup, GetParams()) - .Times(1) - .WillRepeatedly(Return(&metricsConcurrentGroupParams)); - - EXPECT_CALL(metricsConcurrentGroup, GetMetricSet(_)) - .WillRepeatedly(Return(&metricsSet)); - - EXPECT_CALL(metricsSet, GetParams()) - .WillRepeatedly(Return(&metricsSetParams)); - - EXPECT_CALL(metricsSet, SetApiFiltering(_)) - .WillRepeatedly(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, OpenIoStream(_, _, _, _)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockCommandBufferGetSize(_, _)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<1>(::testing::ByRef(commandBufferSize)), Return(StatusCode::Success))); - - EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockCommandBufferGet(_)) - .Times(1) - .WillOnce(Return(StatusCode::Success)); - - EXPECT_CALL(metricsConcurrentGroup, CloseIoStream()) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - // Metric group count. - uint32_t metricGroupCount = 0; - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, nullptr), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - - // Metric group handle. - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, &metricGroupHandle), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - EXPECT_NE(metricGroupHandle, nullptr); - - // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupProperties.domain, 0u); - EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); - EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); - EXPECT_EQ(strcmp(metricGroupProperties.description, metricsSetParams.ShortName), 0); - EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); - - // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); - - // Metric tracer open. - EXPECT_EQ(zetMetricTracerOpen(metricDeviceHandle, metricGroupHandle, &tracerDesc, eventHandle, &tracerHandle), ZE_RESULT_SUCCESS); - EXPECT_NE(tracerHandle, nullptr); - - // Metric tracer marker. - uint32_t markerValue = 1; - EXPECT_EQ(zetCommandListAppendMetricTracerMarker(commandList->toHandle(), tracerHandle, markerValue), ZE_RESULT_SUCCESS); - - // Metric tracer close. - EXPECT_EQ(zetMetricTracerClose(tracerHandle), ZE_RESULT_SUCCESS); -} - TEST_F(MetricStreamerTest, givenMultipleMarkerInsertionsWhenZetCommandListAppendMetricStreamerMarkerIsCalledThenReturnsSuccess) { // One api: device handle. @@ -1486,7 +863,7 @@ TEST_F(MetricStreamerTest, givenMultipleMarkerInsertionsWhenZetCommandListAppend // One api: metric group handle. Mock metricGroup; zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; + zet_metric_group_properties_t metricGroupProperties = {}; // Metrics Discovery device. metricsDeviceParams.ConcurrentGroupsCount = 1; @@ -1590,7 +967,7 @@ TEST_F(MetricStreamerTest, givenMultipleMarkerInsertionsWhenZetCommandListAppend EXPECT_NE(metricGroupHandle, nullptr); // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetMetricGroupGetProperties(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); EXPECT_EQ(metricGroupProperties.domain, 0u); EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); @@ -1598,7 +975,7 @@ TEST_F(MetricStreamerTest, givenMultipleMarkerInsertionsWhenZetCommandListAppend EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); + EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); // Metric streamer open. EXPECT_EQ(zetMetricStreamerOpen(context->toHandle(), metricDeviceHandle, metricGroupHandle, &streamerDesc, eventHandle, &streamerHandle), ZE_RESULT_SUCCESS); @@ -1614,155 +991,5 @@ TEST_F(MetricStreamerTest, givenMultipleMarkerInsertionsWhenZetCommandListAppend EXPECT_EQ(zetMetricStreamerClose(streamerHandle), ZE_RESULT_SUCCESS); } -TEST_F(MetricStreamerTest, givenMultipleMarkerInsertionsWhenZetCommandListAppendMetricTracerMarkerIsCalledThenReturnsSuccess) { - - // One api: device handle. - zet_device_handle_t metricDeviceHandle = device->toHandle(); - - // One api: event handle. - ze_event_handle_t eventHandle = {}; - - // One api: command list handle. - std::unique_ptr commandList(CommandList::create(productFamily, device, false)); - - // One api: tracer handle. - zet_metric_tracer_handle_t tracerHandle = {}; - zet_metric_tracer_desc_t tracerDesc = {}; - - tracerDesc.version = ZET_METRIC_TRACER_DESC_VERSION_CURRENT; - tracerDesc.notifyEveryNReports = 32768; - tracerDesc.samplingPeriod = 1000; - - // One api: metric group handle. - Mock metricGroup; - zet_metric_group_handle_t metricGroupHandle = metricGroup.toHandle(); - zet_metric_group_properties_ext_t metricGroupProperties = {}; - - // Metrics Discovery device. - metricsDeviceParams.ConcurrentGroupsCount = 1; - - // Metrics Discovery concurrent group. - Mock metricsConcurrentGroup; - TConcurrentGroupParams_1_0 metricsConcurrentGroupParams = {}; - metricsConcurrentGroupParams.MetricSetsCount = 1; - metricsConcurrentGroupParams.SymbolName = "OA"; - metricsConcurrentGroupParams.Description = "OA description"; - - // Metrics Discovery metric set. - Mock metricsSet; - MetricsDiscovery::TMetricSetParams_1_4 metricsSetParams = {}; - metricsSetParams.ApiMask = MetricsDiscovery::API_TYPE_IOSTREAM; - metricsSetParams.MetricsCount = 0; - metricsSetParams.SymbolName = "Metric set name"; - metricsSetParams.ShortName = "Metric set description"; - metricsSetParams.RawReportSize = 256; - - TypedValue_1_0 value = {}; - value.Type = ValueType::Uint32; - value.ValueUInt32 = 64; - - ContextHandle_1_0 contextHandle = {&value}; - - CommandBufferSize_1_0 commandBufferSize = {}; - commandBufferSize.GpuMemorySize = 100; - - EXPECT_CALL(*mockMetricEnumeration, loadMetricsDiscovery()) - .Times(0); - - EXPECT_CALL(*mockMetricEnumeration, isInitialized()) - .Times(1) - .WillOnce(Return(true)); - - EXPECT_CALL(*mockMetricsLibrary, getContextData(_, _)) - .Times(1) - .WillOnce(Return(true)); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockOpenMetricsDevice(_)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<0>(&metricsDevice), Return(TCompletionCode::CC_OK))); - - EXPECT_CALL(*mockMetricEnumeration->g_mockApi, MockCloseMetricsDevice(_)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockContextCreate(_, _, _)) - .Times(1) - .WillOnce(DoAll(::testing::SetArgPointee<2>(contextHandle), Return(StatusCode::Success))); - - EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockContextDelete(_)) - .Times(1) - .WillOnce(Return(StatusCode::Success)); - - EXPECT_CALL(metricsDevice, GetParams()) - .WillRepeatedly(Return(&metricsDeviceParams)); - - EXPECT_CALL(metricsDevice, GetConcurrentGroup(_)) - .Times(1) - .WillOnce(Return(&metricsConcurrentGroup)); - - EXPECT_CALL(metricsConcurrentGroup, GetParams()) - .Times(1) - .WillRepeatedly(Return(&metricsConcurrentGroupParams)); - - EXPECT_CALL(metricsConcurrentGroup, GetMetricSet(_)) - .WillRepeatedly(Return(&metricsSet)); - - EXPECT_CALL(metricsSet, GetParams()) - .WillRepeatedly(Return(&metricsSetParams)); - - EXPECT_CALL(metricsSet, SetApiFiltering(_)) - .WillRepeatedly(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(metricsConcurrentGroup, OpenIoStream(_, _, _, _)) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockCommandBufferGetSize(_, _)) - .Times(10) - .WillRepeatedly(DoAll(::testing::SetArgPointee<1>(::testing::ByRef(commandBufferSize)), Return(StatusCode::Success))); - - EXPECT_CALL(*mockMetricsLibrary->g_mockApi, MockCommandBufferGet(_)) - .Times(10) - .WillRepeatedly(Return(StatusCode::Success)); - - EXPECT_CALL(metricsConcurrentGroup, CloseIoStream()) - .Times(1) - .WillOnce(Return(TCompletionCode::CC_OK)); - - // Metric group count. - uint32_t metricGroupCount = 0; - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, nullptr), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - - // Metric group handle. - EXPECT_EQ(zetMetricGroupGet(metricDeviceHandle, &metricGroupCount, &metricGroupHandle), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupCount, 1u); - EXPECT_NE(metricGroupHandle, nullptr); - - // Metric group properties. - EXPECT_EQ(zetMetricGroupGetPropertiesExt(metricGroupHandle, &metricGroupProperties), ZE_RESULT_SUCCESS); - EXPECT_EQ(metricGroupProperties.domain, 0u); - EXPECT_EQ(metricGroupProperties.samplingType, ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED); - EXPECT_EQ(metricGroupProperties.metricCount, metricsSetParams.MetricsCount); - EXPECT_EQ(strcmp(metricGroupProperties.description, metricsSetParams.ShortName), 0); - EXPECT_EQ(strcmp(metricGroupProperties.name, metricsSetParams.SymbolName), 0); - - // Metric group activation. - EXPECT_EQ(zetDeviceActivateMetricGroups(metricDeviceHandle, 1, &metricGroupHandle), ZE_RESULT_SUCCESS); - - // Metric tracer open. - EXPECT_EQ(zetMetricTracerOpen(metricDeviceHandle, metricGroupHandle, &tracerDesc, eventHandle, &tracerHandle), ZE_RESULT_SUCCESS); - EXPECT_NE(tracerHandle, nullptr); - - // Metric tracer marker. - std::array markerValues = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; - for (auto &markerValue : markerValues) { - EXPECT_EQ(zetCommandListAppendMetricTracerMarker(commandList->toHandle(), tracerHandle, markerValue), ZE_RESULT_SUCCESS); - } - - // Metric tracer close. - EXPECT_EQ(zetMetricTracerClose(tracerHandle), ZE_RESULT_SUCCESS); -} - } // namespace ult } // namespace L0 diff --git a/level_zero/tools/test/unit_tests/sources/sysman/engine/linux/test_sysman_engine.cpp b/level_zero/tools/test/unit_tests/sources/sysman/engine/linux/test_sysman_engine.cpp index 60474cc891..7d19dc47b6 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/engine/linux/test_sysman_engine.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/engine/linux/test_sysman_engine.cpp @@ -60,7 +60,7 @@ class SysmanEngineFixture : public DeviceFixture, public ::testing::Test { ON_CALL(*pSysfsAccess, read(_, Matcher(_))) .WillByDefault(::testing::Invoke(pSysfsAccess, &Mock::getVal)); - pEngineImp->init(ZET_ENGINE_GROUP_COMPUTE_ALL); + pEngineImp->init(ZES_ENGINE_GROUP_COMPUTE_ALL); sysmanImp->pEngineHandleContext->handleList.push_back(pEngineImp); hSysman = sysmanImp->toHandle(); @@ -105,7 +105,7 @@ TEST_F(SysmanEngineFixture, GivenValidEngineHandleWhenCallingZetSysmanEngineGetP ze_result_t result = zetSysmanEngineGetProperties(hSysmanEngine, &properties); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(ZET_ENGINE_GROUP_COMPUTE_ALL, properties.type); + EXPECT_EQ(ZES_ENGINE_GROUP_COMPUTE_ALL, properties.type); EXPECT_FALSE(properties.onSubdevice); } TEST_F(SysmanEngineFixture, GivenValidEngineHandleWhenCallingZetSysmanGetActivityThenVerifySysmanEngineGetActivityCallReturnsUnsupportedErrorStatus) { @@ -117,7 +117,7 @@ TEST_F(SysmanEngineFixture, GivenValidEngineHandleWhenCallingZetSysmanGetActivit } TEST_F(SysmanEngineFixture, GivenEngineGroupEmptyWhenGettingEngineGroupAndIfRetrievedEngineGroupNotComputeThenErrorReturned) { - zet_engine_group_t engineGroup; + zes_engine_group_t engineGroup; ON_CALL(*pSysfsAccess, read(_, Matcher(_))) .WillByDefault(::testing::Invoke(pSysfsAccess, &Mock::getIncorrectVal)); EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pEngineImp->pOsEngine->getEngineGroup(engineGroup)); diff --git a/level_zero/tools/test/unit_tests/sources/sysman/fabric_port/linux/test_sysman_fabric_port.cpp b/level_zero/tools/test/unit_tests/sources/sysman/fabric_port/linux/test_sysman_fabric_port.cpp index 67e17a7e6d..f0658ed1b9 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/fabric_port/linux/test_sysman_fabric_port.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/fabric_port/linux/test_sysman_fabric_port.cpp @@ -61,18 +61,18 @@ TEST_F(SysmanFabricPortFixture, GivenPortCountZeroWhenCallingZetSysmanFabricPort TEST_F(SysmanFabricPortFixture, GivenPortCountZeroAndValidHandlePtrWhenCallingZetSysmanFabricPortGetThenCountIsReturnedAndNoHandlesReturnedAndVerifyFabricPortGetCallSucceeds) { uint32_t count = 0U; - zet_sysman_fabric_port_handle_t handle = static_cast(0UL); + zes_fabric_port_handle_t handle = static_cast(0UL); ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, &handle); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_EQ(count, SysmanFabricPortFixture::numPorts); - EXPECT_EQ(handle, static_cast(0UL)); + EXPECT_EQ(handle, static_cast(0UL)); } TEST_F(SysmanFabricPortFixture, GivenPortCountCorrectWhenCallingZetSysmanFabricPortGetThenCountHandlesAreReturnedAndAndVerifySysmanFabricPortGetCallSucceeds) { uint32_t count = SysmanFabricPortFixture::numPorts; - zet_sysman_fabric_port_handle_t hPorts[SysmanFabricPortFixture::numPorts]; + zes_fabric_port_handle_t hPorts[SysmanFabricPortFixture::numPorts]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -81,7 +81,7 @@ TEST_F(SysmanFabricPortFixture, GivenPortCountCorrectWhenCallingZetSysmanFabricP TEST_F(SysmanFabricPortFixture, GivenPortCountGreaterThanPortsWhenCallingZetSysmanFabricPortGetThenCorrectCountisReturnedAndAndVerifySysmanFabricPortGetCallSucceeds) { uint32_t count = SysmanFabricPortFixture::numPorts + 1U; - zet_sysman_fabric_port_handle_t hPorts[SysmanFabricPortFixture::numPorts + 1U]; + zes_fabric_port_handle_t hPorts[SysmanFabricPortFixture::numPorts + 1U]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -90,7 +90,7 @@ TEST_F(SysmanFabricPortFixture, GivenPortCountGreaterThanPortsWhenCallingZetSysm TEST_F(SysmanFabricPortFixture, GivenPortCounLessThanPortsWhenCallingZetSysmanFabricPortGetThenCountLessTanPortsHandlesAreReturned) { uint32_t count = SysmanFabricPortFixture::numPorts - 1U; - zet_sysman_fabric_port_handle_t hPorts[SysmanFabricPortFixture::numPorts - 1U]; + zes_fabric_port_handle_t hPorts[SysmanFabricPortFixture::numPorts - 1U]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -99,7 +99,7 @@ TEST_F(SysmanFabricPortFixture, GivenPortCounLessThanPortsWhenCallingZetSysmanFa TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFabricPortGetPropertiesThenZetSysmanFabricPortGetPropertiesCallSucceeds) { uint32_t count = 1U; - zet_sysman_fabric_port_handle_t hPorts[1U]; + zes_fabric_port_handle_t hPorts[1U]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -109,8 +109,8 @@ TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFa // Initialize values properties.onSubdevice = true; properties.subdeviceId = std::numeric_limits::max(); - std::memset(properties.model, std::numeric_limits::max(), ZET_MAX_FABRIC_PORT_MODEL_SIZE); - std::memset(properties.portUuid.id, std::numeric_limits::max(), ZET_MAX_FABRIC_PORT_UUID_SIZE); + std::memset(properties.model, std::numeric_limits::max(), ZES_MAX_FABRIC_PORT_MODEL_SIZE); + std::memset(properties.portUuid.id, std::numeric_limits::max(), ZES_MAX_FABRIC_PORT_UUID_SIZE); properties.maxRxSpeed.bitRate = std::numeric_limits::max(); properties.maxRxSpeed.width = std::numeric_limits::max(); properties.maxRxSpeed.maxBandwidth = std::numeric_limits::max(); @@ -125,7 +125,7 @@ TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFa EXPECT_EQ(0L, properties.subdeviceId); EXPECT_STREQ("EXAMPLE", reinterpret_cast(properties.model)); zet_fabric_port_uuid_t expectedUuid = {}; - EXPECT_TRUE(0 == std::memcmp(&expectedUuid, properties.portUuid.id, ZET_MAX_FABRIC_PORT_UUID_SIZE)); + EXPECT_TRUE(0 == std::memcmp(&expectedUuid, properties.portUuid.id, ZES_MAX_FABRIC_PORT_UUID_SIZE)); EXPECT_EQ(0LU, properties.maxRxSpeed.bitRate); EXPECT_EQ(0U, properties.maxRxSpeed.width); EXPECT_EQ(0LU, properties.maxRxSpeed.maxBandwidth); @@ -136,7 +136,7 @@ TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFa TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFabricPortGetLinkTypeThenZetSysmanFabricPortGetLinkTypeCallSucceeds) { uint32_t count = 1U; - zet_sysman_fabric_port_handle_t hPorts[1U]; + zes_fabric_port_handle_t hPorts[1U]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -157,7 +157,7 @@ TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFa TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFabricPortGetConfigThenZetSysmanFabricPortGetConfigCallSucceeds) { uint32_t count = 1U; - zet_sysman_fabric_port_handle_t hPorts[1U]; + zes_fabric_port_handle_t hPorts[1U]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -173,7 +173,7 @@ TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFa TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFabricPortSetConfigThenZetSysmanFabricPortGetConfigCallSucceeds) { uint32_t count = 1U; - zet_sysman_fabric_port_handle_t hPorts[1U]; + zes_fabric_port_handle_t hPorts[1U]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -194,7 +194,7 @@ TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFa TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFabricPortGetStateThenZetSysmanFabricPortGetStateCallSucceeds) { uint32_t count = 1U; - zet_sysman_fabric_port_handle_t hPorts[1U]; + zes_fabric_port_handle_t hPorts[1U]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -217,7 +217,7 @@ TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFa TEST_F(SysmanFabricPortFixture, GivenValidFabricPortHandleWhenCallingZetSysmanFabricPortGetThroughputThenZetSysmanFabricPortGetThroughputCallSucceeds) { uint32_t count = 1U; - zet_sysman_fabric_port_handle_t hPorts[1U]; + zes_fabric_port_handle_t hPorts[1U]; ze_result_t result = zetSysmanFabricPortGet(hSysman, &count, hPorts); EXPECT_EQ(ZE_RESULT_SUCCESS, result); diff --git a/level_zero/tools/test/unit_tests/sources/sysman/frequency/linux/test_sysman_frequency.cpp b/level_zero/tools/test/unit_tests/sources/sysman/frequency/linux/test_sysman_frequency.cpp index 0a18a6d11f..4463be33e8 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/frequency/linux/test_sysman_frequency.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/frequency/linux/test_sysman_frequency.cpp @@ -432,7 +432,7 @@ TEST_F(SysmanFrequencyFixture, GivenValidFrequencyHandleWhenCallingzetSysmanFreq TEST_F(SysmanFrequencyFixture, GivenValidFrequencyHandleAndZeroCountWhenCallingzetSysmanFrequencyGetAvailableClocksCallSucceeds) { uint32_t count = 0; - ze_result_t result = zetSysmanFrequencyGetAvailableClocks(hSysmanFrequency, &count, nullptr); + ze_result_t result = zesSysmanFrequencyGetAvailableClocks(hSysmanFrequency, &count, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_EQ(numClocks, count); diff --git a/level_zero/tools/test/unit_tests/sources/sysman/global_operations/linux/test_global_operations.cpp b/level_zero/tools/test/unit_tests/sources/sysman/global_operations/linux/test_global_operations.cpp index bcf95dd11e..3b84060f86 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/global_operations/linux/test_global_operations.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/global_operations/linux/test_global_operations.cpp @@ -27,10 +27,10 @@ constexpr int64_t memSize2 = 1024; // In mock function getValUnsignedLong, we have set the engines used as 0, 3 and 1. // Hence, expecting 28 as engine field because 28 in binary would be 00011100 // This indicates bit number 2, 3 and 4 are set, thus this indicates, this process -// used ZET_ENGINE_TYPE_3D, ZET_ENGINE_TYPE_MEDIA and ZET_ENGINE_TYPE_DMA +// used ZES_ENGINE_TYPE_FLAG_3D, ZES_ENGINE_TYPE_FLAG_MEDIA and ZES_ENGINE_TYPE_FLAG_DMA // Their corresponding mapping with i915 engine numbers are 0, 3 and 1 respectively. constexpr int64_t engines1 = 28u; -// 4 in binary 0100, as 2nd bit is set, hence it indicates, process used ZET_ENGINE_TYPE_3D +// 4 in binary 0100, as 2nd bit is set, hence it indicates, process used ZES_ENGINE_TYPE_FLAG_3D // Corresponding i915 mapped value in mocked getValUnsignedLong() is 0. constexpr int64_t engines2 = 4u; constexpr uint32_t totalProcessStates = 2u; // Two process States for two pids @@ -100,7 +100,7 @@ TEST_F(SysmanGlobalOperationsFixture, GivenValidSysmanHandleWhileRetrievingInfor uint32_t count = 0; ASSERT_EQ(ZE_RESULT_SUCCESS, zetSysmanProcessesGetState(hSysman, &count, nullptr)); EXPECT_EQ(count, totalProcessStates); - std::vector processes(count); + std::vector processes(count); ASSERT_EQ(ZE_RESULT_SUCCESS, zetSysmanProcessesGetState(hSysman, &count, processes.data())); EXPECT_EQ(processes[0].processId, pid1); EXPECT_EQ(processes[0].engines, engines1); diff --git a/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/dg1/test_sysman_memory.cpp b/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/dg1/test_sysman_memory.cpp index 1b1877df45..9866cc6db8 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/dg1/test_sysman_memory.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/memory/linux/dg1/test_sysman_memory.cpp @@ -33,7 +33,7 @@ class SysmanMemoryFixture : public DeviceFixture, public ::testing::Test { OsMemory *pOsMemory = nullptr; PublicLinuxMemoryImp linuxMemoryImp; MemoryImp *pMemoryImp = nullptr; - zet_sysman_mem_handle_t hSysmanMemory; + zes__mem_handle_t hSysmanMemory; void SetUp() override { DeviceFixture::SetUp(); @@ -80,28 +80,28 @@ TEST_F(SysmanMemoryFixture, GivenComponentCountZeroWhenCallingZetSysmanMemoryGet } TEST_F(SysmanMemoryFixture, GivenValidMemoryHandleWhenCallingzetSysmanMemoryGetPropertiesThenVerifySysmanMemoryGetPropertiesCallSucceeds) { - zet_mem_properties_t properties; + zes_mem_properties_t properties; ze_result_t result = zetSysmanMemoryGetProperties(hSysmanMemory, &properties); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(ZET_MEM_TYPE_DDR, properties.type); + EXPECT_EQ(ZES_MEM_TYPE_DDR, properties.type); EXPECT_FALSE(properties.onSubdevice); EXPECT_EQ(0u, properties.subdeviceId); EXPECT_EQ(0u, properties.physicalSize); } TEST_F(SysmanMemoryFixture, GivenValidMemoryHandleWhenCallingzetSysmanMemoryGetStateThenVerifySysmanMemoryGetStateCallSucceeds) { - zet_mem_state_t state; + zes_mem_state_t state; EXPECT_EQ(ZE_RESULT_SUCCESS, zetSysmanMemoryGetState(hSysmanMemory, &state)); - EXPECT_EQ(ZET_MEM_HEALTH_OK, state.health); + EXPECT_EQ(ZES_MEM_HEALTH_OK, state.health); EXPECT_EQ((probedSizeRegionOne - unallocatedSizeRegionOne), state.allocatedSize); EXPECT_EQ(probedSizeRegionOne, state.maxSize); } TEST_F(SysmanMemoryFixture, GivenValidMemoryHandleWhenCallingzetSysmanMemoryGetStateAndIfQueryMemoryInfoFailsThenErrorIsReturned) { - zet_mem_state_t state; + zes_mem_state_t state; ON_CALL(*pDrm, queryMemoryInfo()) .WillByDefault(::testing::Invoke(pDrm, &Mock::queryMemoryInfoMockReturnFalse)); @@ -109,7 +109,7 @@ TEST_F(SysmanMemoryFixture, GivenValidMemoryHandleWhenCallingzetSysmanMemoryGetS } TEST_F(SysmanMemoryFixture, GivenValidMemoryHandleWhenCallingzetSysmanMemoryGetStateAndIfQueryMemoryDidntProvideDeviceMemoryThenErrorIsReturned) { - zet_mem_state_t state; + zes_mem_state_t state; ON_CALL(*pDrm, queryMemoryInfo()) .WillByDefault(::testing::Invoke(pDrm, &Mock::queryMemoryInfoMockWithoutDevice)); diff --git a/level_zero/tools/test/unit_tests/sources/sysman/pci/linux/test_sysman_pci.cpp b/level_zero/tools/test/unit_tests/sources/sysman/pci/linux/test_sysman_pci.cpp index 0b478470ef..7ef1666a46 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/pci/linux/test_sysman_pci.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/pci/linux/test_sysman_pci.cpp @@ -117,7 +117,7 @@ class SysmanPciFixture : public ::testing::Test { }; TEST_F(SysmanPciFixture, GivenValidSysmanHandleWhenCallingzetSysmanPciGetPropertiesThenVerifyzetSysmanPciGetPropertiesCallSucceeds) { - zet_pci_properties_t properties, propertiesBefore; + zes_pci_properties_t properties, propertiesBefore; memset(&properties.address.bus, std::numeric_limits::max(), sizeof(properties.address.bus)); memset(&properties.address.device, std::numeric_limits::max(), sizeof(properties.address.device)); @@ -146,7 +146,7 @@ TEST_F(SysmanPciFixture, GivenValidSysmanHandleWhenCallingzetSysmanPciGetPropert } TEST_F(SysmanPciFixture, GivenValidSysmanHandleWhenSettingLmemSupportAndCallingzetSysmanPciGetPropertiesThenVerifyzetSysmanPciGetPropertiesCallSucceeds) { - zet_pci_properties_t properties, propertiesBefore; + zes_pci_properties_t properties, propertiesBefore; memoryManager->localMemorySupported[0] = 1; pciImp.init(); @@ -196,7 +196,7 @@ TEST_F(SysmanPciFixture, GivenValidSysmanHandleWhenCallingzetSysmanPciGetBarsThe EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_GT(count, 0u); - std::vector pciBarProps(count); + std::vector pciBarProps(count); result = zetSysmanPciGetBars(hSysman, &count, pciBarProps.data()); EXPECT_EQ(ZE_RESULT_SUCCESS, result); for (uint32_t i = 0; i < count; i++) { diff --git a/level_zero/tools/test/unit_tests/sources/sysman/power/linux/test_sysman_power.cpp b/level_zero/tools/test/unit_tests/sources/sysman/power/linux/test_sysman_power.cpp index 9132ca42cc..7cbc2bd43b 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/power/linux/test_sysman_power.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/power/linux/test_sysman_power.cpp @@ -100,9 +100,9 @@ TEST_F(SysmanDevicePowerFixture, GivenValidPowerHandleWhenSettingPowerEnergyThre class SysmanPowerFixture : public DeviceFixture, public ::testing::Test { protected: - std::unique_ptr sysmanImp; + std::unique_ptr sysmanImp; zet_sysman_handle_t hSysman; - zet_sysman_pwr_handle_t hSysmanPowerHandle; + zes_pwr_handle_t hSysmanPowerHandle; Mock *pPmt = nullptr; PowerImp *pPowerImp = nullptr; @@ -111,7 +111,7 @@ class SysmanPowerFixture : public DeviceFixture, public ::testing::Test { void SetUp() override { DeviceFixture::SetUp(); - sysmanImp = std::make_unique(device->toHandle()); + sysmanImp = std::make_unique(device->toHandle()); pPmt = new NiceMock>; OsPower *pOsPower = nullptr; @@ -154,14 +154,14 @@ TEST_F(SysmanPowerFixture, GivenComponentCountZeroWhenCallingZetSysmanPowerGetTh } TEST_F(SysmanPowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyCounterThenValidPowerReadingsRetrieved) { - zet_power_energy_counter_t energyCounter; + zes_power_energy_counter_t energyCounter; uint64_t expectedEnergyCounter = convertJouleToMicroJoule * setEnergyCounter; ASSERT_EQ(ZE_RESULT_SUCCESS, zetSysmanPowerGetEnergyCounter(hSysmanPowerHandle, &energyCounter)); EXPECT_EQ(energyCounter.energy, expectedEnergyCounter); } TEST_F(SysmanPowerFixture, GivenValidPowerHandleWhenGettingPowerEnergyThresholdThenUnsupportedFeatureErrorIsReturned) { - zet_energy_threshold_t threshold; + zes_energy_threshold_t threshold; EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetSysmanPowerGetEnergyThreshold(hSysmanPowerHandle, &threshold)); } diff --git a/level_zero/tools/test/unit_tests/sources/sysman/ras/linux/test_sysman_ras.cpp b/level_zero/tools/test/unit_tests/sources/sysman/ras/linux/test_sysman_ras.cpp index fdf638aecf..6f17c0fa24 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/ras/linux/test_sysman_ras.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/ras/linux/test_sysman_ras.cpp @@ -24,7 +24,7 @@ struct SysmanRasFixture : public DeviceFixture, public ::testing::Test { protected: std::unique_ptr sysmanImp; zet_sysman_handle_t hSysman; - zet_sysman_ras_handle_t hSysmanRas; + zes_ras_handle_t hSysmanRas; Mock *pFsAccess = nullptr; OsRas *pOsRas = nullptr; PublicLinuxRasImp linuxRasImp; @@ -43,9 +43,9 @@ struct SysmanRasFixture : public DeviceFixture, public ::testing::Test { .WillByDefault(::testing::Invoke(pFsAccess, &Mock::getVal)); ON_CALL(*pFsAccess, fileExists(_)) .WillByDefault(::testing::Invoke(pFsAccess, &Mock::checkFileExists)); - pRasImp->rasErrorType = ZET_RAS_ERROR_TYPE_UNCORRECTABLE; + pRasImp->rasErrorType = ZES_RAS_ERROR_TYPE_UNCORRECTABLE; pRasImp->init(); - pOsRas->setRasErrorType(ZET_RAS_ERROR_TYPE_UNCORRECTABLE); + pOsRas->setRasErrorType(ZES_RAS_ERROR_TYPE_UNCORRECTABLE); sysmanImp->pRasHandleContext->handleList.push_back(pRasImp); numRasHandlesSetup = sysmanImp->pRasHandleContext->handleList.size(); hSysman = sysmanImp->toHandle(); @@ -62,7 +62,7 @@ struct SysmanRasFixture : public DeviceFixture, public ::testing::Test { }; TEST_F(SysmanRasFixture, GivenValidRasHandleWhenCallingSysmanRasGetThenExpectCallToSucceed) { - zet_sysman_ras_handle_t rasHandle; + zes_ras_handle_t rasHandle; uint32_t count = 0; ze_result_t result = zetSysmanRasGet(hSysman, &count, NULL); @@ -86,7 +86,7 @@ TEST_F(SysmanRasFixture, GivenCorrectCounterNameWhenCheckingRasCounterSupportThe EXPECT_TRUE(pOsRas->isRasSupported()); } TEST_F(SysmanRasFixture, GivenCorrectableTypeWhenCheckingRasErrorSupportThenExpectFalse) { - pOsRas->setRasErrorType(ZET_RAS_ERROR_TYPE_CORRECTABLE); + pOsRas->setRasErrorType(ZES_RAS_ERROR_TYPE_CORRECTABLE); EXPECT_FALSE(pOsRas->isRasSupported()); } @@ -95,52 +95,14 @@ TEST_F(SysmanRasFixture, GivenIncorrectDirectoryNameWhenCheckingRasCounterSuppor EXPECT_FALSE(pOsRas->isRasSupported()); } -TEST_F(SysmanRasFixture, GivenIncorrectCounterNameWhenCheckingRasCounterValuesThenExpectFailure) { - pFsAccess->setResetCounterFileName("wrongrasEntry"); - zet_ras_details_t pDetails = {0u, 0u, 0u, 0u, 0u, 0u, 0u}; - EXPECT_NE(ZE_RESULT_SUCCESS, pOsRas->getCounterValues(&pDetails)); -} - TEST_F(SysmanRasFixture, GivenValidRasHandleWhenCallingSysmanGetPropertiesThenExpectCallToSucceed) { - zet_ras_properties_t properties; + zes_ras_properties_t properties; EXPECT_EQ(ZE_RESULT_SUCCESS, zetSysmanRasGetProperties(hSysmanRas, &properties)); - EXPECT_EQ(ZET_RAS_ERROR_TYPE_UNCORRECTABLE, properties.type); + EXPECT_EQ(ZES_RAS_ERROR_TYPE_UNCORRECTABLE, properties.type); EXPECT_FALSE(properties.onSubdevice); } -TEST_F(SysmanRasFixture, GivenValidRasHandleWhenCallingSysmanRasGetStateThenExpectCallToSucceed) { - zet_ras_details_t details, detailsBefore; - uint64_t totalErrors; - ze_result_t result; - memset(&details.numResets, std::numeric_limits::max(), sizeof(details.numResets)); - memset(&details.numProgrammingErrors, std::numeric_limits::max(), sizeof(details.numProgrammingErrors)); - memset(&details.numDriverErrors, std::numeric_limits::max(), sizeof(details.numDriverErrors)); - memset(&details.numComputeErrors, std::numeric_limits::max(), sizeof(details.numComputeErrors)); - memset(&details.numNonComputeErrors, std::numeric_limits::max(), sizeof(details.numNonComputeErrors)); - memset(&details.numCacheErrors, std::numeric_limits::max(), sizeof(details.numCacheErrors)); - memset(&details.numDisplayErrors, std::numeric_limits::max(), sizeof(details.numDisplayErrors)); - detailsBefore = details; - result = zetSysmanRasGetState(hSysmanRas, false, &totalErrors, &details); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_NE(details.numResets, detailsBefore.numResets); - EXPECT_NE(details.numProgrammingErrors, detailsBefore.numProgrammingErrors); - EXPECT_NE(details.numDriverErrors, detailsBefore.numDriverErrors); - EXPECT_NE(details.numComputeErrors, detailsBefore.numComputeErrors); - EXPECT_NE(details.numNonComputeErrors, detailsBefore.numNonComputeErrors); - EXPECT_NE(details.numCacheErrors, detailsBefore.numCacheErrors); - EXPECT_NE(details.numDisplayErrors, detailsBefore.numDisplayErrors); - - EXPECT_EQ(totalErrors, mockResetCount); - - EXPECT_EQ(details.numResets, mockResetCount); - EXPECT_NE(details.numProgrammingErrors, mockProgrammingErrorCount); - EXPECT_NE(details.numDriverErrors, mockDriverErrorCount); - EXPECT_NE(details.numComputeErrors, mockComputeErrorCount); - EXPECT_NE(details.numNonComputeErrors, mockNonComputeErrorCount); - EXPECT_NE(details.numCacheErrors, mockCacheErrorCount); - EXPECT_NE(details.numDisplayErrors, mockDisplayErrorCount); -} TEST_F(SysmanRasFixture, GivenNullptrForRasDetailsWhenCallingSysmanRasGetStateThenExpectCallToReturnTotalErrorsOnly) { uint64_t totalErrors; ze_result_t result; diff --git a/level_zero/tools/test/unit_tests/sources/sysman/scheduler/linux/test_sysman_scheduler.cpp b/level_zero/tools/test/unit_tests/sources/sysman/scheduler/linux/test_sysman_scheduler.cpp index ae554262f9..9e85fda2f9 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/scheduler/linux/test_sysman_scheduler.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/scheduler/linux/test_sysman_scheduler.cpp @@ -85,22 +85,22 @@ class SysmanSchedulerFixture : public DeviceFixture, public ::testing::Test { } } - zet_sched_mode_t fixtureGetCurrentMode(zet_sysman_handle_t hSysman) { - zet_sched_mode_t mode; + zes_sched_mode_t fixtureGetCurrentMode(zet_sysman_handle_t hSysman) { + zes_sched_mode_t mode; ze_result_t result = zetSysmanSchedulerGetCurrentMode(hSysman, &mode); EXPECT_EQ(ZE_RESULT_SUCCESS, result); return mode; } - zet_sched_timeout_properties_t fixtureGetTimeoutModeProperties(zet_sysman_handle_t hSysman, ze_bool_t getDefaults) { - zet_sched_timeout_properties_t config; + zes_sched_timeout_properties_t fixtureGetTimeoutModeProperties(zet_sysman_handle_t hSysman, ze_bool_t getDefaults) { + zes_sched_timeout_properties_t config; ze_result_t result = zetSysmanSchedulerGetTimeoutModeProperties(hSysman, getDefaults, &config); EXPECT_EQ(ZE_RESULT_SUCCESS, result); return config; } - zet_sched_timeslice_properties_t fixtureGetTimesliceModeProperties(zet_sysman_handle_t hSysman, ze_bool_t getDefaults) { - zet_sched_timeslice_properties_t config; + zes_sched_timeslice_properties_t fixtureGetTimesliceModeProperties(zet_sysman_handle_t hSysman, ze_bool_t getDefaults) { + zes_sched_timeslice_properties_t config; ze_result_t result = zetSysmanSchedulerGetTimesliceModeProperties(hSysman, getDefaults, &config); EXPECT_EQ(ZE_RESULT_SUCCESS, result); return config; @@ -109,7 +109,7 @@ class SysmanSchedulerFixture : public DeviceFixture, public ::testing::Test { TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedulerGetCurrentModeThenVerifyzetSysmanSchedulerGetCurrentModeCallSucceeds) { auto mode = fixtureGetCurrentMode(hSysman); - EXPECT_EQ(mode, ZET_SCHED_MODE_TIMESLICE); + EXPECT_EQ(mode, ZES_SCHED_MODE_TIMESLICE); } TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedulerGetTimeoutModePropertiesThenVerifyzetSysmanSchedulerGetTimeoutModePropertiesCallSucceeds) { @@ -136,7 +136,7 @@ TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedul TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedulerSetTimeoutModeThenVerifyzetSysmanSchedulerSetTimeoutModeCallSucceeds) { ze_bool_t needReboot; - zet_sched_timeout_properties_t setConfig; + zes_sched_timeout_properties_t setConfig; setConfig.watchdogTimeout = 10000u; ze_result_t result = zetSysmanSchedulerSetTimeoutMode(hSysman, &setConfig, &needReboot); EXPECT_EQ(ZE_RESULT_SUCCESS, result); @@ -144,12 +144,12 @@ TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedul auto getConfig = fixtureGetTimeoutModeProperties(hSysman, false); EXPECT_EQ(getConfig.watchdogTimeout, setConfig.watchdogTimeout); auto mode = fixtureGetCurrentMode(hSysman); - EXPECT_EQ(mode, ZET_SCHED_MODE_TIMEOUT); + EXPECT_EQ(mode, ZES_SCHED_MODE_TIMEOUT); } TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedulerSetTimesliceModeThenVerifyzetSysmanSchedulerSetTimesliceModeCallSucceeds) { ze_bool_t needReboot; - zet_sched_timeslice_properties_t setConfig; + zes_sched_timeslice_properties_t setConfig; setConfig.interval = 1000u; setConfig.yieldTimeout = 1000u; ze_result_t result = zetSysmanSchedulerSetTimesliceMode(hSysman, &setConfig, &needReboot); @@ -159,7 +159,7 @@ TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedul EXPECT_EQ(getConfig.interval, setConfig.interval); EXPECT_EQ(getConfig.yieldTimeout, setConfig.yieldTimeout); auto mode = fixtureGetCurrentMode(hSysman); - EXPECT_EQ(mode, ZET_SCHED_MODE_TIMESLICE); + EXPECT_EQ(mode, ZES_SCHED_MODE_TIMESLICE); } TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedulerSetExclusiveModeThenVerifyzetSysmanSchedulerSetExclusiveModeCallSucceeds) { @@ -168,13 +168,13 @@ TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedul EXPECT_EQ(ZE_RESULT_SUCCESS, result); EXPECT_FALSE(needReboot); auto mode = fixtureGetCurrentMode(hSysman); - EXPECT_EQ(mode, ZET_SCHED_MODE_EXCLUSIVE); + EXPECT_EQ(mode, ZES_SCHED_MODE_EXCLUSIVE); } TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedulerGetCurrentModeWhenSysfsNodeIsAbsentThenFailureIsReturned) { ON_CALL(*pSysfsAccess, read(_, _)) .WillByDefault(::testing::Invoke(pSysfsAccess, &Mock::getValForError)); - zet_sched_mode_t mode; + zes_sched_mode_t mode; ze_result_t result = zetSysmanSchedulerGetCurrentMode(hSysman, &mode); EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, result); } @@ -182,7 +182,7 @@ TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedul TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedulerGetTimeoutModePropertiesWithDefaultsWhenSysfsNodeIsAbsentThenFailureIsReturned) { ON_CALL(*pSysfsAccess, read(_, _)) .WillByDefault(::testing::Invoke(pSysfsAccess, &Mock::getValForError)); - zet_sched_timeout_properties_t config; + zes_sched_timeout_properties_t config; ze_result_t result = zetSysmanSchedulerGetTimeoutModeProperties(hSysman, true, &config); EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, result); } @@ -190,7 +190,7 @@ TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedul TEST_F(SysmanSchedulerFixture, GivenValidSysmanHandleWhenCallingzetSysmanSchedulerGetTimesliceModePropertiesWithDefaultsWhenSysfsNodeIsAbsentThenFailureIsReturned) { ON_CALL(*pSysfsAccess, read(_, _)) .WillByDefault(::testing::Invoke(pSysfsAccess, &Mock::getValForError)); - zet_sched_timeslice_properties_t config; + zes_sched_timeslice_properties_t config; ze_result_t result = zetSysmanSchedulerGetTimesliceModeProperties(hSysman, true, &config); EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, result); } diff --git a/level_zero/tools/test/unit_tests/sources/sysman/standby/linux/test_sysman_standby.cpp b/level_zero/tools/test/unit_tests/sources/sysman/standby/linux/test_sysman_standby.cpp index a4c39c72e3..6cef674c51 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/standby/linux/test_sysman_standby.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/standby/linux/test_sysman_standby.cpp @@ -32,7 +32,7 @@ constexpr int standbyModeDefault = 1; class SysmanStandbyFixture : public DeviceFixture, public ::testing::Test { protected: - std::unique_ptr sysmanImp; + std::unique_ptr sysmanImp; zet_sysman_handle_t hSysman; zet_sysman_standby_handle_t hSysmanStandby; Mock *pSysfsAccess = nullptr; @@ -43,7 +43,7 @@ class SysmanStandbyFixture : public DeviceFixture, public ::testing::Test { void SetUp() override { DeviceFixture::SetUp(); - sysmanImp = std::make_unique(device->toHandle()); + sysmanImp = std::make_unique(device->toHandle()); pSysfsAccess = new NiceMock>; linuxStandbyImp.pSysfsAccess = pSysfsAccess; pOsStandby = static_cast(&linuxStandbyImp); @@ -100,21 +100,21 @@ TEST_F(SysmanStandbyFixture, GivenValidStandbyHandleWhenCallingzetSysmanStandbyG ze_result_t result = zetSysmanStandbyGetProperties(hSysmanStandby, &properties); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(ZET_STANDBY_TYPE_GLOBAL, properties.type); + EXPECT_EQ(ZES_STANDBY_TYPE_GLOBAL, properties.type); EXPECT_FALSE(properties.onSubdevice); } TEST_F(SysmanStandbyFixture, GivenValidStandbyHandleWhenCallingzetSysmanStandbyGetModeThenVerifyzetSysmanStandbyGetModeCallSucceeds) { - zet_standby_promo_mode_t mode; + zes_standby_promo_mode_t mode; ze_result_t result = zetSysmanStandbyGetMode(hSysmanStandby, &mode); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - EXPECT_EQ(ZET_STANDBY_PROMO_MODE_DEFAULT, mode); + EXPECT_EQ(ZES_STANDBY_PROMO_MODE_DEFAULT, mode); } TEST_F(SysmanStandbyFixture, GivenValidStandbyHandleWhenCallingzetSysmanStandbySetModeThenVerifySysmanzetStandbySetModeCallSucceeds) { - ze_result_t result = zetSysmanStandbySetMode(hSysmanStandby, ZET_STANDBY_PROMO_MODE_NEVER); + ze_result_t result = zetSysmanStandbySetMode(hSysmanStandby, ZES_STANDBY_PROMO_MODE_NEVER); EXPECT_EQ(result, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); } diff --git a/level_zero/tools/test/unit_tests/sources/sysman/temperature/linux/test_sysman_temperature.cpp b/level_zero/tools/test/unit_tests/sources/sysman/temperature/linux/test_sysman_temperature.cpp index b4a34304e7..a28a06ba23 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/temperature/linux/test_sysman_temperature.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/temperature/linux/test_sysman_temperature.cpp @@ -42,7 +42,7 @@ class SysmanTemperatureFixture : public DeviceFixture, public ::testing::Test { for (uint32_t i = 0; i < handleCount; i++) { linuxTemperatureImp[i].pPmt = pPmt; - linuxTemperatureImp[i].setSensorType(static_cast(i)); + linuxTemperatureImp[i].setSensorType(static_cast(i)); OsTemperature *pOsTemperature = static_cast(&linuxTemperatureImp[i]); pTemperatureImp[i] = new TemperatureImp(); pTemperatureImp[i]->pOsTemperature = pOsTemperature; @@ -135,7 +135,7 @@ TEST_F(SysmanTemperatureFixture, GivenOsSysmanPointerWhenCreatingOsTemperaturePo auto pLinuxSysmanImpTest = std::make_unique(sysmanImp.get()); pLinuxSysmanImpTest->pPmt = new PlatformMonitoringTech(); auto pOsSysmanTest = static_cast(pLinuxSysmanImpTest.get()); - auto pOsTemperatureTest = OsTemperature::create(pOsSysmanTest, ZET_TEMP_SENSORS_GLOBAL); + auto pOsTemperatureTest = OsTemperature::create(pOsSysmanTest, ZES_TEMP_SENSORS_GLOBAL); EXPECT_NE(pOsTemperatureTest, nullptr); delete pOsTemperatureTest; } diff --git a/level_zero/tools/test/unit_tests/sources/sysman/test_sysman.cpp b/level_zero/tools/test/unit_tests/sources/sysman/test_sysman.cpp index a2e997fc20..47bdf99235 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/test_sysman.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/test_sysman.cpp @@ -16,8 +16,8 @@ using SysmanGetTest = Test; TEST_F(SysmanGetTest, whenCallingZetSysmanGetWithoutCallingZetInitThenUnitializedIsReturned) { zet_sysman_handle_t hSysman; - zet_sysman_version_t version = ZET_SYSMAN_VERSION_CURRENT; - ze_result_t res = zetSysmanGet(device->toHandle(), version, &hSysman); + + ze_result_t res = zetSysmanGet(device->toHandle(), &hSysman); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, res); } diff --git a/manifests/manifest.yml b/manifests/manifest.yml index 8bf1543e6f..c6da19c19d 100644 --- a/manifests/manifest.yml +++ b/manifests/manifest.yml @@ -14,7 +14,7 @@ components: infra: branch: infra dest_dir: infra - revision: c04d188ae49ed3d7e5c3cd6e871dc1e29df631e6 + revision: 0a6a620bba78c7978cc82d96c6f9f7b78575faac type: git internal: branch: master @@ -30,7 +30,7 @@ components: branch: master dest_dir: level_zero repository: https://github.com/oneapi-src/level-zero - revision: v0.91.10 + revision: v1.0 type: git libva: dest_dir: libva diff --git a/third_party/level_zero/ze_api_ext.h b/third_party/level_zero/ze_api_ext.h deleted file mode 100644 index ba452d5d93..0000000000 --- a/third_party/level_zero/ze_api_ext.h +++ /dev/null @@ -1,1330 +0,0 @@ -/* - * - * Copyright (C) 2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - * - */ -#ifndef _ZE_API_EXT_H -#define _ZE_API_EXT_H -#if defined(__cplusplus) -#pragma once -#endif - -// standard headers -#include - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -// Intel 'oneAPI' Level-Zero API common types -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_APICALL -#if defined(_WIN32) -/// @brief Calling convention for all API functions -#define ZE_APICALL __cdecl -#else -#define ZE_APICALL -#endif // defined(_WIN32) -#endif // ZE_APICALL - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_APIEXPORT -#if defined(_WIN32) -/// @brief Microsoft-specific dllexport storage-class attribute -#define ZE_APIEXPORT __declspec(dllexport) -#else -#define ZE_APIEXPORT -#endif // defined(_WIN32) -#endif // ZE_APIEXPORT - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_DLLEXPORT -#if defined(_WIN32) -/// @brief Microsoft-specific dllexport storage-class attribute -#define ZE_DLLEXPORT __declspec(dllexport) -#endif // defined(_WIN32) -#endif // ZE_DLLEXPORT - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_DLLEXPORT -#if __GNUC__ >= 4 -/// @brief GCC-specific dllexport storage-class attribute -#define ZE_DLLEXPORT __attribute__((visibility("default"))) -#else -#define ZE_DLLEXPORT -#endif // __GNUC__ >= 4 -#endif // ZE_DLLEXPORT - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ze_kernel_uuid_t -typedef struct _ze_kernel_uuid_t ze_kernel_uuid_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ze_context_desc_t -typedef struct _ze_context_desc_t ze_context_desc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of driver's context object -typedef struct _ze_context_handle_t *ze_context_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Supported context creation flags -typedef uint32_t ze_context_flags_t; -typedef enum _ze_context_flag_t { - ZE_CONTEXT_FLAG_TBD = ZE_BIT(0), ///< reserved for future use - ZE_CONTEXT_FLAG_FORCE_UINT32 = 0x7fffffff - -} ze_context_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Context descriptor -typedef struct _ze_context_desc_t { - ze_context_flags_t flags; ///< [in] creation flags. - ///< must be 0 (default) or a valid combination of ::ze_context_flag_t; - ///< default behavior may use implicit driver-based heuristics. - -} ze_context_desc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates a context for the driver. -/// -/// @details -/// - The application must only use the context for the driver which was -/// provided during creation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDriver` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == phContext` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x1 < desc->flags` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeContextCreate( - ze_driver_handle_t hDriver, ///< [in] handle of the driver object - const ze_context_desc_t *desc, ///< [in] pointer to context descriptor - ze_context_handle_t *phContext ///< [out] pointer to handle of context object created -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Destroys a context. -/// -/// @details -/// - The application must ensure the device is not currently referencing -/// the context before it is deleted. -/// - The implementation of this function may immediately free all Host and -/// Device allocations associated with this context. -/// - The application must **not** call this function from simultaneous -/// threads with the same context handle. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE -ZE_APIEXPORT ze_result_t ZE_APICALL -zeContextDestroy( - ze_context_handle_t hContext ///< [in][release] handle of context object to destroy -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Returns current status of the context. -/// -/// @details -/// - The application may call this function from simultaneous threads with -/// the same context handle. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_SUCCESS -/// + Context is available for use. -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// + Context is invalid; due to device lost or reset. -ZE_APIEXPORT ze_result_t ZE_APICALL -zeContextGetStatus( - ze_context_handle_t hContext ///< [in] handle of context object -); - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_MAX_KERNEL_UUID_SIZE -/// @brief Maximum kernel universal unique id (UUID) size in bytes -#define ZE_MAX_KERNEL_UUID_SIZE 16 -#endif // ZE_MAX_KERNEL_UUID_SIZE - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_MAX_MODULE_UUID_SIZE -/// @brief Maximum module universal unique id (UUID) size in bytes -#define ZE_MAX_MODULE_UUID_SIZE 16 -#endif // ZE_MAX_MODULE_UUID_SIZE - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Kernel universal unique id (UUID) -typedef struct _ze_kernel_uuid_t { - uint8_t kid[ZE_MAX_KERNEL_UUID_SIZE]; ///< [out] opaque data representing a kernel UUID - uint8_t mid[ZE_MAX_MODULE_UUID_SIZE]; ///< [out] opaque data representing the kernel's module UUID - -} ze_kernel_uuid_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Kernel properties -typedef struct _ze_kernel_propertiesExt_t { - uint32_t numKernelArgs; ///< [out] number of kernel arguments. - uint32_t requiredGroupSizeX; ///< [out] required group size in the X dimension, - ///< or zero if there is no required group size - uint32_t requiredGroupSizeY; ///< [out] required group size in the Y dimension, - ///< or zero if there is no required group size - uint32_t requiredGroupSizeZ; ///< [out] required group size in the Z dimension, - ///< or zero if there is no required group size - uint32_t requiredNumSubGroups; ///< [out] required number of subgroups per thread group, - ///< or zero if there is no required number of subgroups - uint32_t requiredSubgroupSize; ///< [out] required subgroup size, - ///< or zero if there is no required subgroup size - uint32_t maxSubgroupSize; ///< [out] maximum subgroup size - uint32_t maxNumSubgroups; ///< [out] maximum number of subgroups per thread group - uint32_t localMemSize; ///< [out] local memory size used by each thread group - uint32_t privateMemSize; ///< [out] private memory size allocated by compiler used by each thread - uint32_t spillMemSize; ///< [out] spill memory size allocated by compiler - ze_kernel_uuid_t uuid; ///< [out] universal unique identifier. - char name[ZE_MAX_KERNEL_NAME]; ///< [out] kernel name - -} ze_kernel_propertiesExt_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieve kernel properties. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hKernel` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pKernelProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelGetPropertiesExt( - ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object - ze_kernel_propertiesExt_t *pKernelProperties ///< [in,out] query result for kernel properties. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Dynamically link modules together that share import/export linkage -/// dependencies. -/// -/// @details -/// - Modules support import and export linkage for functions and global -/// variables. -/// - Modules that have imports can be dynamically linked to export modules -/// that satisfy those import requirements. -/// - Modules can have both import and export linkages. -/// - Modules that do not have any imports or exports do not need to be -/// linked. -/// - Modules cannot be partially linked. All modules needed to satisfy all -/// import dependencies for a module must be passed in or -/// ::ZE_RESULT_ERROR_MODULE_LINK_FAILURE will returned. -/// - Modules with imports need to be linked before kernel objects can be -/// created from them. -/// - Modules will only be linked once. A module can be used in multiple -/// link calls if it has exports but it's imports will not be re-linked. -/// - Ambiguous dependencies, where multiple modules satisfy the import -/// dependencies for another module, is not allowed. -/// - ModuleGetNativeBinary can be called on any module regardless of -/// whether it is linked or not. -/// - A link log can optionally be returned to the caller. The caller is -/// responsible for destroying build log using ::zeModuleBuildLogDestroy. -/// - See SPIR-V specification for linkage details. -/// - The application may call this function from simultaneous threads as -/// long as the import modules being linked are not the same. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == phModules` -/// - ::ZE_RESULT_ERROR_MODULE_LINK_FAILURE -ZE_APIEXPORT ze_result_t ZE_APICALL -zeModuleDynamicLinkExt( - uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. - ze_module_handle_t *phModules, ///< [in][range(0, numModules)] pointer to an array of modules to - ///< dynamically link together. - ze_module_build_log_handle_t *phLinkLog ///< [out][optional] pointer to handle of dynamic link log. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Supported command queue group property flags -typedef uint32_t ze_command_queue_group_property_flags_t; -typedef enum _ze_command_queue_group_property_flag_t { - ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE = ZE_BIT(0), ///< Command queue group supports enqueing compute commands. - ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY = ZE_BIT(1), ///< Command queue group supports enqueing copy commands. - ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS = ZE_BIT(2), ///< Command queue group supports cooperative kernels. - ///< See ::zeCommandListAppendLaunchCooperativeKernel for more details. - ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS = ZE_BIT(3), ///< Command queue groups supports metric streamers and queries. - ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff - -} ze_command_queue_group_property_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Command queue group properties queried using -/// ::zeDeviceGetCommandQueueGroupProperties -typedef struct _ze_command_queue_group_properties_t { - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_command_queue_group_property_flags_t flags; ///< [out] 0 (none) or a valid combination of - ///< ::ze_command_queue_group_property_flag_t - size_t maxMemoryFillPatternSize; ///< [out] maximum `pattern_size` supported by command queue group. - ///< See ::zeCommandListAppendMemoryFill for more details. - uint32_t numQueues; ///< [out] the number of physical command queues within the group. - -} ze_command_queue_group_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieves command queue group properties of the device. -/// -/// @details -/// - Properties are reported for each physical command queue type supported -/// by the device. -/// - Multiple calls to this function will return properties in the same -/// order. -/// - The order in which the properties are returned defines the command -/// queue group's ordinal. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @remarks -/// _Analogues_ -/// - **vkGetPhysicalDeviceQueueFamilyProperties** -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceGetCommandQueueGroupProperties( - ze_device_handle_t hDevice, ///< [in] handle of the device - uint32_t *pCount, ///< [in,out] pointer to the number of command queue group properties. - ///< if count is zero, then the driver will update the value with the total - ///< number of command queue group properties available. - ///< if count is non-zero, then driver will only retrieve that number of - ///< command queue group properties. - ///< if count is larger than the number of command queue group properties - ///< available, then the driver will update the value with the correct - ///< number of command queue group properties available. - ze_command_queue_group_properties_t *pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for - ///< command queue group properties -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Appends a memory write of the device's global timestamp value into a -/// command list. -/// -/// @details -/// - The application must ensure the events are accessible by the device on -/// which the command list was created. -/// - The timestamp frequency can be queried from -/// ::ze_device_properties_t.timerResolution. -/// - The number of valid bits in the timestamp value can be queried from -/// ::ze_device_properties_t.timestampValidBits. -/// - The application must ensure the memory pointed to by dstptr is -/// accessible by the device on which the command list was created. -/// - The application must ensure the command list and events were created, -/// and the memory was allocated, on the same context. -/// - The application must **not** call this function from simultaneous -/// threads with the same command list handle. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hCommandList` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == dstptr` -/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT -/// - ::ZE_RESULT_ERROR_INVALID_SIZE -/// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListAppendWriteGlobalTimestampExt( - ze_command_list_handle_t hCommandList, ///< [in] handle of the command list - uint64_t *dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must - ///< be 8byte-aligned. - ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion - uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; - ///< must be 0 if `nullptr == phWaitEvents` - ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait - ///< on before executing query -); - -#ifndef ZE_MAX_EXTENSION_NAME -/// @brief Maximum extension name string size -#define ZE_MAX_EXTENSION_NAME 256 -#endif // ZE_MAX_EXTENSION_NAME - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Extension properties queried using ::zeDriverGetExtensionProperties -typedef struct _ze_driver_extension_properties_t { - char name[ZE_MAX_EXTENSION_NAME]; ///< [out] extension name - uint32_t version; ///< [out] extension version using ::ZE_MAKE_VERSION - -} ze_driver_extension_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieves extension properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @remarks -/// _Analogues_ -/// - **vkEnumerateInstanceExtensionProperties** -/// -/// + `nullptr == hDriver` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDriverGetExtensionProperties( - ze_driver_handle_t hDriver, ///< [in] handle of the driver instance - uint32_t *pCount, ///< [in,out] pointer to the number of extension properties. - ///< if count is zero, then the driver will update the value with the total - ///< number of extension properties available. - ///< if count is non-zero, then driver will only retrieve that number of - ///< extension properties. - ///< if count is larger than the number of extension properties available, - ///< then the driver will update the value with the correct number of - ///< extension properties available. - ze_driver_extension_properties_t *pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for - ///< extension properties -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Allocates shared memory on the context. -/// -/// @details -/// - Shared allocations share ownership between the host and one or more -/// devices. -/// - Shared allocations may optionally be associated with a device by -/// passing a handle to the device. -/// - Devices supporting only single-device shared access capabilities may -/// access shared memory associated with the device. -/// For these devices, ownership of the allocation is shared between the -/// host and the associated device only. -/// - Passing nullptr as the device handle does not associate the shared -/// allocation with any device. -/// For allocations with no associated device, ownership of the allocation -/// is shared between the host and all devices supporting cross-device -/// shared access capabilities. -/// - The application must only use the memory allocation for the context -/// and device, or its sub-devices, which was provided during allocation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == deviceDesc` -/// + `nullptr == hostDesc` -/// + `nullptr == pptr` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x3 < deviceDesc->flags` -/// + `0x7 < hostDesc->flags` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT -/// + Must be zero or a power-of-two -/// + `0 != (alignment & (alignment - 1))` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemAllocShared( - ze_context_handle_t hContext, ///< [in] handle of the context object - const ze_device_mem_alloc_desc_t *deviceDesc, ///< [in] pointer to device memory allocation descriptor - const ze_host_mem_alloc_desc_t *hostDesc, ///< [in] pointer to host memory allocation descriptor - size_t size, ///< [in] size in bytes to allocate; must be less-than - ///< ::ze_device_properties_t.maxMemAllocSize. - size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of - ///< two. - ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with - void **pptr ///< [out] pointer to shared allocation -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Allocates device memory on the context. -/// -/// @details -/// - Device allocations are owned by a specific device. -/// - In general, a device allocation may only be accessed by the device -/// that owns it. -/// - The application must only use the memory allocation for the context -/// and device, or its sub-devices, which was provided during allocation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == deviceDesc` -/// + `nullptr == pptr` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x3 < deviceDesc->flags` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT -/// + Must be zero or a power-of-two -/// + `0 != (alignment & (alignment - 1))` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemAllocDevice( - ze_context_handle_t hContext, ///< [in] handle of the context object - const ze_device_mem_alloc_desc_t *deviceDesc, ///< [in] pointer to device memory allocation descriptor - size_t size, ///< [in] size in bytes to allocate; must be less-than - ///< ::ze_device_properties_t.maxMemAllocSize. - size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of - ///< two. - ze_device_handle_t hDevice, ///< [in] handle of the device - void **pptr ///< [out] pointer to device allocation -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Allocates host memory on the context. -/// -/// @details -/// - Host allocations are owned by the host process. -/// - Host allocations are accessible by the host and all devices within the -/// driver's context. -/// - Host allocations are frequently used as staging areas to transfer data -/// to or from devices. -/// - The application must only use the memory allocation for the context -/// which was provided during allocation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == hostDesc` -/// + `nullptr == pptr` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x7 < hostDesc->flags` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT -/// + Must be zero or a power-of-two -/// + `0 != (alignment & (alignment - 1))` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemAllocHost( - ze_context_handle_t hContext, ///< [in] handle of the context object - const ze_host_mem_alloc_desc_t *hostDesc, ///< [in] pointer to host memory allocation descriptor - size_t size, ///< [in] size in bytes to allocate; must be less-than - ///< ::ze_device_properties_t.maxMemAllocSize. - size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of - ///< two. - void **pptr ///< [out] pointer to host allocation -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frees allocated host memory, device memory, or shared memory on the -/// context. -/// -/// @details -/// - The application must ensure the device is not currently referencing -/// the memory before it is freed -/// - The implementation of this function may immediately free all Host and -/// Device allocations associated with this memory -/// - The application must **not** call this function from simultaneous -/// threads with the same pointer. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemFree( - ze_context_handle_t hContext, ///< [in] handle of the context object - void *ptr ///< [in][release] pointer to memory to free -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieves attributes of a memory allocation -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The application may query attributes of a memory allocation unrelated -/// to the context. -/// When this occurs, the returned allocation type will be -/// ::ZE_MEMORY_TYPE_UNKNOWN, and the returned identifier and associated -/// device is unspecified. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -/// + `nullptr == pMemAllocProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemGetAllocProperties( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr, ///< [in] memory pointer to query - ze_memory_allocation_properties_t *pMemAllocProperties, ///< [in,out] query result for memory allocation properties - ze_device_handle_t *phDevice ///< [out][optional] device associated with this allocation -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieves the base address and/or size of an allocation -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemGetAddressRange( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr, ///< [in] memory pointer to query - void **pBase, ///< [in,out][optional] base address of the allocation - size_t *pSize ///< [in,out][optional] size of the allocation -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Supported IPC memory flags -typedef uint32_t ze_ipc_memory_flags_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Opens an IPC memory handle to retrieve a device pointer on the -/// context. -/// -/// @details -/// - Takes an IPC memory handle from a remote process and associates it -/// with a device pointer usable in this process. -/// - The device pointer in this process should not be freed with -/// ::zeMemFree, but rather with ::zeMemCloseIpcHandle. -/// - Multiple calls to this function with the same IPC handle will return -/// unique pointers. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x1 < flags` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pptr` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemOpenIpcHandle( - 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 - ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle - ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. - ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. - void **pptr ///< [out] pointer to device allocation in this process -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Closes an IPC memory handle -/// -/// @details -/// - Closes an IPC memory handle by unmapping memory that was opened in -/// this process using ::zeMemOpenIpcHandle. -/// - The application must **not** call this function from simultaneous -/// threads with the same pointer. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemCloseIpcHandle( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr ///< [in][release] pointer to device allocation in this process -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates an IPC memory handle for the specified allocation -/// -/// @details -/// - Takes a pointer to a device memory allocation and creates an IPC -/// memory handle for exporting it for use in another process. -/// - The pointer must be base pointer of the device memory allocation; i.e. -/// the value returned from ::zeMemAllocDevice. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -/// + `nullptr == pIpcHandle` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeMemGetIpcHandle( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr, ///< [in] pointer to the device memory allocation - ze_ipc_mem_handle_t *pIpcHandle ///< [out] Returned IPC memory handle -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates a module on the context. -/// -/// @details -/// - Compiles the module for execution on the device. -/// - The application must only use the module for the device, or its -/// sub-devices, which was provided during creation. -/// - The module can be copied to other devices and contexts within the same -/// driver instance by using ::zeModuleGetNativeBinary. -/// - A build log can optionally be returned to the caller. The caller is -/// responsible for destroying build log using ::zeModuleBuildLogDestroy. -/// - The module descriptor constants are only supported for SPIR-V -/// specialization constants. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == desc->pInputModule` -/// + `nullptr == phModule` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_MODULE_FORMAT_NATIVE < desc->format` -/// - ::ZE_RESULT_ERROR_INVALID_NATIVE_BINARY -/// - ::ZE_RESULT_ERROR_INVALID_SIZE -/// + `0 == desc->inputSize` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -/// - ::ZE_RESULT_ERROR_MODULE_BUILD_FAILURE -ZE_APIEXPORT ze_result_t ZE_APICALL -zeModuleCreateExt( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device - const ze_module_desc_t *desc, ///< [in] pointer to module descriptor - ze_module_handle_t *phModule, ///< [out] pointer to handle of module object created - ze_module_build_log_handle_t *phBuildLog ///< [out][optional] pointer to handle of module's build log. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates sampler on the context. -/// -/// @details -/// - The application must only use the sampler for the device, or its -/// sub-devices, which was provided during creation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == phSampler` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_SAMPLER_ADDRESS_MODE_MIRROR < desc->addressMode` -/// + `::ZE_SAMPLER_FILTER_MODE_LINEAR < desc->filterMode` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeSamplerCreateExt( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device - const ze_sampler_desc_t *desc, ///< [in] pointer to sampler descriptor - ze_sampler_handle_t *phSampler ///< [out] handle of the sampler -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates a command queue on the context. -/// -/// @details -/// - A command queue represents a logical input stream to the device, tied -/// to a physical input stream. -/// - The application must only use the command queue for the device, or its -/// sub-devices, which was provided during creation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @remarks -/// _Analogues_ -/// - **clCreateCommandQueue** -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == phCommandQueue` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x1 < desc->flags` -/// + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < desc->mode` -/// + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < desc->priority` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandQueueCreateExt( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object - const ze_command_queue_desc_t *desc, ///< [in] pointer to command queue descriptor - ze_command_queue_handle_t *phCommandQueue ///< [out] pointer to handle of command queue object created -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates a command list on the context. -/// -/// @details -/// - A command list represents a sequence of commands for execution on a -/// command queue. -/// - The command list is created in the 'open' state. -/// - The application must only use the command list for the device, or its -/// sub-devices, which was provided during creation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == phCommandList` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x7 < desc->flags` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListCreateExt( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object - const ze_command_list_desc_t *desc, ///< [in] pointer to command list descriptor - ze_command_list_handle_t *phCommandList ///< [out] pointer to handle of command list object created -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates an immediate command list on the context. -/// -/// @details -/// - An immediate command list is used for low-latency submission of -/// commands. -/// - An immediate command list creates an implicit command queue. -/// - The command list is created in the 'open' state and never needs to be -/// closed. -/// - The application must only use the command list for the device, or its -/// sub-devices, which was provided during creation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == altdesc` -/// + `nullptr == phCommandList` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x1 < altdesc->flags` -/// + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < altdesc->mode` -/// + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < altdesc->priority` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeCommandListCreateImmediateExt( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object - const ze_command_queue_desc_t *altdesc, ///< [in] pointer to command queue descriptor - ze_command_list_handle_t *phCommandList ///< [out] pointer to handle of command list object created -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of physical memory object -typedef struct _ze_physical_mem_handle_t *ze_physical_mem_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Virtual memory page access attributes -typedef enum _ze_memory_access_attribute_t { - ZE_MEMORY_ACCESS_ATTRIBUTE_NONE = 0, ///< Indicates the memory page is inaccessible. - ZE_MEMORY_ACCESS_ATTRIBUTE_READWRITE = 1, ///< Indicates the memory page supports read write access. - ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY = 2, ///< Indicates the memory page supports read-only access. - ZE_MEMORY_ACCESS_ATTRIBUTE_FORCE_UINT32 = 0x7fffffff - -} ze_memory_access_attribute_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reserves pages in virtual address space. -/// -/// @details -/// - The application must only use the memory allocation on the context for -/// which it was created. -/// - The starting address and size must be page aligned. See -/// ::zeVirtualMemQueryPageSize. -/// - If pStart is not null then implementation will attempt to reserve -/// starting from that address. If not available then will find another -/// suitable starting address. -/// - The application may call this function from simultaneous threads. -/// - The access attributes will default to none to indicate reservation is -/// inaccessible. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pStart` -/// + `nullptr == pptr` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -ZE_APIEXPORT ze_result_t ZE_APICALL -zeVirtualMemReserve( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *pStart, ///< [in] pointer to start of region to reserve. If nullptr then - ///< implementation will choose a start address. - size_t size, ///< [in] size in bytes to reserve; must be page aligned. - void **pptr ///< [out] pointer to virtual reservation. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Free pages in a reserved virtual address range. -/// -/// @details -/// - Any existing virtual mappings for the range will be unmapped. -/// - Physical allocations objects that were mapped to this range will not -/// be destroyed. These need to be destroyed explicitly. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT -ZE_APIEXPORT ze_result_t ZE_APICALL -zeVirtualMemFree( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr, ///< [in] pointer to start of region to free. - size_t size ///< [in] size in bytes to free; must be page aligned. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Queries page size to use for aligning virtual memory reservations and -/// physical memory allocations. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pagesize` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeVirtualMemQueryPageSize( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object - size_t size, ///< [in] unaligned allocation size in bytes - size_t *pagesize ///< [out] pointer to page size to use for start address and size - ///< alignments. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Supported physical memory creation flags -typedef uint32_t ze_physical_mem_flags_t; -typedef enum _ze_physical_mem_flag_t { - ZE_PHYSICAL_MEM_FLAG_TBD = ZE_BIT(0), ///< reserved for future use. - ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32 = 0x7fffffff - -} ze_physical_mem_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Physical memory descriptor -typedef struct _ze_physical_mem_desc_t { - const void *pNext; ///< [in][optional] pointer to extension-specific structure - ze_physical_mem_flags_t flags; ///< [in] creation flags. - ///< must be 0 (default) or a valid combination of ::ze_physical_mem_flag_t. - size_t size; ///< [in] size in bytes to reserve; must be page aligned. - -} ze_physical_mem_desc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates a physical memory object for the context. -/// -/// @details -/// - The application must only use the physical memory object on the -/// context for which it was created. -/// - The size must be page aligned. See ::zeVirtualMemQueryPageSize. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == phPhysicalMemory` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x1 < desc->flags` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == desc->size` -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT -ZE_APIEXPORT ze_result_t ZE_APICALL -zePhysicalMemCreate( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device object - ze_physical_mem_desc_t *desc, ///< [in] pointer to physical memory descriptor. - ze_physical_mem_handle_t *phPhysicalMemory ///< [out] pointer to handle of physical memory object created -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Destroys a physical memory object. -/// -/// @details -/// - The application must ensure the device is not currently referencing -/// the physical memory object before it is deleted -/// - The application must **not** call this function from simultaneous -/// threads with the same physical memory handle. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hPhysicalMemory` -/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE -ZE_APIEXPORT ze_result_t ZE_APICALL -zePhysicalMemDestroy( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Maps pages in virtual address space to pages from physical memory -/// object. -/// -/// @details -/// - The virtual address range must have been reserved using -/// ::zeVirtualMemReserve. -/// - The application must only use the mapped memory allocation on the -/// context for which it was created. -/// - The virtual start address and size must be page aligned. See -/// ::zeVirtualMemQueryPageSize. -/// - The application should use, for the starting address and size, the -/// same size alignment used for the physical allocation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hPhysicalMemory` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT -ZE_APIEXPORT ze_result_t ZE_APICALL -zeVirtualMemMap( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr, ///< [in] pointer to start of virtual address range to map. - size_t size, ///< [in] size in bytes of virtual address range to map; must be page - ///< aligned. - ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. - size_t offset, ///< [in] offset into physical memory allocation object; must be page - ///< aligned. - ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address - ///< range. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Unmaps pages in virtual address space from pages from a physical -/// memory object. -/// -/// @details -/// - The page access attributes for virtual address range will revert back -/// to none. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY -/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT - "Address must be page aligned" -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// + Size must be page aligned -ZE_APIEXPORT ze_result_t ZE_APICALL -zeVirtualMemUnmap( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr, ///< [in] pointer to start of region to unmap. - size_t size ///< [in] size in bytes to unmap; must be page aligned. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set memory access attributes for a virtual address range. -/// -/// @details -/// - This function may be called from simultaneous threads with the same -/// function handle. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT - "Address must be page aligned" -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// + Size must be page aligned -ZE_APIEXPORT ze_result_t ZE_APICALL -zeVirtualMemSetAccessAttribute( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr, ///< [in] pointer to start of reserved virtual address region. - size_t size, ///< [in] size in bytes; must be page aligned. - ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address - ///< range. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get memory access attribute for a virtual address range. -/// -/// @details -/// - If size and outSize are equal then the pages in the specified virtual -/// address range have the same access attributes. -/// - This function may be called from simultaneous threads with the same -/// function handle. -/// - The implementation of this function should be lock-free. -/// -/// @brief Forward-declare ze_kernel_timestamp_data_t -typedef struct _ze_kernel_timestamp_data_t ze_kernel_timestamp_data_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Kernel timestamp clock data -/// -/// @details -/// - The timestamp frequency can be queried from -/// ::ze_device_properties_t.timerResolution. -/// - The number of valid bits in the timestamp value can be queried from -/// ::ze_device_properties_t.kernelTimestampValidBits. -typedef struct _ze_kernel_timestamp_data_t { - uint64_t kernelStart; ///< [out] device clock at start of kernel execution - uint64_t kernelEnd; ///< [out] device clock at end of kernel execution - -} ze_kernel_timestamp_data_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ze_kernel_timestamp_result_t -typedef struct _ze_kernel_timestamp_result_t ze_kernel_timestamp_result_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Kernel timestamp result -typedef struct _ze_kernel_timestamp_result_t { - ze_kernel_timestamp_data_t global; ///< [out] wall-clock data - ze_kernel_timestamp_data_t context; ///< [out] context-active data; only includes clocks while device context - ///< was actively executing. - -} ze_kernel_timestamp_result_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Queries an event's timestamp value on the host. -/// -/// @details -/// - The application must ensure the event was created from an event pool -/// that was created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag. -/// - The destination memory will be unmodified if the event has not been -/// signaled. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -/// + `nullptr == access` -/// + `nullptr == outSize` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT - "Address must be page aligned" -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE -/// + `0 == size` -/// + Size must be page aligned -ZE_APIEXPORT ze_result_t ZE_APICALL -zeVirtualMemGetAccessAttribute( - ze_context_handle_t hContext, ///< [in] handle of the context object - const void *ptr, ///< [in] pointer to start of virtual address region for query. - size_t size, ///< [in] size in bytes; must be page aligned. - ze_memory_access_attribute_t *access, ///< [out] query result for page access attribute. - size_t *outSize ///< [out] query result for size of virtual address range, starting at ptr, - ///< that shares same access attribute. -); - -/// + `nullptr == hEvent` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == dstptr` -/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT -/// - ::ZE_RESULT_NOT_READY -/// + not signaled -ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventQueryKernelTimestampExt( - ze_event_handle_t hEvent, ///< [in] handle of the event - ze_kernel_timestamp_result_t *dstptr ///< [in,out] pointer to memory for where timestamp result will be written. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieve kernel name from Kernel. -/// -/// @details -/// - The caller can pass nullptr for pName when querying only for size. -/// - The implementation will copy the kernel name into a buffer supplied by -/// the caller. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hKernel` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSize` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeKernelGetName( - ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object - size_t *pSize, ///< [in,out] size of kernel name string, including null terminator, in - ///< bytes. - char *pName ///< [in,out][optional] char pointer to kernel name. -); - -} // extern "C" -#endif // _ZE_API_EXT_H diff --git a/third_party/level_zero/zes_api_ext.h b/third_party/level_zero/zes_api_ext.h deleted file mode 100644 index c8fc236714..0000000000 --- a/third_party/level_zero/zes_api_ext.h +++ /dev/null @@ -1,4402 +0,0 @@ -/* - * - * Copyright (C) 2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ -#ifndef _ZES_API_EXT_H -#define _ZES_API_EXT_H -#if defined(__cplusplus) -#pragma once -#endif - -// 'core' API headers -#include "third_party/level_zero/ze_api_ext.h" - -#if defined(__cplusplus) -extern "C" { -#endif - -// Intel 'oneAPI' Level-Zero Sysman API common types - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle to a driver instance -typedef ze_driver_handle_t zes_driver_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of device object -typedef ze_device_handle_t zes_device_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device scheduler queue -typedef struct _zes_sched_handle_t *zes_sched_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device performance factors -typedef struct _zes_perf_handle_t *zes_perf_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device power domain -typedef struct _zes_pwr_handle_t *zes_pwr_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device frequency domain -typedef struct _zes_freq_handle_t *zes_freq_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device engine group -typedef struct _zes_engine_handle_t *zes_engine_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device standby control -typedef struct _zes_standby_handle_t *zes_standby_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device firmware -typedef struct _zes_firmware_handle_t *zes_firmware_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device memory module -typedef struct _zes_mem_handle_t *zes_mem_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman fabric port -typedef struct _zes_fabric_port_handle_t *zes_fabric_port_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device temperature sensor -typedef struct _zes_temp_handle_t *zes_temp_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device power supply -typedef struct _zes_psu_handle_t *zes_psu_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device fan -typedef struct _zes_fan_handle_t *zes_fan_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device LED -typedef struct _zes_led_handle_t *zes_led_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device RAS error set -typedef struct _zes_ras_handle_t *zes_ras_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a Sysman device diagnostics test suite -typedef struct _zes_diag_handle_t *zes_diag_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Defines structure types -typedef enum _zes_structure_type_t { - ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES = 0x1, ///< ::zes_device_properties_t - ZES_STRUCTURE_TYPE_PCI_PROPERTIES = 0x2, ///< ::zes_pci_properties_t - ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES = 0x3, ///< ::zes_pci_bar_properties_t - ZES_STRUCTURE_TYPE_DIAG_PROPERTIES = 0x4, ///< ::zes_diag_properties_t - ZES_STRUCTURE_TYPE_ENGINE_PROPERTIES = 0x5, ///< ::zes_engine_properties_t - ZES_STRUCTURE_TYPE_FABRIC_PORT_PROPERTIES = 0x6, ///< ::zes_fabric_port_properties_t - ZES_STRUCTURE_TYPE_FAN_PROPERTIES = 0x7, ///< ::zes_fan_properties_t - ZES_STRUCTURE_TYPE_FIRMWARE_PROPERTIES = 0x8, ///< ::zes_firmware_properties_t - ZES_STRUCTURE_TYPE_FREQ_PROPERTIES = 0x9, ///< ::zes_freq_properties_t - ZES_STRUCTURE_TYPE_LED_PROPERTIES = 0xa, ///< ::zes_led_properties_t - ZES_STRUCTURE_TYPE_MEM_PROPERTIES = 0xb, ///< ::zes_mem_properties_t - ZES_STRUCTURE_TYPE_PERF_PROPERTIES = 0xc, ///< ::zes_perf_properties_t - ZES_STRUCTURE_TYPE_POWER_PROPERTIES = 0xd, ///< ::zes_power_properties_t - ZES_STRUCTURE_TYPE_PSU_PROPERTIES = 0xe, ///< ::zes_psu_properties_t - ZES_STRUCTURE_TYPE_RAS_PROPERTIES = 0xf, ///< ::zes_ras_properties_t - ZES_STRUCTURE_TYPE_SCHED_PROPERTIES = 0x10, ///< ::zes_sched_properties_t - ZES_STRUCTURE_TYPE_SCHED_TIMEOUT_PROPERTIES = 0x11, ///< ::zes_sched_timeout_properties_t - ZES_STRUCTURE_TYPE_SCHED_TIMESLICE_PROPERTIES = 0x12, ///< ::zes_sched_timeslice_properties_t - ZES_STRUCTURE_TYPE_STANDBY_PROPERTIES = 0x13, ///< ::zes_standby_properties_t - ZES_STRUCTURE_TYPE_TEMP_PROPERTIES = 0x14, ///< ::zes_temp_properties_t - ZES_STRUCTURE_TYPE_DEVICE_STATE = 0x15, ///< ::zes_device_state_t - ZES_STRUCTURE_TYPE_PROCESS_STATE = 0x16, ///< ::zes_process_state_t - ZES_STRUCTURE_TYPE_PCI_STATE = 0x17, ///< ::zes_pci_state_t - ZES_STRUCTURE_TYPE_FABRIC_PORT_CONFIG = 0x18, ///< ::zes_fabric_port_config_t - ZES_STRUCTURE_TYPE_FABRIC_PORT_STATE = 0x19, ///< ::zes_fabric_port_state_t - ZES_STRUCTURE_TYPE_FAN_CONFIG = 0x1a, ///< ::zes_fan_config_t - ZES_STRUCTURE_TYPE_FREQ_STATE = 0x1b, ///< ::zes_freq_state_t - ZES_STRUCTURE_TYPE_OC_CAPABILITIES = 0x1c, ///< ::zes_oc_capabilities_t - ZES_STRUCTURE_TYPE_LED_STATE = 0x1d, ///< ::zes_led_state_t - ZES_STRUCTURE_TYPE_MEM_STATE = 0x1e, ///< ::zes_mem_state_t - ZES_STRUCTURE_TYPE_PSU_STATE = 0x1f, ///< ::zes_psu_state_t - ZES_STRUCTURE_TYPE_BASE_STATE = 0x20, ///< ::zes_base_state_t - ZES_STRUCTURE_TYPE_RAS_CONFIG = 0x21, ///< ::zes_ras_config_t - ZES_STRUCTURE_TYPE_RAS_STATE = 0x22, ///< ::zes_ras_state_t - ZES_STRUCTURE_TYPE_TEMP_CONFIG = 0x23, ///< ::zes_temp_config_t - ZES_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff - -} zes_structure_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Base for all properties types -typedef struct _zes_base_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - -} zes_base_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Base for all descriptor types -typedef struct _zes_base_desc_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - -} zes_base_desc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Base for all state types -typedef struct _zes_base_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - -} zes_base_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Base for all config types -typedef struct _zes_base_config_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - -} zes_base_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Base for all capability types -typedef struct _zes_base_capability_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - -} zes_base_capability_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_base_properties_t -typedef struct _zes_base_properties_t zes_base_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_base_desc_t -typedef struct _zes_base_desc_t zes_base_desc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_base_state_t -typedef struct _zes_base_state_t zes_base_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_base_config_t -typedef struct _zes_base_config_t zes_base_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_base_capability_t -typedef struct _zes_base_capability_t zes_base_capability_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_device_state_t -typedef struct _zes_device_state_t zes_device_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_device_properties_t -typedef struct _zes_device_properties_t zes_device_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_process_state_t -typedef struct _zes_process_state_t zes_process_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_pci_address_t -typedef struct _zes_pci_address_t zes_pci_address_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_pci_speed_t -typedef struct _zes_pci_speed_t zes_pci_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_pci_properties_t -typedef struct _zes_pci_properties_t zes_pci_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_pci_state_t -typedef struct _zes_pci_state_t zes_pci_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_pci_bar_properties_t -typedef struct _zes_pci_bar_properties_t zes_pci_bar_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_pci_stats_t -typedef struct _zes_pci_stats_t zes_pci_stats_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_diag_test_t -typedef struct _zes_diag_test_t zes_diag_test_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_diag_properties_t -typedef struct _zes_diag_properties_t zes_diag_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_engine_properties_t -typedef struct _zes_engine_properties_t zes_engine_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_engine_stats_t -typedef struct _zes_engine_stats_t zes_engine_stats_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fabric_port_id_t -typedef struct _zes_fabric_port_id_t zes_fabric_port_id_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fabric_port_speed_t -typedef struct _zes_fabric_port_speed_t zes_fabric_port_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fabric_port_properties_t -typedef struct _zes_fabric_port_properties_t zes_fabric_port_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fabric_link_type_t -typedef struct _zes_fabric_link_type_t zes_fabric_link_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fabric_port_config_t -typedef struct _zes_fabric_port_config_t zes_fabric_port_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fabric_port_state_t -typedef struct _zes_fabric_port_state_t zes_fabric_port_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fabric_port_throughput_t -typedef struct _zes_fabric_port_throughput_t zes_fabric_port_throughput_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fan_speed_t -typedef struct _zes_fan_speed_t zes_fan_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fan_temp_speed_t -typedef struct _zes_fan_temp_speed_t zes_fan_temp_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fan_speed_table_t -typedef struct _zes_fan_speed_table_t zes_fan_speed_table_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fan_properties_t -typedef struct _zes_fan_properties_t zes_fan_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_fan_config_t -typedef struct _zes_fan_config_t zes_fan_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_firmware_properties_t -typedef struct _zes_firmware_properties_t zes_firmware_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_freq_properties_t -typedef struct _zes_freq_properties_t zes_freq_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_freq_range_t -typedef struct _zes_freq_range_t zes_freq_range_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_freq_state_t -typedef struct _zes_freq_state_t zes_freq_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_freq_throttle_time_t -typedef struct _zes_freq_throttle_time_t zes_freq_throttle_time_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_oc_capabilities_t -typedef struct _zes_oc_capabilities_t zes_oc_capabilities_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_led_properties_t -typedef struct _zes_led_properties_t zes_led_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_led_color_t -typedef struct _zes_led_color_t zes_led_color_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_led_state_t -typedef struct _zes_led_state_t zes_led_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_mem_properties_t -typedef struct _zes_mem_properties_t zes_mem_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_mem_state_t -typedef struct _zes_mem_state_t zes_mem_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_mem_bandwidth_t -typedef struct _zes_mem_bandwidth_t zes_mem_bandwidth_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_perf_properties_t -typedef struct _zes_perf_properties_t zes_perf_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_power_properties_t -typedef struct _zes_power_properties_t zes_power_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_power_energy_counter_t -typedef struct _zes_power_energy_counter_t zes_power_energy_counter_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_power_sustained_limit_t -typedef struct _zes_power_sustained_limit_t zes_power_sustained_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_power_burst_limit_t -typedef struct _zes_power_burst_limit_t zes_power_burst_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_power_peak_limit_t -typedef struct _zes_power_peak_limit_t zes_power_peak_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_energy_threshold_t -typedef struct _zes_energy_threshold_t zes_energy_threshold_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_psu_properties_t -typedef struct _zes_psu_properties_t zes_psu_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_psu_state_t -typedef struct _zes_psu_state_t zes_psu_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_ras_properties_t -typedef struct _zes_ras_properties_t zes_ras_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_ras_state_t -typedef struct _zes_ras_state_t zes_ras_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_ras_config_t -typedef struct _zes_ras_config_t zes_ras_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_sched_properties_t -typedef struct _zes_sched_properties_t zes_sched_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_sched_timeout_properties_t -typedef struct _zes_sched_timeout_properties_t zes_sched_timeout_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_sched_timeslice_properties_t -typedef struct _zes_sched_timeslice_properties_t zes_sched_timeslice_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_standby_properties_t -typedef struct _zes_standby_properties_t zes_standby_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_temp_properties_t -typedef struct _zes_temp_properties_t zes_temp_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_temp_threshold_t -typedef struct _zes_temp_threshold_t zes_temp_threshold_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zes_temp_config_t -typedef struct _zes_temp_config_t zes_temp_config_t; - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Device management - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZES_STRING_PROPERTY_SIZE -/// @brief Maximum number of characters in string properties. -#define ZES_STRING_PROPERTY_SIZE 64 -#endif // ZES_STRING_PROPERTY_SIZE - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Types of accelerator engines -typedef uint32_t zes_engine_type_flags_t; -typedef enum _zes_engine_type_flag_t { - ZES_ENGINE_TYPE_FLAG_OTHER = ZE_BIT(0), ///< Undefined types of accelerators. - ZES_ENGINE_TYPE_FLAG_COMPUTE = ZE_BIT(1), ///< Engines that process compute kernels. - ZES_ENGINE_TYPE_FLAG_3D = ZE_BIT(2), ///< Engines that process 3D content - ZES_ENGINE_TYPE_FLAG_MEDIA = ZE_BIT(3), ///< Engines that process media workloads - ZES_ENGINE_TYPE_FLAG_DMA = ZE_BIT(4), ///< Engines that copy blocks of data - ZES_ENGINE_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff - -} zes_engine_type_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Device repair status -typedef enum _zes_repair_status_t { - ZES_REPAIR_STATUS_UNSUPPORTED = 0, ///< The device does not support in-field repairs. - ZES_REPAIR_STATUS_NOT_PERFORMED = 1, ///< The device has never been repaired. - ZES_REPAIR_STATUS_PERFORMED = 2, ///< The device has been repaired. - ZES_REPAIR_STATUS_FORCE_UINT32 = 0x7fffffff - -} zes_repair_status_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Device reset reasons -typedef uint32_t zes_reset_reason_flags_t; -typedef enum _zes_reset_reason_flag_t { - ZES_RESET_REASON_FLAG_WEDGED = ZE_BIT(0), ///< The device needs to be reset because one or more parts of the hardware - ///< is wedged - ZES_RESET_REASON_FLAG_REPAIR = ZE_BIT(1), ///< The device needs to be reset in order to complete in-field repairs - ZES_RESET_REASON_FLAG_FORCE_UINT32 = 0x7fffffff - -} zes_reset_reason_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Device state -typedef struct _zes_device_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - zes_reset_reason_flags_t reset; ///< [out] Indicates if the device needs to be reset and for what reasons. - ///< returns 0 (none) or combination of ::zes_reset_reason_flag_t - zes_repair_status_t repaired; ///< [out] Indicates if the device has been repaired - -} zes_device_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Device properties -typedef struct _zes_device_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_device_properties_t core; ///< [out] Core device properties - uint32_t numSubdevices; ///< [out] Number of sub-devices. A value of 0 indicates that this device - ///< doesn't have sub-devices. - char serialNumber[ZES_STRING_PROPERTY_SIZE]; ///< [out] Manufacturing serial number (NULL terminated string value). Will - ///< be set to the string "unkown" if this cannot be determined for the - ///< device. - char boardNumber[ZES_STRING_PROPERTY_SIZE]; ///< [out] Manufacturing board number (NULL terminated string value). Will - ///< be set to the string "unkown" if this cannot be determined for the - ///< device. - char brandName[ZES_STRING_PROPERTY_SIZE]; ///< [out] Brand name of the device (NULL terminated string value). Will be - ///< set to the string "unkown" if this cannot be determined for the - ///< device. - char modelName[ZES_STRING_PROPERTY_SIZE]; ///< [out] Model name of the device (NULL terminated string value). Will be - ///< set to the string "unkown" if this cannot be determined for the - ///< device. - char vendorName[ZES_STRING_PROPERTY_SIZE]; ///< [out] Vendor name of the device (NULL terminated string value). Will - ///< be set to the string "unkown" if this cannot be determined for the - ///< device. - char driverVersion[ZES_STRING_PROPERTY_SIZE]; ///< [out] Installed driver version (NULL terminated string value). Will be - ///< set to the string "unkown" if this cannot be determined for the - ///< device. - -} zes_device_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get properties about the device -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceGetProperties( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - zes_device_properties_t *pProperties ///< [in,out] Structure that will contain information about the device. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get information about the state of the device - if a reset is -/// required, reasons for the reset and if the device has been repaired -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceGetState( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - zes_device_state_t *pState ///< [in,out] Structure that will contain information about the device. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reset device -/// -/// @details -/// - Performs a PCI bus reset of the device. This will result in all -/// current device state being lost. -/// - All applications using the device should be stopped before calling -/// this function. -/// - If the force argument is specified, all applications using the device -/// will be forcibly killed. -/// - The function will block until the device has restarted or a timeout -/// occurred waiting for the reset to complete. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to perform this operation. -/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE - "Reset cannot be performed because applications are using this device." -/// - ::ZE_RESULT_ERROR_UNKNOWN - "There were problems unloading the device driver, performing a bus reset or reloading the device driver." -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceReset( - zes_device_handle_t hDevice, ///< [in] Sysman handle for the device - ze_bool_t force ///< [in] If set to true, all applications that are currently using the - ///< device will be forcibly killed. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Contains information about a process that has an open connection with -/// this device -/// -/// @details -/// - The application can use the process ID to query the OS for the owner -/// and the path to the executable. -typedef struct _zes_process_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - uint32_t processId; ///< [out] Host OS process ID. - uint64_t memSize; ///< [out] Device memory size in bytes allocated by this process (may not - ///< necessarily be resident on the device at the time of reading). - uint64_t sharedSize; ///< [out] The size of shared device memory mapped into this process (may - ///< not necessarily be resident on the device at the time of reading). - zes_engine_type_flags_t engines; ///< [out] Bitfield of accelerator engine types being used by this process. - -} zes_process_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get information about host processes using the device -/// -/// @details -/// - The number of processes connected to the device is dynamic. This means -/// that between a call to determine the value of pCount and the -/// subsequent call, the number of processes may have increased or -/// decreased. It is recommended that a large array be passed in so as to -/// avoid receiving the error ::ZE_RESULT_ERROR_INVALID_SIZE. Also, always -/// check the returned value in pCount since it may be less than the -/// earlier call to get the required array size. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -/// - ::ZE_RESULT_ERROR_INVALID_SIZE -/// + The provided value of pCount is not big enough to store information about all the processes currently attached to the device. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceProcessesGetState( - zes_device_handle_t hDevice, ///< [in] Sysman handle for the device - uint32_t *pCount, ///< [in,out] pointer to the number of processes. - ///< if count is zero, then the driver will update the value with the total - ///< number of processes currently using the device. - ///< if count is non-zero but less than the number of processes, the driver - ///< will set to the number of processes currently using the device and - ///< return the error ::ZE_RESULT_ERROR_INVALID_SIZE. - ///< if count is larger than the number of processes, then the driver will - ///< update the value with the correct number of processes that are returned. - zes_process_state_t *pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information, - ///< one for each process currently using the device -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI address -typedef struct _zes_pci_address_t { - uint32_t domain; ///< [out] BDF domain - uint32_t bus; ///< [out] BDF bus - uint32_t device; ///< [out] BDF device - uint32_t function; ///< [out] BDF function - -} zes_pci_address_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI speed -typedef struct _zes_pci_speed_t { - int32_t gen; ///< [out] The link generation. A value of -1 means that this property is - ///< unknown. - int32_t width; ///< [out] The number of lanes. A value of -1 means that this property is - ///< unknown. - int64_t maxBandwidth; ///< [out] The maximum bandwidth in bytes/sec (sum of all lanes). A value - ///< of -1 means that this property is unknown. - -} zes_pci_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Static PCI properties -typedef struct _zes_pci_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zes_pci_address_t address; ///< [out] The BDF address - zes_pci_speed_t maxSpeed; ///< [out] Fastest port configuration supported by the device (sum of all - ///< lanes) - ze_bool_t haveBandwidthCounters; ///< [out] Indicates if ::zes_pci_stats_t.rxCounter and - ///< ::zes_pci_stats_t.txCounter will have valid values - ze_bool_t havePacketCounters; ///< [out] Indicates if ::zes_pci_stats_t.packetCounter will have valid - ///< values - ze_bool_t haveReplayCounters; ///< [out] Indicates if ::zes_pci_stats_t.replayCounter will have valid - ///< values - -} zes_pci_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI link status -typedef enum _zes_pci_link_status_t { - ZES_PCI_LINK_STATUS_UNKNOWN = 0, ///< The link status could not be determined - ZES_PCI_LINK_STATUS_GOOD = 1, ///< The link is up and operating as expected - ZES_PCI_LINK_STATUS_QUALITY_ISSUES = 2, ///< The link is up but has quality and/or bandwidth degradation - ZES_PCI_LINK_STATUS_STABILITY_ISSUES = 3, ///< The link has stability issues and preventing workloads making forward - ///< progress - ZES_PCI_LINK_STATUS_FORCE_UINT32 = 0x7fffffff - -} zes_pci_link_status_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI link quality degradation reasons -typedef uint32_t zes_pci_link_qual_issue_flags_t; -typedef enum _zes_pci_link_qual_issue_flag_t { - ZES_PCI_LINK_QUAL_ISSUE_FLAG_REPLAYS = ZE_BIT(0), ///< A significant number of replays are occurring - ZES_PCI_LINK_QUAL_ISSUE_FLAG_SPEED = ZE_BIT(1), ///< There is a degradation in the maximum bandwidth of the link - ZES_PCI_LINK_QUAL_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff - -} zes_pci_link_qual_issue_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI link stability issues -typedef uint32_t zes_pci_link_stab_issue_flags_t; -typedef enum _zes_pci_link_stab_issue_flag_t { - ZES_PCI_LINK_STAB_ISSUE_FLAG_RETRAINING = ZE_BIT(0), ///< Link retraining has occurred to deal with quality issues - ZES_PCI_LINK_STAB_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff - -} zes_pci_link_stab_issue_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Dynamic PCI state -typedef struct _zes_pci_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - zes_pci_link_status_t status; ///< [out] The current status of the port - zes_pci_link_qual_issue_flags_t qualityIssues; ///< [out] If status is ::ZES_PCI_LINK_STATUS_QUALITY_ISSUES, - ///< then this gives a combination of ::zes_pci_link_qual_issue_flag_t for - ///< quality issues that have been detected; - ///< otherwise, 0 indicates there are no quality issues with the link at - ///< this time." - zes_pci_link_stab_issue_flags_t stabilityIssues; ///< [out] If status is ::ZES_PCI_LINK_STATUS_STABILITY_ISSUES, - ///< then this gives a combination of ::zes_pci_link_stab_issue_flag_t for - ///< reasons for the connection instability; - ///< otherwise, 0 indicates there are no connection stability issues at - ///< this time." - zes_pci_speed_t speed; ///< [out] The current port configure speed - -} zes_pci_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI bar types -typedef enum _zes_pci_bar_type_t { - ZES_PCI_BAR_TYPE_MMIO = 0, ///< MMIO registers - ZES_PCI_BAR_TYPE_ROM = 1, ///< ROM aperture - ZES_PCI_BAR_TYPE_MEM = 2, ///< Device memory - ZES_PCI_BAR_TYPE_FORCE_UINT32 = 0x7fffffff - -} zes_pci_bar_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Properties of a pci bar -typedef struct _zes_pci_bar_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zes_pci_bar_type_t type; ///< [out] The type of bar - uint32_t index; ///< [out] The index of the bar - uint64_t base; ///< [out] Base address of the bar. - uint64_t size; ///< [out] Size of the bar. - -} zes_pci_bar_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI stats counters -/// -/// @details -/// - Percent replays is calculated by taking two snapshots (s1, s2) and -/// using the equation: %replay = 10^6 * (s2.replayCounter - -/// s1.replayCounter) / (s2.maxBandwidth * (s2.timestamp - s1.timestamp)) -/// - Percent throughput is calculated by taking two snapshots (s1, s2) and -/// using the equation: %bw = 10^6 * ((s2.rxCounter - s1.rxCounter) + -/// (s2.txCounter - s1.txCounter)) / (s2.maxBandwidth * (s2.timestamp - -/// s1.timestamp)) -typedef struct _zes_pci_stats_t { - uint64_t timestamp; ///< [out] Monotonic timestamp counter in microseconds when the measurement - ///< was made. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - uint64_t replayCounter; ///< [out] Monotonic counter for the number of replay packets (sum of all - ///< lanes). Will always be 0 if ::zes_pci_properties_t.haveReplayCounters - ///< is FALSE. - uint64_t packetCounter; ///< [out] Monotonic counter for the number of packets (sum of all lanes). - ///< Will always be 0 if ::zes_pci_properties_t.havePacketCounters is - ///< FALSE. - uint64_t rxCounter; ///< [out] Monotonic counter for the number of bytes received (sum of all - ///< lanes). Will always be 0 if - ///< ::zes_pci_properties_t.haveBandwidthCounters is FALSE. - uint64_t txCounter; ///< [out] Monotonic counter for the number of bytes transmitted (including - ///< replays) (sum of all lanes). Will always be 0 if - ///< ::zes_pci_properties_t.haveBandwidthCounters is FALSE. - zes_pci_speed_t speed; ///< [out] The current speed of the link (sum of all lanes) - -} zes_pci_stats_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get PCI properties - address, max speed -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDevicePciGetProperties( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - zes_pci_properties_t *pProperties ///< [in,out] Will contain the PCI properties. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current PCI state - current speed -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDevicePciGetState( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - zes_pci_state_t *pState ///< [in,out] Will contain the PCI properties. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get information about each configured bar -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDevicePciGetBars( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of PCI bars. - ///< if count is zero, then the driver will update the value with the total - ///< number of bars. - ///< if count is non-zero, then driver will only retrieve that number of bars. - ///< if count is larger than the number of bar, then the driver will update - ///< the value with the correct number of bars that are returned. - zes_pci_bar_properties_t *pProperties ///< [in,out][optional][range(0, *pCount)] array of bar properties -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get PCI stats - bandwidth, number of packets, number of replays -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pStats` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to query this telemetry. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDevicePciGetStats( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - zes_pci_stats_t *pStats ///< [in,out] Will contain a snapshot of the latest stats. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Diagnostic results -typedef enum _zes_diag_result_t { - ZES_DIAG_RESULT_NO_ERRORS = 0, ///< Diagnostic completed without finding errors to repair - ZES_DIAG_RESULT_ABORT = 1, ///< Diagnostic had problems running tests - ZES_DIAG_RESULT_FAIL_CANT_REPAIR = 2, ///< Diagnostic had problems setting up repairs - ZES_DIAG_RESULT_REBOOT_FOR_REPAIR = 3, ///< Diagnostics found errors, setup for repair and reboot is required to - ///< complete the process - ZES_DIAG_RESULT_FORCE_UINT32 = 0x7fffffff - -} zes_diag_result_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZES_DIAG_FIRST_TEST_INDEX -/// @brief Diagnostic test index to use for the very first test. -#define ZES_DIAG_FIRST_TEST_INDEX 0x0 -#endif // ZES_DIAG_FIRST_TEST_INDEX - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZES_DIAG_LAST_TEST_INDEX -/// @brief Diagnostic test index to use for the very last test. -#define ZES_DIAG_LAST_TEST_INDEX 0xFFFFFFFF -#endif // ZES_DIAG_LAST_TEST_INDEX - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Diagnostic test -typedef struct _zes_diag_test_t { - uint32_t index; ///< [out] Index of the test - char name[ZES_STRING_PROPERTY_SIZE]; ///< [out] Name of the test - -} zes_diag_test_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Diagnostics test suite properties -typedef struct _zes_diag_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - char name[ZES_STRING_PROPERTY_SIZE]; ///< [out] Name of the diagnostics test suite - ze_bool_t haveTests; ///< [out] Indicates if this test suite has individual tests which can be - ///< run separately (use the function ::zesDiagnosticsGetTests() to get the - ///< list of these tests) - -} zes_diag_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of diagnostics test suites -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumDiagnosticTestSuites( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_diag_handle_t *phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get properties of a diagnostics test suite -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDiagnostics` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDiagnosticsGetProperties( - zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. - zes_diag_properties_t *pProperties ///< [in,out] Structure describing the properties of a diagnostics test - ///< suite -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get individual tests that can be run separately. Not all test suites -/// permit running individual tests - check -/// ::zes_diag_properties_t.haveTests -/// -/// @details -/// - The list of available tests is returned in order of increasing test -/// index ::zes_diag_test_t.index. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDiagnostics` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDiagnosticsGetTests( - zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. - uint32_t *pCount, ///< [in,out] pointer to the number of tests. - ///< If count is zero, then the driver will update the value with the total - ///< number of tests available. - ///< If count is non-zero, then driver will only retrieve that number of tests. - ///< If count is larger than the number of tests available, then the driver - ///< will update the value with the correct number of tests available. - zes_diag_test_t *pTests ///< [in,out][optional][range(0, *pCount)] Array of tests sorted by - ///< increasing value of ::zes_diag_test_t.index -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Run a diagnostics test suite, either all tests or a subset of tests. -/// -/// @details -/// - WARNING: Performancing diagnostics may destroy current device state -/// information. Gracefully close any running workloads before initiating. -/// - To run all tests in a test suite, set start = -/// ::ZES_DIAG_FIRST_TEST_INDEX and end = ::ZES_DIAG_LAST_TEST_INDEX. -/// - If the test suite permits running individual tests, -/// ::zes_diag_properties_t.haveTests will be true. In this case, the -/// function ::zesDiagnosticsGetTests() can be called to get the list of -/// tests and corresponding indices that can be supplied to the arguments -/// start and end in this function. -/// - This function will block until the diagnostics have completed. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDiagnostics` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pResult` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to perform diagnostics. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDiagnosticsRunTests( - zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. - uint32_t start, ///< [in] The index of the first test to run. Set to - ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. - uint32_t end, ///< [in] The index of the last test to run. Set to - ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. - zes_diag_result_t *pResult ///< [in,out] The result of the diagnostics -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Engine groups - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Accelerator engine groups -typedef enum _zes_engine_group_t { - ZES_ENGINE_GROUP_ALL = 0, ///< Access information about all engines combined. - ZES_ENGINE_GROUP_COMPUTE_ALL = 1, ///< Access information about all compute/render engines combined. - ZES_ENGINE_GROUP_MEDIA_ALL = 2, ///< Access information about all media engines combined. - ZES_ENGINE_GROUP_COPY_ALL = 3, ///< Access information about all copy (blitter) engines combined. - ZES_ENGINE_GROUP_COMPUTE_SINGLE = 4, ///< Access information about a single compute engine. Note that single - ///< engines may share the same underlying accelerator resources as other - ///< engines so activity of such an engine may not be indicative of the - ///< underlying resource utilization - use ::ZES_ENGINE_GROUP_COMPUTE_ALL - ///< for that. - ZES_ENGINE_GROUP_RENDER_SINGLE = 5, ///< Access information about a single render engine. Note that single - ///< engines may share the same underlying accelerator resources as other - ///< engines so activity of such an engine may not be indicative of the - ///< underlying resource utilization - use ::ZES_ENGINE_GROUP_COMPUTE_ALL - ///< for that. - ZES_ENGINE_GROUP_MEDIA_DECODE_SINGLE = 6, ///< Access information about a single media decode engine. Note that - ///< single engines may share the same underlying accelerator resources as - ///< other engines so activity of such an engine may not be indicative of - ///< the underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL - ///< for that. - ZES_ENGINE_GROUP_MEDIA_ENCODE_SINGLE = 7, ///< Access information about a single media encode engine. Note that - ///< single engines may share the same underlying accelerator resources as - ///< other engines so activity of such an engine may not be indicative of - ///< the underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL - ///< for that. - ZES_ENGINE_GROUP_COPY_SINGLE = 8, ///< Access information about a single media encode engine. Note that - ///< single engines may share the same underlying accelerator resources as - ///< other engines so activity of such an engine may not be indicative of - ///< the underlying resource utilization - use ::ZES_ENGINE_GROUP_COPY_ALL - ///< for that. - ZES_ENGINE_GROUP_FORCE_UINT32 = 0x7fffffff - -} zes_engine_group_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Engine group properties -typedef struct _zes_engine_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zes_engine_group_t type; ///< [out] The engine group - ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - -} zes_engine_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Engine activity counters -/// -/// @details -/// - Percent utilization is calculated by taking two snapshots (s1, s2) and -/// using the equation: %util = (s2.activeTime - s1.activeTime) / -/// (s2.timestamp - s1.timestamp) -typedef struct _zes_engine_stats_t { - uint64_t activeTime; ///< [out] Monotonic counter for time in microseconds that this resource is - ///< actively running workloads. - uint64_t timestamp; ///< [out] Monotonic timestamp counter in microseconds when activeTime - ///< counter was sampled. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - -} zes_engine_stats_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of engine groups -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumEngineGroups( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_engine_handle_t *phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get engine group properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hEngine` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesEngineGetProperties( - zes_engine_handle_t hEngine, ///< [in] Handle for the component. - zes_engine_properties_t *pProperties ///< [in,out] The properties for the specified engine group. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the activity stats for an engine group -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hEngine` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pStats` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesEngineGetActivity( - zes_engine_handle_t hEngine, ///< [in] Handle for the component. - zes_engine_stats_t *pStats ///< [in,out] Will contain a snapshot of the engine group activity - ///< counters. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Event management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Event types -typedef uint32_t zes_event_type_flags_t; -typedef enum _zes_event_type_flag_t { - ZES_EVENT_TYPE_FLAG_DEVICE_DETACH = ZE_BIT(0), ///< Event is triggered when the device is no longer available (due to a - ///< reset or being disabled). - ZES_EVENT_TYPE_FLAG_DEVICE_ATTACH = ZE_BIT(1), ///< Event is triggered after the device is available again. - ZES_EVENT_TYPE_FLAG_DEVICE_SLEEP_STATE_ENTER = ZE_BIT(2), ///< Event is triggered when the driver is about to put the device into a - ///< deep sleep state - ZES_EVENT_TYPE_FLAG_DEVICE_SLEEP_STATE_EXIT = ZE_BIT(3), ///< Event is triggered when the driver is waking the device up from a deep - ///< sleep state - ZES_EVENT_TYPE_FLAG_FREQ_THROTTLED = ZE_BIT(4), ///< Event is triggered when the frequency starts being throttled - ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED = ZE_BIT(5), ///< Event is triggered when the energy consumption threshold is reached - ///< (use ::zesPowerSetEnergyThreshold() to configure). - ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL = ZE_BIT(6), ///< Event is triggered when the critical temperature is reached (use - ///< ::zesTemperatureSetConfig() to configure - disabled by default). - ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 = ZE_BIT(7), ///< Event is triggered when the temperature crosses threshold 1 (use - ///< ::zesTemperatureSetConfig() to configure - disabled by default). - ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 = ZE_BIT(8), ///< Event is triggered when the temperature crosses threshold 2 (use - ///< ::zesTemperatureSetConfig() to configure - disabled by default). - ZES_EVENT_TYPE_FLAG_MEM_HEALTH = ZE_BIT(9), ///< Event is triggered when the health of device memory changes. - ZES_EVENT_TYPE_FLAG_FABRIC_PORT_HEALTH = ZE_BIT(10), ///< Event is triggered when the health of fabric ports change. - ZES_EVENT_TYPE_FLAG_PCI_LINK_HEALTH = ZE_BIT(11), ///< Event is triggered when the health of the PCI link changes. - ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS = ZE_BIT(12), ///< Event is triggered when accelerator RAS correctable errors cross - ///< thresholds (use ::zesRasSetConfig() to configure - disabled by - ///< default). - ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS = ZE_BIT(13), ///< Event is triggered when accelerator RAS uncorrectable errors cross - ///< thresholds (use ::zesRasSetConfig() to configure - disabled by - ///< default). - ZES_EVENT_TYPE_FLAG_DEVICE_RESET_REQUIRED = ZE_BIT(14), ///< Event is triggered when the device needs to be reset (use - ///< ::zesDeviceGetState() to determine the reasons for the reset). - ZES_EVENT_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff - -} zes_event_type_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Specify the list of events to listen to for a given device -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x7fff < events` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEventRegister( - zes_device_handle_t hDevice, ///< [in] The device handle. - zes_event_type_flags_t events ///< [in] List of events to listen to. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Wait for events to be received from a one or more devices. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDriver` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == phDevices` -/// + `nullptr == pNumDeviceEvents` -/// + `nullptr == pEvents` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to listen to events. -/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT -/// + One or more of the supplied device handles belongs to a different driver. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDriverEventListen( - ze_driver_handle_t hDriver, ///< [in] handle of the driver instance - uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to - ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; - ///< if zero, then will check status and return immediately; - ///< if UINT32_MAX, then function will not return until events arrive. - uint32_t count, ///< [in] Number of device handles in phDevices. - zes_device_handle_t *phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only - ///< devices from the provided driver handle can be specified in this list. - uint32_t *pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that - ///< generated events. If non-zero, check pEvents to determine the devices - ///< and events that were received. - zes_event_type_flags_t *pEvents ///< [in,out] An array that will continue the list of events for each - ///< device listened in phDevices. - ///< This array must be at least as big as count. - ///< For every device handle in phDevices, this will provide the events - ///< that occurred for that device at the same position in this array. If - ///< no event was received for a given device, the corresponding array - ///< entry will be zero. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZES_MAX_FABRIC_PORT_MODEL_SIZE -/// @brief Maximum Fabric port model string size -#define ZES_MAX_FABRIC_PORT_MODEL_SIZE 256 -#endif // ZES_MAX_FABRIC_PORT_MODEL_SIZE - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZES_MAX_FABRIC_LINK_TYPE_SIZE -/// @brief Maximum size of the buffer that will return information about link -/// types -#define ZES_MAX_FABRIC_LINK_TYPE_SIZE 256 -#endif // ZES_MAX_FABRIC_LINK_TYPE_SIZE - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fabric port status -typedef enum _zes_fabric_port_status_t { - ZES_FABRIC_PORT_STATUS_UNKNOWN = 0, ///< The port status cannot be determined - ZES_FABRIC_PORT_STATUS_HEALTHY = 1, ///< The port is up and operating as expected - ZES_FABRIC_PORT_STATUS_DEGRADED = 2, ///< The port is up but has quality and/or speed degradation - ZES_FABRIC_PORT_STATUS_FAILED = 3, ///< Port connection instabilities are preventing workloads making forward - ///< progress - ZES_FABRIC_PORT_STATUS_DISABLED = 4, ///< The port is configured down - ZES_FABRIC_PORT_STATUS_FORCE_UINT32 = 0x7fffffff - -} zes_fabric_port_status_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fabric port quality degradation reasons -typedef uint32_t zes_fabric_port_qual_issue_flags_t; -typedef enum _zes_fabric_port_qual_issue_flag_t { - ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS = ZE_BIT(0), ///< Excessive link errors are occurring - ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED = ZE_BIT(1), ///< There is a degradation in the bitrate and/or width of the link - ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff - -} zes_fabric_port_qual_issue_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fabric port failure reasons -typedef uint32_t zes_fabric_port_failure_flags_t; -typedef enum _zes_fabric_port_failure_flag_t { - ZES_FABRIC_PORT_FAILURE_FLAG_FAILED = ZE_BIT(0), ///< A previously operating link has failed. Hardware will automatically - ///< retrain this port. This state will persist until either the physical - ///< connection is removed or the link trains successfully. - ZES_FABRIC_PORT_FAILURE_FLAG_TRAINING_TIMEOUT = ZE_BIT(1), ///< A connection has not been established within an expected time. - ///< Hardware will continue to attempt port training. This status will - ///< persist until either the physical connection is removed or the link - ///< successfully trains. - ZES_FABRIC_PORT_FAILURE_FLAG_FLAPPING = ZE_BIT(2), ///< Port has excessively trained and then transitioned down for some - ///< period of time. Driver will allow port to continue to train, but will - ///< not enable the port for use until the port has been disabled and - ///< subsequently re-enabled using ::zesFabricPortSetConfig(). - ZES_FABRIC_PORT_FAILURE_FLAG_FORCE_UINT32 = 0x7fffffff - -} zes_fabric_port_failure_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Unique identifier for a fabric port -/// -/// @details -/// - This not a universal identifier. The identified is garanteed to be -/// unique for the current hardware configuration of the system. Changes -/// in the hardware may result in a different identifier for a given port. -/// - The main purpose of this identifier to build up an instantaneous -/// topology map of system connectivity. An application should enumerate -/// all fabric ports and match ::zes_fabric_port_state_t.remotePortId to -/// ::zes_fabric_port_properties_t.portId. -typedef struct _zes_fabric_port_id_t { - uint32_t fabricId; ///< [out] Unique identifier for the fabric end-point - uint32_t attachId; ///< [out] Unique identifier for the device attachment point - uint8_t portNumber; ///< [out] The logical port number (this is typically marked somewhere on - ///< the physical device) - -} zes_fabric_port_id_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fabric port speed in one direction -typedef struct _zes_fabric_port_speed_t { - int64_t bitRate; ///< [out] Bits/sec that the link is operating at. A value of -1 means that - ///< this property is unknown. - int32_t width; ///< [out] The number of lanes. A value of -1 means that this property is - ///< unknown. - -} zes_fabric_port_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fabric port properties -typedef struct _zes_fabric_port_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - char model[ZES_MAX_FABRIC_PORT_MODEL_SIZE]; ///< [out] Description of port technology. Will be set to the string - ///< "unkown" if this cannot be determined for this port. - ze_bool_t onSubdevice; ///< [out] True if the port is located on a sub-device; false means that - ///< the port is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - zes_fabric_port_id_t portId; ///< [out] The unique port identifier - zes_fabric_port_speed_t maxRxSpeed; ///< [out] Maximum speed supported by the receive side of the port (sum of - ///< all lanes) - zes_fabric_port_speed_t maxTxSpeed; ///< [out] Maximum speed supported by the transmit side of the port (sum of - ///< all lanes) - -} zes_fabric_port_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Provides information about the fabric link attached to a port -typedef struct _zes_fabric_link_type_t { - char desc[ZES_MAX_FABRIC_LINK_TYPE_SIZE]; ///< [out] This provides a static textural description of the physic - ///< attachment type. Will be set to the string "unkown" if this cannot be - ///< determined for this port. - -} zes_fabric_link_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fabric port configuration -typedef struct _zes_fabric_port_config_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - ze_bool_t enabled; ///< [in,out] Port is configured up/down - ze_bool_t beaconing; ///< [in,out] Beaconing is configured on/off - -} zes_fabric_port_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fabric port state -typedef struct _zes_fabric_port_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - zes_fabric_port_status_t status; ///< [out] The current status of the port - zes_fabric_port_qual_issue_flags_t qualityIssues; ///< [out] If status is ::ZES_FABRIC_PORT_STATUS_DEGRADED, - ///< then this gives a combination of ::zes_fabric_port_qual_issue_flag_t - ///< for quality issues that have been detected; - ///< otherwise, 0 indicates there are no quality issues with the link at - ///< this time. - zes_fabric_port_failure_flags_t failureReasons; ///< [out] If status is ::ZES_FABRIC_PORT_STATUS_FAILED, - ///< then this gives a combination of ::zes_fabric_port_failure_flag_t for - ///< reasons for the connection instability; - ///< otherwise, 0 indicates there are no connection stability issues at - ///< this time. - zes_fabric_port_id_t remotePortId; ///< [out] The unique port identifier for the remote connection point if - ///< status is ::ZES_FABRIC_PORT_STATUS_HEALTHY, - ///< ::ZES_FABRIC_PORT_STATUS_DEGRADED or ::ZES_FABRIC_PORT_STATUS_FAILED - zes_fabric_port_speed_t rxSpeed; ///< [out] Current maximum receive speed (sum of all lanes) - zes_fabric_port_speed_t txSpeed; ///< [out] Current maximum transmit speed (sum of all lanes) - -} zes_fabric_port_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fabric port throughput. -typedef struct _zes_fabric_port_throughput_t { - uint64_t timestamp; ///< [out] Monotonic timestamp counter in microseconds when the measurement - ///< was made. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - uint64_t rxCounter; ///< [out] Monotonic counter for the number of bytes received (sum of all - ///< lanes). This includes all protocol overhead, not only the GPU traffic. - uint64_t txCounter; ///< [out] Monotonic counter for the number of bytes transmitted (sum of - ///< all lanes). This includes all protocol overhead, not only the GPU - ///< traffic. - -} zes_fabric_port_throughput_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of Fabric ports in a device -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumFabricPorts( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_fabric_port_handle_t *phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Fabric port properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPort` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetProperties( - zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. - zes_fabric_port_properties_t *pProperties ///< [in,out] Will contain properties of the Fabric Port. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Fabric port link type -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPort` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLinkType` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetLinkType( - zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. - zes_fabric_link_type_t *pLinkType ///< [in,out] Will contain details about the link attached to the Fabric - ///< port. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Fabric port configuration -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPort` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetConfig( - zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. - zes_fabric_port_config_t *pConfig ///< [in,out] Will contain configuration of the Fabric Port. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set Fabric port configuration -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPort` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortSetConfig( - zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. - const zes_fabric_port_config_t *pConfig ///< [in] Contains new configuration of the Fabric Port. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Fabric port state - status (health/degraded/failed/disabled), -/// reasons for link degradation or instability, current rx/tx speed -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPort` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetState( - zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. - zes_fabric_port_state_t *pState ///< [in,out] Will contain the current state of the Fabric Port -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Fabric port throughput -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPort` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pThroughput` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to query this telemetry. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFabricPortGetThroughput( - zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. - zes_fabric_port_throughput_t *pThroughput ///< [in,out] Will contain the Fabric port throughput counters. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan resource speed mode -typedef enum _zes_fan_speed_mode_t { - ZES_FAN_SPEED_MODE_DEFAULT = 0, ///< The fan speed is operating using the hardware default settings - ZES_FAN_SPEED_MODE_FIXED = 1, ///< The fan speed is currently set to a fixed value - ZES_FAN_SPEED_MODE_TABLE = 2, ///< The fan speed is currently controlled dynamically by hardware based on - ///< a temp/speed table - ZES_FAN_SPEED_MODE_FORCE_UINT32 = 0x7fffffff - -} zes_fan_speed_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan speed units -typedef enum _zes_fan_speed_units_t { - ZES_FAN_SPEED_UNITS_RPM = 0, ///< The fan speed is in units of revolutions per minute (rpm) - ZES_FAN_SPEED_UNITS_PERCENT = 1, ///< The fan speed is a percentage of the maximum speed of the fan - ZES_FAN_SPEED_UNITS_FORCE_UINT32 = 0x7fffffff - -} zes_fan_speed_units_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan speed -typedef struct _zes_fan_speed_t { - int32_t speed; ///< [in,out] The speed of the fan. On output, a value of -1 indicates that - ///< there is no fixed fan speed setting. - zes_fan_speed_units_t units; ///< [in,out] The units that the fan speed is expressed in. On output, if - ///< fan speed is -1 then units should be ignored. - -} zes_fan_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan temperature/speed pair -typedef struct _zes_fan_temp_speed_t { - uint32_t temperature; ///< [in,out] Temperature in degrees Celsius. - zes_fan_speed_t speed; ///< [in,out] The speed of the fan - -} zes_fan_temp_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZES_FAN_TEMP_SPEED_PAIR_COUNT -/// @brief Maximum number of fan temperature/speed pairs in the fan speed table. -#define ZES_FAN_TEMP_SPEED_PAIR_COUNT 32 -#endif // ZES_FAN_TEMP_SPEED_PAIR_COUNT - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan speed table -typedef struct _zes_fan_speed_table_t { - int32_t numPoints; ///< [in,out] The number of valid points in the fan speed table. 0 means - ///< that there is no fan speed table configured. -1 means that a fan speed - ///< table is not supported by the hardware. - zes_fan_temp_speed_t table[ZES_FAN_TEMP_SPEED_PAIR_COUNT]; ///< [in,out] Array of temperature/fan speed pairs. The table is ordered - ///< based on temperature from lowest to highest. - -} zes_fan_speed_table_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan properties -typedef struct _zes_fan_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - ze_bool_t canControl; ///< [out] Indicates if software can control the fan speed assuming the - ///< user has permissions - uint32_t supportedModes; ///< [out] Bitfield of supported fan configuration modes - ///< (1<<::zes_fan_speed_mode_t) - uint32_t supportedUnits; ///< [out] Bitfield of supported fan speed units - ///< (1<<::zes_fan_speed_units_t) - int32_t maxRPM; ///< [out] The maximum RPM of the fan. A value of -1 means that this - ///< property is unknown. - int32_t maxPoints; ///< [out] The maximum number of points in the fan temp/speed table. A - ///< value of -1 means that this fan doesn't support providing a temp/speed - ///< table. - -} zes_fan_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan configuration -typedef struct _zes_fan_config_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - zes_fan_speed_mode_t mode; ///< [in,out] The fan speed mode (fixed, temp-speed table) - zes_fan_speed_t speedFixed; ///< [in,out] The current fixed fan speed setting - zes_fan_temp_speed_t speedTable; ///< [out] Array of temperature/fan speed pairs currently configured - -} zes_fan_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of fans -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumFans( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_fan_handle_t *phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get fan properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanGetProperties( - zes_fan_handle_t hFan, ///< [in] Handle for the component. - zes_fan_properties_t *pProperties ///< [in,out] Will contain the properties of the fan. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get fan configurations and the current fan speed mode (default, fixed, -/// temp-speed table) -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanGetConfig( - zes_fan_handle_t hFan, ///< [in] Handle for the component. - zes_fan_config_t *pConfig ///< [in,out] Will contain the current configuration of the fan. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configure the fan to run with hardware factory settings (set mode to -/// ::ZES_FAN_SPEED_MODE_DEFAULT) -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanSetDefaultMode( - zes_fan_handle_t hFan ///< [in] Handle for the component. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configure the fan to rotate at a fixed speed (set mode to -/// ::ZES_FAN_SPEED_MODE_FIXED) -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == speed` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See ::zes_fan_properties_t.supportedModes and ::zes_fan_properties_t.supportedUnits. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanSetFixedSpeedMode( - zes_fan_handle_t hFan, ///< [in] Handle for the component. - const zes_fan_speed_t *speed ///< [in] The fixed fan speed setting -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configure the fan to adjust speed based on a temperature/speed table -/// (set mode to ::ZES_FAN_SPEED_MODE_TABLE) -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == speedTable` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT -/// + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest. -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Fan speed table not supported by the hardware or the fan speed units are not supported. See ::zes_fan_properties_t.supportedModes and ::zes_fan_properties_t.supportedUnits. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanSetSpeedTableMode( - zes_fan_handle_t hFan, ///< [in] Handle for the component. - const zes_fan_speed_table_t *speedTable ///< [in] A table containing temperature/speed pairs. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current state of a fan - current mode and speed -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZES_FAN_SPEED_UNITS_PERCENT < units` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSpeed` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + The requested fan speed units are not supported. See ::zes_fan_properties_t.supportedUnits. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFanGetState( - zes_fan_handle_t hFan, ///< [in] Handle for the component. - zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. - int32_t *pSpeed ///< [in,out] Will contain the current speed of the fan in the units - ///< requested. A value of -1 indicates that the fan speed cannot be - ///< measured. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Firmware properties -typedef struct _zes_firmware_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - ze_bool_t canControl; ///< [out] Indicates if software can flash the firmware assuming the user - ///< has permissions - char name[ZES_STRING_PROPERTY_SIZE]; ///< [out] NULL terminated string value. The string "unknown" will be - ///< returned if this property cannot be determined. - char version[ZES_STRING_PROPERTY_SIZE]; ///< [out] NULL terminated string value. The string "unknown" will be - ///< returned if this property cannot be determined. - -} zes_firmware_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of firmwares -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumFirmwares( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_firmware_handle_t *phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get firmware properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFirmware` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFirmwareGetProperties( - zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. - zes_firmware_properties_t *pProperties ///< [in,out] Pointer to an array that will hold the properties of the - ///< firmware -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Flash a new firmware image -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFirmware` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pImage` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to perform this operation. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFirmwareFlash( - zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. - void *pImage, ///< [in] Image of the new firmware to flash. - uint32_t size ///< [in] Size of the flash image. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Frequency domains - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency domains. -typedef enum _zes_freq_domain_t { - ZES_FREQ_DOMAIN_GPU = 0, ///< GPU Core Domain. - ZES_FREQ_DOMAIN_MEMORY = 1, ///< Local Memory Domain. - ZES_FREQ_DOMAIN_FORCE_UINT32 = 0x7fffffff - -} zes_freq_domain_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency properties -/// -/// @details -/// - Indicates if this frequency domain can be overclocked (if true, -/// functions such as ::zesFrequencyOcSetFrequencyTarget() are supported). -/// - The min/max hardware frequencies are specified for non-overclock -/// configurations. For overclock configurations, use -/// ::zesFrequencyOcGetFrequencyTarget() to determine the maximum -/// frequency that can be requested. -typedef struct _zes_freq_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zes_freq_domain_t type; ///< [out] The hardware block that this frequency domain controls (GPU, - ///< memory, ...) - ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - ze_bool_t canControl; ///< [out] Indicates if software can control the frequency of this domain - ///< assuming the user has permissions - ze_bool_t isThrottleEventSupported; ///< [out] Indicates if software can register to receive event - ///< ::ZES_EVENT_TYPE_FLAG_FREQ_THROTTLED - double min; ///< [out] The minimum hardware clock frequency in units of MHz. - double max; ///< [out] The maximum non-overclock hardware clock frequency in units of - ///< MHz. - -} zes_freq_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency range between which the hardware can operate. The limits can -/// be above or below the hardware limits - the hardware will clamp -/// appropriately. -typedef struct _zes_freq_range_t { - double min; ///< [in,out] The min frequency in MHz below which hardware frequency - ///< management will not request frequencies. On input, setting to 0 will - ///< permit the frequency to go down to the hardware minimum. On output, a - ///< negative value indicates that no external minimum frequency limit is - ///< in effect. - double max; ///< [in,out] The max frequency in MHz above which hardware frequency - ///< management will not request frequencies. On input, setting to 0 or a - ///< very big number will permit the frequency to go all the way up to the - ///< hardware maximum. On output, a negative number indicates that no - ///< external maximum frequency limit is in effect. - -} zes_freq_range_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency throttle reasons -typedef uint32_t zes_freq_throttle_reason_flags_t; -typedef enum _zes_freq_throttle_reason_flag_t { - ZES_FREQ_THROTTLE_REASON_FLAG_AVE_PWR_CAP = ZE_BIT(0), ///< frequency throttled due to average power excursion (PL1) - ZES_FREQ_THROTTLE_REASON_FLAG_BURST_PWR_CAP = ZE_BIT(1), ///< frequency throttled due to burst power excursion (PL2) - ZES_FREQ_THROTTLE_REASON_FLAG_CURRENT_LIMIT = ZE_BIT(2), ///< frequency throttled due to current excursion (PL4) - ZES_FREQ_THROTTLE_REASON_FLAG_THERMAL_LIMIT = ZE_BIT(3), ///< frequency throttled due to thermal excursion (T > TjMax) - ZES_FREQ_THROTTLE_REASON_FLAG_PSU_ALERT = ZE_BIT(4), ///< frequency throttled due to power supply assertion - ZES_FREQ_THROTTLE_REASON_FLAG_SW_RANGE = ZE_BIT(5), ///< frequency throttled due to software supplied frequency range - ZES_FREQ_THROTTLE_REASON_FLAG_HW_RANGE = ZE_BIT(6), ///< frequency throttled due to a sub block that has a lower frequency - ///< range when it receives clocks - ZES_FREQ_THROTTLE_REASON_FLAG_FORCE_UINT32 = 0x7fffffff - -} zes_freq_throttle_reason_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency state -typedef struct _zes_freq_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - double currentVoltage; ///< [out] Current voltage in Volts. A negative value indicates that this - ///< property is not known. - double request; ///< [out] The current frequency request in MHz. A negative value indicates - ///< that this property is not known. - double tdp; ///< [out] The maximum frequency in MHz supported under the current TDP - ///< conditions. This fluctuates dynamically based on the power and thermal - ///< limits of the part. A negative value indicates that this property is - ///< not known. - double efficient; ///< [out] The efficient minimum frequency in MHz. A negative value - ///< indicates that this property is not known. - double actual; ///< [out] The resolved frequency in MHz. A negative value indicates that - ///< this property is not known. - zes_freq_throttle_reason_flags_t throttleReasons; ///< [out] The reasons that the frequency is being limited by the hardware. - ///< Returns 0 (frequency not throttled) or a combination of ::zes_freq_throttle_reason_flag_t. - -} zes_freq_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency throttle time snapshot -/// -/// @details -/// - Percent time throttled is calculated by taking two snapshots (s1, s2) -/// and using the equation: %throttled = (s2.throttleTime - -/// s1.throttleTime) / (s2.timestamp - s1.timestamp) -typedef struct _zes_freq_throttle_time_t { - uint64_t throttleTime; ///< [out] The monotonic counter of time in microseconds that the frequency - ///< has been limited by the hardware. - uint64_t timestamp; ///< [out] Microsecond timestamp when throttleTime was captured. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - -} zes_freq_throttle_time_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Overclocking modes -typedef enum _zes_oc_mode_t { - ZES_OC_MODE_OFF = 0, ///< Overclocking if off - hardware is running using factory default - ///< voltages/frequencies. - ZES_OC_MODE_OVERRIDE = 1, ///< Overclock override mode - In this mode, a fixed user-supplied voltage - ///< is applied independent of the frequency request. The maximum permitted - ///< frequency can also be increased. This mode disables INTERPOLATIVE and - ///< FIXED modes. - ZES_OC_MODE_INTERPOLATIVE = 2, ///< Overclock interpolative mode - In this mode, the voltage/frequency - ///< curve can be extended with a new voltage/frequency point that will be - ///< interpolated. The existing voltage/frequency points can also be offset - ///< (up or down) by a fixed voltage. This mode disables FIXED and OVERRIDE - ///< modes. - ZES_OC_MODE_FIXED = 3, ///< Overclocking fixed Mode - In this mode, hardware will disable most - ///< frequency throttling and lock the frequency and voltage at the - ///< specified overclock values. This mode disables OVERRIDE and - ///< INTERPOLATIVE modes. This mode can damage the part, most of the - ///< protections are disabled on this mode. - ZES_OC_MODE_FORCE_UINT32 = 0x7fffffff - -} zes_oc_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Overclocking properties -/// -/// @details -/// - Provides all the overclocking capabilities and properties supported by -/// the device for the frequency domain. -typedef struct _zes_oc_capabilities_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - ze_bool_t isOcSupported; ///< [out] Indicates if any overclocking features are supported on this - ///< frequency domain. - double maxFactoryDefaultFrequency; ///< [out] Factory default non-overclock maximum frequency in Mhz. - double maxFactoryDefaultVoltage; ///< [out] Factory default voltage used for the non-overclock maximum - ///< frequency in MHz. - double maxOcFrequency; ///< [out] Maximum hardware overclocking frequency limit in Mhz. - double minOcVoltageOffset; ///< [out] The minimum voltage offset that can be applied to the - ///< voltage/frequency curve. Note that this number can be negative. - double maxOcVoltageOffset; ///< [out] The maximum voltage offset that can be applied to the - ///< voltage/frequency curve. - double maxOcVoltage; ///< [out] The maximum overclock voltage that hardware supports. - ze_bool_t isTjMaxSupported; ///< [out] Indicates if the maximum temperature limit (TjMax) can be - ///< changed for this frequency domain. - ze_bool_t isIccMaxSupported; ///< [out] Indicates if the maximum current (IccMax) can be changed for - ///< this frequency domain. - ze_bool_t isHighVoltModeCapable; ///< [out] Indicates if this frequency domains supports a feature to set - ///< very high voltages. - ze_bool_t isHighVoltModeEnabled; ///< [out] Indicates if very high voltages are permitted on this frequency - ///< domain. - ze_bool_t isExtendedModeSupported; ///< [out] Indicates if the extended overclocking features are supported. - ///< If this is supported, increments are on 1 Mhz basis. - ze_bool_t isFixedModeSupported; ///< [out] Indicates if the fixed mode is supported. In this mode, hardware - ///< will disable most frequency throttling and lock the frequency and - ///< voltage at the specified overclock values. - -} zes_oc_capabilities_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of frequency domains -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumFrequencyDomains( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_freq_handle_t *phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get frequency properties - available frequencies -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetProperties( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - zes_freq_properties_t *pProperties ///< [in,out] The frequency properties for the specified domain. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get available non-overclocked hardware clock frequencies for the -/// frequency domain -/// -/// @details -/// - The list of available frequencies is returned in order of slowest to -/// fastest. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetAvailableClocks( - zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of frequencies. - ///< If count is zero, then the driver will update the value with the total - ///< number of frequencies available. - ///< If count is non-zero, then driver will only retrieve that number of frequencies. - ///< If count is larger than the number of frequencies available, then the - ///< driver will update the value with the correct number of frequencies available. - double *phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of - ///< MHz and sorted from slowest to fastest -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current frequency limits -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLimits` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetRange( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - zes_freq_range_t *pLimits ///< [in,out] The range between which the hardware can operate for the - ///< specified domain. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set frequency range between which the hardware can operate. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLimits` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencySetRange( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - const zes_freq_range_t *pLimits ///< [in] The limits between which the hardware can operate for the - ///< specified domain. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current frequency state - frequency request, actual frequency, TDP -/// limits -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetState( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - zes_freq_state_t *pState ///< [in,out] Frequency state for the specified domain. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get frequency throttle time -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pThrottleTime` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyGetThrottleTime( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - zes_freq_throttle_time_t *pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the - ///< specified domain. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the overclocking capabilities. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pOcCapabilities` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetCapabilities( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - zes_oc_capabilities_t *pOcCapabilities ///< [in,out] Pointer to the capabilities structure - ///< ::zes_oc_capabilities_t. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the current overclocking frequency target, if extended moded is -/// supported, will returned in 1 Mhz granularity. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCurrentOcFrequency` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset). -/// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Overclocking feature is locked on this frequency domain -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetFrequencyTarget( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - double *pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported, - ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This - ///< cannot be greater than ::zes_oc_capabilities_t.maxOcFrequency. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the current overclocking frequency target, if extended moded is -/// supported, can be set in 1 Mhz granularity. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset). -/// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Overclocking feature is locked on this frequency domain -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetFrequencyTarget( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it - ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This - ///< cannot be greater than ::zes_oc_capabilities_t.maxOcFrequency. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the current overclocking voltage settings. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCurrentVoltageTarget` -/// + `nullptr == pCurrentVoltageOffset` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset). -/// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Overclocking feature is locked on this frequency domain -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetVoltageTarget( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - double *pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than - ///< ::zes_oc_capabilities_t.maxOcVoltage. - double *pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the - ///< voltage/frequency curve, include the new overclock voltageTarget. It - ///< can be in the range (::zes_oc_capabilities_t.minOcVoltageOffset, - ///< ::zes_oc_capabilities_t.maxOcVoltageOffset). -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the current overclocking voltage settings. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset). -/// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Overclocking feature is locked on this frequency domain -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetVoltageTarget( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than - ///< ::zes_oc_capabilities_t.maxOcVoltage. - double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the - ///< voltage/frequency curve, include the new overclock voltageTarget. It - ///< can be in the range (::zes_oc_capabilities_t.minOcVoltageOffset, - ///< ::zes_oc_capabilities_t.maxOcVoltageOffset). -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the current overclocking mode. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZES_OC_MODE_FIXED < CurrentOcMode` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset). -/// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Overclocking feature is locked on this frequency domain -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetMode( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the current overclocking mode. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCurrentOcMode` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + The specified voltage and/or frequency overclock settings exceed the hardware values (see ::zes_oc_capabilities_t.maxOcFrequency, ::zes_oc_capabilities_t.maxOcVoltage, ::zes_oc_capabilities_t.minOcVoltageOffset, ::zes_oc_capabilities_t.maxOcVoltageOffset). -/// + Requested voltage overclock is very high but ::zes_oc_capabilities_t.isHighVoltModeEnabled is not enabled for the device. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Overclocking feature is locked on this frequency domain -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetMode( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - zes_oc_mode_t *pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the maximum current limit setting. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pOcIccMax` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + Capability ::zes_oc_capabilities_t.isIccMaxSupported is false for this frequency domain -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetIccMax( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - double *pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on - ///< successful return. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Change the maximum current limit setting. -/// -/// @details -/// - Setting ocIccMax to 0.0 will return the value to the factory default. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + Capability ::zes_oc_capabilities_t.isIccMaxSupported is false for this frequency domain -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Overclocking feature is locked on this frequency domain -/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT -/// + The specified current limit is too low or too high -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetIccMax( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - double ocIccMax ///< [in] The new maximum current limit in Amperes. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the maximum temperature limit setting. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pOcTjMax` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcGetTjMax( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - double *pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius - ///< on successful return. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Change the maximum temperature limit setting. -/// -/// @details -/// - Setting ocTjMax to 0.0 will return the value to the factory default. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Overclocking is not supported on this frequency domain (::zes_oc_capabilities_t.isOcSupported) -/// + Capability ::zes_oc_capabilities_t.isTjMaxSupported is false for this frequency domain -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Overclocking feature is locked on this frequency domain -/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT -/// + The specified temperature limit is too high -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesFrequencyOcSetTjMax( - zes_freq_handle_t hFrequency, ///< [in] Handle for the component. - double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief LED properties -typedef struct _zes_led_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - ze_bool_t canControl; ///< [out] Indicates if software can control the LED assuming the user has - ///< permissions - ze_bool_t haveRGB; ///< [out] Indicates if the LED is RGB capable - -} zes_led_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief LED color -typedef struct _zes_led_color_t { - double red; ///< [in,out][range(0.0, 1.0)] The LED red value. On output, a value less - ///< than 0.0 indicates that the color is not known. - double green; ///< [in,out][range(0.0, 1.0)] The LED green value. On output, a value less - ///< than 0.0 indicates that the color is not known. - double blue; ///< [in,out][range(0.0, 1.0)] The LED blue value. On output, a value less - ///< than 0.0 indicates that the color is not known. - -} zes_led_color_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief LED state -typedef struct _zes_led_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - ze_bool_t isOn; ///< [out] Indicates if the LED is on or off - zes_led_color_t color; ///< [out] Color of the LED - -} zes_led_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of LEDs -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumLeds( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_led_handle_t *phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get LED properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hLed` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesLedGetProperties( - zes_led_handle_t hLed, ///< [in] Handle for the component. - zes_led_properties_t *pProperties ///< [in,out] Will contain the properties of the LED. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current state of a LED - on/off, color -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hLed` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesLedGetState( - zes_led_handle_t hLed, ///< [in] Handle for the component. - zes_led_state_t *pState ///< [in,out] Will contain the current state of the LED. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Turn the LED on/off -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hLed` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesLedSetState( - zes_led_handle_t hLed, ///< [in] Handle for the component. - ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the color of the LED -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hLed` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pColor` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + This LED doesn't not support color changes. See ::zes_led_properties_t.haveRGB. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesLedSetColor( - zes_led_handle_t hLed, ///< [in] Handle for the component. - const zes_led_color_t *pColor ///< [in] New color of the LED. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Memory management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory module types -typedef enum _zes_mem_type_t { - ZES_MEM_TYPE_HBM = 0, ///< HBM memory - ZES_MEM_TYPE_DDR = 1, ///< DDR memory - ZES_MEM_TYPE_DDR3 = 2, ///< DDR3 memory - ZES_MEM_TYPE_DDR4 = 3, ///< DDR4 memory - ZES_MEM_TYPE_DDR5 = 4, ///< DDR5 memory - ZES_MEM_TYPE_LPDDR = 5, ///< LPDDR memory - ZES_MEM_TYPE_LPDDR3 = 6, ///< LPDDR3 memory - ZES_MEM_TYPE_LPDDR4 = 7, ///< LPDDR4 memory - ZES_MEM_TYPE_LPDDR5 = 8, ///< LPDDR5 memory - ZES_MEM_TYPE_SRAM = 9, ///< SRAM memory - ZES_MEM_TYPE_L1 = 10, ///< L1 cache - ZES_MEM_TYPE_L3 = 11, ///< L3 cache - ZES_MEM_TYPE_GRF = 12, ///< Execution unit register file - ZES_MEM_TYPE_SLM = 13, ///< Execution unit shared local memory - ZES_MEM_TYPE_FORCE_UINT32 = 0x7fffffff - -} zes_mem_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory module location -typedef enum _zes_mem_loc_t { - ZES_MEM_LOC_SYSTEM = 0, ///< System memory - ZES_MEM_LOC_DEVICE = 1, ///< On board local device memory - ZES_MEM_LOC_FORCE_UINT32 = 0x7fffffff - -} zes_mem_loc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory health -typedef enum _zes_mem_health_t { - ZES_MEM_HEALTH_UNKNOWN = 0, ///< The memory health cannot be determined. - ZES_MEM_HEALTH_OK = 1, ///< All memory channels are healthy. - ZES_MEM_HEALTH_DEGRADED = 2, ///< Excessive correctable errors have been detected on one or more - ///< channels. Device should be reset. - ZES_MEM_HEALTH_CRITICAL = 3, ///< Operating with reduced memory to cover banks with too many - ///< uncorrectable errors. - ZES_MEM_HEALTH_REPLACE = 4, ///< Device should be replaced due to excessive uncorrectable errors. - ZES_MEM_HEALTH_FORCE_UINT32 = 0x7fffffff - -} zes_mem_health_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory properties -typedef struct _zes_mem_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zes_mem_type_t type; ///< [out] The memory type - ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - zes_mem_loc_t location; ///< [out] Location of this memory (system, device) - uint64_t physicalSize; ///< [out] Physical memory size in bytes - int32_t busWidth; ///< [out] Width of the memory bus. A value of -1 means that this property - ///< is unknown. - int32_t numChannels; ///< [out] The number of memory channels. A value of -1 means that this - ///< property is unknown. - -} zes_mem_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory state - health, allocated -/// -/// @details -/// - Percent allocation is given by 100 * allocatedSize / maxSize. -/// - Percent free is given by 100 * (maxSize - allocatedSize) / maxSize. -typedef struct _zes_mem_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - zes_mem_health_t health; ///< [out] Indicates the health of the memory - uint64_t free; ///< [out] The free memory in bytes - uint64_t size; ///< [out] The total allocatable memory in bytes (can be less than - ///< ::zes_mem_properties_t.physicalSize) - -} zes_mem_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory bandwidth -/// -/// @details -/// - Percent bandwidth is calculated by taking two snapshots (s1, s2) and -/// using the equation: %bw = 10^6 * ((s2.readCounter - s1.readCounter) + -/// (s2.writeCounter - s1.writeCounter)) / (s2.maxBandwidth * -/// (s2.timestamp - s1.timestamp)) -typedef struct _zes_mem_bandwidth_t { - uint64_t readCounter; ///< [out] Total bytes read from memory - uint64_t writeCounter; ///< [out] Total bytes written to memory - uint64_t maxBandwidth; ///< [out] Current maximum bandwidth in units of bytes/sec - uint64_t timestamp; ///< [out] The timestamp when these measurements were sampled. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - -} zes_mem_bandwidth_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of memory modules -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumMemoryModules( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_mem_handle_t *phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get memory properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMemory` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesMemoryGetProperties( - zes_mem_handle_t hMemory, ///< [in] Handle for the component. - zes_mem_properties_t *pProperties ///< [in,out] Will contain memory properties. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get memory state - health, allocated -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMemory` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesMemoryGetState( - zes_mem_handle_t hMemory, ///< [in] Handle for the component. - zes_mem_state_t *pState ///< [in,out] Will contain the current health and allocated memory. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get memory bandwidth -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMemory` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pBandwidth` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to query this telemetry. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesMemoryGetBandwidth( - zes_mem_handle_t hMemory, ///< [in] Handle for the component. - zes_mem_bandwidth_t *pBandwidth ///< [in,out] Will contain the current health, free memory, total memory - ///< size. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Performance factor - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Static information about a Performance Factor domain -typedef struct _zes_perf_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_bool_t onSubdevice; ///< [out] True if this Performance Factor affects accelerators located on - ///< a sub-device - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - zes_engine_type_flags_t engines; ///< [out] Bitfield of accelerator engine types that are affected by this - ///< Performance Factor. - -} zes_perf_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handles to accelerator domains whose performance can be optimized -/// via a Performance Factor -/// -/// @details -/// - A Performance Factor should be tuned for each workload. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumPerformanceFactorDomains( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_perf_handle_t *phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get properties about a Performance Factor domain -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPerf` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPerformanceFactorGetProperties( - zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. - zes_perf_properties_t *pProperties ///< [in,out] Will contain information about the specified Performance - ///< Factor domain. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current Performance Factor for a given domain -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPerf` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pFactor` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPerformanceFactorGetConfig( - zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. - double *pFactor ///< [in,out] Will contain the actual Performance Factor being used by the - ///< hardware (may not be the same as the requested Performance Factor). -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Change the performance factor for a domain -/// -/// @details -/// - The Performance Factor is a number between 0 and 100. -/// - A Performance Factor is a hint to the hardware. Depending on the -/// hardware, the request may not be granted. Follow up this function with -/// a call to ::zesPerformanceFactorGetConfig() to determine the actual -/// factor being used by the hardware. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPerf` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPerformanceFactorSetConfig( - zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. - double factor ///< [in] The new Performance Factor. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Scheduler management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Properties related to device power settings -typedef struct _zes_power_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - ze_bool_t canControl; ///< [out] Software can change the power limits of this domain assuming the - ///< user has permissions. - ze_bool_t isEnergyThresholdSupported; ///< [out] Indicates if this power domain supports the energy threshold - ///< event (::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED). - int32_t defaultLimit; ///< [out] The factory default TDP power limit of the part in milliwatts. A - ///< value of -1 means that this is not known. - int32_t minLimit; ///< [out] The minimum power limit in milliwatts that can be requested. - int32_t maxLimit; ///< [out] The maximum power limit in milliwatts that can be requested. - -} zes_power_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Energy counter snapshot -/// -/// @details -/// - Average power is calculated by taking two snapshots (s1, s2) and using -/// the equation: PowerWatts = (s2.energy - s1.energy) / (s2.timestamp - -/// s1.timestamp) -typedef struct _zes_power_energy_counter_t { - uint64_t energy; ///< [out] The monotonic energy counter in microjoules. - uint64_t timestamp; ///< [out] Microsecond timestamp when energy was captured. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - -} zes_power_energy_counter_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Sustained power limits -/// -/// @details -/// - The power controller (Punit) will throttle the operating frequency if -/// the power averaged over a window (typically seconds) exceeds this -/// limit. -typedef struct _zes_power_sustained_limit_t { - ze_bool_t enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false) - int32_t power; ///< [in,out] power limit in milliwatts - int32_t interval; ///< [in,out] power averaging window (Tau) in milliseconds - -} zes_power_sustained_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Burst power limit -/// -/// @details -/// - The power controller (Punit) will throttle the operating frequency of -/// the device if the power averaged over a few milliseconds exceeds a -/// limit known as PL2. Typically PL2 > PL1 so that it permits the -/// frequency to burst higher for short periods than would be otherwise -/// permitted by PL1. -typedef struct _zes_power_burst_limit_t { - ze_bool_t enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false) - int32_t power; ///< [in,out] power limit in milliwatts - -} zes_power_burst_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Peak power limit -/// -/// @details -/// - The power controller (Punit) will preemptively throttle the operating -/// frequency of the device when the instantaneous power exceeds this -/// limit. The limit is known as PL4. It expresses the maximum power that -/// can be drawn from the power supply. -/// - If this power limit is removed or set too high, the power supply will -/// generate an interrupt when it detects an overcurrent condition and the -/// power controller will throttle the device frequencies down to min. It -/// is thus better to tune the PL4 value in order to avoid such -/// excursions. -typedef struct _zes_power_peak_limit_t { - int32_t powerAC; ///< [in,out] power limit in milliwatts for the AC power source. - int32_t powerDC; ///< [in,out] power limit in milliwatts for the DC power source. On input, - ///< this is ignored if the product does not have a battery. On output, - ///< this will be -1 if the product does not have a battery. - -} zes_power_peak_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Energy threshold -/// -/// @details -/// - . -typedef struct _zes_energy_threshold_t { - ze_bool_t enable; ///< [in,out] Indicates if the energy threshold is enabled. - double threshold; ///< [in,out] The energy threshold in Joules. Will be 0.0 if no threshold - ///< has been set. - uint32_t processId; ///< [in,out] The host process ID that set the energy threshold. Will be - ///< 0xFFFFFFFF if no threshold has been set. - -} zes_energy_threshold_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of power domains -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumPowerDomains( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_pwr_handle_t *phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get properties related to a power domain -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerGetProperties( - zes_pwr_handle_t hPower, ///< [in] Handle for the component. - zes_power_properties_t *pProperties ///< [in,out] Structure that will contain property data. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get energy counter -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pEnergy` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerGetEnergyCounter( - zes_pwr_handle_t hPower, ///< [in] Handle for the component. - zes_power_energy_counter_t *pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and - ///< timestamp when the last counter value was measured. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get power limits -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerGetLimits( - zes_pwr_handle_t hPower, ///< [in] Handle for the component. - zes_power_sustained_limit_t *pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the - ///< current sustained power limits will not be returned. - zes_power_burst_limit_t *pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current - ///< peak power limits will not be returned. - zes_power_peak_limit_t *pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak - ///< power limits will not be returned. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set power limits -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerSetLimits( - zes_pwr_handle_t hPower, ///< [in] Handle for the component. - const zes_power_sustained_limit_t *pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes - ///< will be made to the sustained power limits. - const zes_power_burst_limit_t *pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will - ///< be made to the burst power limits. - const zes_power_peak_limit_t *pPeak ///< [in][optional] The peak power limit. If this is null, no changes will - ///< be made to the peak power limits. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get energy threshold -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pThreshold` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Energy threshold not supported on this power domain (check ::zes_power_properties_t.isEnergyThresholdSupported). -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to request this feature. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerGetEnergyThreshold( - zes_pwr_handle_t hPower, ///< [in] Handle for the component. - zes_energy_threshold_t *pThreshold ///< [in,out] Returns information about the energy threshold setting - - ///< enabled/energy threshold/process ID. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set energy threshold -/// -/// @details -/// - An event ::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED will be -/// generated when the delta energy consumed starting from this call -/// exceeds the specified threshold. Use the function -/// ::zesDeviceEventRegister() to start receiving the event. -/// - Only one running process can control the energy threshold at a given -/// time. If another process attempts to change the energy threshold, the -/// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function -/// ::zesPowerGetEnergyThreshold() to determine the process ID currently -/// controlling this setting. -/// - Calling this function will remove any pending energy thresholds and -/// start counting from the time of this call. -/// - Once the energy threshold has been reached and the event generated, -/// the threshold is automatically removed. It is up to the application to -/// request a new threshold. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Energy threshold not supported on this power domain (check ::zes_power_properties_t.isEnergyThresholdSupported). -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to request this feature. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Another running process has set the energy threshold. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPowerSetEnergyThreshold( - zes_pwr_handle_t hPower, ///< [in] Handle for the component. - double threshold ///< [in] The energy threshold to be set in joules. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PSU voltage status -typedef enum _zes_psu_voltage_status_t { - ZES_PSU_VOLTAGE_STATUS_UNKNOWN = 0, ///< The status of the power supply voltage controllers cannot be - ///< determined - ZES_PSU_VOLTAGE_STATUS_NORMAL = 1, ///< No unusual voltages have been detected - ZES_PSU_VOLTAGE_STATUS_OVER = 2, ///< Over-voltage has occurred - ZES_PSU_VOLTAGE_STATUS_UNDER = 3, ///< Under-voltage has occurred - ZES_PSU_VOLTAGE_STATUS_FORCE_UINT32 = 0x7fffffff - -} zes_psu_voltage_status_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Static properties of the power supply -typedef struct _zes_psu_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - ze_bool_t haveFan; ///< [out] True if the power supply has a fan - int32_t ampLimit; ///< [out] The maximum electrical current in milliamperes that can be - ///< drawn. A value of -1 indicates that this property cannot be - ///< determined. - -} zes_psu_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Dynamic state of the power supply -typedef struct _zes_psu_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - zes_psu_voltage_status_t voltStatus; ///< [out] The current PSU voltage status - ze_bool_t fanFailed; ///< [out] Indicates if the fan has failed - int32_t temperature; ///< [out] Read the current heatsink temperature in degrees Celsius. A - ///< value of -1 indicates that this property cannot be determined. - int32_t current; ///< [out] The amps being drawn in milliamperes. A value of -1 indicates - ///< that this property cannot be determined. - -} zes_psu_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of power supplies -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumPsus( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_psu_handle_t *phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get power supply properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPsu` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPsuGetProperties( - zes_psu_handle_t hPsu, ///< [in] Handle for the component. - zes_psu_properties_t *pProperties ///< [in,out] Will contain the properties of the power supply. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current power supply state -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPsu` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesPsuGetState( - zes_psu_handle_t hPsu, ///< [in] Handle for the component. - zes_psu_state_t *pState ///< [in,out] Will contain the current state of the power supply. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief RAS error type -typedef enum _zes_ras_error_type_t { - ZES_RAS_ERROR_TYPE_CORRECTABLE = 0, ///< Errors were corrected by hardware - ZES_RAS_ERROR_TYPE_UNCORRECTABLE = 1, ///< Error were not corrected - ZES_RAS_ERROR_TYPE_FORCE_UINT32 = 0x7fffffff - -} zes_ras_error_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief RAS error categories -typedef enum _zes_ras_error_cat_t { - ZES_RAS_ERROR_CAT_RESET = 0, ///< The number of accelerator engine resets attempted by the driver - ZES_RAS_ERROR_CAT_PROGRAMMING_ERRORS = 1, ///< The number of hardware exceptions generated by the way workloads have - ///< programmed the hardware - ZES_RAS_ERROR_CAT_DRIVER_ERRORS = 2, ///< The number of low level driver communication errors have occurred - ZES_RAS_ERROR_CAT_COMPUTE_ERRORS = 3, ///< The number of errors that have occurred in the compute accelerator - ///< hardware - ZES_RAS_ERROR_CAT_NON_COMPUTE_ERRORS = 4, ///< The number of errors that have occurred in the fixed-function - ///< accelerator hardware - ZES_RAS_ERROR_CAT_CACHE_ERRORS = 5, ///< The number of errors that have occurred in caches (L1/L3/register - ///< file/shared local memory/sampler) - ZES_RAS_ERROR_CAT_DISPLAY_ERRORS = 6, ///< The number of errors that have occurred in the display - ZES_RAS_ERROR_CAT_FORCE_UINT32 = 0x7fffffff - -} zes_ras_error_cat_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZES_MAX_RAS_ERROR_CATEGORY_COUNT -/// @brief The maximum number of categories -#define ZES_MAX_RAS_ERROR_CATEGORY_COUNT 7 -#endif // ZES_MAX_RAS_ERROR_CATEGORY_COUNT - -/////////////////////////////////////////////////////////////////////////////// -/// @brief RAS properties -typedef struct _zes_ras_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zes_ras_error_type_t type; ///< [out] The type of RAS error - ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - -} zes_ras_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief RAS error details -typedef struct _zes_ras_state_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - uint64_t category[ZES_MAX_RAS_ERROR_CATEGORY_COUNT]; ///< [in][out] Breakdown of error by category - -} zes_ras_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief RAS error configuration - thresholds used for triggering RAS events -/// (::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS, -/// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS) -/// -/// @details -/// - The driver maintains a total counter which is updated every time a -/// hardware block covered by the corresponding RAS error set notifies -/// that an error has occurred. When this total count goes above the -/// totalThreshold specified below, a RAS event is triggered. -/// - The driver also maintains a counter for each category of RAS error -/// (see ::zes_ras_state_t for a breakdown). Each time a hardware block of -/// that category notifies that an error has occurred, that corresponding -/// category counter is updated. When it goes above the threshold -/// specified in detailedThresholds, a RAS event is triggered. -typedef struct _zes_ras_config_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - uint64_t totalThreshold; ///< [in,out] If the total RAS errors exceeds this threshold, the event - ///< will be triggered. A value of 0ULL disables triggering the event based - ///< on the total counter. - zes_ras_state_t detailedThresholds; ///< [in,out] If the RAS errors for each category exceed the threshold for - ///< that category, the event will be triggered. A value of 0ULL will - ///< disable an event being triggered for that category. - -} zes_ras_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of all RAS error sets on a device -/// -/// @details -/// - A RAS error set is a collection of RAS error counters of a given type -/// (correctable/uncorrectable) from hardware blocks contained within a -/// sub-device or within the device. -/// - A device without sub-devices will typically return two handles, one -/// for correctable errors sets and one for uncorrectable error sets. -/// - A device with sub-devices will return RAS error sets for each -/// sub-device and possibly RAS error sets for hardware blocks outside the -/// sub-devices. -/// - If the function completes successfully but pCount is set to 0, RAS -/// features are not available/enabled on this device. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumRasErrorSets( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_ras_handle_t *phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get RAS properties of a given RAS error set - this enables discovery -/// of the type of RAS error set (correctable/uncorrectable) and if -/// located on a sub-device -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hRas` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesRasGetProperties( - zes_ras_handle_t hRas, ///< [in] Handle for the component. - zes_ras_properties_t *pProperties ///< [in,out] Structure describing RAS properties -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get RAS error thresholds that control when RAS events are generated -/// -/// @details -/// - The driver maintains counters for all RAS error sets and error -/// categories. Events are generated when errors occur. The configuration -/// enables setting thresholds to limit when events are sent. -/// - When a particular RAS correctable error counter exceeds the configured -/// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will -/// be triggered. -/// - When a particular RAS uncorrectable error counter exceeds the -/// configured threshold, the event -/// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be triggered. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hRas` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesRasGetConfig( - zes_ras_handle_t hRas, ///< [in] Handle for the component. - zes_ras_config_t *pConfig ///< [in,out] Will be populed with the current RAS configuration - - ///< thresholds used to trigger events -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set RAS error thresholds that control when RAS events are generated -/// -/// @details -/// - The driver maintains counters for all RAS error sets and error -/// categories. Events are generated when errors occur. The configuration -/// enables setting thresholds to limit when events are sent. -/// - When a particular RAS correctable error counter exceeds the specified -/// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will -/// be generated. -/// - When a particular RAS uncorrectable error counter exceeds the -/// specified threshold, the event -/// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be generated. -/// - Call ::zesRasGetState() and set the clear flag to true to restart -/// event generation once counters have exceeded thresholds. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hRas` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Another running process is controlling these settings. -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + Don't have permissions to set thresholds. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesRasSetConfig( - zes_ras_handle_t hRas, ///< [in] Handle for the component. - const zes_ras_config_t *pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the current value of RAS error counters for a particular error set -/// -/// @details -/// - Clearing errors will affect other threads/applications - the counter -/// values will start from zero. -/// - Clearing errors requires write permissions. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hRas` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + Don't have permissions to clear error counters. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesRasGetState( - zes_ras_handle_t hRas, ///< [in] Handle for the component. - ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type - zes_ras_state_t *pState ///< [in,out] Breakdown of where errors have occurred -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Scheduler management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Scheduler mode -typedef enum _zes_sched_mode_t { - ZES_SCHED_MODE_TIMEOUT = 0, ///< Multiple applications or contexts are submitting work to the hardware. - ///< When higher priority work arrives, the scheduler attempts to pause the - ///< current executing work within some timeout interval, then submits the - ///< other work. - ZES_SCHED_MODE_TIMESLICE = 1, ///< The scheduler attempts to fairly timeslice hardware execution time - ///< between multiple contexts submitting work to the hardware - ///< concurrently. - ZES_SCHED_MODE_EXCLUSIVE = 2, ///< Any application or context can run indefinitely on the hardware - ///< without being preempted or terminated. All pending work for other - ///< contexts must wait until the running context completes with no further - ///< submitted work. - ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG = 3, ///< This is a special mode that must ben enabled when debugging an - ///< application that uses this device e.g. using the Level0 Debug API. It - ///< has the effect of disabling any timeouts on workload execution time - ///< and will change workload scheduling to ensure debug accuracy. - ZES_SCHED_MODE_FORCE_UINT32 = 0x7fffffff - -} zes_sched_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Properties related to scheduler component -typedef struct _zes_sched_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - ze_bool_t canControl; ///< [out] Software can change the scheduler component configuration - ///< assuming the user has permissions. - zes_engine_type_flags_t engines; ///< [out] Bitfield of accelerator engine types that are controlled by this - ///< scheduler component. - uint32_t supportedModes; ///< [out] Bitfield of scheduler modes that can be configured for this - ///< scheduler component (bitfield of 1<<::zes_sched_mode_t). - -} zes_sched_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef ZES_SCHED_WATCHDOG_DISABLE -/// @brief Disable forward progress guard timeout. -#define ZES_SCHED_WATCHDOG_DISABLE (~(0ULL)) -#endif // ZES_SCHED_WATCHDOG_DISABLE - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configuration for timeout scheduler mode (::ZES_SCHED_MODE_TIMEOUT) -typedef struct _zes_sched_timeout_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - uint64_t watchdogTimeout; ///< [in,out] The maximum time in microseconds that the scheduler will wait - ///< for a batch of work submitted to a hardware engine to complete or to - ///< be preempted so as to run another context. - ///< If this time is exceeded, the hardware engine is reset and the context terminated. - ///< If set to ::ZES_SCHED_WATCHDOG_DISABLE, a running workload can run as - ///< long as it wants without being terminated, but preemption attempts to - ///< run other contexts are permitted but not enforced. - -} zes_sched_timeout_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configuration for timeslice scheduler mode -/// (::ZES_SCHED_MODE_TIMESLICE) -typedef struct _zes_sched_timeslice_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - uint64_t interval; ///< [in,out] The average interval in microseconds that a submission for a - ///< context will run on a hardware engine before being preempted out to - ///< run a pending submission for another context. - uint64_t yieldTimeout; ///< [in,out] The maximum time in microseconds that the scheduler will wait - ///< to preempt a workload running on an engine before deciding to reset - ///< the hardware engine and terminating the associated context. - -} zes_sched_timeslice_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle to a scheduler component -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumSchedulers( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_sched_handle_t *phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get properties related to a scheduler component -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hScheduler` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerGetProperties( - zes_sched_handle_t hScheduler, ///< [in] Handle for the component. - zes_sched_properties_t *pProperties ///< [in,out] Structure that will contain property data. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current scheduling mode in effect on a scheduler component. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hScheduler` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pMode` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + This scheduler component does not support scheduler modes. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerGetCurrentMode( - zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. - zes_sched_mode_t *pMode ///< [in,out] Will contain the current scheduler mode. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get scheduler config for mode ::ZES_SCHED_MODE_TIMEOUT -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hScheduler` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + This scheduler component does not support scheduler modes. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerGetTimeoutModeProperties( - zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. - ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for - ///< this mode, otherwise it will return the current properties. - zes_sched_timeout_properties_t *pConfig ///< [in,out] Will contain the current parameters for this mode. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get scheduler config for mode ::ZES_SCHED_MODE_TIMESLICE -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hScheduler` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + This scheduler component does not support scheduler modes. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerGetTimesliceModeProperties( - zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. - ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for - ///< this mode, otherwise it will return the current properties. - zes_sched_timeslice_properties_t *pConfig ///< [in,out] Will contain the current parameters for this mode. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Change scheduler mode to ::ZES_SCHED_MODE_TIMEOUT or update scheduler -/// mode parameters if already running in this mode. -/// -/// @details -/// - This mode is optimized for multiple applications or contexts -/// submitting work to the hardware. When higher priority work arrives, -/// the scheduler attempts to pause the current executing work within some -/// timeout interval, then submits the other work. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hScheduler` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -/// + `nullptr == pNeedReload` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + This scheduler component does not support scheduler modes. -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make this modification. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerSetTimeoutMode( - zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. - zes_sched_timeout_properties_t *pProperties, ///< [in] The properties to use when configurating this mode. - ze_bool_t *pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to - ///< apply the new scheduler mode. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Change scheduler mode to ::ZES_SCHED_MODE_TIMESLICE or update -/// scheduler mode parameters if already running in this mode. -/// -/// @details -/// - This mode is optimized to provide fair sharing of hardware execution -/// time between multiple contexts submitting work to the hardware -/// concurrently. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hScheduler` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -/// + `nullptr == pNeedReload` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + This scheduler component does not support scheduler modes. -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make this modification. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerSetTimesliceMode( - zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. - zes_sched_timeslice_properties_t *pProperties, ///< [in] The properties to use when configurating this mode. - ze_bool_t *pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to - ///< apply the new scheduler mode. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Change scheduler mode to ::ZES_SCHED_MODE_EXCLUSIVE -/// -/// @details -/// - This mode is optimized for single application/context use-cases. It -/// permits a context to run indefinitely on the hardware without being -/// preempted or terminated. All pending work for other contexts must wait -/// until the running context completes with no further submitted work. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hScheduler` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pNeedReload` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + This scheduler component does not support scheduler modes. -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make this modification. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerSetExclusiveMode( - zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. - ze_bool_t *pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to - ///< apply the new scheduler mode. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Change scheduler mode to ::ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG -/// -/// @details -/// - This is a special mode that must ben enabled when debugging an -/// application that uses this device e.g. using the Level0 Debug API. -/// - It ensures that only one command queue can execute work on the -/// hardware at a given time. Work is permitted to run as long as needed -/// without enforcing any scheduler fairness policies. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hScheduler` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pNeedReload` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + This scheduler component does not support scheduler modes. -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make this modification. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesSchedulerSetComputeUnitDebugMode( - zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. - ze_bool_t *pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to - ///< apply the new scheduler mode. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Standby domains - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Standby hardware components -typedef enum _zes_standby_type_t { - ZES_STANDBY_TYPE_GLOBAL = 0, ///< Control the overall standby policy of the device/sub-device - ZES_STANDBY_TYPE_FORCE_UINT32 = 0x7fffffff - -} zes_standby_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Standby hardware component properties -typedef struct _zes_standby_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zes_standby_type_t type; ///< [out] Which standby hardware component this controls - ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - -} zes_standby_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Standby promotion modes -typedef enum _zes_standby_promo_mode_t { - ZES_STANDBY_PROMO_MODE_DEFAULT = 0, ///< Best compromise between performance and energy savings. - ZES_STANDBY_PROMO_MODE_NEVER = 1, ///< The device/component will never shutdown. This can improve performance - ///< but uses more energy. - ZES_STANDBY_PROMO_MODE_FORCE_UINT32 = 0x7fffffff - -} zes_standby_promo_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of standby controls -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumStandbyDomains( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_standby_handle_t *phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get standby hardware component properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hStandby` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesStandbyGetProperties( - zes_standby_handle_t hStandby, ///< [in] Handle for the component. - zes_standby_properties_t *pProperties ///< [in,out] Will contain the standby hardware properties. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the current standby promotion mode -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hStandby` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pMode` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesStandbyGetMode( - zes_standby_handle_t hStandby, ///< [in] Handle for the component. - zes_standby_promo_mode_t *pMode ///< [in,out] Will contain the current standby mode. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set standby promotion mode -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hStandby` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZES_STANDBY_PROMO_MODE_NEVER < mode` -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesStandbySetMode( - zes_standby_handle_t hStandby, ///< [in] Handle for the component. - zes_standby_promo_mode_t mode ///< [in] New standby mode. -); - -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Temperature sensors -typedef enum _zes_temp_sensors_t { - ZES_TEMP_SENSORS_GLOBAL = 0, ///< The maximum temperature across all device sensors - ZES_TEMP_SENSORS_GPU = 1, ///< The maximum temperature across all sensors in the GPU - ZES_TEMP_SENSORS_MEMORY = 2, ///< The maximum temperature across all sensors in the local memory - ZES_TEMP_SENSORS_GLOBAL_MIN = 3, ///< The minimum temperature across all device sensors - ZES_TEMP_SENSORS_GPU_MIN = 4, ///< The minimum temperature across all sensors in the GPU - ZES_TEMP_SENSORS_MEMORY_MIN = 5, ///< The minimum temperature across all sensors in the local device memory - ZES_TEMP_SENSORS_FORCE_UINT32 = 0x7fffffff - -} zes_temp_sensors_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Temperature sensor properties -typedef struct _zes_temp_properties_t { - zes_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zes_temp_sensors_t type; ///< [out] Which part of the device the temperature sensor measures - ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means - ///< that the resource is on the device of the calling Sysman handle - uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device - double maxTemperature; ///< [out] Will contain the maximum temperature for the specific device in - ///< degrees Celsius. - ze_bool_t isCriticalTempSupported; ///< [out] Indicates if the critical temperature event - ///< ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL is supported - ze_bool_t isThreshold1Supported; ///< [out] Indicates if the temperature threshold 1 event - ///< ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 is supported - ze_bool_t isThreshold2Supported; ///< [out] Indicates if the temperature threshold 2 event - ///< ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 is supported - -} zes_temp_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Temperature sensor threshold -typedef struct _zes_temp_threshold_t { - ze_bool_t enableLowToHigh; ///< [in,out] Trigger an event when the temperature crosses from below the - ///< threshold to above. - ze_bool_t enableHighToLow; ///< [in,out] Trigger an event when the temperature crosses from above the - ///< threshold to below. - double threshold; ///< [in,out] The threshold in degrees Celsius. - -} zes_temp_threshold_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Temperature configuration - which events should be triggered and the -/// trigger conditions. -typedef struct _zes_temp_config_t { - zes_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - ze_bool_t enableCritical; ///< [in,out] Indicates if event ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL should - ///< be triggered by the driver. - zes_temp_threshold_t threshold1; ///< [in,out] Configuration controlling if and when event - ///< ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 should be triggered by the - ///< driver. - zes_temp_threshold_t threshold2; ///< [in,out] Configuration controlling if and when event - ///< ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 should be triggered by the - ///< driver. - -} zes_temp_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of temperature sensors -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesDeviceEnumTemperatureSensors( - zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. - uint32_t *pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver will update the value with the total - ///< number of components of this type. - ///< if count is non-zero, then driver will only retrieve that number of components. - ///< if count is larger than the number of components available, then the - ///< driver will update the value with the correct number of components - ///< that are returned. - zes_temp_handle_t *phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get temperature sensor properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hTemperature` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesTemperatureGetProperties( - zes_temp_handle_t hTemperature, ///< [in] Handle for the component. - zes_temp_properties_t *pProperties ///< [in,out] Will contain the temperature sensor properties. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get temperature configuration for this sensor - which events are -/// triggered and the trigger conditions -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hTemperature` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Temperature thresholds are not supported on this temperature sensor. Generally this is only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL -/// + One or both of the thresholds is not supported - check ::zes_temp_properties_t.isThreshold1Supported and ::zes_temp_properties_t.isThreshold2Supported -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to request this feature. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesTemperatureGetConfig( - zes_temp_handle_t hTemperature, ///< [in] Handle for the component. - zes_temp_config_t *pConfig ///< [in,out] Returns current configuration. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set temperature configuration for this sensor - indicates which events -/// are triggered and the trigger conditions -/// -/// @details -/// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL will be triggered when -/// temperature reaches the critical range. Use the function -/// ::zesDeviceEventRegister() to start receiving this event. -/// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 and -/// ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 will be generated when -/// temperature cross the thresholds set using this function. Use the -/// function ::zesDeviceEventRegister() to start receiving these events. -/// - Only one running process can set the temperature configuration at a -/// time. If another process attempts to change the configuration, the -/// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function -/// ::zesTemperatureGetConfig() will return the process ID currently -/// controlling these settings. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hTemperature` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Temperature thresholds are not supported on this temperature sensor. Generally they are only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL -/// + Enabling the critical temperature event is not supported - check ::zes_temp_properties_t.isCriticalTempSupported -/// + One or both of the thresholds is not supported - check ::zes_temp_properties_t.isThreshold1Supported and ::zes_temp_properties_t.isThreshold2Supported -/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to request this feature. -/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE -/// + Another running process is controlling these settings. -/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT -/// + One or both the thresholds is above TjMax (see ::zesFrequencyOcGetTjMax()). Temperature thresholds must be below this value. -ZE_APIEXPORT ze_result_t ZE_APICALL -zesTemperatureSetConfig( - zes_temp_handle_t hTemperature, ///< [in] Handle for the component. - const zes_temp_config_t *pConfig ///< [in] New configuration. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the temperature from a specified sensor -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hTemperature` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pTemperature` -ZE_APIEXPORT ze_result_t ZE_APICALL -zesTemperatureGetState( - zes_temp_handle_t hTemperature, ///< [in] Handle for the component. - double *pTemperature ///< [in,out] Will contain the temperature read from the specified sensor - ///< in degrees Celsius. -); - -#if defined(__cplusplus) -} // extern "C" -#endif - -#endif // _ZES_API_H \ No newline at end of file diff --git a/third_party/level_zero/zet_api_ext.h b/third_party/level_zero/zet_api_ext.h deleted file mode 100644 index e3e9b970ed..0000000000 --- a/third_party/level_zero/zet_api_ext.h +++ /dev/null @@ -1,475 +0,0 @@ -/* - * - * Copyright (C) 2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - * - */ -#ifndef _ZET_API_EXT_H -#define _ZET_API_EXT_H -#if defined(__cplusplus) -#pragma once -#endif - -// standard headers -#include - -#include "third_party/level_zero/ze_api_ext.h" - -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -// Intel 'oneAPI' Level-Zero Tool API common types -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of context object -typedef ze_context_handle_t zet_context_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of metric streamer's object -typedef struct _zet_metric_streamer_handle_t *zet_metric_streamer_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Defines structure types -typedef enum _zet_structure_type_t { - ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES = 0x1, ///< ::zet_metric_group_properties_t - ZET_STRUCTURE_TYPE_METRIC_PROPERTIES = 0x2, ///< ::zet_metric_properties_t - ZET_STRUCTURE_TYPE_METRIC_STREAMER_DESC = 0x3, ///< ::zet_metric_streamer_desc_t - ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC = 0x4, ///< ::zet_metric_query_pool_desc_t - ZET_STRUCTURE_TYPE_PROFILE_PROPERTIES = 0x5, ///< ::zet_profile_properties_t - ZET_STRUCTURE_TYPE_DEVICE_DEBUG_PROPERTIES = 0x6, ///< ::zet_device_debug_properties_t - ZET_STRUCTURE_TYPE_DEBUG_MEMORY_SPACE_DESC = 0x7, ///< ::zet_debug_memory_space_desc_t - ZET_STRUCTURE_TYPE_DEBUG_REGSET_PROPERTIES = 0x8, ///< ::zet_debug_regset_properties_t - ZET_STRUCTURE_TYPE_TRACER_EXP_DESC = 0x00010001, ///< ::zet_tracer_exp_desc_t - ZET_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff - -} zet_structure_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zet_metric_streamer_desc_t -typedef struct _zet_metric_streamer_desc_t zet_metric_streamer_desc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare zet_metric_query_pool_desc_ext_t -typedef struct _zet_metric_query_pool_desc_ext_t zet_metric_query_pool_desc_ext_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Metric streamer descriptor -typedef struct _zet_metric_streamer_desc_t { - zet_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - uint32_t notifyEveryNReports; ///< [in,out] number of collected reports after which notification event - ///< will be signalled - uint32_t samplingPeriod; ///< [in,out] streamer sampling period in nanoseconds - -} zet_metric_streamer_desc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Opens metric streamer for a device. -/// -/// @details -/// - The notification event must have been created from an event pool that -/// was created using ::ZE_EVENT_POOL_FLAG_HOST_VISIBLE flag. -/// - The notification event must **not** have been created from an event -/// pool that was created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP -/// flag. -/// - The application must **not** call this function from simultaneous -/// threads with the same device handle. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// + `nullptr == hMetricGroup` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == phMetricStreamer` -/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricStreamerOpen( - zet_context_handle_t hContext, ///< [in] handle of the context object - zet_device_handle_t hDevice, ///< [in] handle of the device - zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group - zet_metric_streamer_desc_t *desc, ///< [in,out] metric streamer descriptor - ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification - zet_metric_streamer_handle_t *phMetricStreamer ///< [out] handle of metric streamer -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Append metric streamer marker into a command list. -/// -/// @details -/// - The application must ensure the metric streamer is accessible by the -/// device on which the command list was created. -/// - The application must ensure the command list and metric streamer were -/// created on the same context. -/// - The application must **not** call this function from simultaneous -/// threads with the same command list handle. -/// - Allow to associate metric stream time based metrics with executed -/// workload. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hCommandList` -/// + `nullptr == hMetricStreamer` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetCommandListAppendMetricStreamerMarker( - zet_command_list_handle_t hCommandList, ///< [in] handle of the command list - zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer - uint32_t value ///< [in] streamer marker value -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Closes metric streamer. -/// -/// @details -/// - The application must **not** call this function from simultaneous -/// threads with the same metric streamer handle. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMetricStreamer` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricStreamerClose( - zet_metric_streamer_handle_t hMetricStreamer ///< [in][release] handle of the metric streamer -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reads data from metric streamer. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMetricStreamer` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pRawDataSize` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricStreamerReadData( - zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer - uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. - ///< if UINT32_MAX, then function will retrieve all reports available - size_t *pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. - uint8_t *pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer - ///< reports in raw format -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Metric query pool types -typedef enum _zet_metric_query_pool_type_t { - ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE = 0, ///< Performance metric query pool. - ZET_METRIC_QUERY_POOL_TYPE_EXECUTION = 1, ///< Skips workload execution between begin/end calls. - ZET_METRIC_QUERY_POOL_TYPE_FORCE_UINT32 = 0x7fffffff - -} zet_metric_query_pool_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Metric query pool description -typedef struct _zet_metric_query_pool_desc_ext_t { - zet_structure_type_t stype; ///< [in] type of this structure - const void *pNext; ///< [in][optional] pointer to extension-specific structure - zet_metric_query_pool_type_t type; ///< [in] Query pool type. - uint32_t count; ///< [in] Internal slots count within query pool object. - -} zet_metric_query_pool_desc_ext_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Creates a pool of metric queries on the context. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// + `nullptr == hMetricGroup` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == phMetricQueryPool` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZET_METRIC_QUERY_POOL_TYPE_EXECUTION < desc->type` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricQueryPoolCreateExt( - zet_context_handle_t hContext, ///< [in] handle of the context object - zet_device_handle_t hDevice, ///< [in] handle of the device - zet_metric_group_handle_t hMetricGroup, ///< [in] metric group associated with the query object. - const zet_metric_query_pool_desc_ext_t *desc, ///< [in] metric query pool descriptor - zet_metric_query_pool_handle_t *phMetricQueryPool ///< [out] handle of metric query pool -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Activates metric groups. -/// -/// @details -/// - Immediately reconfigures the device to activate only those metric -/// groups provided. -/// - Any metric groups previously activated but not provided will be -/// deactivated. -/// - Deactivating metric groups that are still in-use will result in -/// undefined behavior. -/// - All metric groups must have different domains, see -/// ::zet_metric_group_properties_t. -/// - The application must **not** call this function from simultaneous -/// threads with the same device handle. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_SIZE -/// + `(nullptr == phMetricGroups) && (0 < count)` -/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT -/// + Multiple metric groups share the same domain -ZE_APIEXPORT ze_result_t ZE_APICALL -zetContextActivateMetricGroups( - zet_context_handle_t hContext, ///< [in] handle of the context object - zet_device_handle_t hDevice, ///< [in] handle of the device - uint32_t count, ///< [in] metric group count to activate; must be 0 if `nullptr == - ///< phMetricGroups` - zet_metric_group_handle_t *phMetricGroups ///< [in][optional][range(0, count)] handles of the metric groups to activate. - ///< nullptr deactivates all previously used metric groups. - ///< all metrics groups must come from a different domains. - ///< metric query and metric stream must use activated metric groups. -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Appends metric query end into a command list. -/// -/// @details -/// - The application must ensure the metric query and events are accessible -/// by the device on which the command list was created. -/// - The application must ensure the command list, events and metric query -/// were created on the same context. -/// - The application must ensure the signal event was **not** created from -/// an event pool that was created using -/// ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag. -/// - The application must **not** call this function from simultaneous -/// threads with the same command list handle. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hCommandList` -/// + `nullptr == hMetricQuery` -/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT -/// - ::ZE_RESULT_ERROR_INVALID_SIZE -/// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetCommandListAppendMetricQueryEndExt( - zet_command_list_handle_t hCommandList, ///< [in] handle of the command list - zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query - ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion - uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 - ///< if `nullptr == phWaitEvents` - ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait - ///< on before launching -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Metric group sampling type -typedef uint32_t zet_metric_group_sampling_type_flags_t; -typedef enum _zet_metric_group_sampling_type_flag_t { - ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED = ZE_BIT(0), ///< Event based sampling - ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED = ZE_BIT(1), ///< Time based sampling - ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff - -} zet_metric_group_sampling_type_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Metric group properties queried using ::zetMetricGroupGetProperties -typedef struct _zet_metric_group_properties_ext_t { - zet_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - char name[ZET_MAX_METRIC_GROUP_NAME]; ///< [out] metric group name - char description[ZET_MAX_METRIC_GROUP_DESCRIPTION]; ///< [out] metric group description - zet_metric_group_sampling_type_flags_t samplingType; ///< [out] metric group sampling type. - ///< returns a combination of ::zet_metric_group_sampling_type_flag_t. - uint32_t domain; ///< [out] metric group domain number. Cannot use simultaneous metric - ///< groups from different domains. - uint32_t metricCount; ///< [out] metric count belonging to this group - -} zet_metric_group_properties_ext_t; - -/// @brief Metric properties queried using ::zetMetricGetProperties -typedef struct _zet_metric_properties_ext_t { - zet_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - char name[ZET_MAX_METRIC_NAME]; ///< [out] metric name - char description[ZET_MAX_METRIC_DESCRIPTION]; ///< [out] metric description - char component[ZET_MAX_METRIC_COMPONENT]; ///< [out] metric component - uint32_t tierNumber; ///< [out] number of tier - zet_metric_type_t metricType; ///< [out] metric type - zet_value_type_t resultType; ///< [out] metric result type - char resultUnits[ZET_MAX_METRIC_RESULT_UNITS]; ///< [out] metric result units - -} zet_metric_properties_ext_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieves attributes of a metric group. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMetricGroup` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricGroupGetPropertiesExt( - zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group - zet_metric_group_properties_ext_t *pProperties ///< [in,out] metric group properties -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieves attributes of a metric. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMetric` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricGetPropertiesExt( - zet_metric_handle_t hMetric, ///< [in] handle of the metric - zet_metric_properties_ext_t *pProperties ///< [in,out] metric properties -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Metric group calculation type -typedef enum _zet_metric_group_calculation_type_t { - ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES = 0, ///< Calculated metric values from raw data. - ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES = 1, ///< Maximum metric values. - ZET_METRIC_GROUP_CALCULATION_TYPE_FORCE_UINT32 = 0x7fffffff - -} zet_metric_group_calculation_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Calculates metric values from raw data. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMetricGroup` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pRawData` -/// + `nullptr == pMetricValueCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetMetricGroupCalculateMetricValuesExt( - zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group - zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data - size_t rawDataSize, ///< [in] size in bytes of raw data buffer - const uint8_t *pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate - uint32_t *pMetricValueCount, ///< [in,out] pointer to number of metric values calculated. - ///< if count is zero, then the driver will update the value with the total - ///< number of metric values to be calculated. - ///< if count is non-zero, then driver will only calculate that number of - ///< metric values. - ///< if count is larger than the number available in the raw data buffer, - ///< then the driver will update the value with the actual number of metric - ///< values to be calculated. - zet_typed_value_t *pMetricValues ///< [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated - ///< metrics -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Supportted profile features -typedef uint32_t zet_profile_flagsExt_t; -typedef enum _zet_profile_flagExt_t { - ZET_PROFILE_FLAG_REGISTER_REALLOCATION_EXT = ZE_BIT(0), ///< request the compiler attempt to minimize register usage as much as - ///< possible to allow for instrumentation - ZET_PROFILE_FLAG_FREE_REGISTER_INFO_EXT = ZE_BIT(1), ///< request the compiler generate free register info - ZET_PROFILE_FLAG_FORCE_UINT32_EXT = 0x7fffffff - -} zet_profile_flagExt_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Profiling meta-data for instrumentation -typedef struct _zet_profile_properties_t { - zet_structure_type_t stype; ///< [in] type of this structure - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - zet_profile_flagsExt_t flags; ///< [out] indicates which flags were enabled during compilation. - ///< returns 0 (none) or a combination of ::zet_profile_flag_t - uint32_t numTokens; ///< [out] number of tokens immediately following this structure - -} zet_profile_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retrieve profiling information generated for the kernel. -/// -/// @details -/// - Module must be created using the following build option: -/// + "-zet-profile-flags " - enable generation of profile -/// information -/// + "" must be a combination of ::zet_profile_flag_t, in hex -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - ::ZE_RESULT_SUCCESS -/// - ::ZE_RESULT_ERROR_UNINITIALIZED -/// - ::ZE_RESULT_ERROR_DEVICE_LOST -/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hKernel` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProfileProperties` -ZE_APIEXPORT ze_result_t ZE_APICALL -zetKernelGetProfileInfoExt( - zet_kernel_handle_t hKernel, ///< [in] handle to kernel - zet_profile_properties_t *pProfileProperties ///< [out] pointer to profile properties -); - -#if defined(__cplusplus) -} // extern "C" -#endif - -#endif // _ZET_API_EXT_H diff --git a/version.cmake b/version.cmake index d0d6dbdeaa..5ca38e0f53 100644 --- a/version.cmake +++ b/version.cmake @@ -67,5 +67,5 @@ else() endif(UNIX) # Level-Zero package version -set(NEO_L0_VERSION_MAJOR 0) -set(NEO_L0_VERSION_MINOR 8) +set(NEO_L0_VERSION_MAJOR 1) +set(NEO_L0_VERSION_MINOR 0)