refactor: Move disableRcs to releaseHelper

Related-To: NEO-8296

Signed-off-by: Baj, Tomasz <tomasz.baj@intel.com>
This commit is contained in:
Baj, Tomasz
2023-09-15 10:28:08 +00:00
committed by Compute-Runtime-Automation
parent 8da92f56c7
commit cb903cbc03
28 changed files with 87 additions and 64 deletions

View File

@@ -22,6 +22,7 @@
#include "shared/source/os_interface/driver_info.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/os_time.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_driver_model.h"
@@ -159,6 +160,47 @@ TEST(RootDeviceEnvironment, givenRootExecutionEnvironmentWhenGetAssertHandlerIsC
EXPECT_EQ(assertHandler, rootDeviceEnvironment->getAssertHandler(device.get()));
}
TEST(RootDeviceEnvironment, givenDefaultHardwareInfoWhenPrepareDeviceEnvironmentsThenFtrRcsNodeIsCorrectSet) {
MockExecutionEnvironment executionEnvironment;
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get());
rootDeviceEnvironment->setHwInfoAndInitHelpers(defaultHwInfo.get());
rootDeviceEnvironment->setRcsExposure();
auto hwInfo = rootDeviceEnvironment->getMutableHardwareInfo();
auto releaseHelper = rootDeviceEnvironment->getReleaseHelper();
if (releaseHelper) {
bool shouldRcsBeDisabled = releaseHelper->isRcsExposureDisabled();
bool isRcsDisabled = hwInfo->featureTable.flags.ftrRcsNode;
EXPECT_NE(shouldRcsBeDisabled, isRcsDisabled);
}
}
TEST(RootDeviceEnvironment, givenHardwareInfoAndDebugVariableNodeOrdinalEqualsRcsWhenPrepareDeviceEnvironmentsThenFtrRcsNodeIsTrue) {
DebugManagerStateRestore restorer;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS));
MockExecutionEnvironment executionEnvironment;
executionEnvironment.rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get());
rootDeviceEnvironment->setRcsExposure();
auto hwInfo = rootDeviceEnvironment->getMutableHardwareInfo();
EXPECT_TRUE(hwInfo->featureTable.flags.ftrRcsNode);
}
TEST(RootDeviceEnvironment, givenHardwareInfoAndDebugVariableNodeOrdinalEqualsCccsWhenPrepareDeviceEnvironmentsThenFtrRcsNodeIsTrue) {
DebugManagerStateRestore restorer;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCCS));
MockExecutionEnvironment executionEnvironment;
executionEnvironment.rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get());
rootDeviceEnvironment->setRcsExposure();
auto hwInfo = rootDeviceEnvironment->getMutableHardwareInfo();
EXPECT_TRUE(hwInfo->featureTable.flags.ftrRcsNode);
}
TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeMemoryManagerIsCalledThenLocalMemorySupportedInMemoryManagerHasCorrectValue) {
const HardwareInfo *hwInfo = defaultHwInfo.get();
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(hwInfo));

View File

@@ -992,33 +992,6 @@ HWTEST2_F(ProductHelperCommonTest, givenBlitterPreferenceWhenEnablingBlitterOper
EXPECT_EQ(expectedBlitterSupport, hardwareInfo.capabilityTable.blitterOperationsSupported);
}
HWTEST2_F(ProductHelperCommonTest, givenHardwareInfoWhendisableRcsExposureIsCalledThenFtrRcsNodeIsFalse, IsAtLeastGen12lp) {
HardwareInfo hwInfo = *defaultHwInfo;
auto &productHelper = getHelper<ProductHelper>();
productHelper.disableRcsExposure(&hwInfo);
EXPECT_FALSE(hwInfo.featureTable.flags.ftrRcsNode);
}
HWTEST2_F(ProductHelperCommonTest, givenHardwareInfoAndDebugVariableNodeOrdinalEqualsRcsWhenDisableRcsExposureIsCalledThenFtrRcsNodeIsTrue, IsAtLeastGen12lp) {
HardwareInfo hwInfo = *defaultHwInfo;
auto &productHelper = getHelper<ProductHelper>();
DebugManagerStateRestore restore;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS));
productHelper.disableRcsExposure(&hwInfo);
EXPECT_TRUE(hwInfo.featureTable.flags.ftrRcsNode);
}
HWTEST2_F(ProductHelperCommonTest, givenHardwareInfoAndDebugVariableNodeOrdinalEqualsCccsWhenDisableRcsExposureIsCalledThenFtrRcsNodeIsTrue, IsAtLeastGen12lp) {
HardwareInfo hwInfo = *defaultHwInfo;
auto &productHelper = getHelper<ProductHelper>();
DebugManagerStateRestore restore;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCCS));
productHelper.disableRcsExposure(&hwInfo);
EXPECT_TRUE(hwInfo.featureTable.flags.ftrRcsNode);
}
HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenAskingForIsaSystemMemoryPlacementThenReturnFalseIfLocalMemorySupported) {
DebugManagerStateRestore restorer;
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();

View File

@@ -9,14 +9,18 @@ target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_tests_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_tests_base.h
)
if(TESTS_XE_HPG_CORE OR TESTS_XE_HPC_CORE)
if(TESTS_XE_HPG_CORE)
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_12_55_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_12_56_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_12_57_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_12_60_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_12_70_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_12_71_tests.cpp
)
endif()
if(TESTS_XE_HPC_CORE)
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/release_helper_12_60_tests.cpp
)
endif()
add_subdirectories()

View File

@@ -34,6 +34,7 @@ TEST_F(ReleaseHelper1255Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_TRUE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
EXPECT_FALSE(releaseHelper->isAuxSurfaceModeOverrideRequired());
EXPECT_TRUE(releaseHelper->isRcsExposureDisabled());
}
}

View File

@@ -34,6 +34,7 @@ TEST_F(ReleaseHelper1256Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_TRUE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
EXPECT_FALSE(releaseHelper->isAuxSurfaceModeOverrideRequired());
EXPECT_TRUE(releaseHelper->isRcsExposureDisabled());
}
}

View File

@@ -34,6 +34,7 @@ TEST_F(ReleaseHelper1257Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_TRUE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
EXPECT_FALSE(releaseHelper->isAuxSurfaceModeOverrideRequired());
EXPECT_TRUE(releaseHelper->isRcsExposureDisabled());
}
}

View File

@@ -32,5 +32,6 @@ TEST_F(ReleaseHelper1260Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_FALSE(releaseHelper->isBFloat16ConversionSupported());
EXPECT_TRUE(releaseHelper->isResolvingSubDeviceIDNeeded());
EXPECT_TRUE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isRcsExposureDisabled());
}
}

View File

@@ -35,6 +35,7 @@ TEST_F(ReleaseHelper1270Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_FALSE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
EXPECT_TRUE(releaseHelper->isAuxSurfaceModeOverrideRequired());
EXPECT_FALSE(releaseHelper->isRcsExposureDisabled());
}
}

View File

@@ -35,6 +35,7 @@ TEST_F(ReleaseHelper1271Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_FALSE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
EXPECT_TRUE(releaseHelper->isAuxSurfaceModeOverrideRequired());
EXPECT_FALSE(releaseHelper->isRcsExposureDisabled());
}
}

View File

@@ -205,21 +205,6 @@ PVCTEST_F(PvcProductHelper, givenProductHelperAndProgramExtendedPipeControlPrior
EXPECT_FALSE(isBasicWARequired);
}
PVCTEST_F(PvcProductHelper, givenPvcWhenConfiguringThenDisableCccs) {
productHelper->configureHardwareCustom(&pInHwInfo, nullptr);
EXPECT_FALSE(pInHwInfo.featureTable.flags.ftrRcsNode);
}
PVCTEST_F(PvcProductHelper, givenDebugVariableSetWhenConfiguringThenEnableCccs) {
DebugManagerStateRestore restore;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCCS));
HardwareInfo hwInfo = *defaultHwInfo;
productHelper->configureHardwareCustom(&hwInfo, nullptr);
EXPECT_TRUE(hwInfo.featureTable.flags.ftrRcsNode);
}
PVCTEST_F(PvcProductHelper, givenDeviceIdThenProperMaxThreadsForWorkgroupIsReturned) {
HardwareInfo hwInfo = *defaultHwInfo;

View File

@@ -40,14 +40,12 @@ DG2TEST_F(GfxCoreHelperTestDg2, givenRcsDisabledWhenGetGpgpuEnginesCalledThenDon
HardwareInfo hwInfo = *defaultHwInfo;
MockExecutionEnvironment mockExecutionEnvironment{};
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
hwInfo.featureTable.flags.ftrCCSNode = true;
hwInfo.featureTable.ftrBcsInfo = 1;
hwInfo.featureTable.flags.ftrRcsNode = true;
hwInfo.featureTable.flags.ftrRcsNode = false;
hwInfo.capabilityTable.blitterOperationsSupported = true;
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
productHelper.configureHardwareCustom(&hwInfo, nullptr);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
auto &gfxCoreHelper = device->getGfxCoreHelper();