Do not use selector copy engine

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-09-20 15:46:54 +00:00
committed by Compute-Runtime-Automation
parent 92893a5101
commit efac290ba3
11 changed files with 93 additions and 5 deletions

View File

@ -25,6 +25,8 @@ using namespace NEO;
using CommandQueuePvcAndLaterTests = ::testing::Test;
HWTEST2_F(CommandQueuePvcAndLaterTests, givenMultipleBcsEnginesWhenGetBcsCommandStreamReceiverIsCalledThenReturnProperCsrs, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
hwInfo.capabilityTable.blitterOperationsSupported = true;
@ -52,6 +54,8 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenMultipleBcsEnginesWhenGetBcsCommand
}
HWTEST2_F(CommandQueuePvcAndLaterTests, givenAdditionalBcsWhenCreatingCommandQueueThenUseCorrectEngine, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
hwInfo.capabilityTable.blitterOperationsSupported = true;
@ -86,6 +90,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenAdditionalBcsWhenCreatingCommandQue
HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQBcsInitializationEnabledWhenCreateCommandQueueThenBcsCountIsZero, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
DebugManager.flags.DeferCmdQBcsInitialization.set(1u);
HardwareInfo hwInfo = *defaultHwInfo;
@ -106,6 +111,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQBcsInitializationEnabledWh
HWTEST2_F(CommandQueuePvcAndLaterTests, whenConstructBcsEnginesForSplitThenContainsMultipleBcsEngines, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
DebugManager.flags.DeferCmdQBcsInitialization.set(1u);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
@ -131,6 +137,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, whenConstructBcsEnginesForSplitThenConta
HWTEST2_F(CommandQueuePvcAndLaterTests, givenSplitBcsMaskWhenConstructBcsEnginesForSplitThenContainsGivenBcsEngines, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
std::bitset<bcsInfoMaskSize> bcsMask = 0b100110101;
DebugManager.flags.DeferCmdQBcsInitialization.set(1u);
DebugManager.flags.SplitBcsMask.set(static_cast<int>(bcsMask.to_ulong()));
@ -162,6 +169,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenSplitBcsMaskWhenConstructBcsEngines
HWTEST2_F(CommandQueuePvcAndLaterTests, whenSelectCsrForHostPtrAllocationThenReturnProperEngine, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
DebugManager.flags.DeferCmdQBcsInitialization.set(1u);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
@ -187,6 +195,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, whenSelectCsrForHostPtrAllocationThenRet
HWTEST2_F(CommandQueuePvcAndLaterTests, whenPrepareHostPtrSurfaceForSplitThenSetTaskCountsToZero, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
DebugManager.flags.DeferCmdQBcsInitialization.set(1u);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
@ -240,6 +249,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, whenPrepareHostPtrSurfaceForSplitThenSet
HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQBcsInitializationDisabledWhenCreateCommandQueueThenBcsIsInitialized, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
DebugManager.flags.DeferCmdQBcsInitialization.set(0u);
HardwareInfo hwInfo = *defaultHwInfo;
@ -259,6 +269,8 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQBcsInitializationDisabledW
}
HWTEST2_F(CommandQueuePvcAndLaterTests, givenQueueWithMainBcsIsReleasedWhenNewQueueIsCreatedThenMainBcsCanBeUsedAgain, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
hwInfo.capabilityTable.blitterOperationsSupported = true;
@ -292,7 +304,8 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenQueueWithMainBcsIsReleasedWhenNewQu
}
HWTEST2_F(CommandQueuePvcAndLaterTests, givenCooperativeEngineUsageHintAndCcsWhenCreatingCommandQueueThenCreateQueueWithCooperativeEngine, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restore;
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
DebugManager.flags.EngineUsageHint.set(static_cast<int32_t>(EngineUsage::Cooperative));
auto hwInfo = *defaultHwInfo;
@ -325,6 +338,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenCooperativeEngineUsageHintAndCcsWhe
HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQGpgpuInitializationEnabledWhenCreateCommandQueueThenGpgpuIsNullptr, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
DebugManager.flags.DeferCmdQGpgpuInitialization.set(1u);
HardwareInfo hwInfo = *defaultHwInfo;
@ -343,6 +357,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQGpgpuInitializationEnabled
HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQGpgpuInitializationDisabledWhenCreateCommandQueueThenGpgpuIsnotNullptr, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
DebugManager.flags.DeferCmdQGpgpuInitialization.set(0u);
HardwareInfo hwInfo = *defaultHwInfo;
@ -361,6 +376,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQGpgpuInitializationDisable
struct BcsCsrSelectionCommandQueueTests : ::testing::Test {
void SetUp() override {
DebugManager.flags.EnableCopyEngineSelector.set(1);
HardwareInfo hwInfo = *::defaultHwInfo;
hwInfo.capabilityTable.blitterOperationsSupported = true;
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(bcsInfoMaskSize);
@ -398,6 +414,7 @@ struct BcsCsrSelectionCommandQueueTests : ::testing::Test {
MockDevice *device;
std::unique_ptr<MockClDevice> clDevice;
std::unique_ptr<MockContext> context;
DebugManagerStateRestore restorer;
};
HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenBcsSelectedWithQueueFamiliesWhenSelectingCsrThenSelectProperBcs, IsAtLeastXeHpcCore) {

View File

@ -18,8 +18,36 @@
using namespace NEO;
using EngineNodeHelperPvcTests = ::Test<ClDeviceFixture>;
PVCTEST_F(EngineNodeHelperPvcTests, WhenGetBcsEngineTypeIsCalledWithoutSelectorEnabledForPVCThenCorrectBcsEngineIsReturned) {
using namespace aub_stream;
auto pHwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
auto deviceBitfield = pDevice->getDeviceBitfield();
pHwInfo->featureTable.ftrBcsInfo = 1;
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
selectorCopyEngine.isMainUsed.store(true);
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
pHwInfo->featureTable.ftrBcsInfo = 0b111;
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
pHwInfo->featureTable.ftrBcsInfo = 0b11;
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
pHwInfo->featureTable.ftrBcsInfo = 0b101;
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
EXPECT_EQ(ENGINE_BCS, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, false));
}
PVCTEST_F(EngineNodeHelperPvcTests, WhenGetBcsEngineTypeIsCalledForPVCThenCorrectBcsEngineIsReturned) {
using namespace aub_stream;
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
auto pHwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
auto deviceBitfield = pDevice->getDeviceBitfield();
@ -46,6 +74,8 @@ PVCTEST_F(EngineNodeHelperPvcTests, WhenGetBcsEngineTypeIsCalledForPVCThenCorrec
PVCTEST_F(EngineNodeHelperPvcTests, givenPvcBaseDieA0AndTile1WhenGettingBcsEngineTypeThenDoNotUseBcs1) {
using namespace aub_stream;
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
auto pHwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
pHwInfo->featureTable.ftrBcsInfo = 0b11111;
@ -75,7 +105,7 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledButDebugVariableSetWhenGetG
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
DebugManagerStateRestore restore;
DebugManagerStateRestore restorer;
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCCS));
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));

View File

@ -53,6 +53,12 @@ PVCTEST_F(PvcHwInfoConfig, givenPvcHwInfoConfigWhenCheckDirectSubmissionSupporte
EXPECT_TRUE(hwInfoConfig.isDirectSubmissionSupported(hwInfo));
}
PVCTEST_F(PvcHwInfoConfig, givenPvcHwInfoConfigWhenCheckCopyEngineSelectorEnabledThenFalseIsReturned) {
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
auto hwInfo = *defaultHwInfo;
EXPECT_FALSE(hwInfoConfig.isCopyEngineSelectorEnabled(hwInfo));
}
PVCTEST_F(PvcHwInfoConfig, givenHwInfoConfigAndProgramExtendedPipeControlPriorToNonPipelinedStateCommandDisabledWhenAskedIfPipeControlPriorToNonPipelinedStateCommandsWARequiredThenFalseIsReturned) {
DebugManagerStateRestore restore;
DebugManager.flags.ProgramExtendedPipeControlPriorToNonPipelinedStateCommand.set(0);

View File

@ -391,6 +391,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideNotifyEnableForTagUpdatePostSync, -1, "-
DECLARE_DEBUG_VARIABLE(int32_t, EnableCmdQRoundRobindEngineAssign, -1, "-1: default, 0: disable, 1: enable")
DECLARE_DEBUG_VARIABLE(int32_t, CmdQRoundRobindEngineAssignBitfield, -1, "-1: default, >0: bitfield with supported engines")
DECLARE_DEBUG_VARIABLE(int32_t, CmdQRoundRobindEngineAssignNTo1, -1, "-1: default, >0: assign same engine to N queues")
DECLARE_DEBUG_VARIABLE(int32_t, EnableCopyEngineSelector, -1, "Do not choose only main copy engine, -1: default, 0: disable, 1: enable")
DECLARE_DEBUG_VARIABLE(int32_t, EnableCmdQRoundRobindBcsEngineAssign, -1, "-1: default, 0: disable, 1: enable")
DECLARE_DEBUG_VARIABLE(int32_t, EnableCmdQRoundRobindBcsEngineAssignLimit, -1, "-1: default, >=0: round robin limit")
DECLARE_DEBUG_VARIABLE(int32_t, EnableCmdQRoundRobindBcsEngineAssignStartingValue, -1, "-1: default, >=0: round robin starting point")

View File

@ -109,9 +109,17 @@ aub_stream::EngineType getBcsEngineType(const HardwareInfo &hwInfo, const Device
return aub_stream::ENGINE_BCS3;
}
const bool isMainCopyEngineAlreadyUsed = selectorCopyEngine.isMainUsed.exchange(true);
if (isMainCopyEngineAlreadyUsed) {
return selectLinkCopyEngine(hwInfo, deviceBitfield, selectorCopyEngine.selector);
auto enableSelector = HwInfoConfig::get(hwInfo.platform.eProductFamily)->isCopyEngineSelectorEnabled(hwInfo);
if (DebugManager.flags.EnableCopyEngineSelector.get() != -1) {
enableSelector = DebugManager.flags.EnableCopyEngineSelector.get();
}
if (enableSelector) {
const bool isMainCopyEngineAlreadyUsed = selectorCopyEngine.isMainUsed.exchange(true);
if (isMainCopyEngineAlreadyUsed) {
return selectLinkCopyEngine(hwInfo, deviceBitfield, selectorCopyEngine.selector);
}
}
return aub_stream::ENGINE_BCS;

View File

@ -112,6 +112,7 @@ class HwInfoConfig {
virtual bool isGlobalFenceInCommandStreamRequired(const HardwareInfo &hwInfo) const = 0;
virtual bool isGlobalFenceInDirectSubmissionRequired(const HardwareInfo &hwInfo) const = 0;
virtual bool isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const = 0;
virtual bool isCopyEngineSelectorEnabled(const HardwareInfo &hwInfo) const = 0;
virtual bool isAdjustProgrammableIdPreferredSlmSizeRequired(const HardwareInfo &hwInfo) const = 0;
virtual uint32_t getThreadEuRatioForScratch(const HardwareInfo &hwInfo) const = 0;
virtual bool isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const = 0;
@ -244,6 +245,7 @@ class HwInfoConfigHw : public HwInfoConfig {
bool programAllStateComputeCommandFields() const override;
bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const override;
bool isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const override;
bool isCopyEngineSelectorEnabled(const HardwareInfo &hwInfo) const override;
bool isGlobalFenceInCommandStreamRequired(const HardwareInfo &hwInfo) const override;
bool isGlobalFenceInDirectSubmissionRequired(const HardwareInfo &hwInfo) const override;
bool isAdjustProgrammableIdPreferredSlmSizeRequired(const HardwareInfo &hwInfo) const override;

View File

@ -363,6 +363,11 @@ bool HwInfoConfigHw<gfxProduct>::isComputeDispatchAllWalkerEnableInComputeWalker
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::isCopyEngineSelectorEnabled(const HardwareInfo &hwInfo) const {
return true;
}
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::isGlobalFenceInCommandStreamRequired(const HardwareInfo &hwInfo) const {
return false;

View File

@ -180,6 +180,11 @@ bool HwInfoConfigHw<gfxProduct>::isComputeDispatchAllWalkerEnableInComputeWalker
return false;
}
template <>
bool HwInfoConfigHw<gfxProduct>::isCopyEngineSelectorEnabled(const HardwareInfo &hwInfo) const {
return false;
}
template <>
uint32_t HwInfoConfigHw<gfxProduct>::getThreadEuRatioForScratch(const HardwareInfo &hwInfo) const {
return PVC::isXlA0(hwInfo) ? 8u : 16u;

View File

@ -306,6 +306,11 @@ bool HwInfoConfigHw<IGFX_UNKNOWN>::isComputeDispatchAllWalkerEnableInComputeWalk
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isCopyEngineSelectorEnabled(const HardwareInfo &hwInfo) const {
return true;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isGlobalFenceInCommandStreamRequired(const HardwareInfo &hwInfo) const {
return false;

View File

@ -323,6 +323,7 @@ OverrideNotifyEnableForTagUpdatePostSync = -1
OverrideUseKmdWaitFunction = -1
EnableCacheFlushAfterWalkerForAllQueues = -1
Force32BitDriverSupport = -1
EnableCopyEngineSelector = -1
EnableCmdQRoundRobindEngineAssign = -1
CmdQRoundRobindEngineAssignBitfield = -1
CmdQRoundRobindEngineAssignNTo1 = -1

View File

@ -74,6 +74,8 @@ TEST(EngineNodeHelperTest, givenInvalidEngineTypeWhenGettingStringRepresentation
}
TEST(EngineNodeHelperTest, givenLinkCopyEnginesSupportedWhenGettingBcsEngineTypeThenFirstReturnMainCopyEngineAndThenRoundRobinBetweenLinkEngines) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
SelectorCopyEngine selectorCopyEngine{};
HardwareInfo hwInfo = *::defaultHwInfo;
DeviceBitfield deviceBitfield = 0b11;
@ -89,6 +91,8 @@ TEST(EngineNodeHelperTest, givenLinkCopyEnginesSupportedWhenGettingBcsEngineType
}
TEST(EngineNodeHelperTest, givenMainBcsEngineIsReleasedWhenGettingBcsEngineTypeThenItCanBeReturnedAgain) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
SelectorCopyEngine selectorCopyEngine{};
HardwareInfo hwInfo = *::defaultHwInfo;
DeviceBitfield deviceBitfield = 0b11;
@ -106,6 +110,8 @@ TEST(EngineNodeHelperTest, givenMainBcsEngineIsReleasedWhenGettingBcsEngineTypeT
}
TEST(EngineNodeHelperTest, givenLinkBcsEngineIsReleasedWhenGettingBcsEngineTypeThenItDoesNotAffectFurtherSelections) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
SelectorCopyEngine selectorCopyEngine{};
HardwareInfo hwInfo = *::defaultHwInfo;
DeviceBitfield deviceBitfield = 0b11;
@ -123,6 +129,8 @@ TEST(EngineNodeHelperTest, givenLinkBcsEngineIsReleasedWhenGettingBcsEngineTypeT
}
TEST(EngineNodeHelperTest, givenLinkCopyEnginesAndInternalUsageEnabledWhenGettingBcsEngineThenUseBcs2only) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableCopyEngineSelector.set(1);
SelectorCopyEngine selectorCopyEngine{};
HardwareInfo hwInfo = *::defaultHwInfo;
DeviceBitfield deviceBitfield = 0b11;