|
11 | 11 |
|
12 | 12 | #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" |
13 | 13 | #include "level_zero/core/test/unit_tests/fixtures/host_pointer_manager_fixture.h" |
| 14 | +#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h" |
14 | 15 | #include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" |
15 | 16 | #include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" |
| 17 | +#include "level_zero/core/test/unit_tests/mocks/mock_module.h" |
16 | 18 |
|
17 | 19 | namespace L0 { |
18 | 20 | namespace ult { |
@@ -161,6 +163,56 @@ HWTEST2_F(CommandListCreate, whenCommandListIsCreatedThenFlagsAreCorrectlySet, P |
161 | 163 | EXPECT_EQ(flag, pCommandListCoreFamily->flags); |
162 | 164 | } |
163 | 165 | } |
| 166 | +using CommandListAppendLaunchKernel = Test<ModuleFixture>; |
| 167 | +HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenChangedFieldsAreDirty, IsAtLeastGen12lp) { |
| 168 | + using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE; |
| 169 | + DebugManagerStateRestore restorer; |
| 170 | + |
| 171 | + Mock<::L0::Kernel> kernel; |
| 172 | + auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr)); |
| 173 | + kernel.module = pMockModule.get(); |
| 174 | + |
| 175 | + auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>(); |
| 176 | + auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u); |
| 177 | + ASSERT_EQ(ZE_RESULT_SUCCESS, result); |
| 178 | + |
| 179 | + const_cast<NEO::KernelDescriptor *>(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x100; |
| 180 | + pCommandList->updateStreamProperties(kernel, false, false); |
| 181 | + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); |
| 182 | + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); |
| 183 | + |
| 184 | + const_cast<NEO::KernelDescriptor *>(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x80; |
| 185 | + pCommandList->updateStreamProperties(kernel, false, false); |
| 186 | + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); |
| 187 | + if (IsXEHP::isMatched<productFamily>()) { |
| 188 | + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); |
| 189 | + } else { |
| 190 | + EXPECT_FALSE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); |
| 191 | + } |
| 192 | +} |
| 193 | + |
| 194 | +HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenPropertesNotChangedThenAllFieldsAreNotDirty, IsAtLeastGen12lp) { |
| 195 | + using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE; |
| 196 | + DebugManagerStateRestore restorer; |
| 197 | + |
| 198 | + Mock<::L0::Kernel> kernel; |
| 199 | + auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr)); |
| 200 | + kernel.module = pMockModule.get(); |
| 201 | + |
| 202 | + auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>(); |
| 203 | + auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u); |
| 204 | + ASSERT_EQ(ZE_RESULT_SUCCESS, result); |
| 205 | + |
| 206 | + const_cast<NEO::KernelDescriptor *>(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x100; |
| 207 | + pCommandList->updateStreamProperties(kernel, false, false); |
| 208 | + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); |
| 209 | + EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); |
| 210 | + |
| 211 | + pCommandList->updateStreamProperties(kernel, false, false); |
| 212 | + EXPECT_FALSE(pCommandList->finalStreamState.stateComputeMode.isCoherencyRequired.isDirty); |
| 213 | + |
| 214 | + EXPECT_FALSE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty); |
| 215 | +} |
164 | 216 |
|
165 | 217 | using HostPointerManagerCommandListTest = Test<HostPointerManagerFixure>; |
166 | 218 | HWTEST2_F(HostPointerManagerCommandListTest, |
|
0 commit comments