Add EngineUsageHint debug variable

Related-To: NEO-6219

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2021-12-01 17:59:35 +00:00
committed by Compute-Runtime-Automation
parent b2f286fc4a
commit f137e927c5
5 changed files with 62 additions and 1 deletions

View File

@@ -905,6 +905,10 @@ void CommandQueue::processProperties(const cl_queue_properties *properties) {
const auto &engine = getDevice().getEngineGroups()[selectedQueueFamilyIndex].engines[selectedQueueIndex];
auto engineType = engine.getEngineType();
auto engineUsage = engine.getEngineUsage();
if ((DebugManager.flags.EngineUsageHint.get() != -1) &&
(getDevice().tryGetEngine(engineType, static_cast<EngineUsage>(DebugManager.flags.EngineUsageHint.get())) != nullptr)) {
engineUsage = static_cast<EngineUsage>(DebugManager.flags.EngineUsageHint.get());
}
this->overrideEngine(engineType, engineUsage);
this->queueCapabilities = getClDevice().getDeviceInfo().queueFamilyProperties[selectedQueueFamilyIndex].capabilities;
this->queueFamilyIndex = selectedQueueFamilyIndex;
@@ -929,7 +933,7 @@ void CommandQueue::overrideEngine(aub_stream::EngineType engineType, EngineUsage
deferredTimestampPackets = std::make_unique<TimestampPacketContainer>();
isCopyOnly = true;
} else {
gpgpuEngine = &device->getEngine(engineType, EngineUsage::Regular);
gpgpuEngine = &device->getEngine(engineType, engineUsage);
}
}

View File

@@ -858,6 +858,28 @@ HWTEST_F(CommandQueueTests, givenMultipleCommandQueuesWhenMarkerIsEmittedThenGra
EXPECT_EQ(commandStreamGraphicsAllocation, commandStreamGraphicsAllocation2);
}
HWTEST_F(CommandQueueTests, givenEngineUsageHintSetWithInvalidValueWhenCreatingCommandQueueThenReturnSuccess) {
DebugManagerStateRestore restore;
DebugManager.flags.EngineUsageHint.set(static_cast<int32_t>(EngineUsage::EngineUsageCount));
auto pDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockContext context(pDevice.get());
cl_int retVal = CL_SUCCESS;
cl_queue_properties propertiesCooperativeQueue[] = {CL_QUEUE_FAMILY_INTEL, 0, CL_QUEUE_INDEX_INTEL, 0, 0};
auto pCmdQ = CommandQueue::create(
&context,
pDevice.get(),
propertiesCooperativeQueue,
false,
retVal);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, pCmdQ);
EXPECT_EQ(EngineUsage::Regular, pCmdQ->getGpgpuEngine().getEngineUsage());
delete pCmdQ;
}
struct WaitForQueueCompletionTests : public ::testing::Test {
template <typename Family>
struct MyCmdQueue : public CommandQueueHw<Family> {

View File

@@ -112,6 +112,39 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenQueueWithMainBcsIsReleasedWhenNewQu
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS2, queue2->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2)->getOsContext().getEngineType());
}
HWTEST2_F(CommandQueuePvcAndLaterTests, givenCooperativeEngineUsageHintAndCcsWhenCreatingCommandQueueThenCreateQueueWithCooperativeEngine, IsAtLeastXeHpcCore) {
DebugManagerStateRestore restore;
DebugManager.flags.EngineUsageHint.set(static_cast<int32_t>(EngineUsage::Cooperative));
auto hwInfo = *defaultHwInfo;
hwInfo.featureTable.flags.ftrCCSNode = true;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4;
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily);
uint32_t revisions[] = {REVISION_A0, REVISION_B};
for (auto &revision : revisions) {
auto hwRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo);
hwInfo.platform.usRevId = hwRevId;
if (hwRevId == CommonConstants::invalidStepping ||
!hwHelper.isCooperativeEngineSupported(hwInfo)) {
continue;
}
auto pDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
MockContext context(pDevice.get());
cl_queue_properties propertiesCooperativeQueue[] = {CL_QUEUE_FAMILY_INTEL, 0, CL_QUEUE_INDEX_INTEL, 0, 0};
propertiesCooperativeQueue[1] = pDevice->getDevice().getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
for (size_t i = 0; i < 4; i++) {
propertiesCooperativeQueue[3] = i;
auto pCommandQueue = std::make_unique<MockCommandQueueHw<FamilyType>>(&context, pDevice.get(), propertiesCooperativeQueue);
EXPECT_EQ(aub_stream::ENGINE_CCS + i, pCommandQueue->gpgpuEngine->osContext->getEngineType());
EXPECT_EQ(EngineUsage::Cooperative, pCommandQueue->gpgpuEngine->osContext->getEngineUsage());
}
}
}
struct BcsCsrSelectionCommandQueueTests : ::testing::Test {
void SetUp() override {
HardwareInfo hwInfo = *::defaultHwInfo;

View File

@@ -359,6 +359,7 @@ ProgramGlobalFenceAsKernelInstructionInEUKernel = -1
DoNotReportTile1BscWaActive = -1
ForceTile0PlacementForTile1ResourcesWaActive = -1
ClosEnabled = -1
EngineUsageHint = -1
AddStatePrefetchCmdToMemoryPrefetchAPI = -1
UpdateCrossThreadDataSize = 0
ForceBcsEngineIndex = -1

View File

@@ -176,6 +176,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, ProgramGlobalFenceAsKernelInstructionInEUKernel,
DECLARE_DEBUG_VARIABLE(int32_t, DoNotReportTile1BscWaActive, -1, "-1: default, 0: WA Disabled, 1: WA enabled")
DECLARE_DEBUG_VARIABLE(int32_t, ForceTile0PlacementForTile1ResourcesWaActive, -1, "-1: default, 0: WA Disabled, 1: WA enabled")
DECLARE_DEBUG_VARIABLE(int32_t, ClosEnabled, -1, "-1: default, 0: disabled, 1: enabled. Enable CLOS based cache reservation")
DECLARE_DEBUG_VARIABLE(int32_t, EngineUsageHint, -1, "-1: default, >=0: engine usage value to use when creating command queue on user selected engine")
DECLARE_DEBUG_VARIABLE(int32_t, ForceBcsEngineIndex, -1, "-1: default, >=0 Copy Engine index")
/*LOGGING FLAGS*/