Test compute mode WA based on TestTraits

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka 2021-09-17 16:37:07 +00:00 committed by Compute-Runtime-Automation
parent 8a2612a754
commit caa536b6a0
7 changed files with 45 additions and 8 deletions

View File

@ -86,6 +86,7 @@ target_include_directories(${TARGET_NAME}
$<TARGET_PROPERTY:${TARGET_NAME_L0},SOURCE_DIR>/../../../../instrumentation/inc/common/instrumentation/api/
$<TARGET_PROPERTY:${TARGET_NAME_L0},SOURCE_DIR>/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)

View File

@ -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<ModuleFixture>;
HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenChangedFieldsAreDirty, IsAtLeastGen12lp) {
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
struct ProgramChangedFieldsInComputeMode {
template <PRODUCT_FAMILY productFamily>
static constexpr bool isMatched() {
if (productFamily == IGFX_BROADWELL)
return false;
return TestTraits<NEO::ToGfxCoreFamily<productFamily>::get()>::programOnlyChangedFieldsInComputeStateMode;
}
};
HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenChangedFieldsAreDirty, ProgramChangedFieldsInComputeMode) {
DebugManagerStateRestore restorer;
Mock<::L0::Kernel> kernel;
@ -184,15 +193,37 @@ HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModePropertiesWhenUpdateStr
const_cast<NEO::KernelDescriptor *>(&kernel.getKernelDescriptor())->kernelAttributes.numGrfRequired = 0x80;
pCommandList->updateStreamProperties(kernel, false, false);
EXPECT_TRUE(pCommandList->finalStreamState.stateComputeMode.largeGrfMode.isDirty);
if (IsXEHP::isMatched<productFamily>()) {
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 <PRODUCT_FAMILY productFamily>
static constexpr bool isMatched() {
return !TestTraits<NEO::ToGfxCoreFamily<productFamily>::get()>::programOnlyChangedFieldsInComputeStateMode;
}
};
HWTEST2_F(CommandListAppendLaunchKernel, GivenComputeModeTraitsSetToFalsePropertiesWhenUpdateStreamPropertiesIsCalledTwiceThenAllFieldsAreDirty, ProgramAllFieldsInComputeMode) {
DebugManagerStateRestore restorer;
Mock<::L0::Kernel> kernel;
auto pMockModule = std::unique_ptr<Module>(new Mock<Module>(device, nullptr));
kernel.module = pMockModule.get();
auto pCommandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<gfxCoreFamily>>>();
auto result = pCommandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
const_cast<NEO::KernelDescriptor *>(&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<NEO::KernelDescriptor *>(&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;

View File

@ -11,4 +11,5 @@
template <>
struct TestTraits<IGFX_GEN11_CORE> {
static constexpr bool auxBuiltinsSupported = true;
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
};

View File

@ -11,4 +11,5 @@
template <>
struct TestTraits<IGFX_GEN12LP_CORE> {
static constexpr bool auxBuiltinsSupported = true;
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
};

View File

@ -11,4 +11,5 @@
template <>
struct TestTraits<IGFX_GEN8_CORE> {
static constexpr bool auxBuiltinsSupported = true;
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
};

View File

@ -11,4 +11,5 @@
template <>
struct TestTraits<IGFX_GEN9_CORE> {
static constexpr bool auxBuiltinsSupported = true;
static constexpr bool programOnlyChangedFieldsInComputeStateMode = true;
};

View File

@ -17,4 +17,5 @@ struct TestTraits<IGFX_XE_HP_CORE> {
static constexpr bool l3ControlSupported = true;
static constexpr bool forceNonCoherentSupported = true;
static constexpr bool threadPreemptionDisableBitMatcher = true;
static constexpr bool programOnlyChangedFieldsInComputeStateMode = false;
};