From ebdf993a255e11d214f1097226b1f3070e70f1f4 Mon Sep 17 00:00:00 2001 From: Jaroslaw Warchulski Date: Wed, 15 Oct 2025 10:29:20 +0000 Subject: [PATCH] fix: state cache invalidation WA for xe3 Related-To: NEO-16281, NEO-16405 Signed-off-by: Jaroslaw Warchulski --- .../cmdlist/cmdlist_hw_xehp_and_later.inl | 2 +- .../sources/cmdlist/test_cmdlist_4.cpp | 4 ++ .../sources/cmdlist/test_cmdlist_5.cpp | 8 ++- .../test_cmdlist_append_launch_kernel_1.cpp | 47 ++++++++++++++++++ .../cmdlist/test_in_order_cmdlist_1.cpp | 49 +++++++++++++------ .../cmdlist/test_in_order_cmdlist_2.cpp | 4 ++ .../hardware_interface_xehp_and_later.inl | 6 +++ .../command_queue/dispatch_walker_tests.cpp | 11 +++++ .../enqueue_kernel_two_ioq_tests.cpp | 10 ++-- .../enqueue_kernel_two_walker_ioq_tests.cpp | 34 ++++++++++++- .../enqueue_kernel_two_walker_ooq_tests.cpp | 12 +++-- ...and_stream_receiver_flush_task_1_tests.cpp | 24 +++++---- ...and_stream_receiver_flush_task_2_tests.cpp | 14 +++++- .../helpers/timestamp_packet_1_tests.cpp | 4 +- shared/source/release_helper/release_helper.h | 2 + .../release_helper/release_helper_base.inl | 5 ++ .../release_helper_common_xe3_lpg.inl | 7 ++- .../test/common/mocks/mock_release_helper.h | 1 + .../release_helper_12_55_tests.cpp | 6 ++- .../release_helper_12_56_tests.cpp | 6 ++- .../release_helper_12_57_tests.cpp | 6 ++- .../release_helper_12_60_tests.cpp | 6 ++- .../release_helper_12_61_tests.cpp | 6 ++- .../release_helper_12_70_tests.cpp | 6 ++- .../release_helper_12_71_tests.cpp | 6 ++- .../release_helper_12_74_tests.cpp | 6 ++- .../release_helper_20_01_tests.cpp | 6 ++- .../release_helper_20_02_tests.cpp | 6 ++- .../release_helper_20_04_tests.cpp | 6 ++- .../release_helper_30_00_tests.cpp | 6 ++- .../release_helper_30_01_tests.cpp | 6 ++- .../release_helper_30_03_tests.cpp | 6 ++- .../release_helper_tests_base.cpp | 20 +++++++- .../release_helper_tests_base.h | 2 + 34 files changed, 296 insertions(+), 54 deletions(-) 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 fab1601bb9..3ac7012aaa 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 @@ -573,7 +573,7 @@ ze_result_t CommandListCoreFamily::appendLaunchKernelWithParams(K kernelWithAssertAppended = true; } - if (kernelImp->usesRayTracing()) { + if (neoDevice->getReleaseHelper()->isStateCacheInvalidationWaRequired() || kernelImp->usesRayTracing()) { NEO::PipeControlArgs args{}; args.stateCacheInvalidationEnable = true; NEO::MemorySynchronizationCommands::addSingleBarrier(*commandContainer.getCommandStream(), args); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp index 50c5fa7351..3b2542ef3f 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp @@ -14,6 +14,7 @@ #include "shared/source/helpers/definitions/command_encoder_args.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/indirect_heap/indirect_heap.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/mocks/mock_command_encoder.h" @@ -889,6 +890,9 @@ HWTEST_F(HostPointerManagerCommandListTest, givenCommandListWhenMemoryFillWithSi if (!l3FlushAfterPostSupported && NEO::MemorySynchronizationCommands::getDcFlushEnable(true, device->getNEODevice()->getRootDeviceEnvironment())) { EXPECT_NE(nullptr, pc); EXPECT_TRUE(pc->getDcFlushEnable()); + } else if (device->getNEODevice()->getReleaseHelper()->isStateCacheInvalidationWaRequired()) { + EXPECT_NE(nullptr, pc); + EXPECT_TRUE(pc->getStateCacheInvalidationEnable()); } else { EXPECT_EQ(nullptr, pc); } diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp index 489c585c62..0998693753 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/state_base_address_helper.h" #include "shared/source/indirect_heap/indirect_heap.h" #include "shared/source/kernel/implicit_args_helper.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" @@ -3428,7 +3429,12 @@ HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest, NEO::EncodeMemoryPrefetch::getSizeForMemoryPrefetch(kernel->getImmutableData()->getIsaSize(), device->getNEODevice()->getRootDeviceEnvironment()); } - EXPECT_EQ(usedBefore + prefetchSize, cmdListStream.getUsed()); + size_t barrierSize = 0; + if (neoDevice->getReleaseHelper()->isStateCacheInvalidationWaRequired()) { + barrierSize += MemorySynchronizationCommands::getSizeForSingleBarrier(); + } + + EXPECT_EQ(usedBefore + prefetchSize + barrierSize, cmdListStream.getUsed()); } } // namespace ult diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp index 723cf8c050..fe0971f5a0 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp @@ -1780,5 +1780,52 @@ HWTEST2_F(CommandListAppendLaunchKernelMockModule, EXPECT_NE(eventAllocationIt, cmdlistResidency.end()); } +HWTEST2_F(CommandListAppendLaunchKernelMockModule, + givenStateCacheInvalidationWaIsRequiredWhenTwoKernelsAreAppendedThenPipeControlWithStateCacheInvalidationIsInsertedBetweenWalkers, IsAtLeastXeCore) { + using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; + using COMPUTE_WALKER = typename FamilyType::DefaultWalkerType; + + ze_group_count_t groupCount{1, 1, 1}; + ze_result_t returnValue; + CmdListKernelLaunchParams launchParams = {}; + + auto usedSpaceBefore = commandList->getCmdContainer().getCommandStream()->getUsed(); + + returnValue = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams); + ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); + + returnValue = commandList->appendLaunchKernel(kernel->toHandle(), groupCount, nullptr, 0, nullptr, launchParams); + ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue); + + auto usedSpaceAfter = commandList->getCmdContainer().getCommandStream()->getUsed(); + EXPECT_GT(usedSpaceAfter, usedSpaceBefore); + + GenCmdList cmdList; + ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer( + cmdList, + ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), usedSpaceBefore), + usedSpaceAfter - usedSpaceBefore)); + + auto walkers = findAll(cmdList.begin(), cmdList.end()); + ASSERT_EQ(2u, walkers.size()); + + auto itorPC = findAll(walkers[0], walkers[1]); + + bool foundStateCacheInvalidation = false; + for (auto it : itorPC) { + auto pcCmd = genCmdCast(*it); + if (pcCmd->getStateCacheInvalidationEnable()) { + foundStateCacheInvalidation = true; + break; + } + } + + if (device->getNEODevice()->getReleaseHelper()->isStateCacheInvalidationWaRequired()) { + EXPECT_TRUE(foundStateCacheInvalidation); + } else { + EXPECT_FALSE(foundStateCacheInvalidation); + } +} + } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp index 7405105165..e44f6521bd 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_1.cpp @@ -4264,16 +4264,25 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenInOrderModeWhenProgrammin ASSERT_NE(cmdList.end(), walkerItor); - auto pcItor = find(walkerItor, cmdList.end()); - ASSERT_NE(cmdList.end(), pcItor); + auto pcItors = findAll(walkerItor, cmdList.end()); + EXPECT_FALSE(pcItors.empty()); - auto pcCmd = genCmdCast(*pcItor); - ASSERT_NE(nullptr, pcCmd); - EXPECT_EQ(immCmdList->getDcFlushRequired(true), pcCmd->getDcFlushEnable()); - EXPECT_TRUE(UnitTestHelper::getPipeControlHdcPipelineFlush(*pcCmd)); - EXPECT_TRUE(pcCmd->getUnTypedDataPortCacheFlush()); + bool foundMatchingPipeControl = false; + for (auto pcItor : pcItors) { + auto pcCmd = genCmdCast(*pcItor); + ASSERT_NE(nullptr, pcCmd); - auto sdiItor = find(pcItor, cmdList.end()); + if (pcCmd->getDcFlushEnable() == immCmdList->getDcFlushRequired(true) && + UnitTestHelper::getPipeControlHdcPipelineFlush(*pcCmd) && + pcCmd->getUnTypedDataPortCacheFlush()) { + foundMatchingPipeControl = true; + break; + } + } + + EXPECT_TRUE(foundMatchingPipeControl); + + auto sdiItor = find(walkerItor, cmdList.end()); ASSERT_NE(cmdList.end(), sdiItor); auto sdiCmd = genCmdCast(*sdiItor); @@ -6609,15 +6618,25 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenInOrderModeWhenProgrammin GenCmdList cmdList; ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, cmdStream->getCpuBase(), cmdStream->getUsed())); - auto cmdItor = find(cmdList.begin(), cmdList.end()); - ASSERT_NE(cmdList.end(), cmdItor); + auto pcItors = findAll(cmdList.begin(), cmdList.end()); + ASSERT_FALSE(pcItors.empty()); + auto cmdItor = pcItors[0]; - auto pcCmd = genCmdCast(*cmdItor); - ASSERT_NE(nullptr, pcCmd); + bool foundMatchingPipeControl = false; + for (auto pcItor : pcItors) { + auto pcCmd = genCmdCast(*pcItor); + ASSERT_NE(nullptr, pcCmd); - EXPECT_EQ(immCmdList->getDcFlushRequired(true), pcCmd->getDcFlushEnable()); - EXPECT_TRUE(UnitTestHelper::getPipeControlHdcPipelineFlush(*pcCmd)); - EXPECT_TRUE(pcCmd->getUnTypedDataPortCacheFlush()); + if (pcCmd->getDcFlushEnable() == immCmdList->getDcFlushRequired(true) && + UnitTestHelper::getPipeControlHdcPipelineFlush(*pcCmd) && + pcCmd->getUnTypedDataPortCacheFlush()) { + foundMatchingPipeControl = true; + cmdItor = pcItor; + break; + } + } + + EXPECT_TRUE(foundMatchingPipeControl); auto sdiCmd = genCmdCast(*(++cmdItor)); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp index 7a077ec708..f5c4dac036 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_in_order_cmdlist_2.cpp @@ -9,6 +9,7 @@ #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/helpers/compiler_product_helper.h" #include "shared/source/memory_manager/internal_allocation_storage.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/test/common/helpers/relaxed_ordering_commands_helper.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" #include "shared/test/common/mocks/mock_direct_submission_hw.h" @@ -4049,6 +4050,9 @@ HWTEST2_F(MultiTileInOrderCmdListTests, givenMultiTileInOrderModeWhenProgramming auto pcItors = findAll(cmdList.begin(), cmdList.end()); ASSERT_NE(pcItors.size(), 0u); auto pcCmd = genCmdCast(*pcItors.back()); + if (device->getNEODevice()->getReleaseHelper()->isStateCacheInvalidationWaRequired()) { + pcCmd = genCmdCast(*pcItors.front()); + } uint64_t address = pcCmd->getAddressHigh(); address <<= 32; diff --git a/opencl/source/command_queue/hardware_interface_xehp_and_later.inl b/opencl/source/command_queue/hardware_interface_xehp_and_later.inl index 3ddafe769b..9255125407 100644 --- a/opencl/source/command_queue/hardware_interface_xehp_and_later.inl +++ b/opencl/source/command_queue/hardware_interface_xehp_and_later.inl @@ -15,6 +15,7 @@ #include "shared/source/helpers/engine_node_helper.h" #include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/os_interface.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/source/utilities/tag_allocator.h" #include "opencl/source/command_queue/hardware_interface_base.inl" @@ -39,6 +40,11 @@ inline void HardwareInterface::dispatchWorkarounds( CommandQueue &commandQueue, Kernel &kernel, const bool &enable) { + if (!enable && commandQueue.getDevice().getReleaseHelper()->isStateCacheInvalidationWaRequired()) { + PipeControlArgs args{}; + args.stateCacheInvalidationEnable = true; + MemorySynchronizationCommands::addSingleBarrier(*commandStream, args); + } } template diff --git a/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp b/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp index 34a1b5470f..c73b6bb932 100644 --- a/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp +++ b/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp @@ -13,6 +13,7 @@ #include "shared/source/helpers/local_work_size.h" #include "shared/source/kernel/implicit_args_helper.h" #include "shared/source/memory_manager/internal_allocation_storage.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/source/utilities/hw_timestamps.h" #include "shared/source/utilities/tag_allocator.h" #include "shared/test/common/cmd_parse/hw_parse.h" @@ -147,6 +148,11 @@ HWTEST_F(DispatchWalkerTest, WhenDispatchingWalkerThenCommandStreamMemoryIsntCha auto sizeDispatchWalkerNeeds = sizeof(typename FamilyType::DefaultWalkerType) + HardwareCommandsHelper::getSizeRequiredCS(); + auto releaseHelper = pClDevice->getDevice().getReleaseHelper(); + if (releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired()) { + sizeDispatchWalkerNeeds += MemorySynchronizationCommands::getSizeForSingleBarrier(); + } + // cs has a minimum required size auto sizeThatNeedsToBeSubstracted = sizeDispatchWalkerNeeds + CSRequirements::minCommandQueueCommandStreamSize; @@ -191,6 +197,11 @@ HWTEST_F(DispatchWalkerTest, GivenNoLocalIdsWhenDispatchingWalkerThenWalkerIsDis auto sizeDispatchWalkerNeeds = sizeof(typename FamilyType::DefaultWalkerType) + HardwareCommandsHelper::getSizeRequiredCS(); + auto releaseHelper = pClDevice->getDevice().getReleaseHelper(); + if (releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired()) { + sizeDispatchWalkerNeeds += MemorySynchronizationCommands::getSizeForSingleBarrier(); + } + // cs has a minimum required size auto sizeThatNeedsToBeSubstracted = sizeDispatchWalkerNeeds + CSRequirements::minCommandQueueCommandStreamSize; diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_two_ioq_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_two_ioq_tests.cpp index ac27ba3604..bb691fb359 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_two_ioq_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_two_ioq_tests.cpp @@ -5,6 +5,8 @@ * */ +#include "shared/source/release_helper/release_helper.h" + #include "opencl/source/command_queue/command_queue.h" #include "opencl/source/event/event.h" #include "opencl/test/unit_test/fixtures/hello_world_fixture.h" @@ -112,15 +114,17 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, TwoIOQsTwoDependentWalkers, GivenTwoCommandQueues EXPECT_EQ(1u, numCommands); } -HWTEST_F(TwoIOQsTwoDependentWalkers, GivenTwoCommandQueuesWhenEnqueuingKernelThenOnePipeControlIsInsertedBetweenWalkers) { +HWTEST_F(TwoIOQsTwoDependentWalkers, GivenTwoCommandQueuesWhenEnqueuingKernelThenAtLeastOnePipeControlIsInsertedBetweenWalkers) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; parseWalkers(); auto itorCmd = find(itorWalker1, itorWalker2); - // Should find a PC. + auto releaseHelper = pClDevice->getDevice().getReleaseHelper(); + const bool isStateCacheInvalidationWaRequired = releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired(); + const bool isUpdateTagFromWaitEnabled = pCmdQ2->getGpgpuCommandStreamReceiver().isUpdateTagFromWaitEnabled(); - if (pCmdQ2->getGpgpuCommandStreamReceiver().isUpdateTagFromWaitEnabled()) { + if (isUpdateTagFromWaitEnabled && !isStateCacheInvalidationWaRequired) { EXPECT_EQ(itorWalker2, itorCmd); } else { EXPECT_NE(itorWalker2, itorCmd); diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_two_walker_ioq_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_two_walker_ioq_tests.cpp index 272d1da603..98cc7417e4 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_two_walker_ioq_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_two_walker_ioq_tests.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/helpers/gfx_core_helper.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" #include "shared/test/common/test_macros/test.h" @@ -35,7 +36,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, IOQWithTwoWalkers, GivenTwoCommandQueuesWhenEnque EXPECT_EQ(1u, numCommands); } -HWTEST_F(IOQWithTwoWalkers, GivenTwoCommandQueuesWhenEnqueuingKernelThenOnePipeControlIsInsertedBetweenWalkers) { +HWTEST_F(IOQWithTwoWalkers, GivenTwoCommandQueuesWhenEnqueuingKernelThenAtLeastOnePipeControlIsInsertedBetweenWalkers) { DebugManagerStateRestore restorer{}; debugManager.flags.EnableL3FlushAfterPostSync.set(0); @@ -47,7 +48,8 @@ HWTEST_F(IOQWithTwoWalkers, GivenTwoCommandQueuesWhenEnqueuingKernelThenOnePipeC typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; - auto waNeeded = MemorySynchronizationCommands::isBarrierWaRequired(pDevice->getRootDeviceEnvironment()); + auto releaseHelper = pClDevice->getDevice().getReleaseHelper(); + auto waNeeded = MemorySynchronizationCommands::isBarrierWaRequired(pDevice->getRootDeviceEnvironment()) || (releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired()); auto itorCmd = find(itorWalker1, itorWalker2); ASSERT_NE(itorWalker2, itorCmd); @@ -69,3 +71,31 @@ HWTEST_F(IOQWithTwoWalkers, GivenTwoCommandQueuesWhenEnqueuingKernelThenOnePipeC EXPECT_EQ(commandStreamReceiver.getTagAllocation()->getGpuAddress(), NEO::UnitTestHelper::getPipeControlPostSyncAddress(*pipeControl)); EXPECT_EQ(commandStreamReceiver.heaplessStateInitialized ? 2u : 1u, pipeControl->getImmediateData()); } + +HWTEST_F(IOQWithTwoWalkers, GivenStateCacheInvalidationWaIsRequiredWhenTwoKernelsAreEnqueuedThenPipeControlWithStateCacheInvalidationIsInsertedBetweenWalkers) { + enqueueTwoKernels(); + + typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; + using COMPUTE_WALKER = typename FamilyType::DefaultWalkerType; + + auto walkers = findAll(cmdList.begin(), cmdList.end()); + ASSERT_EQ(2u, walkers.size()); + + auto itorPC = findAll(walkers[0], walkers[1]); + + bool foundStateCacheInvalidation = false; + for (auto it : itorPC) { + auto pcCmd = genCmdCast(*it); + if (pcCmd->getStateCacheInvalidationEnable()) { + foundStateCacheInvalidation = true; + break; + } + } + + auto releaseHelper = pClDevice->getDevice().getReleaseHelper(); + if (releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired()) { + EXPECT_TRUE(foundStateCacheInvalidation); + } else { + EXPECT_FALSE(foundStateCacheInvalidation); + } +} diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_two_walker_ooq_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_two_walker_ooq_tests.cpp index cab94bef8c..a2f2df8b7a 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_two_walker_ooq_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_two_walker_ooq_tests.cpp @@ -5,6 +5,8 @@ * */ +#include "shared/source/release_helper/release_helper.h" + #include "opencl/test/unit_test/fixtures/hello_world_fixture.h" #include "opencl/test/unit_test/fixtures/two_walker_fixture.h" @@ -35,14 +37,16 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, OOQWithTwoWalkers, GivenTwoCommandQueuesWhenEnque EXPECT_EQ(1u, numCommands); } -HWTEST_F(OOQWithTwoWalkers, GivenTwoCommandQueuesWhenEnqueuingKernelThenOnePipeControlIsInsertedBetweenWalkers) { +HWTEST_F(OOQWithTwoWalkers, GivenTwoCommandQueuesWhenEnqueuingKernelThenAtLeastOnePipeControlIsInsertedBetweenWalkers) { enqueueTwoKernels(); auto itorCmd = find(itorWalker1, itorWalker2); - // Workaround for DRM i915 coherency patch - // EXPECT_EQ(itorWalker2, itorCmd); - if (pCmdQ->getGpgpuCommandStreamReceiver().isUpdateTagFromWaitEnabled()) { + auto releaseHelper = pClDevice->getDevice().getReleaseHelper(); + const bool isStateCacheInvalidationWaRequired = releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired(); + const bool isUpdateTagFromWaitEnabled = pCmdQ->getGpgpuCommandStreamReceiver().isUpdateTagFromWaitEnabled(); + + if (isUpdateTagFromWaitEnabled && !isStateCacheInvalidationWaRequired) { EXPECT_EQ(itorWalker2, itorCmd); } else { EXPECT_NE(itorWalker2, itorCmd); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp index 3a99846384..281d12a20b 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_1_tests.cpp @@ -11,6 +11,7 @@ #include "shared/source/helpers/preamble.h" #include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/product_helper.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/dispatch_flags_helper.h" #include "shared/test/common/helpers/ult_gfx_core_helper.h" @@ -1250,17 +1251,22 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelRequiringDCFlush // Parse command list parseCommands(commandStreamTask, 0); - auto itorPC = find(cmdList.begin(), cmdList.end()); - EXPECT_NE(cmdList.end(), itorPC); - if (UnitTestHelper::isPipeControlWArequired(pDevice->getHardwareInfo())) { - itorPC++; - itorPC = find(itorPC, cmdList.end()); - EXPECT_NE(cmdList.end(), itorPC); + auto pcItors = findAll(cmdList.begin(), cmdList.end()); + EXPECT_FALSE(pcItors.empty()); + + bool foundMatchingPipeControl = false; + for (auto pcItor : pcItors) { + auto pcCmd = genCmdCast(*pcItor); + ASSERT_NE(nullptr, pcCmd); + + // Verify that the dcFlushEnabled bit is set in PC + if (MemorySynchronizationCommands::getDcFlushEnable(true, pDevice->getRootDeviceEnvironment()) == pcCmd->getDcFlushEnable()) { + foundMatchingPipeControl = true; + break; + } } - // Verify that the dcFlushEnabled bit is set in PC - auto pCmdWA = reinterpret_cast(*itorPC); - EXPECT_EQ(MemorySynchronizationCommands::getDcFlushEnable(true, pDevice->getRootDeviceEnvironment()), pCmdWA->getDcFlushEnable()); + EXPECT_TRUE(foundMatchingPipeControl); buffer->release(); } diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp index 2f3555ee31..fe7c010eb1 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp @@ -14,6 +14,7 @@ #include "shared/source/helpers/state_base_address.h" #include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/os_interface/os_context.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/dispatch_flags_helper.h" #include "shared/test/common/helpers/raii_gfx_core_helper.h" @@ -76,7 +77,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelNotRequiringDCFl auto itorPC = find(cmdList.begin(), cmdList.end()); EXPECT_NE(cmdList.end(), itorPC); - if (UnitTestHelper::isPipeControlWArequired(pDevice->getHardwareInfo())) { + + auto releaseHelper = pClDevice->getDevice().getReleaseHelper(); + if (UnitTestHelper::isPipeControlWArequired(pDevice->getHardwareInfo()) || (releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired())) { itorPC++; itorPC = find(itorPC, cmdList.end()); EXPECT_NE(cmdList.end(), itorPC); @@ -89,7 +92,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenBlockedKernelNotRequiringDCFl buffer->release(); } -HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenEnableUpdateTaskFromWaitWhenNonBlockingCallIsMadeThenNoPipeControlInsertedOnDevicesWithoutDCFlushRequirements) { +HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenEnableUpdateTaskFromWaitWhenNonBlockingCallIsMadeThenNoPipeControlInsertedOnDevicesWithoutDCFlushAndStateCacheInvalidationWaRequirements) { DebugManagerStateRestore restorer; debugManager.flags.UpdateTaskCountFromWait.set(3u); typedef typename FamilyType::PIPE_CONTROL PIPE_CONTROL; @@ -112,6 +115,13 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenEnableUpdateTaskFromWaitWhenN parseCommands(commandStreamTask, 0); auto itorPC = find(cmdList.begin(), cmdList.end()); + + auto releaseHelper = pClDevice->getDevice().getReleaseHelper(); + if (releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired()) { + EXPECT_NE(cmdList.end(), itorPC); + itorPC++; + itorPC = find(itorPC, cmdList.end()); + } EXPECT_EQ(cmdList.end(), itorPC); buffer->release(); diff --git a/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp b/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp index 8e466134bb..4345ec2201 100644 --- a/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp +++ b/opencl/test/unit_test/helpers/timestamp_packet_1_tests.cpp @@ -7,6 +7,7 @@ #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/timestamp_packet.h" +#include "shared/source/release_helper/release_helper.h" #include "shared/source/utilities/tag_allocator.h" #include "shared/source/utilities/wait_util.h" #include "shared/test/common/cmd_parse/hw_parse.h" @@ -434,7 +435,8 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe auto walker = genCmdCast(*it); ASSERT_NE(nullptr, walker); - if (MemorySynchronizationCommands::isBarrierWaRequired(device->getRootDeviceEnvironment())) { + auto releaseHelper = device->getDevice().getReleaseHelper(); + if (MemorySynchronizationCommands::isBarrierWaRequired(device->getRootDeviceEnvironment()) || (releaseHelper && releaseHelper->isStateCacheInvalidationWaRequired())) { auto pipeControl = genCmdCast(*++it); EXPECT_NE(nullptr, pipeControl); } diff --git a/shared/source/release_helper/release_helper.h b/shared/source/release_helper/release_helper.h index a5d112213c..55e1297af2 100644 --- a/shared/source/release_helper/release_helper.h +++ b/shared/source/release_helper/release_helper.h @@ -70,6 +70,7 @@ class ReleaseHelper { virtual bool shouldQueryPeerAccess() const = 0; virtual bool isSpirSupported() const = 0; virtual bool isSingleDispatchRequiredForMultiCCS() const = 0; + virtual bool isStateCacheInvalidationWaRequired() const = 0; protected: ReleaseHelper(HardwareIpVersion hardwareIpVersion) : hardwareIpVersion(hardwareIpVersion) {} @@ -119,6 +120,7 @@ class ReleaseHelperHw : public ReleaseHelper { bool shouldQueryPeerAccess() const override; bool isSpirSupported() const override; bool isSingleDispatchRequiredForMultiCCS() const override; + bool isStateCacheInvalidationWaRequired() const override; protected: ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {} diff --git a/shared/source/release_helper/release_helper_base.inl b/shared/source/release_helper/release_helper_base.inl index bf2850e763..4742384112 100644 --- a/shared/source/release_helper/release_helper_base.inl +++ b/shared/source/release_helper/release_helper_base.inl @@ -196,4 +196,9 @@ bool ReleaseHelperHw::isSingleDispatchRequiredForMultiCCS() const { return false; } +template +bool ReleaseHelperHw::isStateCacheInvalidationWaRequired() const { + return false; +} + } // namespace NEO diff --git a/shared/source/release_helper/release_helper_common_xe3_lpg.inl b/shared/source/release_helper/release_helper_common_xe3_lpg.inl index a4449f923d..a4c8f7fa5b 100644 --- a/shared/source/release_helper/release_helper_common_xe3_lpg.inl +++ b/shared/source/release_helper/release_helper_common_xe3_lpg.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -33,4 +33,9 @@ const SizeToPreferredSlmValueArray &ReleaseHelperHw::getSizeToPreferred return sizeToPreferredSlmValue; } +template <> +bool ReleaseHelperHw::isStateCacheInvalidationWaRequired() const { + return true; +} + } // namespace NEO diff --git a/shared/test/common/mocks/mock_release_helper.h b/shared/test/common/mocks/mock_release_helper.h index e497e62745..fd6fb2f543 100644 --- a/shared/test/common/mocks/mock_release_helper.h +++ b/shared/test/common/mocks/mock_release_helper.h @@ -48,6 +48,7 @@ class MockReleaseHelper : public ReleaseHelper { ADDMETHOD_CONST_NOBASE(shouldQueryPeerAccess, bool, false, ()); ADDMETHOD_CONST_NOBASE(isSpirSupported, bool, true, ()); ADDMETHOD_CONST_NOBASE(isSingleDispatchRequiredForMultiCCS, bool, false, ()); + ADDMETHOD_CONST_NOBASE(isStateCacheInvalidationWaRequired, bool, false, ()); const SizeToPreferredSlmValueArray &getSizeToPreferredSlmValue(bool isHeapless) const override { static SizeToPreferredSlmValueArray sizeToPreferredSlmValue = {}; diff --git a/shared/test/unit_test/release_helper/release_helper_12_55_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_55_tests.cpp index 6b05426188..53ef50fc3d 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_55_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_55_tests.cpp @@ -128,4 +128,8 @@ TEST_F(ReleaseHelper1255Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper1255Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1255Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_56_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_56_tests.cpp index fbece1a7e7..fe16bb5b08 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_56_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_56_tests.cpp @@ -128,4 +128,8 @@ TEST_F(ReleaseHelper1256Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper1256Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1256Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_57_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_57_tests.cpp index 7d674feeed..578995fa24 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_57_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_57_tests.cpp @@ -128,4 +128,8 @@ TEST_F(ReleaseHelper1257Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper1257Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1257Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_60_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_60_tests.cpp index 379856dcfb..b04870cb26 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_60_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_60_tests.cpp @@ -113,4 +113,8 @@ TEST_F(ReleaseHelper1260Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper1260Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1260Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_61_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_61_tests.cpp index 430cf35cb1..e6f54c4110 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_61_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_61_tests.cpp @@ -112,4 +112,8 @@ TEST_F(ReleaseHelper1261Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper1261Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1261Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_70_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_70_tests.cpp index 52cabd236c..05483c470f 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_70_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_70_tests.cpp @@ -122,4 +122,8 @@ TEST_F(ReleaseHelper1270Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper1270Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1270Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_71_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_71_tests.cpp index a391052ae3..de952c3541 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_71_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_71_tests.cpp @@ -122,4 +122,8 @@ TEST_F(ReleaseHelper1271Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper1271Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1271Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_12_74_tests.cpp b/shared/test/unit_test/release_helper/release_helper_12_74_tests.cpp index 8698b91b56..68cc7e90cb 100644 --- a/shared/test/unit_test/release_helper/release_helper_12_74_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_12_74_tests.cpp @@ -128,4 +128,8 @@ TEST_F(ReleaseHelper1274Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper1274Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper1274Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_20_01_tests.cpp b/shared/test/unit_test/release_helper/release_helper_20_01_tests.cpp index ccd83a6a22..f3dd2ec4b0 100644 --- a/shared/test/unit_test/release_helper/release_helper_20_01_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_20_01_tests.cpp @@ -121,4 +121,8 @@ TEST_F(ReleaseHelper2001Tests, whenShouldQueryPeerAccessCalledThenTrueReturned) TEST_F(ReleaseHelper2001Tests, whenIsSingleDispatchRequiredForMultiCCSThenTrueReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenTrueReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper2001Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_20_02_tests.cpp b/shared/test/unit_test/release_helper/release_helper_20_02_tests.cpp index fc55ab0d23..75fb23816d 100644 --- a/shared/test/unit_test/release_helper/release_helper_20_02_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_20_02_tests.cpp @@ -121,4 +121,8 @@ TEST_F(ReleaseHelper2002Tests, whenShouldQueryPeerAccessCalledThenTrueReturned) TEST_F(ReleaseHelper2002Tests, whenIsSingleDispatchRequiredForMultiCCSThenTrueReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenTrueReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper2002Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_20_04_tests.cpp b/shared/test/unit_test/release_helper/release_helper_20_04_tests.cpp index a1afa4d636..ab99f8d241 100644 --- a/shared/test/unit_test/release_helper/release_helper_20_04_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_20_04_tests.cpp @@ -124,4 +124,8 @@ TEST_F(ReleaseHelper2004Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper2004Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper2004Tests, whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_30_00_tests.cpp b/shared/test/unit_test/release_helper/release_helper_30_00_tests.cpp index bc071c58d9..d357416c13 100644 --- a/shared/test/unit_test/release_helper/release_helper_30_00_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_30_00_tests.cpp @@ -122,4 +122,8 @@ TEST_F(ReleaseHelper3000Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper3000Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper3000Tests, whenIsStateCacheInvalidationWaRequiredCalledThenTrueReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenTrueReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_30_01_tests.cpp b/shared/test/unit_test/release_helper/release_helper_30_01_tests.cpp index 5773fca391..383e9b6b4b 100644 --- a/shared/test/unit_test/release_helper/release_helper_30_01_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_30_01_tests.cpp @@ -122,4 +122,8 @@ TEST_F(ReleaseHelper3001Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper3001Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper3001Tests, whenIsStateCacheInvalidationWaRequiredCalledThenTrueReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenTrueReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_30_03_tests.cpp b/shared/test/unit_test/release_helper/release_helper_30_03_tests.cpp index bd6092a3df..5d24183509 100644 --- a/shared/test/unit_test/release_helper/release_helper_30_03_tests.cpp +++ b/shared/test/unit_test/release_helper/release_helper_30_03_tests.cpp @@ -122,4 +122,8 @@ TEST_F(ReleaseHelper3003Tests, whenShouldQueryPeerAccessCalledThenFalseReturned) TEST_F(ReleaseHelper3003Tests, whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned) { whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); -} \ No newline at end of file +} + +TEST_F(ReleaseHelper3003Tests, whenIsStateCacheInvalidationWaRequiredCalledThenTrueReturned) { + whenIsStateCacheInvalidationWaRequiredCalledThenTrueReturned(); +} diff --git a/shared/test/unit_test/release_helper/release_helper_tests_base.cpp b/shared/test/unit_test/release_helper/release_helper_tests_base.cpp index 4b2bd8df8a..6d5936de33 100644 --- a/shared/test/unit_test/release_helper/release_helper_tests_base.cpp +++ b/shared/test/unit_test/release_helper/release_helper_tests_base.cpp @@ -231,4 +231,22 @@ void ReleaseHelperTestsBase::whenIsSingleDispatchRequiredForMultiCCSCalledThenTr ASSERT_NE(nullptr, releaseHelper); EXPECT_TRUE(releaseHelper->isSingleDispatchRequiredForMultiCCS()); } -} \ No newline at end of file +} + +void ReleaseHelperTestsBase::whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned() { + for (auto &revision : getRevisions()) { + ipVersion.revision = revision; + releaseHelper = ReleaseHelper::create(ipVersion); + ASSERT_NE(nullptr, releaseHelper); + EXPECT_FALSE(releaseHelper->isStateCacheInvalidationWaRequired()); + } +} + +void ReleaseHelperTestsBase::whenIsStateCacheInvalidationWaRequiredCalledThenTrueReturned() { + for (auto &revision : getRevisions()) { + ipVersion.revision = revision; + releaseHelper = ReleaseHelper::create(ipVersion); + ASSERT_NE(nullptr, releaseHelper); + EXPECT_TRUE(releaseHelper->isStateCacheInvalidationWaRequired()); + } +} diff --git a/shared/test/unit_test/release_helper/release_helper_tests_base.h b/shared/test/unit_test/release_helper/release_helper_tests_base.h index 6489586c90..2eaa7701b0 100644 --- a/shared/test/unit_test/release_helper/release_helper_tests_base.h +++ b/shared/test/unit_test/release_helper/release_helper_tests_base.h @@ -41,6 +41,8 @@ struct ReleaseHelperTestsBase : public ::testing::Test { void whenShouldQueryPeerAccessCalledThenTrueReturned(); void whenIsSingleDispatchRequiredForMultiCCSCalledThenFalseReturned(); void whenIsSingleDispatchRequiredForMultiCCSCalledThenTrueReturned(); + void whenIsStateCacheInvalidationWaRequiredCalledThenFalseReturned(); + void whenIsStateCacheInvalidationWaRequiredCalledThenTrueReturned(); virtual std::vector getRevisions() = 0; std::unique_ptr releaseHelper;