From 464e4fd1b1116c53589815b650b5d0a287a9cc6f Mon Sep 17 00:00:00 2001 From: "Spruit, Neil R" Date: Wed, 24 Feb 2021 08:18:34 -0800 Subject: [PATCH] Fix GMM usage in 1D image allocation on windows Properly use the gmm resource created for the Image allocation instead of the gmm resource created in allocateGraphicsMemoryWithAlignment in the windows wddm memory manager by removing the call to allocateGraphicsMemoryWithAlignment for 1D images. Invalid ULT testing this functionality has been removed. Related-To: LOCI-1845 Signed-off-by: Spruit, Neil R --- .../windows/wddm_memory_manager_tests.cpp | 31 ------------------- .../windows/wddm_memory_manager.cpp | 4 --- 2 files changed, 35 deletions(-) diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index d11f6c954c..e8168e4412 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -852,37 +852,6 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreat EXPECT_EQ(GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_IMAGE, imageGraphicsAllocation->getDefaultGmm()->resourceParams.Usage); } -TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountZeroisBeingCreatedThenAllocateGraphicsMemoryIsUsed) { - MockContext context; - context.memoryManager = memoryManager.get(); - - cl_image_format imageFormat; - imageFormat.image_channel_data_type = CL_UNORM_INT8; - imageFormat.image_channel_order = CL_R; - - cl_image_desc imageDesc = {}; - - imageDesc.image_type = CL_MEM_OBJECT_IMAGE1D; - imageDesc.image_width = 64u; - - char data[64u * 4 * 8]; - - auto retVal = CL_SUCCESS; - - cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR; - auto surfaceFormat = Image::getSurfaceFormatFromTable( - flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features); - std::unique_ptr dstImage( - Image::create(&context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context.getDevice(0)->getDevice()), - flags, 0, surfaceFormat, &imageDesc, data, retVal)); - EXPECT_EQ(CL_SUCCESS, retVal); - ASSERT_NE(nullptr, dstImage); - - auto imageGraphicsAllocation = dstImage->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()); - ASSERT_NE(nullptr, imageGraphicsAllocation); - EXPECT_EQ(GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_BUFFER, imageGraphicsAllocation->getDefaultGmm()->resourceParams.Usage); -} - TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountNonZeroisBeingCreatedThenAllocateGraphicsMemoryForImageIsUsed) { MockContext context; context.memoryManager = memoryManager.get(); diff --git a/shared/source/os_interface/windows/wddm_memory_manager.cpp b/shared/source/os_interface/windows/wddm_memory_manager.cpp index e57e97a834..ca3e293fbf 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.cpp +++ b/shared/source/os_interface/windows/wddm_memory_manager.cpp @@ -69,10 +69,6 @@ GraphicsAllocation *WddmMemoryManager::allocateShareableMemory(const AllocationD } GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImageImpl(const AllocationData &allocationData, std::unique_ptr gmm) { - if (allocationData.imgInfo->linearStorage && allocationData.imgInfo->mipCount == 0) { - return allocateGraphicsMemoryWithAlignment(allocationData); - } - auto allocation = std::make_unique(allocationData.rootDeviceIndex, 1u, // numGmms allocationData.type, nullptr, allocationData.imgInfo->size,