From a820e73dd74300f66527f60983e3f3c95639b993 Mon Sep 17 00:00:00 2001 From: Dominik Dabek Date: Tue, 23 Aug 2022 11:48:18 +0000 Subject: [PATCH] Change DG2 l1 cache policy to WB With compiler LSC WAs this gives better performance. If debugger is active, policy will not be changed ie. will be WBP. Related-To: NEO-7003 Signed-off-by: Dominik Dabek --- .../core/source/cmdlist/cmdlist_hw_base.inl | 1 + .../cmdlist/cmdlist_hw_xehp_and_later.inl | 1 + .../core/source/cmdqueue/cmdqueue_hw_base.inl | 4 +- .../cmdqueue_xe_hp_core_and_later.inl | 4 +- level_zero/core/source/kernel/kernel_hw.h | 3 +- level_zero/core/source/kernel/kernel_imp.cpp | 3 +- level_zero/core/source/module/module_imp.cpp | 6 +- .../unit_tests/sources/module/test_module.cpp | 2 +- .../unit_tests/xe_hpg_core/dg2/CMakeLists.txt | 4 +- .../xe_hpg_core/dg2/test_cmdqueue_dg2.cpp | 55 +++++++ .../xe_hpg_core/dg2/test_excludes_dg2.cpp | 10 ++ .../xe_hpg_core/dg2/test_kernel_dg2.cpp | 64 ++++++++ .../xe_hpg_core/test_module_xe_hpg_core.cpp | 4 +- opencl/source/mem_obj/buffer_base.inl | 2 + opencl/source/program/program.cpp | 3 +- .../test/unit_test/program/program_tests.cpp | 2 +- .../xe_hpg_core/dg2/excludes_ocl_dg2.cpp | 4 + .../dg2/test_cmds_programming_dg2.cpp | 57 ++++++- .../source/offline_compiler.cpp | 2 +- .../command_container/command_encoder.h | 2 +- .../command_container/command_encoder.inl | 2 +- .../command_encoder_bdw_and_later.inl | 6 +- .../command_encoder_xe_hpg_core_and_later.inl | 10 +- .../command_encoder_xehp_and_later.inl | 11 +- .../encode_surface_state_args_base.h | 1 + .../command_stream_receiver_hw_base.inl | 3 +- shared/source/helpers/cache_policy.h | 6 +- shared/source/helpers/cache_policy_base.inl | 4 +- .../helpers/cache_policy_bdw_and_later.inl | 4 +- .../helpers/cache_policy_dg2_and_later.inl | 6 +- .../source/helpers/compiler_hw_info_config.h | 4 +- .../helpers/compiler_hw_info_config_base.inl | 4 +- shared/source/helpers/state_base_address.h | 3 +- .../state_base_address_bdw_and_later.inl | 2 +- ...ate_base_address_xe_hpg_core_and_later.inl | 10 +- .../state_base_address_xehp_and_later.inl | 2 +- shared/source/os_interface/hw_info_config.h | 4 +- shared/source/os_interface/hw_info_config.inl | 4 +- .../xe_hp_core/command_encoder_xe_hp_core.cpp | 2 +- .../state_base_address_xe_hp_core.cpp | 2 +- .../source/xe_hpg_core/enable_xe_hpg_core.cpp | 7 +- .../test/common/mocks/mock_hw_info_config.cpp | 8 +- .../unit_test/helpers/cache_policy_tests.cpp | 24 ++- .../helpers/state_base_address_tests.cpp | 150 ++++++++++++++---- .../unit_test/helpers/test_hw_info_config.cpp | 36 +++-- .../dg2/cache_policy_tests_dg2.cpp | 12 +- .../dg2/excludes_xe_hpg_core_dg2.cpp | 7 +- .../xe_hpg_core/dg2/test_encode_dg2.cpp | 8 +- 48 files changed, 447 insertions(+), 128 deletions(-) create mode 100644 level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_excludes_dg2.cpp create mode 100644 level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_kernel_dg2.cpp diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_base.inl b/level_zero/core/source/cmdlist/cmdlist_hw_base.inl index 99707bf233..15be09a5f2 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_base.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_base.inl @@ -155,6 +155,7 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K args.gmmHelper = neoDevice->getGmmHelper(); args.useGlobalAtomics = kernelImp->getKernelDescriptor().kernelAttributes.flags.useGlobalAtomics; args.areMultipleSubDevicesInContext = false; + args.isDebuggerActive = true; NEO::EncodeSurfaceState::encodeBuffer(args); *reinterpret_cast(surfaceStateSpace) = surfaceState; } diff --git a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl index fda8bda553..059ffbf303 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl @@ -275,6 +275,7 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K args.useGlobalAtomics = kernelImp->getKernelDescriptor().kernelAttributes.flags.useGlobalAtomics; args.areMultipleSubDevicesInContext = args.numAvailableDevices > 1; args.implicitScaling = this->partitionCount > 1; + args.isDebuggerActive = true; NEO::EncodeSurfaceState::encodeBuffer(args); *reinterpret_cast(surfaceStateSpace) = surfaceState; diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl index cd3237ba57..a04bc545ee 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw_base.inl @@ -51,6 +51,7 @@ void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool auto indirectObjectHeapBaseAddress = neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), useLocalMemoryForIndirectHeap); auto instructionHeapBaseAddress = neoDevice->getMemoryManager()->getInternalHeapBaseAddress(device->getRootDeviceIndex(), neoDevice->getMemoryManager()->isLocalMemoryUsedForIsa(neoDevice->getRootDeviceIndex())); + auto isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr; NEO::StateBaseAddressHelperArgs stateBaseAddressHelperArgs = { gsba, // generalStateBase @@ -71,7 +72,8 @@ void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + isDebuggerActive // isDebuggerActive }; NEO::StateBaseAddressHelper::programStateBaseAddress(stateBaseAddressHelperArgs); diff --git a/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl b/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl index c9d2ccec18..ed7912a407 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_xe_hp_core_and_later.inl @@ -41,6 +41,7 @@ void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool NEO::EncodeWA::addPipeControlBeforeStateBaseAddress(commandStream, hwInfo, isRcs); auto sbaCmdBuf = NEO::StateBaseAddressHelper::getSpaceForSbaCmd(commandStream); + auto isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr; STATE_BASE_ADDRESS sbaCmd; NEO::StateBaseAddressHelperArgs stateBaseAddressHelperArgs = { @@ -62,7 +63,8 @@ void CommandQueueHw::programStateBaseAddress(uint64_t gsba, bool multiOsContextCapable, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + isDebuggerActive // isDebuggerActive }; NEO::StateBaseAddressHelper::programStateBaseAddress(stateBaseAddressHelperArgs); diff --git a/level_zero/core/source/kernel/kernel_hw.h b/level_zero/core/source/kernel/kernel_hw.h index dd9ed333db..7ee42e7e64 100644 --- a/level_zero/core/source/kernel/kernel_hw.h +++ b/level_zero/core/source/kernel/kernel_hw.h @@ -75,7 +75,7 @@ struct KernelHw : public KernelImp { if (l3Enabled == false) { this->kernelRequiresQueueUncachedMocsCount++; } - + auto isDebuggerActive = neoDevice->isDebuggerActive() || neoDevice->getDebugger() != nullptr; NEO::EncodeSurfaceStateArgs args; args.outMemory = &surfaceState; args.graphicsAddress = bufferAddressForSsh; @@ -87,6 +87,7 @@ struct KernelHw : public KernelImp { args.useGlobalAtomics = kernelImmData->getDescriptor().kernelAttributes.flags.useGlobalAtomics; args.areMultipleSubDevicesInContext = args.numAvailableDevices > 1; args.implicitScaling = device->isImplicitScalingCapable(); + args.isDebuggerActive = isDebuggerActive; NEO::EncodeSurfaceState::encodeBuffer(args); *reinterpret_cast(surfaceStateAddress) = surfaceState; diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index 60519e61f9..2bbab418dd 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -72,7 +72,7 @@ inline void patchWithImplicitSurface(ArrayRef crossThreadData, ArrayRef auto &hwInfo = device.getHardwareInfo(); auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily); - + auto isDebuggerActive = device.isDebuggerActive() || device.getDebugger() != nullptr; NEO::EncodeSurfaceStateArgs args; args.outMemory = surfaceState; args.size = sizeToPatch; @@ -84,6 +84,7 @@ inline void patchWithImplicitSurface(ArrayRef crossThreadData, ArrayRef args.areMultipleSubDevicesInContext = args.numAvailableDevices > 1; args.mocs = hwHelper.getMocsIndex(*args.gmmHelper, true, false) << 1; args.implicitScaling = implicitScaling; + args.isDebuggerActive = isDebuggerActive; hwHelper.encodeBufferSurfaceState(args); } diff --git a/level_zero/core/source/module/module_imp.cpp b/level_zero/core/source/module/module_imp.cpp index 20ec03261a..b61c7f25c4 100644 --- a/level_zero/core/source/module/module_imp.cpp +++ b/level_zero/core/source/module/module_imp.cpp @@ -121,8 +121,8 @@ std::string ModuleTranslationUnit::generateCompilerOptions(const char *buildOpti } std::string internalOptions = NEO::CompilerOptions::concatenate(internalBuildOptions, BuildOptions::hasBufferOffsetArg); auto &neoDevice = *device->getNEODevice(); - - if (neoDevice.getDeviceInfo().debuggerActive) { + auto isDebuggerActive = neoDevice.getDeviceInfo().debuggerActive; + if (isDebuggerActive) { if (NEO::SourceLevelDebugger::shouldAppendOptDisable(*device->getSourceLevelDebugger())) { NEO::CompilerOptions::concatenateAppend(options, BuildOptions::optDisable); } @@ -139,7 +139,7 @@ std::string ModuleTranslationUnit::generateCompilerOptions(const char *buildOpti internalOptions = NEO::CompilerOptions::concatenate(internalOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired); } - NEO::CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions()); + NEO::CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions(isDebuggerActive)); return internalOptions; } diff --git a/level_zero/core/test/unit_tests/sources/module/test_module.cpp b/level_zero/core/test/unit_tests/sources/module/test_module.cpp index 0cc33543c0..0e8e9dc606 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module.cpp @@ -2259,7 +2259,7 @@ HWTEST_F(ModuleTranslationUnitTest, givenInternalOptionsThenLSCCachePolicyIsSet) auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); EXPECT_TRUE(ret); - auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions(); + auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions(false); if (expectedPolicy != nullptr) { EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find(expectedPolicy), std::string::npos); } else { diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/CMakeLists.txt b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/CMakeLists.txt index 95cc240a8c..434c505714 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/CMakeLists.txt +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/CMakeLists.txt @@ -7,9 +7,11 @@ if(TESTS_DG2) target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ${CMAKE_CURRENT_SOURCE_DIR}/test_sampler_dg2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_cmdlist_dg2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_cmdqueue_dg2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_kernel_dg2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_excludes_dg2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_sampler_dg2.cpp ) add_subdirectories() endif() diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdqueue_dg2.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdqueue_dg2.cpp index 701c4f146d..bbbe508eb9 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdqueue_dg2.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_cmdqueue_dg2.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/test_macros/hw_test.h" @@ -30,5 +31,59 @@ HWTEST2_F(CommandQueueTestDG2, givenBindlessEnabledWhenEstimateStateBaseAddressC EXPECT_EQ(size, expectedSize); } +HWTEST2_F(CommandQueueTestDG2, givenBindlessEnabledWhenProgramStateBaseAddressCalledOnDG2ThenProgramCorrectL1CachePolicy, IsDG2) { + DebugManagerStateRestore restorer; + DebugManager.flags.UseBindlessMode.set(1); + + neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(neoDevice->getMemoryManager(), + neoDevice->getNumGenericSubDevices() > 1, + neoDevice->getRootDeviceIndex(), + neoDevice->getDeviceBitfield()); + + using GfxFamily = typename NEO::GfxFamilyMapper::GfxFamily; + using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS; + ze_command_queue_desc_t desc = {}; + auto &csr = neoDevice->getGpgpuCommandStreamReceiver(); + auto commandQueue = std::make_unique>(device, &csr, &desc); + void *linearStreamBuffer = alignedMalloc(4096, 0x1000); + { + NEO::LinearStream cmdStream(linearStreamBuffer, 4096); + auto usedSpaceBefore = cmdStream.getUsed(); + commandQueue->programStateBaseAddress(0, false, cmdStream, false); + auto usedSpaceAfter = cmdStream.getUsed(); + ASSERT_GT(usedSpaceAfter, usedSpaceBefore); + + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( + cmdList, ptrOffset(cmdStream.getCpuBase(), 0), usedSpaceAfter)); + + auto sbaItor = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(cmdList.end(), sbaItor); + auto cmdSba = genCmdCast(*sbaItor); + + EXPECT_EQ(STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, cmdSba->getL1CachePolicyL1CacheControl()); + } + { + const_cast(device->getDeviceInfo()).debuggerActive = true; + NEO::LinearStream cmdStream(linearStreamBuffer, 4096); + auto usedSpaceBefore = cmdStream.getUsed(); + commandQueue->programStateBaseAddress(0, false, cmdStream, false); + auto usedSpaceAfter = cmdStream.getUsed(); + ASSERT_GT(usedSpaceAfter, usedSpaceBefore); + + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( + cmdList, ptrOffset(cmdStream.getCpuBase(), 0), usedSpaceAfter)); + + auto sbaItor = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(cmdList.end(), sbaItor); + auto cmdSba = genCmdCast(*sbaItor); + + EXPECT_EQ(STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, cmdSba->getL1CachePolicyL1CacheControl()); + } + + alignedFree(linearStreamBuffer); +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_excludes_dg2.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_excludes_dg2.cpp new file mode 100644 index 0000000000..947de841b1 --- /dev/null +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_excludes_dg2.cpp @@ -0,0 +1,10 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/test/common/test_macros/hw_test_base.h" + +HWTEST_EXCLUDE_PRODUCT(ModuleTranslationUnitTest, givenAtLeastXeHpgCoreWhenGetInternalOptionsThenCorrectBuildOptionIsSet_IsAtLeastXeHpgCore, IGFX_DG2); \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_kernel_dg2.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_kernel_dg2.cpp new file mode 100644 index 0000000000..09a7833bd4 --- /dev/null +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_kernel_dg2.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/test/common/cmd_parse/gen_cmd_parse.h" +#include "shared/test/common/helpers/debug_manager_state_restore.h" +#include "shared/test/common/test_macros/hw_test.h" + +#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h" +#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" + +namespace L0 { +namespace ult { +using KernelTestDG2 = Test; + +HWTEST2_F(KernelTestDG2, givenKernelImpWhenSetBufferSurfaceStateCalledThenProgramCorrectL1CachePolicy, IsDG2) { + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; + ze_kernel_handle_t kernelHandle; + + ze_kernel_desc_t kernelDesc = {}; + kernelDesc.pKernelName = kernelName.c_str(); + + ze_result_t res = module->createKernel(&kernelDesc, &kernelHandle); + + ASSERT_EQ(ZE_RESULT_SUCCESS, res); + + auto kernelImp = reinterpret_cast(L0::Kernel::fromHandle(kernelHandle)); + + void *devicePtr = nullptr; + ze_device_mem_alloc_desc_t deviceDesc = {}; + res = context->allocDeviceMem(device->toHandle(), + &deviceDesc, + 16384u, + 0u, + &devicePtr); + ASSERT_EQ(ZE_RESULT_SUCCESS, res); + + auto gpuAlloc = device->getDriverHandle()->getSvmAllocsManager()->getSVMAllocs()->get(devicePtr)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()); + ASSERT_NE(nullptr, gpuAlloc); + + uint32_t argIndex = 0u; + kernelImp->setBufferSurfaceState(argIndex, devicePtr, gpuAlloc); + + auto argInfo = kernelImp->getImmutableData()->getDescriptor().payloadMappings.explicitArgs[argIndex].as(); + auto surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful); + auto surfaceStateAddress = reinterpret_cast(const_cast(surfaceStateAddressRaw)); + EXPECT_EQ(RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB, surfaceStateAddress->getL1CachePolicyL1CacheControl()); + + const_cast(device->getDeviceInfo()).debuggerActive = true; + kernelImp->setBufferSurfaceState(argIndex, devicePtr, gpuAlloc); + surfaceStateAddressRaw = ptrOffset(kernelImp->getSurfaceStateHeapData(), argInfo.bindful); + surfaceStateAddress = reinterpret_cast(const_cast(surfaceStateAddressRaw)); + EXPECT_EQ(RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP, surfaceStateAddress->getL1CachePolicyL1CacheControl()); + + Kernel::fromHandle(kernelHandle)->destroy(); + + context->freeMem(devicePtr); +} + +} // namespace ult +} // namespace L0 diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/test_module_xe_hpg_core.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/test_module_xe_hpg_core.cpp index 57417fa9fa..d7ac7228c3 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/test_module_xe_hpg_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/test_module_xe_hpg_core.cpp @@ -46,14 +46,14 @@ HWTEST2_F(KernelPropertyTest, givenKernelExtendedPropertiesStructureWhenKernelPr EXPECT_FALSE(kernelExtendedProperties.fp64Flags & FP_ATOMIC_EXT_FLAG_LOCAL_MIN_MAX); } -HWTEST2_F(KernelPropertyTest, givenDG2WhenGetInternalOptionsThenWriteByPassBuildOptionIsSet, IsDG2) { +HWTEST2_F(KernelPropertyTest, givenDG2WhenGetInternalOptionsThenWriteBackBuildOptionIsSet, IsDG2) { auto pMockCompilerInterface = new MockCompilerInterface; auto &rootDeviceEnvironment = this->neoDevice->executionEnvironment->rootDeviceEnvironments[this->neoDevice->getRootDeviceIndex()]; rootDeviceEnvironment->compilerInterface.reset(pMockCompilerInterface); MockModuleTranslationUnit moduleTu(this->device); auto ret = moduleTu.buildFromSpirV("", 0U, nullptr, "", nullptr); EXPECT_TRUE(ret); - EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=2 -cl-load-cache-default=4"), std::string::npos); + EXPECT_NE(pMockCompilerInterface->inputInternalOptions.find("-cl-store-cache-default=7 -cl-load-cache-default=4"), std::string::npos); } } // namespace ult diff --git a/opencl/source/mem_obj/buffer_base.inl b/opencl/source/mem_obj/buffer_base.inl index a448dc28f1..b166fc42de 100644 --- a/opencl/source/mem_obj/buffer_base.inl +++ b/opencl/source/mem_obj/buffer_base.inl @@ -30,6 +30,7 @@ void BufferHw::setArgStateful(void *memory, bool forceNonAuxMode, boo auto rootDeviceIndex = device.getRootDeviceIndex(); auto graphicsAllocation = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex); const auto isReadOnly = isValueSet(getFlags(), CL_MEM_READ_ONLY) || isReadOnlyArgument; + auto isDebuggerActive = device.isDebuggerActive() || device.getDebugger() != nullptr; NEO::EncodeSurfaceStateArgs args; args.outMemory = memory; @@ -45,6 +46,7 @@ void BufferHw::setArgStateful(void *memory, bool forceNonAuxMode, boo args.useGlobalAtomics = useGlobalAtomics; args.areMultipleSubDevicesInContext = areMultipleSubDevicesInContext; args.implicitScaling = ImplicitScalingHelper::isImplicitScalingEnabled(device.getDeviceBitfield(), true); + args.isDebuggerActive = isDebuggerActive; appendSurfaceStateArgs(args); EncodeSurfaceState::encodeBuffer(args); } diff --git a/opencl/source/program/program.cpp b/opencl/source/program/program.cpp index d94b47c2a0..6f087c80ec 100644 --- a/opencl/source/program/program.cpp +++ b/opencl/source/program/program.cpp @@ -105,7 +105,8 @@ std::string Program::getInternalOptions() const { } CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::preserveVec3Type); - CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions()); + auto isDebuggerActive = pClDevice->getDevice().isDebuggerActive() || pClDevice->getDevice().getDebugger() != nullptr; + CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions(isDebuggerActive)); return internalOptions; } diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index dfb0d1cb3b..ec1b9c0676 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -1743,7 +1743,7 @@ TEST_F(ProgramTests, whenGetInternalOptionsThenLSCPolicyIsSet) { MockProgram program(pContext, false, toClDeviceVector(*pClDevice)); auto internalOptions = program.getInternalOptions(); const auto &compilerHwInfoConfig = *CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions(); + auto expectedPolicy = compilerHwInfoConfig.getCachingPolicyOptions(false); if (expectedPolicy != nullptr) { EXPECT_TRUE(CompilerOptions::contains(internalOptions, expectedPolicy)); } else { diff --git a/opencl/test/unit_test/xe_hpg_core/dg2/excludes_ocl_dg2.cpp b/opencl/test/unit_test/xe_hpg_core/dg2/excludes_ocl_dg2.cpp index d3fe7eaf6f..2d563324da 100644 --- a/opencl/test/unit_test/xe_hpg_core/dg2/excludes_ocl_dg2.cpp +++ b/opencl/test/unit_test/xe_hpg_core/dg2/excludes_ocl_dg2.cpp @@ -12,3 +12,7 @@ HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTestXeHpAndLater, givenXeHPAndLaterPlatformWh HWTEST_EXCLUDE_PRODUCT(WddmMemoryManagerSimpleTest, givenLinearStreamWhenItIsAllocatedThenItIsInLocalMemoryHasCpuPointerAndHasStandardHeap64kbAsGpuAddress, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(HwHelperTestXeHPAndLater, GiveCcsNodeThenDefaultEngineTypeIsCcs, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(XeHPAndLaterDeviceCapsTests, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(ProgramTests, givenAtLeastXeHpgCoreWhenGetInternalOptionsThenCorrectBuildOptionIsSet_IsAtLeastXeHpgCore, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(CmdsProgrammingTestsXeHpgCore, givenL3ToL1DebugFlagWhenStatelessMocsIsProgrammedThenItHasL1CachingOn, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(CmdsProgrammingTestsXeHpgCore, givenAlignedCacheableReadOnlyBufferThenChoseOclBufferConstPolicy, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(CmdsProgrammingTestsXeHpgCore, whenAppendingRssThenProgramWBPL1CachePolicy, IGFX_DG2); diff --git a/opencl/test/unit_test/xe_hpg_core/dg2/test_cmds_programming_dg2.cpp b/opencl/test/unit_test/xe_hpg_core/dg2/test_cmds_programming_dg2.cpp index 036e62ea42..8fc59909cb 100644 --- a/opencl/test/unit_test/xe_hpg_core/dg2/test_cmds_programming_dg2.cpp +++ b/opencl/test/unit_test/xe_hpg_core/dg2/test_cmds_programming_dg2.cpp @@ -37,10 +37,27 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenL3ToL1DebugFlagWhenStatelessMocsIsProgra auto stateBaseAddress = static_cast(hwParserCsr.cmdStateBaseAddress); - auto actualL1CachePolocy = static_cast(stateBaseAddress->getL1CachePolicyL1CacheControl()); + EXPECT_EQ(stateBaseAddress->getL1CachePolicyL1CacheControl(), STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB); +} - const uint8_t expectedL1CachePolicy = FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP; - EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy); +DG2TEST_F(CmdsProgrammingTestsDg2, givenL3ToL1DebugFlagAndDebuggerActiveWhenStatelessMocsIsProgrammedThenItHasCorrectL1CachingOn) { + using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; + + DebugManagerStateRestore restore; + DebugManager.flags.ForceL1Caching.set(1u); + pDevice->setDebuggerActive(true); + + auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); + flushTask(commandStreamReceiver); + + HardwareParse hwParserCsr; + hwParserCsr.parseCommands(commandStreamReceiver.commandStream, 0); + hwParserCsr.findHardwareCommands(); + ASSERT_NE(nullptr, hwParserCsr.cmdStateBaseAddress); + + auto stateBaseAddress = static_cast(hwParserCsr.cmdStateBaseAddress); + + EXPECT_EQ(stateBaseAddress->getL1CachePolicyL1CacheControl(), STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP); } DG2TEST_F(CmdsProgrammingTestsDg2, whenAppendingRssThenProgramWBPL1CachePolicy) { @@ -69,7 +86,10 @@ DG2TEST_F(CmdsProgrammingTestsDg2, whenAppendingRssThenProgramWBPL1CachePolicy) args.areMultipleSubDevicesInContext = true; EncodeSurfaceState::encodeBuffer(args); + EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB, rssCmd.getL1CachePolicyL1CacheControl()); + args.isDebuggerActive = true; + EncodeSurfaceState::encodeBuffer(args); EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP, rssCmd.getL1CachePolicyL1CacheControl()); } @@ -95,10 +115,35 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenAlignedCacheableReadOnlyBufferThenChoseO const auto actualMocs = surfaceState.getMemoryObjectControlState(); EXPECT_EQ(expectedMocs, actualMocs); - auto actualL1CachePolocy = static_cast(surfaceState.getL1CachePolicyL1CacheControl()); + EXPECT_EQ(surfaceState.getL1CachePolicyL1CacheControl(), FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB); - const uint8_t expectedL1CachePolicy = FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP; - EXPECT_EQ(expectedL1CachePolicy, actualL1CachePolocy); + alignedFree(ptr); +} + +DG2TEST_F(CmdsProgrammingTestsDg2, givenAlignedCacheableReadOnlyBufferAndDebuggerActiveWhenBufferCreateThenChoseOclBufferConstPolicy) { + MockContext context; + const_cast(context.getDevice(0)->getDevice().getDeviceInfo()).debuggerActive = true; + const auto size = MemoryConstants::pageSize; + const auto ptr = (void *)alignedMalloc(size * 2, MemoryConstants::pageSize); + const auto flags = CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY; + + auto retVal = CL_SUCCESS; + auto buffer = std::unique_ptr(Buffer::create( + &context, + flags, + size, + ptr, + retVal)); + EXPECT_EQ(CL_SUCCESS, retVal); + + typename FamilyType::RENDER_SURFACE_STATE surfaceState = {}; + buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false, false); + + const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST); + const auto actualMocs = surfaceState.getMemoryObjectControlState(); + EXPECT_EQ(expectedMocs, actualMocs); + + EXPECT_EQ(surfaceState.getL1CachePolicyL1CacheControl(), FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP); alignedFree(ptr); } diff --git a/shared/offline_compiler/source/offline_compiler.cpp b/shared/offline_compiler/source/offline_compiler.cpp index 5dff56f8ca..6095a0bc0f 100644 --- a/shared/offline_compiler/source/offline_compiler.cpp +++ b/shared/offline_compiler/source/offline_compiler.cpp @@ -779,7 +779,7 @@ void OfflineCompiler::appendExtraInternalOptions(std::string &internalOptions) { if (compilerHwInfoConfig.isForceEmuInt32DivRemSPRequired()) { CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::forceEmuInt32DivRemSP); } - CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions()); + CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions(false)); } void OfflineCompiler::parseDebugSettings() { diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index 985a93ae7a..9f911d20d3 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -283,7 +283,7 @@ struct EncodeSurfaceState { static void encodeBuffer(EncodeSurfaceStateArgs &args); static void encodeExtraBufferParams(EncodeSurfaceStateArgs &args); static void encodeImplicitScalingParams(const EncodeSurfaceStateArgs &args); - static void encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const HardwareInfo &hwInfo); + static void encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args); static void appendBufferSurfaceState(EncodeSurfaceStateArgs &args); static constexpr uintptr_t getSurfaceBaseAddressAlignmentMask() { diff --git a/shared/source/command_container/command_encoder.inl b/shared/source/command_container/command_encoder.inl index 8d83780baf..e1f4f5688d 100644 --- a/shared/source/command_container/command_encoder.inl +++ b/shared/source/command_container/command_encoder.inl @@ -467,7 +467,7 @@ size_t EncodeSurfaceState::pushBindingTableAndSurfaceStates(IndirectHeap } template -inline void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const HardwareInfo &hwInfo) {} +inline void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args) {} template void EncodeSurfaceState::setImageAuxParamsForCCS(R_SURFACE_STATE *surfaceState, Gmm *gmm) { diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index 399be4b9d1..56a946f8b7 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -371,6 +371,7 @@ void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs & auto dsh = args.container->isHeapDirty(HeapType::DYNAMIC_STATE) ? args.container->getIndirectHeap(HeapType::DYNAMIC_STATE) : nullptr; auto ioh = args.container->isHeapDirty(HeapType::INDIRECT_OBJECT) ? args.container->getIndirectHeap(HeapType::INDIRECT_OBJECT) : nullptr; auto ssh = args.container->isHeapDirty(HeapType::SURFACE_STATE) ? args.container->getIndirectHeap(HeapType::SURFACE_STATE) : nullptr; + auto isDebuggerActive = device.isDebuggerActive() || device.getDebugger() != nullptr; StateBaseAddressHelperArgs stateBaseAddressHelperArgs = { 0, // generalStateBase @@ -391,7 +392,8 @@ void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs & false, // isMultiOsContextCapable args.useGlobalAtomics, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + isDebuggerActive // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(stateBaseAddressHelperArgs); @@ -457,7 +459,7 @@ inline void EncodeWA::adjustCompressionFormatForPlanarImage(uint32_t template inline void EncodeSurfaceState::encodeExtraBufferParams(EncodeSurfaceStateArgs &args) { auto surfaceState = reinterpret_cast(args.outMemory); - encodeExtraCacheSettings(surfaceState, *args.gmmHelper->getHardwareInfo()); + encodeExtraCacheSettings(surfaceState, args); } template diff --git a/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl b/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl index 6642e2dd86..5fab081c11 100644 --- a/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl +++ b/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl @@ -13,16 +13,16 @@ namespace NEO { template <> -void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const HardwareInfo &hwInfo) { +void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args) { using L1_CACHE_POLICY = typename R_SURFACE_STATE::L1_CACHE_POLICY; + const auto &hwInfo = *args.gmmHelper->getHardwareInfo(); auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily); - auto cachePolicy = static_cast(hwInfoConfig->getL1CachePolicy()); - surfaceState->setL1CachePolicyL1CacheControl(cachePolicy); - + auto cachePolicy = static_cast(hwInfoConfig->getL1CachePolicy(args.isDebuggerActive)); if (DebugManager.flags.OverrideL1CacheControlInSurfaceState.get() != -1 && DebugManager.flags.ForceAllResourcesUncached.get() == false) { - surfaceState->setL1CachePolicyL1CacheControl(static_cast(DebugManager.flags.OverrideL1CacheControlInSurfaceState.get())); + cachePolicy = static_cast(DebugManager.flags.OverrideL1CacheControlInSurfaceState.get()); } + surfaceState->setL1CachePolicyL1CacheControl(cachePolicy); } template diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index 995f06dd89..cee329d5fd 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -473,11 +473,13 @@ void EncodeStateBaseAddress::setSbaAddressesForDebugger(NEO::Debugger::S template void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs &args) { - auto gmmHelper = args.container->getDevice()->getRootDeviceEnvironment().getGmmHelper(); + auto &device = *args.container->getDevice(); + auto gmmHelper = device.getRootDeviceEnvironment().getGmmHelper(); auto dsh = args.container->isHeapDirty(HeapType::DYNAMIC_STATE) ? args.container->getIndirectHeap(HeapType::DYNAMIC_STATE) : nullptr; auto ioh = args.container->isHeapDirty(HeapType::INDIRECT_OBJECT) ? args.container->getIndirectHeap(HeapType::INDIRECT_OBJECT) : nullptr; auto ssh = args.container->isHeapDirty(HeapType::SURFACE_STATE) ? args.container->getIndirectHeap(HeapType::SURFACE_STATE) : nullptr; + auto isDebuggerActive = device.isDebuggerActive() || device.getDebugger() != nullptr; StateBaseAddressHelperArgs stateBaseAddressHelperArgs = { 0, // generalStateBase @@ -498,7 +500,8 @@ void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs & args.multiOsContextCapable, // isMultiOsContextCapable args.useGlobalAtomics, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + isDebuggerActive // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(stateBaseAddressHelperArgs); @@ -506,7 +509,7 @@ void EncodeStateBaseAddress::encode(EncodeStateBaseAddressArgs & auto cmdSpace = StateBaseAddressHelper::getSpaceForSbaCmd(*args.container->getCommandStream()); *cmdSpace = args.sbaCmd; - auto &hwInfo = args.container->getDevice()->getHardwareInfo(); + auto &hwInfo = device.getHardwareInfo(); auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); if (hwInfoConfig.isAdditionalStateBaseAddressWARequired(hwInfo)) { cmdSpace = StateBaseAddressHelper::getSpaceForSbaCmd(*args.container->getCommandStream()); @@ -630,7 +633,7 @@ void EncodeSurfaceState::encodeExtraBufferParams(EncodeSurfaceStateArgs surfaceState->setMemoryObjectControlState(args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST)); } - encodeExtraCacheSettings(surfaceState, *args.gmmHelper->getHardwareInfo()); + encodeExtraCacheSettings(surfaceState, args); encodeImplicitScalingParams(args); diff --git a/shared/source/command_container/definitions/encode_surface_state_args_base.h b/shared/source/command_container/definitions/encode_surface_state_args_base.h index b6e0d635d8..00133857e1 100644 --- a/shared/source/command_container/definitions/encode_surface_state_args_base.h +++ b/shared/source/command_container/definitions/encode_surface_state_args_base.h @@ -31,6 +31,7 @@ struct EncodeSurfaceStateArgsBase { bool useGlobalAtomics = false; bool areMultipleSubDevicesInContext = false; bool implicitScaling = false; + bool isDebuggerActive = false; protected: EncodeSurfaceStateArgsBase() = default; diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index bdd2d5c2a3..4a1c10f2da 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -428,7 +428,8 @@ CompletionStamp CommandStreamReceiverHw::flushTask( isMultiOsContextCapable(), // isMultiOsContextCapable dispatchFlags.useGlobalAtomics, // useGlobalAtomics dispatchFlags.areMultipleSubDevicesInContext, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + debuggingEnabled || device.isDebuggerActive() // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); diff --git a/shared/source/helpers/cache_policy.h b/shared/source/helpers/cache_policy.h index 0279b57dc8..fea12fbdea 100644 --- a/shared/source/helpers/cache_policy.h +++ b/shared/source/helpers/cache_policy.h @@ -21,13 +21,13 @@ bool isL3Capable(const GraphicsAllocation &graphicsAllocation); template struct L1CachePolicyHelper { - static const char *getCachingPolicyOptions(); + static const char *getCachingPolicyOptions(bool isDebuggerActive); - static uint32_t getDefaultL1CachePolicy(); + static uint32_t getDefaultL1CachePolicy(bool isDebuggerActive); static uint32_t getUncachedL1CachePolicy(); - static uint32_t getL1CachePolicy(); + static uint32_t getL1CachePolicy(bool isDebuggerActive); }; } // namespace NEO diff --git a/shared/source/helpers/cache_policy_base.inl b/shared/source/helpers/cache_policy_base.inl index ff731940bb..61b1b028f0 100644 --- a/shared/source/helpers/cache_policy_base.inl +++ b/shared/source/helpers/cache_policy_base.inl @@ -12,14 +12,14 @@ namespace NEO { template -uint32_t L1CachePolicyHelper::getL1CachePolicy() { +uint32_t L1CachePolicyHelper::getL1CachePolicy(bool isDebuggerActive) { if (DebugManager.flags.ForceAllResourcesUncached.get()) { return L1CachePolicyHelper::getUncachedL1CachePolicy(); } if (DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get() != -1) { return DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.get(); } - return L1CachePolicyHelper::getDefaultL1CachePolicy(); + return L1CachePolicyHelper::getDefaultL1CachePolicy(isDebuggerActive); } } // namespace NEO \ No newline at end of file diff --git a/shared/source/helpers/cache_policy_bdw_and_later.inl b/shared/source/helpers/cache_policy_bdw_and_later.inl index ce3542db6e..a5c75969d5 100644 --- a/shared/source/helpers/cache_policy_bdw_and_later.inl +++ b/shared/source/helpers/cache_policy_bdw_and_later.inl @@ -11,12 +11,12 @@ namespace NEO { template -const char *L1CachePolicyHelper::getCachingPolicyOptions() { +const char *L1CachePolicyHelper::getCachingPolicyOptions(bool isDebuggerActive) { return nullptr; } template -uint32_t L1CachePolicyHelper::getDefaultL1CachePolicy() { +uint32_t L1CachePolicyHelper::getDefaultL1CachePolicy(bool isDebuggerActive) { return 0u; } diff --git a/shared/source/helpers/cache_policy_dg2_and_later.inl b/shared/source/helpers/cache_policy_dg2_and_later.inl index 502c935cc2..9d1278f595 100644 --- a/shared/source/helpers/cache_policy_dg2_and_later.inl +++ b/shared/source/helpers/cache_policy_dg2_and_later.inl @@ -12,14 +12,14 @@ namespace NEO { template -const char *L1CachePolicyHelper::getCachingPolicyOptions() { +const char *L1CachePolicyHelper::getCachingPolicyOptions(bool isDebuggerActive) { using GfxFamily = typename HwMapper::GfxFamily; static constexpr const char *writeBackCachingPolicy = "-cl-store-cache-default=7 -cl-load-cache-default=4"; static constexpr const char *writeByPassCachingPolicy = "-cl-store-cache-default=2 -cl-load-cache-default=4"; static constexpr const char *uncachedCachingPolicy = "-cl-store-cache-default=1 -cl-load-cache-default=1"; - switch (L1CachePolicyHelper::getL1CachePolicy()) { + switch (L1CachePolicyHelper::getL1CachePolicy(isDebuggerActive)) { case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP: return writeByPassCachingPolicy; case GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB: @@ -32,7 +32,7 @@ const char *L1CachePolicyHelper::getCachingPolicyOptions() { } template -uint32_t L1CachePolicyHelper::getDefaultL1CachePolicy() { +uint32_t L1CachePolicyHelper::getDefaultL1CachePolicy(bool isDebuggerActive) { using GfxFamily = typename HwMapper::GfxFamily; return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP; } diff --git a/shared/source/helpers/compiler_hw_info_config.h b/shared/source/helpers/compiler_hw_info_config.h index bfbb5858f3..70ca45f181 100644 --- a/shared/source/helpers/compiler_hw_info_config.h +++ b/shared/source/helpers/compiler_hw_info_config.h @@ -30,7 +30,7 @@ class CompilerHwInfoConfig { virtual bool isForceToStatelessRequired() const = 0; virtual void adjustHwInfoForIgc(HardwareInfo &hwInfo) const = 0; virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, AheadOfTimeConfig config) const = 0; - virtual const char *getCachingPolicyOptions() const = 0; + virtual const char *getCachingPolicyOptions(bool isDebuggerActive) const = 0; }; template @@ -47,7 +47,7 @@ class CompilerHwInfoConfigHw : public CompilerHwInfoConfig { bool isForceToStatelessRequired() const override; void adjustHwInfoForIgc(HardwareInfo &hwInfo) const override; void setProductConfigForHwInfo(HardwareInfo &hwInfo, AheadOfTimeConfig config) const override; - const char *getCachingPolicyOptions() const override; + const char *getCachingPolicyOptions(bool isDebuggerActive) const override; protected: CompilerHwInfoConfigHw() = default; diff --git a/shared/source/helpers/compiler_hw_info_config_base.inl b/shared/source/helpers/compiler_hw_info_config_base.inl index 6dcfe2fbc7..5696bb17cb 100644 --- a/shared/source/helpers/compiler_hw_info_config_base.inl +++ b/shared/source/helpers/compiler_hw_info_config_base.inl @@ -26,8 +26,8 @@ void CompilerHwInfoConfigHw::adjustHwInfoForIgc(HardwareInfo &hwInfo } template -const char *CompilerHwInfoConfigHw::getCachingPolicyOptions() const { - return L1CachePolicyHelper::getCachingPolicyOptions(); +const char *CompilerHwInfoConfigHw::getCachingPolicyOptions(bool isDebuggerActive) const { + return L1CachePolicyHelper::getCachingPolicyOptions(isDebuggerActive); }; } // namespace NEO diff --git a/shared/source/helpers/state_base_address.h b/shared/source/helpers/state_base_address.h index 13aea6c8eb..c7890f84e8 100644 --- a/shared/source/helpers/state_base_address.h +++ b/shared/source/helpers/state_base_address.h @@ -45,6 +45,7 @@ struct StateBaseAddressHelperArgs { bool useGlobalAtomics = false; bool areMultipleSubDevicesInContext = false; bool overrideSurfaceStateBaseAddress = false; + bool isDebuggerActive = false; }; template @@ -60,7 +61,7 @@ struct StateBaseAddressHelper { static void appendStateBaseAddressParameters(StateBaseAddressHelperArgs &args, bool overrideBindlessSurfaceStateBase); - static void appendExtraCacheSettings(STATE_BASE_ADDRESS *stateBaseAddress, const HardwareInfo *hwInfo); + static void appendExtraCacheSettings(StateBaseAddressHelperArgs &args); static void programBindingTableBaseAddress(LinearStream &commandStream, const IndirectHeap &ssh, GmmHelper *gmmHelper); diff --git a/shared/source/helpers/state_base_address_bdw_and_later.inl b/shared/source/helpers/state_base_address_bdw_and_later.inl index 154e801120..5f244cb346 100644 --- a/shared/source/helpers/state_base_address_bdw_and_later.inl +++ b/shared/source/helpers/state_base_address_bdw_and_later.inl @@ -29,6 +29,6 @@ void StateBaseAddressHelper::appendIohParameters(StateBaseAddressHelp } template -void StateBaseAddressHelper::appendExtraCacheSettings(STATE_BASE_ADDRESS *stateBaseAddress, const HardwareInfo *hwInfo) {} +void StateBaseAddressHelper::appendExtraCacheSettings(StateBaseAddressHelperArgs &args) {} } // namespace NEO diff --git a/shared/source/helpers/state_base_address_xe_hpg_core_and_later.inl b/shared/source/helpers/state_base_address_xe_hpg_core_and_later.inl index a727c337e1..a1235bbd95 100644 --- a/shared/source/helpers/state_base_address_xe_hpg_core_and_later.inl +++ b/shared/source/helpers/state_base_address_xe_hpg_core_and_later.inl @@ -6,13 +6,13 @@ */ template -void StateBaseAddressHelper::appendExtraCacheSettings(STATE_BASE_ADDRESS *stateBaseAddress, const HardwareInfo *hwInfo) { - auto hwInfoConfig = HwInfoConfig::get(hwInfo->platform.eProductFamily); - auto cachePolicy = hwInfoConfig->getL1CachePolicy(); - stateBaseAddress->setL1CachePolicyL1CacheControl(static_cast(cachePolicy)); +void StateBaseAddressHelper::appendExtraCacheSettings(StateBaseAddressHelperArgs &args) { + auto hwInfoConfig = HwInfoConfig::get(args.gmmHelper->getHardwareInfo()->platform.eProductFamily); + auto cachePolicy = hwInfoConfig->getL1CachePolicy(args.isDebuggerActive); + args.stateBaseAddressCmd->setL1CachePolicyL1CacheControl(static_cast(cachePolicy)); if (DebugManager.flags.ForceStatelessL1CachingPolicy.get() != -1 && DebugManager.flags.ForceAllResourcesUncached.get() == false) { - stateBaseAddress->setL1CachePolicyL1CacheControl(static_cast(DebugManager.flags.ForceStatelessL1CachingPolicy.get())); + args.stateBaseAddressCmd->setL1CachePolicyL1CacheControl(static_cast(DebugManager.flags.ForceStatelessL1CachingPolicy.get())); } } diff --git a/shared/source/helpers/state_base_address_xehp_and_later.inl b/shared/source/helpers/state_base_address_xehp_and_later.inl index c17656a0fc..2bd61ea76f 100644 --- a/shared/source/helpers/state_base_address_xehp_and_later.inl +++ b/shared/source/helpers/state_base_address_xehp_and_later.inl @@ -78,7 +78,7 @@ void StateBaseAddressHelper::appendStateBaseAddressParameters( args.stateBaseAddressCmd->setStatelessDataPortAccessMemoryObjectControlState(args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST)); } - appendExtraCacheSettings(args.stateBaseAddressCmd, args.gmmHelper->getHardwareInfo()); + appendExtraCacheSettings(args); } template diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index 0e60c3a1fb..5000a6253d 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -132,7 +132,7 @@ class HwInfoConfig { virtual bool isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const = 0; virtual bool isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const = 0; virtual bool isAssignEngineRoundRobinSupported() const = 0; - virtual uint32_t getL1CachePolicy() const = 0; + virtual uint32_t getL1CachePolicy(bool isDebuggerActive) const = 0; virtual bool isEvictionIfNecessaryFlagSupported() const = 0; virtual void adjustNumberOfCcs(HardwareInfo &hwInfo) const = 0; virtual bool isPrefetcherDisablingInDirectSubmissionRequired() const = 0; @@ -258,7 +258,7 @@ class HwInfoConfigHw : public HwInfoConfig { bool isCpuCopyNecessary(const void *ptr, MemoryManager *memoryManager) const override; bool isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const override; bool isAssignEngineRoundRobinSupported() const override; - uint32_t getL1CachePolicy() const override; + uint32_t getL1CachePolicy(bool isDebuggerActive) const override; bool isEvictionIfNecessaryFlagSupported() const override; void adjustNumberOfCcs(HardwareInfo &hwInfo) const override; bool isPrefetcherDisablingInDirectSubmissionRequired() const override; diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 55854fda63..80bfbe5af4 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -482,8 +482,8 @@ template bool HwInfoConfigHw::isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const { return false; } template -uint32_t HwInfoConfigHw::getL1CachePolicy() const { - return L1CachePolicyHelper::getL1CachePolicy(); +uint32_t HwInfoConfigHw::getL1CachePolicy(bool isDebuggerActive) const { + return L1CachePolicyHelper::getL1CachePolicy(isDebuggerActive); } template diff --git a/shared/source/xe_hp_core/command_encoder_xe_hp_core.cpp b/shared/source/xe_hp_core/command_encoder_xe_hp_core.cpp index 3a271269e0..363ba4caf0 100644 --- a/shared/source/xe_hp_core/command_encoder_xe_hp_core.cpp +++ b/shared/source/xe_hp_core/command_encoder_xe_hp_core.cpp @@ -26,7 +26,7 @@ void EncodeDispatchKernel::adjustTimestampPacket(WALKER_TYPE &walkerCmd, } template <> -inline void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const HardwareInfo &hwInfo) { +inline void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args) { } template <> diff --git a/shared/source/xe_hp_core/state_base_address_xe_hp_core.cpp b/shared/source/xe_hp_core/state_base_address_xe_hp_core.cpp index 88ce30bb31..8580fa0870 100644 --- a/shared/source/xe_hp_core/state_base_address_xe_hp_core.cpp +++ b/shared/source/xe_hp_core/state_base_address_xe_hp_core.cpp @@ -11,7 +11,7 @@ namespace NEO { template <> -void StateBaseAddressHelper::appendExtraCacheSettings(STATE_BASE_ADDRESS *stateBaseAddress, const HardwareInfo *hwInfo) { +void StateBaseAddressHelper::appendExtraCacheSettings(StateBaseAddressHelperArgs &args) { } template struct StateBaseAddressHelper; diff --git a/shared/source/xe_hpg_core/enable_xe_hpg_core.cpp b/shared/source/xe_hpg_core/enable_xe_hpg_core.cpp index a103b3ca4c..2a4af55bc4 100644 --- a/shared/source/xe_hpg_core/enable_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/enable_xe_hpg_core.cpp @@ -18,9 +18,12 @@ namespace NEO { #ifdef SUPPORT_DG2 template <> -uint32_t L1CachePolicyHelper::getDefaultL1CachePolicy() { +uint32_t L1CachePolicyHelper::getDefaultL1CachePolicy(bool isDebuggerActive) { using GfxFamily = HwMapper::GfxFamily; - return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP; + if (isDebuggerActive) { + return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP; + } + return GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB; } template struct L1CachePolicyHelper; diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index 9a3c820000..5859131993 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -393,12 +393,12 @@ bool HwInfoConfigHw::isEvictionIfNecessaryFlagSupported() const { } template <> -const char *L1CachePolicyHelper::getCachingPolicyOptions() { +const char *L1CachePolicyHelper::getCachingPolicyOptions(bool isDebuggerActive) { return nullptr; } template <> -uint32_t L1CachePolicyHelper::getDefaultL1CachePolicy() { +uint32_t L1CachePolicyHelper::getDefaultL1CachePolicy(bool isDebuggerActive) { return 0u; } @@ -408,8 +408,8 @@ bool HwInfoConfigHw::isPrefetcherDisablingInDirectSubmissionRequir } template <> -uint32_t L1CachePolicyHelper::getL1CachePolicy() { - return L1CachePolicyHelper::getDefaultL1CachePolicy(); +uint32_t L1CachePolicyHelper::getL1CachePolicy(bool isDebuggerActive) { + return L1CachePolicyHelper::getDefaultL1CachePolicy(isDebuggerActive); } template <> diff --git a/shared/test/unit_test/helpers/cache_policy_tests.cpp b/shared/test/unit_test/helpers/cache_policy_tests.cpp index cac6a1cd82..dbd603f22e 100644 --- a/shared/test/unit_test/helpers/cache_policy_tests.cpp +++ b/shared/test/unit_test/helpers/cache_policy_tests.cpp @@ -13,7 +13,8 @@ using namespace NEO; HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenUnsupportedL1PoliciesAndGetDefaultL1CachePolicyThenReturnZero, IsAtMostXeHpCore) { - EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(), 0u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(false), 0u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(true), 0u); } HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenUnsupportedL1PoliciesAndGetUncached1CachePolicyThenReturnOne, IsAtMostXeHpCore) { @@ -22,7 +23,8 @@ HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenUnsupportedL1PoliciesAnd HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetL1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) { using GfxFamily = typename HwMapper::GfxFamily; - EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(), GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(false), GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(true), GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP); } HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetUncached1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) { @@ -35,7 +37,8 @@ HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreAndWriteBackPolicyWhenGetL1Cach DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2); const char *expectedStr = "-cl-store-cache-default=7 -cl-load-cache-default=4"; - EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(false), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(true), expectedStr, strlen(expectedStr))); } HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreAndForceAllResourcesUncachedWhenGetL1CachePolicyThenReturnCorrectValue, IsAtLeastXeHpgCore) { @@ -44,21 +47,26 @@ HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreAndForceAllResourcesUncachedWhe DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(4); const char *expectedStr = "-cl-store-cache-default=1 -cl-load-cache-default=1"; - EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(false), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(true), expectedStr, strlen(expectedStr))); } HWTEST2_F(HwInfoConfigTest, givenL1CachePolicyHelperWhenDebugFlagSetAndGetL1CachePolicyThenReturnCorrectValue, MatchAny) { DebugManagerStateRestore restorer; DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(0); - EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(), 0u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(false), 0u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(true), 0u); DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2); - EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(), 2u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(false), 2u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(true), 2u); DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(3); - EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(), 3u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(false), 3u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(true), 3u); DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(4); - EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(), 4u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(false), 4u); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(true), 4u); } diff --git a/shared/test/unit_test/helpers/state_base_address_tests.cpp b/shared/test/unit_test/helpers/state_base_address_tests.cpp index 8a1a02911c..cd008056c2 100644 --- a/shared/test/unit_test/helpers/state_base_address_tests.cpp +++ b/shared/test/unit_test/helpers/state_base_address_tests.cpp @@ -42,7 +42,8 @@ HWTEST2_F(SbaTest, WhenAppendStateBaseAddressParametersIsCalledThenSBACmdHasBind false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::appendStateBaseAddressParameters(args, true); @@ -84,7 +85,8 @@ HWTEST2_F(SbaTest, WhenProgramStateBaseAddressParametersIsCalledThenSBACmdHasBin false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -126,7 +128,8 @@ HWTEST2_F(SbaTest, false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - true // overrideSurfaceStateBaseAddress + true, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -168,7 +171,8 @@ HWTEST2_F(SbaForBindlessTests, givenGlobalBindlessBaseAddressWhenProgramStateBas false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -223,7 +227,8 @@ HWTEST2_F(SbaForBindlessTests, false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - true // overrideSurfaceStateBaseAddress + true, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -279,7 +284,8 @@ HWTEST2_F(SbaForBindlessTests, givenGlobalBindlessBaseAddressWhenPassingIndirect false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -316,7 +322,8 @@ HWTEST2_F(SbaTest, givenSbaWhenOverrideBindlessSurfaceBaseIsFalseThenBindlessSur false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::appendStateBaseAddressParameters(args, false); @@ -355,7 +362,8 @@ HWTEST2_F(SbaTest, givenGlobalBindlessBaseAddressWhenSshIsPassedThenBindlessSurf false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -393,7 +401,8 @@ HWTEST2_F(SbaTest, givenSurfaceStateHeapWhenNotUsingGlobalHeapBaseThenBindlessSu false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -407,41 +416,110 @@ HWTEST2_F(SbaTest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSetti auto expectedStateBaseAddress = FamilyType::cmdInitStateBaseAddress; DebugManagerStateRestore restore; - StateBaseAddressHelper::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo); + StateBaseAddressHelperArgs args = { + 0, // generalStateBase + 0, // indirectObjectHeapBaseAddress + 0, // instructionHeapBaseAddress + 0, // globalHeapsBaseAddress + 0, // surfaceStateBaseAddress + &stateBaseAddress, // stateBaseAddressCmd + nullptr, // dsh + nullptr, // ioh + &ssh, // ssh + pDevice->getGmmHelper(), // gmmHelper + 0, // statelessMocsIndex + MemoryCompressionState::NotApplicable, // memoryCompressionState + false, // setInstructionStateBaseAddress + false, // setGeneralStateBaseAddress + false, // useGlobalHeapsBaseAddress + false, // isMultiOsContextCapable + false, // useGlobalAtomics + false, // areMultipleSubDevicesInContext + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive + }; + + StateBaseAddressHelper::appendExtraCacheSettings(args); EXPECT_EQ(0, memcmp(&stateBaseAddress, &expectedStateBaseAddress, sizeof(STATE_BASE_ADDRESS))); DebugManager.flags.ForceStatelessL1CachingPolicy.set(2); - StateBaseAddressHelper::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo); + StateBaseAddressHelper::appendExtraCacheSettings(args); EXPECT_EQ(0, memcmp(&stateBaseAddress, &expectedStateBaseAddress, sizeof(STATE_BASE_ADDRESS))); DebugManager.flags.ForceAllResourcesUncached.set(true); - StateBaseAddressHelper::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo); + StateBaseAddressHelper::appendExtraCacheSettings(args); EXPECT_EQ(0, memcmp(&stateBaseAddress, &expectedStateBaseAddress, sizeof(STATE_BASE_ADDRESS))); } HWTEST2_F(SbaTest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSettingsThenProgramCorrectL1CachePolicy, IsAtLeastXeHpgCore) { using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS; auto stateBaseAddress = FamilyType::cmdInitStateBaseAddress; - DebugManagerStateRestore restore; - StateBaseAddressHelper::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, stateBaseAddress.getL1CachePolicyL1CacheControl()); + StateBaseAddressHelperArgs args = { + 0, // generalStateBase + 0, // indirectObjectHeapBaseAddress + 0, // instructionHeapBaseAddress + 0, // globalHeapsBaseAddress + 0, // surfaceStateBaseAddress + &stateBaseAddress, // stateBaseAddressCmd + nullptr, // dsh + nullptr, // ioh + &ssh, // ssh + pDevice->getGmmHelper(), // gmmHelper + 0, // statelessMocsIndex + MemoryCompressionState::NotApplicable, // memoryCompressionState + false, // setInstructionStateBaseAddress + false, // setGeneralStateBaseAddress + false, // useGlobalHeapsBaseAddress + false, // isMultiOsContextCapable + false, // useGlobalAtomics + false, // areMultipleSubDevicesInContext + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive + }; + { + DebugManagerStateRestore restore; + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, stateBaseAddress.getL1CachePolicyL1CacheControl()); - DebugManager.flags.ForceStatelessL1CachingPolicy.set(2); - StateBaseAddressHelper::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, stateBaseAddress.getL1CachePolicyL1CacheControl()); + DebugManager.flags.ForceStatelessL1CachingPolicy.set(2); + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, stateBaseAddress.getL1CachePolicyL1CacheControl()); - DebugManager.flags.ForceStatelessL1CachingPolicy.set(3); - StateBaseAddressHelper::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, stateBaseAddress.getL1CachePolicyL1CacheControl()); + DebugManager.flags.ForceStatelessL1CachingPolicy.set(3); + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, stateBaseAddress.getL1CachePolicyL1CacheControl()); - DebugManager.flags.ForceStatelessL1CachingPolicy.set(4); - StateBaseAddressHelper::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, stateBaseAddress.getL1CachePolicyL1CacheControl()); + DebugManager.flags.ForceStatelessL1CachingPolicy.set(4); + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, stateBaseAddress.getL1CachePolicyL1CacheControl()); - DebugManager.flags.ForceAllResourcesUncached.set(true); - StateBaseAddressHelper::appendExtraCacheSettings(&stateBaseAddress, &hardwareInfo); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, stateBaseAddress.getL1CachePolicyL1CacheControl()); + DebugManager.flags.ForceAllResourcesUncached.set(true); + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, stateBaseAddress.getL1CachePolicyL1CacheControl()); + } + args.isDebuggerActive = true; + { + DebugManagerStateRestore restore; + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, stateBaseAddress.getL1CachePolicyL1CacheControl()); + + DebugManager.flags.ForceStatelessL1CachingPolicy.set(2); + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, stateBaseAddress.getL1CachePolicyL1CacheControl()); + + DebugManager.flags.ForceStatelessL1CachingPolicy.set(3); + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, stateBaseAddress.getL1CachePolicyL1CacheControl()); + + DebugManager.flags.ForceStatelessL1CachingPolicy.set(4); + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, stateBaseAddress.getL1CachePolicyL1CacheControl()); + + DebugManager.flags.ForceAllResourcesUncached.set(true); + StateBaseAddressHelper::appendExtraCacheSettings(args); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, stateBaseAddress.getL1CachePolicyL1CacheControl()); + } } HWTEST2_F(SbaTest, givenDebugFlagSetWhenAppendingSbaThenProgramCorrectL1CachePolicy, IsAtLeastXeHpgCore) { @@ -475,7 +553,8 @@ HWTEST2_F(SbaTest, givenDebugFlagSetWhenAppendingSbaThenProgramCorrectL1CachePol false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; for (const auto &input : testInputs) { @@ -555,7 +634,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, SbaTest, whenGeneralStateBaseAddressIsProgrammedThen false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -586,7 +666,8 @@ HWTEST_F(SbaTest, givenNonZeroGeneralStateBaseAddressWhenProgrammingIsDisabledTh false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -619,7 +700,8 @@ HWTEST_F(SbaTest, givenNonZeroInternalHeapBaseAddressWhenProgrammingIsDisabledTh false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -658,7 +740,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, SbaTest, givenSbaProgrammingWhenHeapsAreNotProvidedT false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); @@ -717,7 +800,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, SbaTest, false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::programStateBaseAddress(args); diff --git a/shared/test/unit_test/helpers/test_hw_info_config.cpp b/shared/test/unit_test/helpers/test_hw_info_config.cpp index 6381b893fd..25eab5d0cd 100644 --- a/shared/test/unit_test/helpers/test_hw_info_config.cpp +++ b/shared/test/unit_test/helpers/test_hw_info_config.cpp @@ -104,13 +104,15 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsAdjustWalkOrderAvailableCallTh HWTEST2_F(HwInfoConfigTest, givenAtMostXeHPWhenGetCachingPolicyOptionsThenReturnNullptr, IsAtMostXeHpCore) { auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - EXPECT_EQ(compilerHwInfoConfig->getCachingPolicyOptions(), nullptr); + EXPECT_EQ(compilerHwInfoConfig->getCachingPolicyOptions(false), nullptr); + EXPECT_EQ(compilerHwInfoConfig->getCachingPolicyOptions(true), nullptr); } HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetCachingPolicyOptionsThenReturnWriteByPassPolicyOption, IsAtLeastXeHpgCore) { auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); const char *expectedStr = "-cl-store-cache-default=2 -cl-load-cache-default=4"; - EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(false), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(true), expectedStr, strlen(expectedStr))); } HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetCachingPolicyOptionsThenReturnWriteBackPolicyOption, IsAtLeastXeHpgCore) { @@ -119,7 +121,8 @@ HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetCachingPolicyOptionsThen auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); const char *expectedStr = "-cl-store-cache-default=7 -cl-load-cache-default=4"; - EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(false), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(true), expectedStr, strlen(expectedStr))); } HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreAndDebugFlagSetForceAllResourcesUncachedWhenGetCachingPolicyOptionsThenReturnUncachedPolicyOption, IsAtLeastXeHpgCore) { @@ -129,7 +132,8 @@ HWTEST2_F(HwInfoConfigTest, givenAtLeastXeHpgCoreAndDebugFlagSetForceAllResource auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); const char *expectedStr = "-cl-store-cache-default=1 -cl-load-cache-default=1"; - EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(false), expectedStr, strlen(expectedStr))); + EXPECT_EQ(0, memcmp(compilerHwInfoConfig->getCachingPolicyOptions(true), expectedStr, strlen(expectedStr))); } HWTEST2_F(HwInfoConfigTest, givenCachePolicyWithoutCorrespondingBuildOptionWhenGetCachingPolicyOptionsThenReturnNullptr, IsAtLeastXeHpgCore) { @@ -137,7 +141,8 @@ HWTEST2_F(HwInfoConfigTest, givenCachePolicyWithoutCorrespondingBuildOptionWhenG DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(5); auto compilerHwInfoConfig = CompilerHwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - EXPECT_EQ(nullptr, compilerHwInfoConfig->getCachingPolicyOptions()); + EXPECT_EQ(nullptr, compilerHwInfoConfig->getCachingPolicyOptions(false)); + EXPECT_EQ(nullptr, compilerHwInfoConfig->getCachingPolicyOptions(true)); } HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigAndDebugFlagWhenGetL1CachePolicyThenReturnCorrectPolicy, IsAtLeastXeHpgCore) { @@ -146,33 +151,40 @@ HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigAndDebugFlagWhenGetL1CachePolicyThe auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily); DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(0); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, hwInfoConfig->getL1CachePolicy()); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, hwInfoConfig->getL1CachePolicy(false)); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, hwInfoConfig->getL1CachePolicy(true)); DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(2); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, hwInfoConfig->getL1CachePolicy()); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, hwInfoConfig->getL1CachePolicy(false)); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, hwInfoConfig->getL1CachePolicy(true)); DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(3); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, hwInfoConfig->getL1CachePolicy()); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, hwInfoConfig->getL1CachePolicy(false)); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WT, hwInfoConfig->getL1CachePolicy(true)); DebugManager.flags.OverrideL1CachePolicyInSurfaceStateAndStateless.set(4); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, hwInfoConfig->getL1CachePolicy()); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, hwInfoConfig->getL1CachePolicy(false)); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WS, hwInfoConfig->getL1CachePolicy(true)); DebugManager.flags.ForceAllResourcesUncached.set(true); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, hwInfoConfig->getL1CachePolicy()); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, hwInfoConfig->getL1CachePolicy(false)); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_UC, hwInfoConfig->getL1CachePolicy(true)); } HWTEST2_F(HwInfoConfigTest, givenHwInfoConfigWhenGetL1CachePolicyThenReturnWriteByPass, IsAtLeastXeHpgCore) { auto hwInfo = *defaultHwInfo; auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily); - EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, hwInfoConfig->getL1CachePolicy()); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, hwInfoConfig->getL1CachePolicy(false)); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, hwInfoConfig->getL1CachePolicy(true)); } HWTEST2_F(HwInfoConfigTest, givenPlatformWithUnsupportedL1CachePoliciesWhenGetL1CachePolicyThenReturnZero, IsAtMostXeHpCore) { auto hwInfo = *defaultHwInfo; auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily); - EXPECT_EQ(0u, hwInfoConfig->getL1CachePolicy()); + EXPECT_EQ(0u, hwInfoConfig->getL1CachePolicy(false)); + EXPECT_EQ(0u, hwInfoConfig->getL1CachePolicy(true)); } HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsPrefetcherDisablingInDirectSubmissionRequiredThenTrueIsReturned) { diff --git a/shared/test/unit_test/xe_hpg_core/dg2/cache_policy_tests_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/cache_policy_tests_dg2.cpp index 54db4d99ed..c1610cdd44 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/cache_policy_tests_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/cache_policy_tests_dg2.cpp @@ -15,12 +15,16 @@ using namespace NEO; -DG2TEST_F(HwInfoConfigTest, givenDG2WhenGetL1CachePolicyThenReturnWbpPolicy) { +DG2TEST_F(HwInfoConfigTest, givenDG2WhenGetL1CachePolicyThenReturnWbPolicyUnlessDebuggerIsActive) { using GfxFamily = typename HwMapper::GfxFamily; - EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(), GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(false), GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB); + EXPECT_EQ(L1CachePolicyHelper::getL1CachePolicy(true), GfxFamily::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP); } DG2TEST_F(HwInfoConfigTest, givenDG2WhenGetCachingPolicyOptionsThenReturnCorrectValue) { - const char *expectedStr = "-cl-store-cache-default=2 -cl-load-cache-default=4"; - EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(), expectedStr, strlen(expectedStr))); + const char *writeBackPolicyOptions = "-cl-store-cache-default=7 -cl-load-cache-default=4"; + EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(false), writeBackPolicyOptions, strlen(writeBackPolicyOptions))); + + const char *writeByPassPolicyOptions = "-cl-store-cache-default=2 -cl-load-cache-default=4"; + EXPECT_EQ(0, memcmp(L1CachePolicyHelper::getCachingPolicyOptions(true), writeByPassPolicyOptions, strlen(writeByPassPolicyOptions))); } \ No newline at end of file diff --git a/shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp index 9f6b8317cb..921f29010b 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp @@ -18,8 +18,13 @@ HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfTile64With3 HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, WhenAllowRenderCompressionIsCalledThenTrueIsReturned, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, whenConvertingTimestampsToCsDomainThenNothingIsChanged, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfStorageInfoAdjustmentIsRequiredThenFalseIsReturned, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetCachingPolicyOptionsThenReturnWriteByPassPolicyOption_IsAtLeastXeHpgCore, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenGetL1CachePolicyThenReturnWriteByPass_IsAtLeastXeHpgCore, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenAtLeastXeHpgCoreWhenGetL1CachePolicyThenReturnCorrectValue_IsAtLeastXeHpgCore, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(AILTests, whenModifyKernelIfRequiredIsCalledThenDontChangeKernelSources, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesTest, givenSlmTotalSizeEqualZeroWhenDispatchingKernelThenSharedMemorySizeIsSetCorrectly, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateInternalAllocationInDevicePoolThen32BitAllocationIsCreated, IGFX_DG2); HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenLinearStreamIsAllocatedInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_DG2); -HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateKernelIsaInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_DG2); \ No newline at end of file +HWTEST_EXCLUDE_PRODUCT(MemoryManagerTests, givenEnabledLocalMemoryWhenAllocateKernelIsaInDevicePoolThenLocalMemoryPoolIsUsed, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(SbaTest, givenStateBaseAddressAndDebugFlagSetWhenAppendExtraCacheSettingsThenProgramCorrectL1CachePolicy_IsAtLeastXeHpgCore, IGFX_DG2); +HWTEST_EXCLUDE_PRODUCT(XeHpgSbaTest, givenSpecificProductFamilyWhenAppendingSbaThenProgramWBPL1CachePolicy, IGFX_DG2); diff --git a/shared/test/unit_test/xe_hpg_core/dg2/test_encode_dg2.cpp b/shared/test/unit_test/xe_hpg_core/dg2/test_encode_dg2.cpp index 6908bcede3..5abdf8d8d2 100644 --- a/shared/test/unit_test/xe_hpg_core/dg2/test_encode_dg2.cpp +++ b/shared/test/unit_test/xe_hpg_core/dg2/test_encode_dg2.cpp @@ -53,7 +53,7 @@ DG2TEST_F(CommandEncodeDG2Test, whenProgrammingStateComputeModeThenProperFieldsA using Dg2SbaTest = SbaTest; -DG2TEST_F(Dg2SbaTest, givenSpecificProductFamilyWhenAppendingSbaThenProgramWtL1CachePolicy) { +DG2TEST_F(Dg2SbaTest, givenSpecificProductFamilyWhenAppendingSbaThenProgramWBL1CachePolicyUnlessDebuggerIsActive) { auto sbaCmd = FamilyType::cmdInitStateBaseAddress; StateBaseAddressHelperArgs args = { 0, // generalStateBase @@ -74,10 +74,14 @@ DG2TEST_F(Dg2SbaTest, givenSpecificProductFamilyWhenAppendingSbaThenProgramWtL1C false, // isMultiOsContextCapable false, // useGlobalAtomics false, // areMultipleSubDevicesInContext - false // overrideSurfaceStateBaseAddress + false, // overrideSurfaceStateBaseAddress + false // isDebuggerActive }; StateBaseAddressHelper::appendStateBaseAddressParameters(args, true); + EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WB, sbaCmd.getL1CachePolicyL1CacheControl()); + args.isDebuggerActive = true; + StateBaseAddressHelper::appendStateBaseAddressParameters(args, true); EXPECT_EQ(FamilyType::STATE_BASE_ADDRESS::L1_CACHE_POLICY_WBP, sbaCmd.getL1CachePolicyL1CacheControl()); }