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

@@ -62,6 +62,17 @@ bool Device::createDeviceImpl() {
if (!createEngines()) {
return false;
}
getDefaultEngine().osContext->setDefaultContext(true);
for (auto &engine : engines) {
auto commandStreamReceiver = engine.commandStreamReceiver;
auto osContext = engine.osContext;
if (!commandStreamReceiver->initDirectSubmission(*this, *osContext)) {
return false;
}
}
executionEnvironment->memoryManager->setDefaultEngineIndex(defaultEngineIndex);
auto osInterface = getRootDeviceEnvironment().osInterface.get();
@@ -144,10 +155,6 @@ bool Device::createEngine(uint32_t deviceCsrIndex, aub_stream::EngineType engine
return false;
}
if (!commandStreamReceiver->initDirectSubmission(*this, *osContext)) {
return false;
}
engines.push_back({commandStreamReceiver.get(), osContext});
commandStreamReceivers.push_back(std::move(commandStreamReceiver));

View File

@@ -15,9 +15,10 @@ namespace NEO {
struct DirectSubmissionProperties {
bool engineSupported = false;
bool submitOnInit = false;
bool useNonDefault = false;
bool useRootDevice = false;
bool useInternal = false;
bool useLowPriority = false;
bool useRootDevice = false;
};
using EngineDirectSubmissionInitVec = std::vector<std::pair<aub_stream::EngineType, DirectSubmissionProperties>>;

View File

@@ -33,6 +33,8 @@ class OsContext : public ReferenceTrackedObject<OsContext> {
bool isInternalEngine() const { return internalEngine; }
bool isRootDevice() const { return rootDevice; }
virtual bool isInitialized() const { return true; }
bool isDefaultContext() const { return defaultContext; }
void setDefaultContext(bool value) { defaultContext = value; }
protected:
OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType, PreemptionMode preemptionMode,
@@ -54,5 +56,6 @@ class OsContext : public ReferenceTrackedObject<OsContext> {
const bool lowPriority = false;
const bool internalEngine = false;
const bool rootDevice = false;
bool defaultContext = false;
};
} // namespace NEO

View File

@@ -617,6 +617,6 @@ HWTEST_F(DirectSubmissionTest, givenDirectSubmissionAvailableWhenProgrammingEndi
HWTEST_F(DirectSubmissionTest, whenInitDirectSubmissionFailThenEngineIsNotCreated) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.csrFailInitDirectSubmission = true;
bool ret = pDevice->createEngine(0u, aub_stream::ENGINE_RCS);
EXPECT_FALSE(ret);
auto device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo);
EXPECT_EQ(nullptr, device);
}