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

@ -41,7 +41,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTests, whenPrepareDeviceEnvironmentsIsCalledTh
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
}
HWTEST_F(PrepareDeviceEnvironmentsTests, givenRcsAndCcsNotSupportedWhenInitializingThenReturnFalse) {
HWTEST_F(PrepareDeviceEnvironmentsTests, givenCcsNotSupportedWhenInitializingThenReturnFalse) {
REQUIRE_64BIT_OR_SKIP();
NEO::ExecutionEnvironment executionEnvironment;
@ -53,7 +53,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTests, givenRcsAndCcsNotSupportedWhenInitializ
productHelper.configureHardwareCustom(&hwInfo, nullptr);
bool expectedValue = false;
if (hwInfo.featureTable.flags.ftrRcsNode || hwInfo.featureTable.flags.ftrCCSNode) {
if (hwInfo.featureTable.flags.ftrCCSNode) {
expectedValue = true;
}

View File

@ -210,6 +210,17 @@ bool RootDeviceEnvironment::isNumberOfCcsLimited() const {
return limitedNumberOfCcs;
}
void RootDeviceEnvironment::setRcsExposure() {
if (releaseHelper) {
if (releaseHelper->isRcsExposureDisabled()) {
hwInfo->featureTable.flags.ftrRcsNode = false;
if ((DebugManager.flags.NodeOrdinal.get() == static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS)) || (DebugManager.flags.NodeOrdinal.get() == static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCCS))) {
hwInfo->featureTable.flags.ftrRcsNode = true;
}
}
}
}
void RootDeviceEnvironment::initDummyAllocation() {
std::call_once(isDummyAllocationInitialized, [this]() {
auto customDeleter = [this](GraphicsAllocation *dummyAllocation) {

View File

@ -78,6 +78,7 @@ struct RootDeviceEnvironment {
void createBindlessHeapsHelper(MemoryManager *memoryManager, bool availableDevices, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield);
void limitNumberOfCcs(uint32_t numberOfCcs);
bool isNumberOfCcsLimited() const;
void setRcsExposure();
void initProductHelper();
void initHelpers();
void initGfxCoreHelper();

View File

@ -476,6 +476,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl
status = querySystemInfo();
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
device->setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable, compilerProductHelper);
rootDeviceEnvironment.setRcsExposure();
if (status) {
systemInfo->checkSysInfoMismatch(hwInfo);

View File

@ -69,7 +69,6 @@ class ProductHelper {
virtual int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const = 0;
virtual void adjustPlatformForProductFamily(HardwareInfo *hwInfo) = 0;
virtual void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const = 0;
virtual void disableRcsExposure(HardwareInfo *hwInfo) const = 0;
virtual uint64_t getHostMemCapabilities(const HardwareInfo *hwInfo) const = 0;
virtual uint64_t getDeviceMemCapabilities() const = 0;
virtual uint64_t getSingleDeviceSharedMemCapabilities() const = 0;

View File

@ -84,14 +84,6 @@ void ProductHelperHw<gfxProduct>::enableBlitterOperationsSupport(HardwareInfo *h
}
}
template <PRODUCT_FAMILY gfxProduct>
void ProductHelperHw<gfxProduct>::disableRcsExposure(HardwareInfo *hwInfo) const {
hwInfo->featureTable.flags.ftrRcsNode = false;
if ((DebugManager.flags.NodeOrdinal.get() == static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS)) || (DebugManager.flags.NodeOrdinal.get() == static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCCS))) {
hwInfo->featureTable.flags.ftrRcsNode = true;
}
}
template <PRODUCT_FAMILY gfxProduct>
uint64_t ProductHelperHw<gfxProduct>::getDeviceMemCapabilities() const {
uint64_t capabilities = UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS;

View File

@ -22,7 +22,6 @@ class ProductHelperHw : public ProductHelper {
int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const override;
void adjustPlatformForProductFamily(HardwareInfo *hwInfo) override;
void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const override;
void disableRcsExposure(HardwareInfo *hwInfo) const override;
uint64_t getHostMemCapabilities(const HardwareInfo *hwInfo) const override;
uint64_t getDeviceMemCapabilities() const override;
uint64_t getSingleDeviceSharedMemCapabilities() const override;

View File

@ -115,6 +115,7 @@ bool Wddm::init() {
populateIpVersion(*hardwareInfo);
rootDeviceEnvironment.initReleaseHelper();
rootDeviceEnvironment.setRcsExposure();
if (productHelper.configureHwInfoWddm(hardwareInfo, hardwareInfo, rootDeviceEnvironment)) {
return false;

View File

@ -41,6 +41,7 @@ class ReleaseHelper {
virtual bool isCachingOnCpuAvailable() const = 0;
virtual bool shouldAdjustDepth() const = 0;
virtual bool isDirectSubmissionSupported() const = 0;
virtual bool isRcsExposureDisabled() const = 0;
virtual std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const = 0;
protected:
@ -69,6 +70,7 @@ class ReleaseHelperHw : public ReleaseHelper {
bool isCachingOnCpuAvailable() const override;
bool shouldAdjustDepth() const override;
bool isDirectSubmissionSupported() const override;
bool isRcsExposureDisabled() const override;
std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const override;
protected:

View File

@ -13,6 +13,10 @@
namespace NEO {
constexpr auto release = ReleaseType::release1260;
template <>
bool ReleaseHelperHw<release>::isRcsExposureDisabled() const {
return true;
}
} // namespace NEO
template class NEO::ReleaseHelperHw<NEO::release>;

View File

@ -82,4 +82,9 @@ template <ReleaseType releaseType>
bool ReleaseHelperHw<releaseType>::isDirectSubmissionSupported() const {
return false;
}
template <ReleaseType releaseType>
bool ReleaseHelperHw<releaseType>::isRcsExposureDisabled() const {
return false;
}
} // namespace NEO

View File

@ -29,4 +29,8 @@ bool ReleaseHelperHw<release>::isDirectSubmissionSupported() const {
return true;
}
template <>
bool ReleaseHelperHw<release>::isRcsExposureDisabled() const {
return true;
}
} // namespace NEO

View File

@ -18,8 +18,6 @@ int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, O
enableBlitterOperationsSupport(hwInfo);
disableRcsExposure(hwInfo);
auto &kmdNotifyProperties = hwInfo->capabilityTable.kmdNotifyProperties;
kmdNotifyProperties.enableKmdNotify = true;
kmdNotifyProperties.delayKmdNotifyMicroseconds = 150;

View File

@ -23,7 +23,6 @@ template <>
int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const {
enableCompression(hwInfo);
enableBlitterOperationsSupport(hwInfo);
disableRcsExposure(hwInfo);
return 0;
}

View File

@ -35,7 +35,6 @@ int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, O
DG2::adjustHardwareInfo(hwInfo);
enableBlitterOperationsSupport(hwInfo);
disableRcsExposure(hwInfo);
hwInfo->workaroundTable.flags.wa_15010089951 = true;
auto &kmdNotifyProperties = hwInfo->capabilityTable.kmdNotifyProperties;

View File

@ -58,7 +58,6 @@ int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, O
DG2::adjustHardwareInfo(hwInfo);
enableBlitterOperationsSupport(hwInfo);
disableRcsExposure(hwInfo);
hwInfo->workaroundTable.flags.wa_15010089951 = true;
return 0;

View File

@ -27,6 +27,7 @@ class MockReleaseHelper : public ReleaseHelper {
ADDMETHOD_CONST_NOBASE(isCachingOnCpuAvailable, bool, false, ());
ADDMETHOD_CONST_NOBASE(shouldAdjustDepth, bool, false, ());
ADDMETHOD_CONST_NOBASE(isDirectSubmissionSupported, bool, false, ());
ADDMETHOD_CONST_NOBASE(isRcsExposureDisabled, bool, false, ());
ADDMETHOD_CONST_NOBASE(getPreferredAllocationMethod, std::optional<GfxMemoryAllocationMethod>, std::nullopt, (AllocationType allocationType));
};
} // namespace NEO

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();