From e8d43ff0746173148a2823c47daaceb5f52ed83d Mon Sep 17 00:00:00 2001 From: Maciej Bielski Date: Thu, 18 Sep 2025 10:07:05 +0000 Subject: [PATCH] fix: various small improvements Related-To: NEO-15630 Signed-off-by: Maciej Bielski --- level_zero/core/source/driver/driver_handle_imp.cpp | 2 ++ shared/source/ail/linux/ail_configuration_linux.cpp | 4 +++- shared/source/helpers/gfx_core_helper_base.inl | 2 ++ shared/source/os_interface/windows/wddm/wddm.cpp | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/level_zero/core/source/driver/driver_handle_imp.cpp b/level_zero/core/source/driver/driver_handle_imp.cpp index c16fc37925..811b39c8c2 100644 --- a/level_zero/core/source/driver/driver_handle_imp.cpp +++ b/level_zero/core/source/driver/driver_handle_imp.cpp @@ -13,6 +13,7 @@ #include "shared/source/execution_environment/execution_environment.h" #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/api_specific_config.h" +#include "shared/source/helpers/debug_helpers.h" #include "shared/source/helpers/device_bitfield.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/hw_info.h" @@ -289,6 +290,7 @@ DriverHandleImp::~DriverHandleImp() { void DriverHandleImp::updateRootDeviceBitFields(std::unique_ptr &neoDevice) { const auto rootDeviceIndex = neoDevice->getRootDeviceIndex(); auto entry = this->deviceBitfields.find(rootDeviceIndex); + UNRECOVERABLE_IF(entry == this->deviceBitfields.end()); entry->second = neoDevice->getDeviceBitfield(); } diff --git a/shared/source/ail/linux/ail_configuration_linux.cpp b/shared/source/ail/linux/ail_configuration_linux.cpp index 7e40ccd559..0f187f2a12 100644 --- a/shared/source/ail/linux/ail_configuration_linux.cpp +++ b/shared/source/ail/linux/ail_configuration_linux.cpp @@ -1,11 +1,12 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/ail/ail_configuration.h" +#include "shared/source/helpers/debug_helpers.h" #include "shared/source/os_interface/linux/sys_calls.h" #include @@ -25,6 +26,7 @@ bool AILConfiguration::initProcessExecutableName() { std::string_view pathView(path); auto lastPosition = pathView.find_last_of("/"); + UNRECOVERABLE_IF(lastPosition == std::string_view::npos); pathView.remove_prefix(lastPosition + 1u); diff --git a/shared/source/helpers/gfx_core_helper_base.inl b/shared/source/helpers/gfx_core_helper_base.inl index 10c64cd353..4092427d05 100644 --- a/shared/source/helpers/gfx_core_helper_base.inl +++ b/shared/source/helpers/gfx_core_helper_base.inl @@ -16,6 +16,7 @@ #include "shared/source/helpers/basic_math.h" #include "shared/source/helpers/bit_helpers.h" #include "shared/source/helpers/constants.h" +#include "shared/source/helpers/debug_helpers.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/local_id_gen.h" @@ -763,6 +764,7 @@ DeviceHierarchyMode GfxCoreHelperHw::getDefaultDeviceHierarchy() cons template uint64_t GfxCoreHelperHw::getGpuTimeStampInNS(uint64_t timeStamp, double resolution) const { auto numBitsForResolution = Math::log2(static_cast(resolution)) + 1u; + UNRECOVERABLE_IF(numBitsForResolution > 64U); auto timestampMask = maxNBitValue(64 - numBitsForResolution); return static_cast(static_cast(timeStamp & timestampMask) * resolution); } diff --git a/shared/source/os_interface/windows/wddm/wddm.cpp b/shared/source/os_interface/windows/wddm/wddm.cpp index c9bb75b958..16e4883ef7 100644 --- a/shared/source/os_interface/windows/wddm/wddm.cpp +++ b/shared/source/os_interface/windows/wddm/wddm.cpp @@ -1256,8 +1256,8 @@ void Wddm::initGfxPartition(GfxPartition &outGfxPartition, uint32_t rootDeviceIn outGfxPartition.heapInitExternalWithFrontWindow(heap, gfxPartition.Heap32[static_cast(heap)].Base, gfxPartition.Heap32[static_cast(heap)].Limit - gfxPartition.Heap32[static_cast(heap)].Base + 1); size_t externalFrontWindowSize = GfxPartition::externalFrontWindowPoolSize; - outGfxPartition.heapInitExternalWithFrontWindow(HeapAssigner::mapExternalWindowIndex(heap), outGfxPartition.heapAllocate(heap, externalFrontWindowSize), - externalFrontWindowSize); + auto address = outGfxPartition.heapAllocate(heap, externalFrontWindowSize); + outGfxPartition.heapInitExternalWithFrontWindow(HeapAssigner::mapExternalWindowIndex(heap), address, externalFrontWindowSize); } else if (HeapAssigner::isInternalHeap(heap)) { auto baseAddress = gfxPartition.Heap32[static_cast(heap)].Base >= minAddress ? gfxPartition.Heap32[static_cast(heap)].Base : minAddress;