diff --git a/opencl/test/unit_test/aub_mem_dump/aub_alloc_dump_tests.cpp b/opencl/test/unit_test/aub_mem_dump/aub_alloc_dump_tests.cpp index 596b088a37..77f32343c3 100644 --- a/opencl/test/unit_test/aub_mem_dump/aub_alloc_dump_tests.cpp +++ b/opencl/test/unit_test/aub_mem_dump/aub_alloc_dump_tests.cpp @@ -402,7 +402,7 @@ struct AubSurfaceDumpTests : public AubAllocDumpTests, AubAllocDumpTests::TearDown(); } - bool isCompressed = false; + bool isCompressed = true; AubAllocDump::DumpFormat dumpFormat = AubAllocDump::DumpFormat::NONE; }; @@ -413,6 +413,8 @@ HWTEST_P(AubSurfaceDumpTests, givenGraphicsAllocationWhenGetDumpSurfaceIsCalledA if (AubAllocDump::isBufferDumpFormat(dumpFormat)) { auto bufferAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); + bufferAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + ASSERT_NE(nullptr, bufferAllocation); MockBuffer::setAllocationType(bufferAllocation, gmmHelper, isCompressed); diff --git a/shared/source/aub_mem_dump/aub_alloc_dump.inl b/shared/source/aub_mem_dump/aub_alloc_dump.inl index d1f2afa1fb..0a5721042b 100644 --- a/shared/source/aub_mem_dump/aub_alloc_dump.inl +++ b/shared/source/aub_mem_dump/aub_alloc_dump.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2021 Intel Corporation + * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -43,10 +43,12 @@ SurfaceInfo *getDumpSurfaceInfo(GraphicsAllocation &gfxAllocation, DumpFormat du SurfaceInfo *surfaceInfo = nullptr; if (isBufferDumpFormat(dumpFormat)) { + auto gmmHelper = gfxAllocation.getDefaultGmm()->getGmmHelper(); + using RENDER_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE; using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT; surfaceInfo = new SurfaceInfo(); - surfaceInfo->address = GmmHelper::decanonize(gfxAllocation.getGpuAddress()); + surfaceInfo->address = gmmHelper->decanonize(gfxAllocation.getGpuAddress()); surfaceInfo->width = static_cast(gfxAllocation.getUnderlyingBufferSize()); surfaceInfo->height = 1; surfaceInfo->pitch = static_cast(gfxAllocation.getUnderlyingBufferSize()); @@ -57,11 +59,13 @@ SurfaceInfo *getDumpSurfaceInfo(GraphicsAllocation &gfxAllocation, DumpFormat du surfaceInfo->dumpType = (AubAllocDump::DumpFormat::BUFFER_TRE == dumpFormat) ? dumpType::tre : dumpType::bin; } else if (isImageDumpFormat(dumpFormat)) { auto gmm = gfxAllocation.getDefaultGmm(); + auto gmmHelper = gmm->getGmmHelper(); + if (gmm->gmmResourceInfo->getNumSamples() > 1) { return nullptr; } surfaceInfo = new SurfaceInfo(); - surfaceInfo->address = GmmHelper::decanonize(gfxAllocation.getGpuAddress()); + surfaceInfo->address = gmmHelper->decanonize(gfxAllocation.getGpuAddress()); surfaceInfo->width = static_cast(gmm->gmmResourceInfo->getBaseWidth()); surfaceInfo->height = static_cast(gmm->gmmResourceInfo->getBaseHeight()); surfaceInfo->pitch = static_cast(gmm->gmmResourceInfo->getRenderPitch()); diff --git a/shared/test/unit_test/command_stream/aub_command_stream_receiver_3_tests.cpp b/shared/test/unit_test/command_stream/aub_command_stream_receiver_3_tests.cpp index 77e1dbd2b8..136db28308 100644 --- a/shared/test/unit_test/command_stream/aub_command_stream_receiver_3_tests.cpp +++ b/shared/test/unit_test/command_stream/aub_command_stream_receiver_3_tests.cpp @@ -273,7 +273,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA auto memoryManager = pDevice->getMemoryManager(); auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()}); + gfxAllocation->setMemObjectsAllocationWithWritableFlags(true); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation)); aubCsr.dumpAllocation(*gfxAllocation); @@ -327,6 +330,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenCompressedGraphicsAllocationWritabl auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties); gfxAllocation->setMemObjectsAllocationWithWritableFlags(true); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation)); aubCsr.dumpAllocation(*gfxAllocation); @@ -421,6 +426,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()}); gfxAllocation->setMemObjectsAllocationWithWritableFlags(true); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); auto &csrOsContext = aubCsr.getOsContext(); @@ -490,6 +496,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenDumpAllocatio gfxAllocation->setMemObjectsAllocationWithWritableFlags(true); gfxAllocation->setAllocDumpable(false, false); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); aubCsr.dumpAllocation(*gfxAllocation); EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled); @@ -516,7 +523,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA auto memoryManager = pDevice->getMemoryManager(); auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()}); + gfxAllocation->setMemObjectsAllocationWithWritableFlags(true); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation)); aubCsr.dumpAllocation(*gfxAllocation); @@ -548,6 +558,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenUsmAllocationWhenDumpAllocationIsCa ASSERT_NE(nullptr, ptr); auto gfxAllocation = svmManager->getSVMAlloc(ptr)->gpuAllocations.getGraphicsAllocation(0); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + ASSERT_NE(nullptr, gfxAllocation); EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation)); diff --git a/shared/test/unit_test/command_stream/tbx_command_stream_tests.cpp b/shared/test/unit_test/command_stream/tbx_command_stream_tests.cpp index d21485f8f9..485766bec4 100644 --- a/shared/test/unit_test/command_stream/tbx_command_stream_tests.cpp +++ b/shared/test/unit_test/command_stream/tbx_command_stream_tests.cpp @@ -933,7 +933,10 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWritableWhenDumpAllocatio auto memoryManager = pDevice->getMemoryManager(); auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()}); + gfxAllocation->setMemObjectsAllocationWithWritableFlags(true); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); + EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation)); tbxCsr.dumpAllocation(*gfxAllocation); @@ -958,6 +961,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle gfxAllocation->setMemObjectsAllocationWithWritableFlags(true); gfxAllocation->setAllocDumpable(false, false); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); tbxCsr.dumpAllocation(*gfxAllocation); EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled); @@ -1030,6 +1034,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle gfxAllocation->setMemObjectsAllocationWithWritableFlags(true); gfxAllocation->setAllocDumpable(false, false); + gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true)); tbxCsr.dumpAllocation(*gfxAllocation); EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);