Do not force Cooperative Context in Offline Debugging Mode

Related-To: NEO-7630
Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwolinski 2023-04-13 11:00:22 +00:00 committed by Compute-Runtime-Automation
parent 0ff46562db
commit 3fe0272381
2 changed files with 32 additions and 1 deletions

View File

@ -86,7 +86,7 @@ int IoctlHelper::createDrmContext(Drm &drm, OsContextLinux &osContext, uint32_t
const auto numberOfCCS = drm.getRootDeviceEnvironment().getHardwareInfo()->gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
const bool debuggableContext = drm.isContextDebugSupported() && drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled() && !osContext.isInternalEngine();
const bool debuggableContextCooperative = debuggableContext && numberOfCCS > 0;
const bool debuggableContextCooperative = drm.getRootDeviceEnvironment().executionEnvironment.getDebuggingMode() == DebuggingMode::Offline ? false : (debuggableContext && numberOfCCS > 0);
auto drmContextId = drm.createDrmContext(drmVmId, drm.isVmBindAvailable(), osContext.isCooperativeEngine() || debuggableContextCooperative);
if (drmContextId < 0) {
return drmContextId;

View File

@ -518,6 +518,37 @@ TEST_F(IoctlHelperPrelimFixture, givenProgramDebuggingAndContextDebugSupportedWh
EXPECT_TRUE(drm->capturedCooperativeContextRequest);
}
TEST_F(IoctlHelperPrelimFixture, givenProgramDebuggingModeAndContextDebugSupportedAndRegularEngineUsageWhenCreatingContextThenCooperativeFlagIsNotPassedInOfflineDebuggingMode) {
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);
drm->contextDebugSupported = true;
drm->callBaseCreateDrmContext = false;
OsContextLinux osContext(*drm, 0, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}));
osContext.ensureContextInitialized();
EXPECT_NE(static_cast<uint32_t>(-1), drm->passedContextDebugId);
if (executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->gtSystemInfo.CCSInfo.NumberOfCCSEnabled > 0) {
EXPECT_TRUE(drm->capturedCooperativeContextRequest);
} else {
EXPECT_FALSE(drm->capturedCooperativeContextRequest);
}
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Offline);
OsContextLinux osContext2(*drm, 0, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}));
osContext2.ensureContextInitialized();
EXPECT_NE(static_cast<uint32_t>(-1), drm->passedContextDebugId);
EXPECT_FALSE(drm->capturedCooperativeContextRequest);
OsContextLinux osContext3(*drm, 0, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Cooperative}));
osContext3.ensureContextInitialized();
EXPECT_NE(static_cast<uint32_t>(-1), drm->passedContextDebugId);
EXPECT_TRUE(drm->capturedCooperativeContextRequest);
}
TEST(IoctlHelperPrelimTest, givenProgramDebuggingAndContextDebugSupportedWhenInitializingContextThenVmIsCreatedWithAllNecessaryFlags) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);