diff --git a/level_zero/core/test/unit_tests/CMakeLists.txt b/level_zero/core/test/unit_tests/CMakeLists.txt index d9211e4d68..83f85a9cc5 100644 --- a/level_zero/core/test/unit_tests/CMakeLists.txt +++ b/level_zero/core/test/unit_tests/CMakeLists.txt @@ -86,6 +86,7 @@ target_include_directories(${TARGET_NAME} $/../../../../instrumentation/inc/common/instrumentation/api/ $/core/os_interface ${NEO_SHARED_TEST_DIRECTORY}/common/test_macros/header${BRANCH_DIR_SUFFIX} + ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/includes${BRANCH_DIR_SUFFIX} ) if(UNIX) 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 129b26e02c..0285ce4ee5 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 @@ -16,6 +16,8 @@ #include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" #include "level_zero/core/test/unit_tests/mocks/mock_module.h" +#include "test_traits_common.h" + namespace L0 { namespace ult { @@ -164,8 +166,15 @@ HWTEST2_F(CommandListCreate, whenCommandListIsCreatedThenFlagsAreCorrectlySet, P } } using CommandListAppendLaunchKernel = Test; -HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenChangedFieldsAreDirty, IsAtLeastGen12lp) { - using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE; +struct ProgramChangedFieldsInComputeMode { + template + static constexpr bool isMatched() { + if (productFamily == IGFX_BROADWELL) + return false; + return TestTraits::get()>::programOnlyChangedFieldsInComputeStateMode; + } +}; +HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenChangedFieldsAreDirty, ProgramChangedFieldsInComputeMode) { DebugManagerStateRestore restorer; Mock<::L0::Kernel> kernel; @@ -184,15 +193,37 @@ HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenUpdateStr const_cast(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x80; pCommandList->updateStreamProperties(kernel, false, false); EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); - if (IsXEHP::isMatched()) { - EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); - } else { - EXPECT_FALSE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); + EXPECT_FALSE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); +} +struct ProgramAllFieldsInComputeMode { + template + static constexpr bool isMatched() { + return !TestTraits::get()>::programOnlyChangedFieldsInComputeStateMode; } +}; +HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModeTraitsSetToFalsePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenAllFieldsAreDirty, ProgramAllFieldsInComputeMode) { + DebugManagerStateRestore restorer; + + Mock<::L0::Kernel> kernel; + auto pMockModule = std::unique_ptr(new Mock(device, nullptr)); + kernel.module = pMockModule.get(); + + auto pCommandList = std::make_unique>>(); + auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u); + ASSERT_EQ(ZE_RESULT_SUCCESS, result); + + const_cast(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x100; + pCommandList->updateStreamProperties(kernel, false, false); + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + + const_cast(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x80; + pCommandList->updateStreamProperties(kernel, false, false); + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); } -HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenPropertesNotChangedThenAllFieldsAreNotDirty, IsAtLeastGen12lp) { - using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE; +HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenPropertesNotChangedThenAllFieldsAreNotDirty, Platforms) { DebugManagerStateRestore restorer; Mock<::L0::Kernel> kernel; diff --git a/shared/test/common/gen11/test_traits_gen11.h b/shared/test/common/gen11/test_traits_gen11.h index 4af92aeb06..71178d17df 100644 --- a/shared/test/common/gen11/test_traits_gen11.h +++ b/shared/test/common/gen11/test_traits_gen11.h @@ -11,4 +11,5 @@ template <> struct TestTraits { static constexpr bool auxBuiltinsSupported = true; + static constexpr bool programOnlyChangedFieldsInComputeStateMode = true; }; diff --git a/shared/test/common/gen12lp/test_traits_gen12lp.h b/shared/test/common/gen12lp/test_traits_gen12lp.h index f11a43bb0c..c754f19f62 100644 --- a/shared/test/common/gen12lp/test_traits_gen12lp.h +++ b/shared/test/common/gen12lp/test_traits_gen12lp.h @@ -11,4 +11,5 @@ template <> struct TestTraits { static constexpr bool auxBuiltinsSupported = true; + static constexpr bool programOnlyChangedFieldsInComputeStateMode = true; }; diff --git a/shared/test/common/gen8/test_traits_gen8.h b/shared/test/common/gen8/test_traits_gen8.h index 0906f0a3ef..ab820f8c8c 100644 --- a/shared/test/common/gen8/test_traits_gen8.h +++ b/shared/test/common/gen8/test_traits_gen8.h @@ -11,4 +11,5 @@ template <> struct TestTraits { static constexpr bool auxBuiltinsSupported = true; + static constexpr bool programOnlyChangedFieldsInComputeStateMode = true; }; diff --git a/shared/test/common/gen9/test_traits_gen9.h b/shared/test/common/gen9/test_traits_gen9.h index 87b18e7b03..6d1e5bc28d 100644 --- a/shared/test/common/gen9/test_traits_gen9.h +++ b/shared/test/common/gen9/test_traits_gen9.h @@ -11,4 +11,5 @@ template <> struct TestTraits { static constexpr bool auxBuiltinsSupported = true; + static constexpr bool programOnlyChangedFieldsInComputeStateMode = true; }; diff --git a/shared/test/common/xe_hp_core/test_traits_xe_hp_core.h b/shared/test/common/xe_hp_core/test_traits_xe_hp_core.h index 7c291ace18..af3908e18d 100644 --- a/shared/test/common/xe_hp_core/test_traits_xe_hp_core.h +++ b/shared/test/common/xe_hp_core/test_traits_xe_hp_core.h @@ -17,4 +17,5 @@ struct TestTraits { static constexpr bool l3ControlSupported = true; static constexpr bool forceNonCoherentSupported = true; static constexpr bool threadPreemptionDisableBitMatcher = true; + static constexpr bool programOnlyChangedFieldsInComputeStateMode = false; };