Revert "Set cooperative flag for debuggable contexts during creation"

This reverts commit 5e0732f57e.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-02-13 04:04:31 +01:00
committed by Compute-Runtime-Automation
parent 6fe91498d8
commit 5ec8c004ce
4 changed files with 5 additions and 77 deletions

View File

@ -632,62 +632,6 @@ TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextFo
EXPECT_EQ(static_cast<uint32_t>(-1), drmMock.passedContextDebugId); EXPECT_EQ(static_cast<uint32_t>(-1), drmMock.passedContextDebugId);
} }
TEST(DrmTest, givenProgramDebuggingAndContextDebugSupportedWhenCreatingContextThenCooperativeFlagIsPassedToCreateDrmContext) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
DrmMockNonFailing drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drmMock.contextDebugSupported = true;
drmMock.callBaseCreateDrmContext = false;
OsContextLinux osContext(drmMock, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}));
osContext.ensureContextInitialized();
EXPECT_NE(static_cast<uint32_t>(-1), drmMock.passedContextDebugId);
EXPECT_TRUE(drmMock.capturedCooperativeContextRequest);
OsContextLinux osContext2(drmMock, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Cooperative}));
osContext2.ensureContextInitialized();
EXPECT_NE(static_cast<uint32_t>(-1), drmMock.passedContextDebugId);
EXPECT_TRUE(drmMock.capturedCooperativeContextRequest);
}
TEST(DrmTest, givenNotEnabledDebuggingOrContextDebugUnsupportedWhenCreatingContextThenCooperativeFlagIsNotPassedToCreateDrmContext) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
DrmMockNonFailing drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drmMock.contextDebugSupported = true;
drmMock.callBaseCreateDrmContext = false;
drmMock.capturedCooperativeContextRequest = true;
EXPECT_FALSE(executionEnvironment->isDebuggingEnabled());
OsContextLinux osContext(drmMock, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}));
osContext.ensureContextInitialized();
EXPECT_FALSE(drmMock.capturedCooperativeContextRequest);
executionEnvironment->setDebuggingEnabled();
drmMock.contextDebugSupported = false;
drmMock.callBaseCreateDrmContext = false;
drmMock.capturedCooperativeContextRequest = true;
OsContextLinux osContext2(drmMock, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}));
osContext2.ensureContextInitialized();
EXPECT_FALSE(drmMock.capturedCooperativeContextRequest);
}
TEST(DrmTest, givenPrintIoctlDebugFlagSetWhenGettingTimestampFrequencyThenCaptureExpectedOutput) { TEST(DrmTest, givenPrintIoctlDebugFlagSetWhenGettingTimestampFrequencyThenCaptureExpectedOutput) {
DebugManagerStateRestore restore; DebugManagerStateRestore restore;
DebugManager.flags.PrintIoctlEntries.set(true); DebugManager.flags.PrintIoctlEntries.set(true);

View File

@ -119,7 +119,7 @@ class Drm : public DriverModel {
int queryAdapterBDF(); int queryAdapterBDF();
int createDrmVirtualMemory(uint32_t &drmVmId); int createDrmVirtualMemory(uint32_t &drmVmId);
void destroyDrmVirtualMemory(uint32_t drmVmId); void destroyDrmVirtualMemory(uint32_t drmVmId);
MOCKABLE_VIRTUAL uint32_t createDrmContext(uint32_t drmVmId, bool isDirectSubmissionRequested, bool isCooperativeContextRequested); uint32_t createDrmContext(uint32_t drmVmId, bool isDirectSubmissionRequested, bool isCooperativeContextRequested);
void appendDrmContextFlags(drm_i915_gem_context_create_ext &gcc, bool isDirectSubmissionRequested); void appendDrmContextFlags(drm_i915_gem_context_create_ext &gcc, bool isDirectSubmissionRequested);
void destroyDrmContext(uint32_t drmContextId); void destroyDrmContext(uint32_t drmContextId);
int queryVmId(uint32_t drmContextId, uint32_t &vmId); int queryVmId(uint32_t drmContextId, uint32_t &vmId);

View File

@ -45,22 +45,19 @@ void OsContextLinux::initializeContext() {
this->drmVmIds.resize(deviceBitfield.size(), 0); this->drmVmIds.resize(deviceBitfield.size(), 0);
} }
const bool debuggableContext = drm.isContextDebugSupported() && drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled() && !isInternalEngine();
for (auto deviceIndex = 0u; deviceIndex < deviceBitfield.size(); deviceIndex++) { for (auto deviceIndex = 0u; deviceIndex < deviceBitfield.size(); deviceIndex++) {
if (deviceBitfield.test(deviceIndex)) { if (deviceBitfield.test(deviceIndex)) {
auto drmVmId = drm.getVirtualMemoryAddressSpace(deviceIndex); auto drmVmId = drm.getVirtualMemoryAddressSpace(deviceIndex);
auto drmContextId = drm.createDrmContext(drmVmId, drm.isVmBindAvailable(), isCooperativeEngine() || debuggableContext); auto drmContextId = drm.createDrmContext(drmVmId, drm.isVmBindAvailable(), isCooperativeEngine());
if (drm.areNonPersistentContextsSupported()) { if (drm.areNonPersistentContextsSupported()) {
drm.setNonPersistentContext(drmContextId); drm.setNonPersistentContext(drmContextId);
} }
if (drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled()) { if (drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled()) {
drm.setUnrecoverableContext(drmContextId); drm.setUnrecoverableContext(drmContextId);
} if (!isInternalEngine()) {
drm.setContextDebugFlag(drmContextId);
if (debuggableContext) { }
drm.setContextDebugFlag(drmContextId);
} }
if (drm.isPreemptionSupported() && isLowPriority()) { if (drm.isPreemptionSupported() && isLowPriority()) {

View File

@ -122,15 +122,6 @@ class DrmMock : public Drm {
queryPageFaultSupportCalled = true; queryPageFaultSupportCalled = true;
} }
uint32_t createDrmContext(uint32_t drmVmId, bool isDirectSubmissionRequested, bool isCooperativeContextRequested) override {
capturedCooperativeContextRequest = isCooperativeContextRequested;
if (callBaseCreateDrmContext) {
return Drm::createDrmContext(drmVmId, isDirectSubmissionRequested, isCooperativeContextRequested);
}
return 0;
}
static const int mockFd = 33; static const int mockFd = 33;
bool failRetTopology = false; bool failRetTopology = false;
@ -165,10 +156,6 @@ class DrmMock : public Drm {
bool disableSomeTopology = false; bool disableSomeTopology = false;
bool allowDebugAttach = false; bool allowDebugAttach = false;
bool allowDebugAttachCallBase = false; bool allowDebugAttachCallBase = false;
bool callBaseCreateDrmContext = true;
bool capturedCooperativeContextRequest = false;
uint32_t passedContextDebugId = std::numeric_limits<uint32_t>::max(); uint32_t passedContextDebugId = std::numeric_limits<uint32_t>::max();
std::vector<drm_i915_reset_stats> resetStatsToReturn{}; std::vector<drm_i915_reset_stats> resetStatsToReturn{};