diff --git a/level_zero/core/source/context/context_imp.cpp b/level_zero/core/source/context/context_imp.cpp index 7c7cf4cb88..7cfeab9264 100644 --- a/level_zero/core/source/context/context_imp.cpp +++ b/level_zero/core/source/context/context_imp.cpp @@ -770,7 +770,7 @@ ze_result_t ContextImp::getIpcMemHandlesImpl(const void *ptr, for (uint32_t i = 0u; i < loopCount; i++) { uint64_t handle = 0; int ret = alloc->createInternalHandle(memoryManager, i, handle); - if (ret < 0) { + if (ret != 0) { return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } diff --git a/shared/source/os_interface/windows/wddm_allocation_common.cpp b/shared/source/os_interface/windows/wddm_allocation_common.cpp index 9d21a3fdbb..d246a1c623 100644 --- a/shared/source/os_interface/windows/wddm_allocation_common.cpp +++ b/shared/source/os_interface/windows/wddm_allocation_common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,12 +16,12 @@ int WddmAllocation::createInternalHandle(MemoryManager *memoryManager, uint32_t WddmMemoryManager *wddmMemoryManager = reinterpret_cast(memoryManager); auto status = wddmMemoryManager->createInternalNTHandle(&resourceHandle, &ntSharedHandle, this->getRootDeviceIndex()); if (status != STATUS_SUCCESS) { - return handle == 0; + return -1; } ntSecureHandle = castToUint64(ntSharedHandle); handle = ntSecureHandle; } - return handle == 0; + return handle == 0 ? -1 : 0; } void WddmAllocation::clearInternalHandle(uint32_t handleId) { ntSecureHandle = 0u; diff --git a/shared/test/unit_test/memory_manager/graphics_allocation_tests.cpp b/shared/test/unit_test/memory_manager/graphics_allocation_tests.cpp index a853a45554..5f24b97152 100644 --- a/shared/test/unit_test/memory_manager/graphics_allocation_tests.cpp +++ b/shared/test/unit_test/memory_manager/graphics_allocation_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -247,7 +247,7 @@ TEST(GraphicsAllocationTest, givenDefaultGraphicsAllocationWhenInternalHandleIsB TEST(GraphicsAllocationTest, givenDefaultGraphicsAllocationWhenInternalHandleIsBeingObtainedOrCreatedThenZeroIsReturned) { MockGraphicsAllocation graphicsAllocation; uint64_t handle = 0; - graphicsAllocation.createInternalHandle(nullptr, 0u, handle); + EXPECT_EQ(0, graphicsAllocation.createInternalHandle(nullptr, 0u, handle)); EXPECT_EQ(0ull, handle); graphicsAllocation.clearInternalHandle(0u); } diff --git a/shared/test/unit_test/os_interface/wddm_linux/configure_device_address_space_drm_or_wddm_test.cpp b/shared/test/unit_test/os_interface/wddm_linux/configure_device_address_space_drm_or_wddm_test.cpp index 44fa3d5bbb..cd80a54b96 100644 --- a/shared/test/unit_test/os_interface/wddm_linux/configure_device_address_space_drm_or_wddm_test.cpp +++ b/shared/test/unit_test/os_interface/wddm_linux/configure_device_address_space_drm_or_wddm_test.cpp @@ -734,7 +734,7 @@ TEST_F(WddmLinuxTest, givenAllocatedMemoryAndCloseInternalHandleWithoutAllocatio memoryManager.freeGraphicsMemoryImpl(alloc); } -TEST_F(WddmLinuxTest, givenAllocatedMemoryAndCreateInternalHandleFailedThenEmpyHandleReturned) { +TEST_F(WddmLinuxTest, givenAllocatedMemoryAndCreateInternalHandleFailedThenEmptyHandleReturned) { osEnvironment->gdi->reserveGpuVirtualAddress = reserveDeviceAddressSpaceMock; osEnvironment->gdi->createAllocation2 = createAllocation2Mock; osEnvironment->gdi->mapGpuVirtualAddress = mapGpuVirtualAddressMock; @@ -756,7 +756,7 @@ TEST_F(WddmLinuxTest, givenAllocatedMemoryAndCreateInternalHandleFailedThenEmpyH memoryManager.closeInternalHandle(handle, 0u, alloc); memoryManager.failCreateInternalNTHandle = true; - EXPECT_EQ(1, alloc->createInternalHandle(&memoryManager, 0u, handle)); + EXPECT_EQ(-1, alloc->createInternalHandle(&memoryManager, 0u, handle)); memoryManager.freeGraphicsMemoryImpl(alloc); } diff --git a/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index b5c13e58bf..bff3d6267d 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -397,7 +397,7 @@ TEST_F(WddmMemoryManagerAllocPathTests, GivenValidAllocationWithFailingCreateInt memoryManager->closeInternalHandle(handle, 0u, graphicsAllocation); memoryManager->failCreateInternalNTHandle = true; - EXPECT_EQ(1, graphicsAllocation->createInternalHandle(memoryManager, 0u, handle)); + EXPECT_EQ(-1, graphicsAllocation->createInternalHandle(memoryManager, 0u, handle)); memoryManager->freeGraphicsMemory(graphicsAllocation); }