Limit direct submission to default context by default

Change-Id: I274d402eead87afca634d3b876fe500777910f96
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2020-03-06 19:02:24 +01:00
committed by sys_ocldev
parent 97d9d35ab7
commit 11f76befda
8 changed files with 76 additions and 7 deletions

View File

@ -353,3 +353,10 @@ TEST(DeviceGenEngineTest, whenCreateDeviceThenInternalEngineHasDefaultType) {
auto defaultEngineType = getChosenEngineType(device->getHardwareInfo());
EXPECT_EQ(defaultEngineType, internalEngineType);
}
TEST(DeviceGenEngineTest, givenCreatedDeviceWhenRetrievingDefaultEngineThenOsContextHasDefaultFieldSet) {
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
auto &defaultEngine = device->getDefaultEngine();
EXPECT_TRUE(defaultEngine.osContext->isDefaultContext());
}

View File

@ -27,3 +27,11 @@ TEST(OSContext, givenLowPriorityRootDeviceInternalAreTrueWhenCreatingDefaultOsCo
EXPECT_TRUE(osContext->isRootDevice());
delete osContext;
}
TEST(OSContext, givenOsContextCreatedDefaultIsFalseWhenSettingTrueThenFlagTrueReturned) {
OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
EXPECT_FALSE(osContext->isDefaultContext());
osContext->setDefaultContext(true);
EXPECT_TRUE(osContext->isDefaultContext());
delete osContext;
}

View File

@ -69,6 +69,7 @@ class WddmCommandStreamFixture {
osContext.reset(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, false));
osContext->setDefaultContext(true);
csr = new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*executionEnvironment, 0);
device.reset(MockDevice::create<MockDevice>(executionEnvironment, 0u));
@ -969,6 +970,7 @@ TEST_F(WddmCommandStreamTest, whenDirectSubmissionEnabledOnBcsThenExpectFeatureA
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup,
false, false, false));
osContext->setDefaultContext(true);
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = true;
@ -984,6 +986,7 @@ TEST_F(WddmCommandStreamTest, givenDirectSubmissionEnabledWhenPlatformNotSupport
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup,
false, false, false));
osContext->setDefaultContext(true);
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = false;
@ -999,6 +1002,7 @@ TEST_F(WddmCommandStreamTest, givenLowPriorityContextWhenDirectSubmissionDisable
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
true, false, false));
osContext->setDefaultContext(true);
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
@ -1030,6 +1034,7 @@ TEST_F(WddmCommandStreamTest, givenInternalContextWhenDirectSubmissionDisabledOn
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, true, false));
osContext->setDefaultContext(true);
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
@ -1062,6 +1067,7 @@ TEST_F(WddmCommandStreamTest, givenRootDeviceContextWhenDirectSubmissionDisabled
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, true));
osContext->setDefaultContext(true);
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
@ -1087,3 +1093,37 @@ TEST_F(WddmCommandStreamTest, givenRootDeviceContextWhenDirectSubmissionEnabledO
EXPECT_TRUE(ret);
EXPECT_TRUE(csr->isDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenNonDefaultContextWhenDirectSubmissionDisabledOnNonDefaultThenExpectFeatureNotAvailable) {
DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, false));
osContext->setDefaultContext(false);
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useNonDefault = false;
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_FALSE(csr->isDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenNonDefaultContextContextWhenDirectSubmissionEnabledOnNonDefaultContextThenExpectFeatureAvailable) {
DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, false));
osContext->setDefaultContext(false);
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useNonDefault = true;
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_TRUE(csr->isDirectSubmissionEnabled());
}