diff --git a/src/plugins/intel_npu/src/backend/include/zero_utils.hpp b/src/plugins/intel_npu/src/backend/include/zero_utils.hpp index 983e9b4a7e963d..a170701cc911e2 100644 --- a/src/plugins/intel_npu/src/backend/include/zero_utils.hpp +++ b/src/plugins/intel_npu/src/backend/include/zero_utils.hpp @@ -18,20 +18,20 @@ namespace intel_npu { namespace zeroUtils { -#define THROW_ON_FAIL_FOR_GRAPH_EXT(step, result, graph_ddi_table_ext) \ - OPENVINO_THROW("L0 ", \ - step, \ - " result: ", \ - ze_result_to_string(result), \ - ", code 0x", \ - std::hex, \ - uint64_t(result), \ - " - ", \ - ze_result_to_description(result), \ - " . ", \ +#define THROW_ON_FAIL_FOR_LEVELZERO_EXT(step, result, graph_ddi_table_ext) \ + OPENVINO_THROW("L0 ", \ + step, \ + " result: ", \ + ze_result_to_string(result), \ + ", code 0x", \ + std::hex, \ + uint64_t(result), \ + " - ", \ + ze_result_to_description(result), \ + " . ", \ intel_npu::zeroUtils::getLatestBuildError(graph_ddi_table_ext)); -#define THROW_ON_FAIL_FOR_BACKEND(step, result) \ +#define THROW_ON_FAIL_FOR_LEVELZERO(step, result) \ if (ZE_RESULT_SUCCESS != result) { \ OPENVINO_THROW("L0 ", \ step, \ diff --git a/src/plugins/intel_npu/src/backend/src/zero_device.cpp b/src/plugins/intel_npu/src/backend/src/zero_device.cpp index ff86f4da3d8a62..1eb87d1b4114b0 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_device.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_device.cpp @@ -20,8 +20,8 @@ ZeroDevice::ZeroDevice(const std::shared_ptr& initStructs log("ZeroDevice", Logger::global().level()) { log.debug("ZeroDevice::ZeroDevice init"); device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; - THROW_ON_FAIL_FOR_BACKEND("zeDeviceGetProperties", - zeDeviceGetProperties(_initStructs->getDevice(), &device_properties)); + THROW_ON_FAIL_FOR_LEVELZERO("zeDeviceGetProperties", + zeDeviceGetProperties(_initStructs->getDevice(), &device_properties)); // Query PCI information // Older drivers do not have this implementend. Linux driver returns NOT_IMPLEMENTED, while windows driver returns @@ -62,7 +62,7 @@ ZeroDevice::ZeroDevice(const std::shared_ptr& initStructs std::vector command_group_properties; uint32_t command_queue_group_count = 0; // Discover all command queue groups - THROW_ON_FAIL_FOR_BACKEND( + THROW_ON_FAIL_FOR_LEVELZERO( "zeDeviceGetCommandQueueGroupProperties", zeDeviceGetCommandQueueGroupProperties(_initStructs->getDevice(), &command_queue_group_count, nullptr)); @@ -74,10 +74,10 @@ ZeroDevice::ZeroDevice(const std::shared_ptr& initStructs prop.pNext = nullptr; } - THROW_ON_FAIL_FOR_BACKEND("zeDeviceGetCommandQueueGroupProperties", - zeDeviceGetCommandQueueGroupProperties(_initStructs->getDevice(), - &command_queue_group_count, - command_group_properties.data())); + THROW_ON_FAIL_FOR_LEVELZERO("zeDeviceGetCommandQueueGroupProperties", + zeDeviceGetCommandQueueGroupProperties(_initStructs->getDevice(), + &command_queue_group_count, + command_group_properties.data())); // Find the corresponding command queue group. log.debug("ZeroDevice::ZeroDevice - findGroupOrdinal"); @@ -141,7 +141,7 @@ uint64_t ZeroDevice::getAllocMemSize() const { ze_result_t result = _graph_ddi_table_ext.pfnQueryContextMemory(_initStructs->getContext(), ZE_GRAPH_QUERY_MEMORY_DDR, &query); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnQueryContextMemory", result, _graph_ddi_table_ext); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnQueryContextMemory", result, _graph_ddi_table_ext); } return query.allocated; } @@ -151,7 +151,7 @@ uint64_t ZeroDevice::getTotalMemSize() const { ze_result_t result = _graph_ddi_table_ext.pfnQueryContextMemory(_initStructs->getContext(), ZE_GRAPH_QUERY_MEMORY_DDR, &query); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnQueryContextMemory", result, _graph_ddi_table_ext); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnQueryContextMemory", result, _graph_ddi_table_ext); } return query.total; } diff --git a/src/plugins/intel_npu/src/backend/src/zero_executor.cpp b/src/plugins/intel_npu/src/backend/src/zero_executor.cpp index 2dd74c639a9d76..e4f77591400a50 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_executor.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_executor.cpp @@ -53,7 +53,7 @@ ZeroExecutor::ZeroExecutor(const std::shared_ptr& i ze_result_t result = _graph_ddi_table_ext.pfnCreate(_initStructs->getContext(), _initStructs->getDevice(), &desc, &_graph); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnCreate", result, _graph_ddi_table_ext); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnCreate", result, _graph_ddi_table_ext); } } else { @@ -68,7 +68,7 @@ ZeroExecutor::ZeroExecutor(const std::shared_ptr& i ze_result_t result = _graph_ddi_table_ext.pfnGetProperties(_graph, &props); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGetProperties", result, _graph_ddi_table_ext); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGetProperties", result, _graph_ddi_table_ext); } auto targetDriverExtVersion = _graph_ddi_table_ext.version(); if (targetDriverExtVersion <= ZE_GRAPH_EXT_VERSION_1_1) { @@ -83,7 +83,7 @@ ZeroExecutor::ZeroExecutor(const std::shared_ptr& i arg3.stype = ZE_STRUCTURE_TYPE_GRAPH_ARGUMENT_PROPERTIES; ze_result_t result = _graph_ddi_table_ext.pfnGetArgumentProperties3(_graph, index, &arg3); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGetArgumentProperties3", result, _graph_ddi_table_ext); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGetArgumentProperties3", result, _graph_ddi_table_ext); } if (arg3.type == ZE_GRAPH_ARGUMENT_TYPE_INPUT) { @@ -171,7 +171,7 @@ void ZeroExecutor::setWorkloadType(const ov::WorkloadType workloadType) const { void ZeroExecutor::setArgumentValue(uint32_t argi_, const void* argv_) const { ze_result_t result = _graph_ddi_table_ext.pfnSetArgumentValue(_graph, argi_, argv_); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("zeGraphSetArgumentValue", result, _graph_ddi_table_ext); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("zeGraphSetArgumentValue", result, _graph_ddi_table_ext); } } diff --git a/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp b/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp index c5c0de852c289b..5adecb9d11efb3 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_infer_request.cpp @@ -188,8 +188,8 @@ ZeroInferRequest::ZeroInferRequest(const std::shared_ptr& } _properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; - THROW_ON_FAIL_FOR_BACKEND("zeDeviceGetProperties", - zeDeviceGetProperties(_executor->getInitStructs()->getDevice(), &_properties)); + THROW_ON_FAIL_FOR_LEVELZERO("zeDeviceGetProperties", + zeDeviceGetProperties(_executor->getInitStructs()->getDevice(), &_properties)); _outputAllocator = std::make_shared(_initStructs); _inputAllocator = diff --git a/src/plugins/intel_npu/src/backend/src/zero_init.cpp b/src/plugins/intel_npu/src/backend/src/zero_init.cpp index e09f31a3f6c4b3..7e34176259d7d0 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_init.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_init.cpp @@ -54,13 +54,13 @@ static std::tuple queryDriverExtensionVersion( ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", Logger::global().level()) { OV_ITT_SCOPED_TASK(itt::domains::LevelZeroBackend, "ZeroInitStructsHolder::ZeroInitStructsHolder"); log.debug("ZeroInitStructsHolder - performing zeInit on VPU only"); - THROW_ON_FAIL_FOR_BACKEND("zeInit", zeInit(ZE_INIT_FLAG_VPU_ONLY)); + THROW_ON_FAIL_FOR_LEVELZERO("zeInit", zeInit(ZE_INIT_FLAG_VPU_ONLY)); uint32_t drivers = 0; - THROW_ON_FAIL_FOR_BACKEND("zeDriverGet", zeDriverGet(&drivers, nullptr)); + THROW_ON_FAIL_FOR_LEVELZERO("zeDriverGet", zeDriverGet(&drivers, nullptr)); std::vector all_drivers(drivers); - THROW_ON_FAIL_FOR_BACKEND("zeDriverGet", zeDriverGet(&drivers, all_drivers.data())); + THROW_ON_FAIL_FOR_LEVELZERO("zeDriverGet", zeDriverGet(&drivers, all_drivers.data())); // Get our target driver driver_properties.stype = ZE_STRUCTURE_TYPE_DRIVER_PROPERTIES; @@ -79,7 +79,7 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", // Check L0 API version ze_api_version_t ze_drv_api_version = {}; - THROW_ON_FAIL_FOR_BACKEND("zeDriverGetApiVersion", zeDriverGetApiVersion(driver_handle, &ze_drv_api_version)); + THROW_ON_FAIL_FOR_LEVELZERO("zeDriverGetApiVersion", zeDriverGetApiVersion(driver_handle, &ze_drv_api_version)); if (ZE_MAJOR_VERSION(ZE_API_VERSION_CURRENT) != ZE_MAJOR_VERSION(ze_drv_api_version)) { OPENVINO_THROW("Incompatibility between NPU plugin and driver! ", @@ -97,13 +97,13 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", } uint32_t count = 0; - THROW_ON_FAIL_FOR_BACKEND("zeDriverGetExtensionProperties", - zeDriverGetExtensionProperties(driver_handle, &count, nullptr)); + THROW_ON_FAIL_FOR_LEVELZERO("zeDriverGetExtensionProperties", + zeDriverGetExtensionProperties(driver_handle, &count, nullptr)); std::vector extProps; extProps.resize(count); - THROW_ON_FAIL_FOR_BACKEND("zeDriverGetExtensionProperties", - zeDriverGetExtensionProperties(driver_handle, &count, extProps.data())); + THROW_ON_FAIL_FOR_LEVELZERO("zeDriverGetExtensionProperties", + zeDriverGetExtensionProperties(driver_handle, &count, extProps.data())); // Query our graph extension version std::string graph_ext_name; @@ -148,7 +148,7 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", // Load our command queue extension ze_command_queue_npu_dditable_ext_last_t* _command_queue_npu_dditable_ext = nullptr; if (command_queue_ext_version) { - THROW_ON_FAIL_FOR_BACKEND( + THROW_ON_FAIL_FOR_LEVELZERO( "zeDriverGetExtensionFunctionAddress " + command_queue_ext_name, zeDriverGetExtensionFunctionAddress(driver_handle, command_queue_ext_name.c_str(), @@ -161,10 +161,10 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", // Load our graph extension ze_graph_dditable_ext_last_t* graph_ddi_table_ext = nullptr; - THROW_ON_FAIL_FOR_BACKEND("zeDriverGetExtensionFunctionAddress", - zeDriverGetExtensionFunctionAddress(driver_handle, - graph_ext_name.c_str(), - reinterpret_cast(&graph_ddi_table_ext))); + THROW_ON_FAIL_FOR_LEVELZERO("zeDriverGetExtensionFunctionAddress", + zeDriverGetExtensionFunctionAddress(driver_handle, + graph_ext_name.c_str(), + reinterpret_cast(&graph_ddi_table_ext))); graph_dditable_ext_decorator = std::make_unique(graph_ddi_table_ext, graph_ext_version); @@ -189,7 +189,7 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", // Load our profiling extension ze_graph_profiling_dditable_ext_t* _graph_profiling_ddi_table_ext = nullptr; - THROW_ON_FAIL_FOR_BACKEND( + THROW_ON_FAIL_FOR_LEVELZERO( "zeDriverGetExtensionFunctionAddress", zeDriverGetExtensionFunctionAddress(driver_handle, "ZE_extension_profiling_data", @@ -200,11 +200,11 @@ ZeroInitStructsHolder::ZeroInitStructsHolder() : log("NPUZeroInitStructsHolder", uint32_t device_count = 1; // Get our target device - THROW_ON_FAIL_FOR_BACKEND("zeDeviceGet", zeDeviceGet(driver_handle, &device_count, &device_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeDeviceGet", zeDeviceGet(driver_handle, &device_count, &device_handle)); // Create context - share between the compiler and the backend ze_context_desc_t context_desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, 0, 0}; - THROW_ON_FAIL_FOR_BACKEND("zeContextCreate", zeContextCreate(driver_handle, &context_desc, &context)); + THROW_ON_FAIL_FOR_LEVELZERO("zeContextCreate", zeContextCreate(driver_handle, &context_desc, &context)); log.debug("ZeroInitStructsHolder initialize complete"); } diff --git a/src/plugins/intel_npu/src/backend/src/zero_profiling.cpp b/src/plugins/intel_npu/src/backend/src/zero_profiling.cpp index 156122b737bb53..5994604e096354 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_profiling.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_profiling.cpp @@ -46,8 +46,9 @@ ProfilingPool::~ProfilingPool() { } void ProfilingQuery::create(const ze_graph_profiling_pool_handle_t& profiling_pool) { - THROW_ON_FAIL_FOR_BACKEND("pfnProfilingQueryCreate", - _graph_profiling_ddi_table_ext.pfnProfilingQueryCreate(profiling_pool, _index, &_handle)); + THROW_ON_FAIL_FOR_LEVELZERO( + "pfnProfilingQueryCreate", + _graph_profiling_ddi_table_ext.pfnProfilingQueryCreate(profiling_pool, _index, &_handle)); } LayerStatistics ProfilingQuery::getLayerStatistics() const { @@ -66,7 +67,7 @@ void ProfilingQuery::queryGetData(const ze_graph_profiling_type_t profilingType, uint32_t* pSize, uint8_t* pData) const { if (_handle && pSize) { - THROW_ON_FAIL_FOR_BACKEND( + THROW_ON_FAIL_FOR_LEVELZERO( "pfnProfilingQueryGetData", _graph_profiling_ddi_table_ext.pfnProfilingQueryGetData(_handle, profilingType, pSize, pData)); } @@ -92,7 +93,7 @@ template std::vector ProfilingQuery::getData() const; void ProfilingQuery::getProfilingProperties(ze_device_profiling_data_properties_t* properties) const { if (_handle && properties) { - THROW_ON_FAIL_FOR_BACKEND( + THROW_ON_FAIL_FOR_LEVELZERO( "getProfilingProperties", _graph_profiling_ddi_table_ext.pfnDeviceGetProfilingDataProperties(_device_handle, properties)); } @@ -187,24 +188,25 @@ NpuInferProfiling::NpuInferProfiling(ze_context_handle_t context, _logger("InferProfiling", loglevel) { /// Fetch and store the device timer resolution _dev_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2; - THROW_ON_FAIL_FOR_BACKEND("zeDeviceGetProperties", zeDeviceGetProperties(_device_handle, &_dev_properties)); + THROW_ON_FAIL_FOR_LEVELZERO("zeDeviceGetProperties", zeDeviceGetProperties(_device_handle, &_dev_properties)); /// Request mem allocations ze_host_mem_alloc_desc_t desc = {ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC, nullptr, ZE_HOST_MEM_ALLOC_FLAG_BIAS_CACHED}; - THROW_ON_FAIL_FOR_BACKEND( + THROW_ON_FAIL_FOR_LEVELZERO( "zeMemAllocHost", zeMemAllocHost(_context, &desc, sizeof(uint64_t), 64, &npu_ts_infer_start)); // align to 64 bytes to match npu l2 cache line size - THROW_ON_FAIL_FOR_BACKEND("zeMemAllocHost", - zeMemAllocHost(_context, - &desc, - sizeof(uint64_t), - 64, - &npu_ts_infer_end)); // alight to 64 bytes to match npu l2 cache line size + THROW_ON_FAIL_FOR_LEVELZERO( + "zeMemAllocHost", + zeMemAllocHost(_context, + &desc, + sizeof(uint64_t), + 64, + &npu_ts_infer_end)); // alight to 64 bytes to match npu l2 cache line size } void NpuInferProfiling::sampleNpuTimestamps() { diff --git a/src/plugins/intel_npu/src/backend/src/zero_remote_tensor.cpp b/src/plugins/intel_npu/src/backend/src/zero_remote_tensor.cpp index 1a151bfd19004c..8e19ad9d9a4faa 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_remote_tensor.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_remote_tensor.cpp @@ -37,8 +37,8 @@ ZeroRemoteTensor::ZeroRemoteTensor(std::shared_ptr context, _mem_type(mem_type), _mem(mem) { _ze_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; - THROW_ON_FAIL_FOR_BACKEND("zeDeviceGetProperties", - zeDeviceGetProperties(_init_structs->getDevice(), &_ze_properties)); + THROW_ON_FAIL_FOR_LEVELZERO("zeDeviceGetProperties", + zeDeviceGetProperties(_init_structs->getDevice(), &_ze_properties)); const auto byte_size = ov::element::get_memory_size(_element_type, shape_size(_shape)); @@ -98,8 +98,9 @@ void ZeroRemoteTensor::allocate(const size_t bytes) { } else { desc = {ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC, nullptr, 0}; } - THROW_ON_FAIL_FOR_BACKEND("zeMemAllocHost", - zeMemAllocHost(_init_structs->getContext(), &desc, size, STANDARD_PAGE_SIZE, &_data)); + THROW_ON_FAIL_FOR_LEVELZERO( + "zeMemAllocHost", + zeMemAllocHost(_init_structs->getContext(), &desc, size, STANDARD_PAGE_SIZE, &_data)); break; } case MemType::SHARED_BUF: { @@ -117,13 +118,13 @@ void ZeroRemoteTensor::allocate(const size_t bytes) { _mem, nullptr}; ze_device_mem_alloc_desc_t desc = {ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC, &memory_import, 0, 0}; - THROW_ON_FAIL_FOR_BACKEND("zeMemAllocDevice", - zeMemAllocDevice(_init_structs->getContext(), - &desc, - bytes, - STANDARD_PAGE_SIZE, - _init_structs->getDevice(), - &_data)); + THROW_ON_FAIL_FOR_LEVELZERO("zeMemAllocDevice", + zeMemAllocDevice(_init_structs->getContext(), + &desc, + bytes, + STANDARD_PAGE_SIZE, + _init_structs->getDevice(), + &_data)); #else // in the case of Linux platforms memory could be changed after allocation - using zeMemAllocHost for importing // memory @@ -132,7 +133,7 @@ void ZeroRemoteTensor::allocate(const size_t bytes) { ZE_EXTERNAL_MEMORY_TYPE_FLAG_DMA_BUF, static_cast(reinterpret_cast(_mem))}; ze_host_mem_alloc_desc_t desc = {.pNext = &memory_import}; - THROW_ON_FAIL_FOR_BACKEND( + THROW_ON_FAIL_FOR_LEVELZERO( "zeMemAllocHost", zeMemAllocHost(_init_structs->getContext(), &desc, bytes, STANDARD_PAGE_SIZE, &_data)); #endif diff --git a/src/plugins/intel_npu/src/backend/src/zero_wrappers.cpp b/src/plugins/intel_npu/src/backend/src/zero_wrappers.cpp index f498131d997b2a..5e6425f856ce17 100644 --- a/src/plugins/intel_npu/src/backend/src/zero_wrappers.cpp +++ b/src/plugins/intel_npu/src/backend/src/zero_wrappers.cpp @@ -19,8 +19,8 @@ EventPool::EventPool(ze_device_handle_t device_handle, nullptr, ZE_EVENT_POOL_FLAG_HOST_VISIBLE, event_count}; - THROW_ON_FAIL_FOR_BACKEND("zeEventPoolCreate", - zeEventPoolCreate(context, &event_pool_desc, 1, &device_handle, &_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeEventPoolCreate", + zeEventPoolCreate(context, &event_pool_desc, 1, &device_handle, &_handle)); } EventPool::~EventPool() { auto result = zeEventPoolDestroy(_handle); @@ -32,25 +32,25 @@ EventPool::~EventPool() { Event::Event(const ze_event_pool_handle_t& event_pool, uint32_t event_index, const Config& config) : _log("Event", config.get()) { ze_event_desc_t event_desc = {ZE_STRUCTURE_TYPE_EVENT_DESC, nullptr, event_index, 0, 0}; - THROW_ON_FAIL_FOR_BACKEND("zeEventCreate", zeEventCreate(event_pool, &event_desc, &_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeEventCreate", zeEventCreate(event_pool, &event_desc, &_handle)); } void Event::AppendSignalEvent(CommandList& command_list) const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandListAppendSignalEvent", - zeCommandListAppendSignalEvent(command_list.handle(), _handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListAppendSignalEvent", + zeCommandListAppendSignalEvent(command_list.handle(), _handle)); } void Event::AppendWaitOnEvent(CommandList& command_list) { - THROW_ON_FAIL_FOR_BACKEND("zeCommandListAppendWaitOnEvents", - zeCommandListAppendWaitOnEvents(command_list.handle(), 1, &_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListAppendWaitOnEvents", + zeCommandListAppendWaitOnEvents(command_list.handle(), 1, &_handle)); } void Event::AppendEventReset(CommandList& command_list) const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandListAppendEventReset", - zeCommandListAppendEventReset(command_list.handle(), _handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListAppendEventReset", + zeCommandListAppendEventReset(command_list.handle(), _handle)); } void Event::hostSynchronize() const { - THROW_ON_FAIL_FOR_BACKEND("zeEventHostSynchronize", zeEventHostSynchronize(_handle, UINT64_MAX)); + THROW_ON_FAIL_FOR_LEVELZERO("zeEventHostSynchronize", zeEventHostSynchronize(_handle, UINT64_MAX)); } void Event::reset() const { - THROW_ON_FAIL_FOR_BACKEND("zeEventHostReset", zeEventHostReset(_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeEventHostReset", zeEventHostReset(_handle)); } Event::~Event() { auto result = zeEventDestroy(_handle); @@ -70,27 +70,27 @@ CommandList::CommandList(const ze_device_handle_t& device_handle, _log("CommandList", config.get()) { ze_mutable_command_list_exp_desc_t mutable_desc = {ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_LIST_EXP_DESC, nullptr, 0}; ze_command_list_desc_t desc = {ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC, &mutable_desc, group_ordinal, 0}; - THROW_ON_FAIL_FOR_BACKEND("zeCommandListCreate", zeCommandListCreate(_context, device_handle, &desc, &_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListCreate", zeCommandListCreate(_context, device_handle, &desc, &_handle)); if (mtci_is_supported) { ze_mutable_command_id_exp_desc_t mutableCmdIdDesc = {ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_ID_EXP_DESC, nullptr, ZE_MUTABLE_COMMAND_EXP_FLAG_GRAPH_ARGUMENT}; - THROW_ON_FAIL_FOR_BACKEND("zeCommandListGetNextCommandIdExp", - zeCommandListGetNextCommandIdExp(_handle, &mutableCmdIdDesc, &_command_id)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListGetNextCommandIdExp", + zeCommandListGetNextCommandIdExp(_handle, &mutableCmdIdDesc, &_command_id)); } } void CommandList::reset() const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandListReset", zeCommandListReset(_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListReset", zeCommandListReset(_handle)); } void CommandList::appendMemoryCopy(void* dst, const void* src, const std::size_t size) const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandListAppendMemoryCopy", - zeCommandListAppendMemoryCopy(_handle, dst, src, size, nullptr, 0, nullptr)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListAppendMemoryCopy", + zeCommandListAppendMemoryCopy(_handle, dst, src, size, nullptr, 0, nullptr)); } void CommandList::appendGraphInitialize(const ze_graph_handle_t& graph_handle) const { ze_result_t result = _graph_ddi_table_ext.pfnAppendGraphInitialize(_handle, graph_handle, nullptr, 0, nullptr); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnAppendGraphInitialize", result, _graph_ddi_table_ext); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnAppendGraphInitialize", result, _graph_ddi_table_ext); } } void CommandList::appendGraphExecute(const ze_graph_handle_t& graph_handle, @@ -98,18 +98,18 @@ void CommandList::appendGraphExecute(const ze_graph_handle_t& graph_handle, ze_result_t result = _graph_ddi_table_ext.pfnAppendGraphExecute(_handle, graph_handle, profiling_query_handle, nullptr, 0, nullptr); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnAppendGraphExecute", result, _graph_ddi_table_ext); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnAppendGraphExecute", result, _graph_ddi_table_ext); } } void CommandList::appendNpuTimestamp(uint64_t* timestamp_buff) const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandListAppendWriteGlobalTimestamp", - zeCommandListAppendWriteGlobalTimestamp(_handle, timestamp_buff, nullptr, 0, nullptr)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListAppendWriteGlobalTimestamp", + zeCommandListAppendWriteGlobalTimestamp(_handle, timestamp_buff, nullptr, 0, nullptr)); } void CommandList::appendBarrier() const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandListAppendBarrier", zeCommandListAppendBarrier(_handle, nullptr, 0, nullptr)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListAppendBarrier", zeCommandListAppendBarrier(_handle, nullptr, 0, nullptr)); } void CommandList::close() const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandListClose", zeCommandListClose(_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListClose", zeCommandListClose(_handle)); } CommandList::~CommandList() { auto result = zeCommandListDestroy(_handle); @@ -128,8 +128,8 @@ void CommandList::updateMutableCommandList(uint32_t arg_index, const void* arg_v &desc, 0}; - THROW_ON_FAIL_FOR_BACKEND("zeCommandListUpdateMutableCommandsExp", - zeCommandListUpdateMutableCommandsExp(_handle, &mutable_commands_exp_desc_t)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandListUpdateMutableCommandsExp", + zeCommandListUpdateMutableCommandsExp(_handle, &mutable_commands_exp_desc_t)); } CommandQueue::CommandQueue(const ze_device_handle_t& device_handle, @@ -152,22 +152,22 @@ CommandQueue::CommandQueue(const ze_device_handle_t& device_handle, OPENVINO_THROW("Turbo is not supported by the current driver"); } } - THROW_ON_FAIL_FOR_BACKEND("zeCommandQueueCreate", - zeCommandQueueCreate(_context, device_handle, &queue_desc, &_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandQueueCreate", + zeCommandQueueCreate(_context, device_handle, &queue_desc, &_handle)); } void CommandQueue::executeCommandList(CommandList& command_list) const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandQueueExecuteCommandLists", - zeCommandQueueExecuteCommandLists(_handle, 1, &command_list._handle, nullptr)); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandQueueExecuteCommandLists", + zeCommandQueueExecuteCommandLists(_handle, 1, &command_list._handle, nullptr)); } void CommandQueue::executeCommandList(CommandList& command_list, Fence& fence) const { - THROW_ON_FAIL_FOR_BACKEND("zeCommandQueueExecuteCommandLists", - zeCommandQueueExecuteCommandLists(_handle, 1, &command_list._handle, fence.handle())); + THROW_ON_FAIL_FOR_LEVELZERO("zeCommandQueueExecuteCommandLists", + zeCommandQueueExecuteCommandLists(_handle, 1, &command_list._handle, fence.handle())); } void CommandQueue::setWorkloadType(ze_command_queue_workload_type_t workloadType) const { if (_command_queue_npu_dditable_ext.version()) { - THROW_ON_FAIL_FOR_BACKEND("zeSetWorkloadType", - _command_queue_npu_dditable_ext.pfnSetWorkloadType(_handle, workloadType)); + THROW_ON_FAIL_FOR_LEVELZERO("zeSetWorkloadType", + _command_queue_npu_dditable_ext.pfnSetWorkloadType(_handle, workloadType)); } else { OPENVINO_THROW("The WorkloadType property is not supported by the current Driver Version!"); } @@ -182,13 +182,13 @@ CommandQueue::~CommandQueue() { Fence::Fence(const CommandQueue& command_queue, const Config& config) : _log("Fence", config.get()) { ze_fence_desc_t fence_desc = {ZE_STRUCTURE_TYPE_FENCE_DESC, nullptr, 0}; - THROW_ON_FAIL_FOR_BACKEND("zeFenceCreate", zeFenceCreate(command_queue.handle(), &fence_desc, &_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeFenceCreate", zeFenceCreate(command_queue.handle(), &fence_desc, &_handle)); } void Fence::reset() const { - THROW_ON_FAIL_FOR_BACKEND("zeFenceReset", zeFenceReset(_handle)); + THROW_ON_FAIL_FOR_LEVELZERO("zeFenceReset", zeFenceReset(_handle)); } void Fence::hostSynchronize() const { - THROW_ON_FAIL_FOR_BACKEND("zeFenceHostSynchronize", zeFenceHostSynchronize(_handle, UINT64_MAX)); + THROW_ON_FAIL_FOR_LEVELZERO("zeFenceHostSynchronize", zeFenceHostSynchronize(_handle, UINT64_MAX)); } Fence::~Fence() { auto result = zeFenceDestroy(_handle); diff --git a/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp b/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp index 4eec7884a9bfb7..d7cb7ab925aa63 100644 --- a/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp +++ b/src/plugins/intel_npu/src/compiler/src/zero_compiler_in_driver.cpp @@ -378,14 +378,14 @@ void LevelZeroCompilerInDriver::getNativeBinary(ze_graph_dditabl blob.resize(blobSize); if (ZE_RESULT_SUCCESS != result) { _logger.warning("Failed to compile network. "); - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGetNativeBinary get blob size", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGetNativeBinary get blob size", result, _graphDdiTableExt); } // Get blob data result = _graphDdiTableExt.pfnGetNativeBinary(graphHandle, &blobSize, blob.data()); if (ZE_RESULT_SUCCESS != result) { _logger.warning("Failed to compile network. "); - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGetNativeBinary get blob data", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGetNativeBinary get blob data", result, _graphDdiTableExt); } blobPtr = blob.data(); @@ -402,7 +402,7 @@ void LevelZeroCompilerInDriver::getNativeBinary(ze_graph_dditabl auto result = _graphDdiTableExt.pfnGetNativeBinary2(graphHandle, &blobSize, &blobPtr); if (ZE_RESULT_SUCCESS != result) { _logger.warning("Failed to compile network. "); - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGetNativeBinary get blob size", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGetNativeBinary get blob size", result, _graphDdiTableExt); } } @@ -650,7 +650,7 @@ ze_result_t LevelZeroCompilerInDriver::seriazlideIRModelAndQuery // Create querynetwork handle ze_result_t result = _graphDdiTableExt.pfnQueryNetworkCreate(_context, _deviceHandle, &desc, &hGraphQueryNetwork); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("seriazlideIRModelAndQueryNetworkCreateV1", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("seriazlideIRModelAndQueryNetworkCreateV1", result, _graphDdiTableExt); } return result; } @@ -666,7 +666,7 @@ std::unordered_set LevelZeroCompilerInDriver::query ze_device_graph_properties_t deviceGraphProperties{}; auto result = _graphDdiTableExt.pfnDeviceGetGraphProperties(_deviceHandle, &deviceGraphProperties); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnDeviceGetGraphProperties", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnDeviceGetGraphProperties", result, _graphDdiTableExt); } ze_graph_query_network_handle_t hGraphQueryNetwork = nullptr; @@ -708,7 +708,7 @@ ze_result_t LevelZeroCompilerInDriver::seriazlideIRModelAndQuery _logger.debug("seriazlideIRModelAndQueryNetworkCreateV2 - performing pfnQueryNetworkCreate2"); ze_result_t result = _graphDdiTableExt.pfnQueryNetworkCreate2(_context, _deviceHandle, &desc, &hGraphQueryNetwork); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("seriazlideIRModelAndQueryNetworkCreateV2", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("seriazlideIRModelAndQueryNetworkCreateV2", result, _graphDdiTableExt); } return result; } @@ -724,7 +724,7 @@ std::unordered_set LevelZeroCompilerInDriver::query ze_device_graph_properties_t deviceGraphProperties{}; auto result = _graphDdiTableExt.pfnDeviceGetGraphProperties(_deviceHandle, &deviceGraphProperties); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnDeviceGetGraphProperties", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnDeviceGetGraphProperties", result, _graphDdiTableExt); } ze_graph_query_network_handle_t hGraphQueryNetwork = nullptr; @@ -747,9 +747,9 @@ std::unordered_set LevelZeroCompilerInDriver::getQu result = _graphDdiTableExt.pfnQueryNetworkGetSupportedLayers(hGraphQueryNetwork, &size, nullptr); if (ZE_RESULT_SUCCESS != result) { _graphDdiTableExt.pfnQueryNetworkDestroy(hGraphQueryNetwork); - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnQueryNetworkGetSupportedLayers get size of query result", - result, - _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnQueryNetworkGetSupportedLayers get size of query result", + result, + _graphDdiTableExt); } // Get the result data of query @@ -757,14 +757,14 @@ std::unordered_set LevelZeroCompilerInDriver::getQu result = _graphDdiTableExt.pfnQueryNetworkGetSupportedLayers(hGraphQueryNetwork, &size, supportedLayers.data()); if (ZE_RESULT_SUCCESS != result) { _graphDdiTableExt.pfnQueryNetworkDestroy(hGraphQueryNetwork); - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnQueryNetworkGetSupportedLayers get result data of query", - result, - _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnQueryNetworkGetSupportedLayers get result data of query", + result, + _graphDdiTableExt); } result = _graphDdiTableExt.pfnQueryNetworkDestroy(hGraphQueryNetwork); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnQueryNetworkDestroy", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnQueryNetworkDestroy", result, _graphDdiTableExt); } return parseQueryResult(supportedLayers); } @@ -810,7 +810,7 @@ ze_result_t LevelZeroCompilerInDriver::createGraph(const ze_grap // Create querynetwork handle auto result = _graphDdiTableExt.pfnCreate(_context, _deviceHandle, &desc, graph); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnCreate", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnCreate", result, _graphDdiTableExt); } return result; } @@ -835,7 +835,7 @@ ze_result_t LevelZeroCompilerInDriver::createGraph(const ze_grap // Create querynetwork handle auto result = _graphDdiTableExt.pfnCreate2(_context, _deviceHandle, &desc, graph); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnCreate2", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnCreate2", result, _graphDdiTableExt); } return result; } @@ -880,9 +880,9 @@ NetworkDescription LevelZeroCompilerInDriver::compile(const std: ze_device_graph_properties_t deviceGraphProperties{}; auto result = _graphDdiTableExt.pfnDeviceGetGraphProperties(_deviceHandle, &deviceGraphProperties); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnDeviceGetGraphProperties, Failed to compile network.", - result, - _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnDeviceGetGraphProperties, Failed to compile network.", + result, + _graphDdiTableExt); } // Graph handle should be used only in scope of compile / parse functions. ze_graph_handle_t graphHandle; @@ -917,7 +917,7 @@ NetworkMetadata LevelZeroCompilerInDriver::parse(const std::vect auto result = _graphDdiTableExt.pfnCreate(_context, _deviceHandle, &desc, &graphHandle); OV_ITT_TASK_NEXT(PARSE_BLOB, "_graphDdiTableExt"); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnCreate", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnCreate", result, _graphDdiTableExt); } } else { OPENVINO_THROW("Empty blob"); @@ -939,7 +939,7 @@ uint32_t LevelZeroCompilerInDriver::getSupportedOpsetVersion() c auto result = _graphDdiTableExt.pfnDeviceGetGraphProperties(_deviceHandle, &graphProperties); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnDeviceGetGraphProperties", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnDeviceGetGraphProperties", result, _graphDdiTableExt); } const auto maxOpsetVersion = graphProperties.maxOVOpsetVersionSupported; _logger.info("getSupportedOpsetVersion Max supported version of opset in CiD: %d", maxOpsetVersion); @@ -1012,7 +1012,7 @@ void LevelZeroCompilerInDriver::getMetadata(ze_graph_dditable_ex ze_graph_argument_properties_3_t arg; auto result = graphDdiTableExt.pfnGetArgumentProperties3(graphHandle, index, &arg); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGetArgumentProperties3", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGetArgumentProperties3", result, _graphDdiTableExt); } switch (arg.type) { case ZE_GRAPH_ARGUMENT_TYPE_INPUT: { @@ -1037,7 +1037,7 @@ void LevelZeroCompilerInDriver::getMetadata(ze_graph_dditable_ex ze_graph_argument_properties_3_t arg; auto result = graphDdiTableExt.pfnGetArgumentProperties3(graphHandle, index, &arg); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGetArgumentProperties3", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGetArgumentProperties3", result, _graphDdiTableExt); } std::optional optionalMetadata = std::nullopt; @@ -1045,7 +1045,7 @@ void LevelZeroCompilerInDriver::getMetadata(ze_graph_dditable_ex ze_graph_argument_metadata_t metadata; result = graphDdiTableExt.pfnGraphGetArgumentMetadata(graphHandle, index, &metadata); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGraphGetArgumentMetadata", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGraphGetArgumentMetadata", result, _graphDdiTableExt); } optionalMetadata = std::optional(metadata); } @@ -1069,7 +1069,7 @@ NetworkMetadata LevelZeroCompilerInDriver::getNetworkMeta(ze_gra auto result = _graphDdiTableExt.pfnGetProperties(graphHandle, &graphProperties); if (ZE_RESULT_SUCCESS != result) { - THROW_ON_FAIL_FOR_GRAPH_EXT("pfnGetProperties", result, _graphDdiTableExt); + THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnGetProperties", result, _graphDdiTableExt); } NetworkMetadata meta;