From 1432f6a7b2fdf7c2d09f93eeba585f4562fd04f6 Mon Sep 17 00:00:00 2001 From: Szymon Morek Date: Mon, 14 Apr 2025 19:16:40 +0000 Subject: [PATCH] test: don't call expectMemory on compressed data Compressed memory can't be compared using expectMemory api. Instead, compressed memory is transferred to usm host. Signed-off-by: Szymon Morek --- .../fixtures/multicontext_l0_aub_fixture.cpp | 3 ++- .../fixtures/multicontext_ocl_aub_fixture.cpp | 3 ++- .../system_memfence_aub_tests_xe3_core.cpp | 4 +++- .../aub_fixtures/multicontext_aub_fixture.cpp | 14 ++++++++++++++ .../aub_fixtures/multicontext_aub_fixture.h | 8 +++++++- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/level_zero/core/test/aub_tests/fixtures/multicontext_l0_aub_fixture.cpp b/level_zero/core/test/aub_tests/fixtures/multicontext_l0_aub_fixture.cpp index be1596f85e..29df8a84aa 100644 --- a/level_zero/core/test/aub_tests/fixtures/multicontext_l0_aub_fixture.cpp +++ b/level_zero/core/test/aub_tests/fixtures/multicontext_l0_aub_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -59,4 +59,5 @@ void MulticontextL0AubFixture::createDevices(const HardwareInfo &hwInfo, uint32_ for (uint32_t i = 0; i < numTiles; i++) { subDevices.push_back(L0::Device::fromHandle(subDevicesH[i])); } + this->svmAllocsManager = driverHandle->getSvmAllocsManager(); } diff --git a/opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.cpp b/opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.cpp index b767252e5f..9a5f7f13d9 100644 --- a/opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.cpp +++ b/opencl/test/unit_test/aub_tests/fixtures/multicontext_ocl_aub_fixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -48,6 +48,7 @@ void MulticontextOclAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStre } context.reset(MockContext::create(nullptr, clDeviceVector, nullptr, nullptr, retVal)); EXPECT_EQ(CL_SUCCESS, retVal); + this->svmAllocsManager = context->getSVMAllocsManager(); } commandQueues.resize(numberOfTiles); diff --git a/opencl/test/unit_test/aub_tests/xe3_core/system_memfence_aub_tests_xe3_core.cpp b/opencl/test/unit_test/aub_tests/xe3_core/system_memfence_aub_tests_xe3_core.cpp index 510f8d61ac..32ed2e7648 100644 --- a/opencl/test/unit_test/aub_tests/xe3_core/system_memfence_aub_tests_xe3_core.cpp +++ b/opencl/test/unit_test/aub_tests/xe3_core/system_memfence_aub_tests_xe3_core.cpp @@ -156,7 +156,9 @@ XE3_CORETEST_F(SystemMemFenceWithBlitterXe3Core, givenSystemMemFenceWhenGenerate retVal = clEnqueueMemcpyINTEL(commandQueues[0][0].get(), true, deviceMemAlloc, buffer.data(), bufferSize, 0, nullptr, nullptr); EXPECT_EQ(CL_SUCCESS, retVal); - expectMemory(deviceMemAlloc, buffer.data(), bufferSize, 0, 0); + if (!tileDevices[0]->getDevice().getReleaseHelper()->getFtrXe2Compression()) { + expectMemory(deviceMemAlloc, buffer.data(), bufferSize, 0, 0); + } auto hostMemAlloc = clHostMemAllocINTEL(context.get(), nullptr, bufferSize, 0, &retVal); EXPECT_EQ(CL_SUCCESS, retVal); diff --git a/shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.cpp b/shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.cpp index f97b56cfb7..f2bbc2616b 100644 --- a/shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.cpp +++ b/shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/api_specific_config.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/hw_info.h" +#include "shared/source/memory_manager/unified_memory_manager.h" #include "shared/source/release_helper/release_helper.h" #include "shared/test/common/helpers/ult_hw_config.h" #include "shared/test/common/helpers/variable_backup.h" @@ -153,4 +154,17 @@ void MulticontextAubFixture::overridePlatformConfigForAllEnginesSupport(Hardware ASSERT_TRUE(setupCalled); } +bool MulticontextAubFixture::isMemoryCompressed(CommandStreamReceiver *csr, void *gfxAddress) { + auto releaseHelper = csr->getReleaseHelper(); + if (!releaseHelper || !releaseHelper->getFtrXe2Compression()) { + return false; + } + auto svmAllocs = svmAllocsManager->getSVMAlloc(gfxAddress); + if (!svmAllocs) { + return false; + } + auto alloc = svmAllocs->gpuAllocations.getGraphicsAllocation(rootDeviceIndex); + return alloc->isCompressionEnabled(); +} + } // namespace NEO diff --git a/shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.h b/shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.h index 8de312c6e3..a5321dc185 100644 --- a/shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.h +++ b/shared/test/common/fixtures/aub_fixtures/multicontext_aub_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,6 +19,7 @@ namespace NEO { class Device; class MockDevice; +class SVMAllocsManager; struct MulticontextAubFixture { enum class EnabledCommandStreamers { @@ -38,6 +39,8 @@ struct MulticontextAubFixture { virtual CommandStreamReceiver *getGpgpuCsr(uint32_t tile, uint32_t engine) = 0; + bool isMemoryCompressed(CommandStreamReceiver *csr, void *gfxAddress); + template CommandStreamReceiverSimulatedCommonHw *getSimulatedCsr(uint32_t tile, uint32_t engine) { using CsrWithAubDump = CommandStreamReceiverWithAUBDump>; @@ -59,6 +62,8 @@ struct MulticontextAubFixture { template void expectMemory(void *gfxAddress, const void *srcAddress, size_t length, uint32_t tile, uint32_t engine) { CommandStreamReceiverSimulatedCommonHw *csrSimulated = getSimulatedCsr(tile, engine); + // expectMemory should not be used for compressed memory + ASSERT_FALSE(isMemoryCompressed(csrSimulated, gfxAddress)); if (testMode == TestMode::aubTestsWithTbx) { auto tbxCsr = csrSimulated; @@ -108,6 +113,7 @@ struct MulticontextAubFixture { void adjustPlatformOverride(HardwareInfo &localHwInfo, bool &setupCalled); DebugManagerStateRestore restore; + SVMAllocsManager *svmAllocsManager = nullptr; const uint32_t rootDeviceIndex = 0u; uint32_t numberOfEnabledTiles = 0; bool isCcs1Supported = false;