mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Capability to create multiple Regular contexts per engine
Ralated-To: NEO-7618 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7850d06c09
commit
99e0493a39
@@ -40,6 +40,10 @@ extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executio
|
||||
Device::Device(ExecutionEnvironment *executionEnvironment, const uint32_t rootDeviceIndex)
|
||||
: executionEnvironment(executionEnvironment), rootDeviceIndex(rootDeviceIndex) {
|
||||
this->executionEnvironment->incRefInternal();
|
||||
|
||||
if (DebugManager.flags.NumberOfRegularContextsPerEngine.get() > 1) {
|
||||
this->numberOfRegularContextsPerEngine = static_cast<uint32_t>(DebugManager.flags.NumberOfRegularContextsPerEngine.get());
|
||||
}
|
||||
}
|
||||
|
||||
Device::~Device() {
|
||||
@@ -322,7 +326,14 @@ void Device::addEngineToEngineGroup(EngineControl &engine) {
|
||||
this->regularEngineGroups.push_back(EngineGroupT{});
|
||||
this->regularEngineGroups.back().engineGroupType = engineGroupType;
|
||||
}
|
||||
this->regularEngineGroups.back().engines.push_back(engine);
|
||||
|
||||
auto &engines = this->regularEngineGroups.back().engines;
|
||||
|
||||
if (engines.size() > 0 && engines.back().getEngineType() == engine.getEngineType()) {
|
||||
return; // Type already added. Exposing multiple contexts for the same engine is disabled.
|
||||
}
|
||||
|
||||
engines.push_back(engine);
|
||||
}
|
||||
|
||||
std::unique_ptr<CommandStreamReceiver> Device::createCommandStreamReceiver() const {
|
||||
@@ -372,11 +383,15 @@ bool Device::createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsa
|
||||
commandStreamReceiver->createKernelArgsBufferAllocation();
|
||||
|
||||
if (isDefaultEngine) {
|
||||
defaultEngineIndex = deviceCsrIndex;
|
||||
bool defaultEngineAlreadySet = (allEngines.size() > defaultEngineIndex) && (allEngines[defaultEngineIndex].getEngineType() == engineType);
|
||||
|
||||
if (osContext->isDebuggableContext()) {
|
||||
if (SubmissionStatus::SUCCESS != commandStreamReceiver->initializeDeviceWithFirstSubmission()) {
|
||||
return false;
|
||||
if (!defaultEngineAlreadySet) {
|
||||
defaultEngineIndex = deviceCsrIndex;
|
||||
|
||||
if (osContext->isDebuggableContext()) {
|
||||
if (SubmissionStatus::SUCCESS != commandStreamReceiver->initializeDeviceWithFirstSubmission()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -910,4 +925,14 @@ CompilerInterface *Device::getCompilerInterface() const {
|
||||
BuiltIns *Device::getBuiltIns() const {
|
||||
return executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->getBuiltIns();
|
||||
}
|
||||
|
||||
EngineControl &Device::getNextEngineForMultiRegularContextMode() {
|
||||
UNRECOVERABLE_IF(defaultEngineIndex != 0);
|
||||
|
||||
auto maxIndex = numberOfRegularContextsPerEngine - 1; // 1 for internal engine
|
||||
|
||||
auto indexToAssign = regularContextPerEngineAssignmentHelper.fetch_add(1) % maxIndex;
|
||||
|
||||
return allEngines[indexToAssign];
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -81,6 +81,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
EngineControl &getEngine(uint32_t index);
|
||||
EngineControl &getDefaultEngine();
|
||||
EngineControl &getNextEngineForCommandQueue();
|
||||
EngineControl &getNextEngineForMultiRegularContextMode();
|
||||
EngineControl &getInternalEngine();
|
||||
EngineControl *getInternalCopyEngine();
|
||||
SelectorCopyEngine &getSelectorCopyEngine();
|
||||
@@ -152,6 +153,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
void getAdapterMask(uint32_t &nodeMask);
|
||||
const GfxCoreHelper &getGfxCoreHelper() const;
|
||||
const ProductHelper &getProductHelper() const;
|
||||
uint32_t getNumberOfRegularContextsPerEngine() const { return numberOfRegularContextsPerEngine; }
|
||||
|
||||
std::atomic<uint32_t> debugExecutionCounter = 0;
|
||||
|
||||
@@ -203,8 +205,10 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
uint32_t defaultEngineIndex = 0;
|
||||
uint32_t numSubDevices = 0;
|
||||
std::atomic_uint32_t regularCommandQueuesCreatedWithinDeviceCount{0};
|
||||
std::atomic<uint8_t> regularContextPerEngineAssignmentHelper = 0;
|
||||
std::bitset<8> availableEnginesForCommandQueueusRoundRobin = 0;
|
||||
uint32_t queuesPerEngineCount = 1;
|
||||
uint32_t numberOfRegularContextsPerEngine = 1;
|
||||
void initializeEngineRoundRobinControls();
|
||||
bool hasGenericSubDevices = false;
|
||||
bool engineInstanced = false;
|
||||
|
||||
Reference in New Issue
Block a user