mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Allow Device creating multiple CSRs [4/n]
- Introduce additional RCS engine - Set fixed size for Engines array Change-Id: I06533a425684b64214f956783b07877e6157935b Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
cd5f85052e
commit
7781089740
@@ -96,8 +96,8 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
||||
uint32_t ggttRingBuffer;
|
||||
size_t sizeRingBuffer;
|
||||
uint32_t tailRingBuffer;
|
||||
} engineInfoTable[arrayCount(allEngineInstances)] = {};
|
||||
size_t gpgpuEngineIndex = arrayCount(gpgpuEngineInstances) - 1;
|
||||
} engineInfoTable[allEngineInstances.size()] = {};
|
||||
size_t gpgpuEngineIndex = gpgpuEngineInstances.size() - 1;
|
||||
|
||||
std::unique_ptr<AubSubCaptureManager> subCaptureManager;
|
||||
uint32_t aubDeviceId;
|
||||
|
||||
@@ -93,13 +93,10 @@ const AubMemDump::LrcaHelper &AUBCommandStreamReceiverHw<GfxFamily>::getCsTraits
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t AUBCommandStreamReceiverHw<GfxFamily>::getEngineIndexFromInstance(EngineInstanceT engineInstance) {
|
||||
constexpr auto numAllEngines = arrayCount(allEngineInstances);
|
||||
constexpr auto findBegin = allEngineInstances;
|
||||
constexpr auto findEnd = findBegin + numAllEngines;
|
||||
auto findCriteria = [&](const auto &it) { return it.type == engineInstance.type && it.id == engineInstance.id; };
|
||||
auto findResult = std::find_if(findBegin, findEnd, findCriteria);
|
||||
UNRECOVERABLE_IF(findResult == findEnd);
|
||||
return findResult - findBegin;
|
||||
auto findResult = std::find_if(allEngineInstances.begin(), allEngineInstances.end(), findCriteria);
|
||||
UNRECOVERABLE_IF(findResult == allEngineInstances.end());
|
||||
return findResult - allEngineInstances.begin();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
enum EngineType : uint32_t {
|
||||
@@ -25,14 +27,16 @@ struct EngineInstanceT {
|
||||
int id;
|
||||
};
|
||||
|
||||
static constexpr EngineInstanceT allEngineInstances[] = {
|
||||
{ENGINE_RCS},
|
||||
static constexpr std::array<EngineInstanceT, 5> allEngineInstances = {{
|
||||
{ENGINE_RCS, 0},
|
||||
{ENGINE_RCS, 1},
|
||||
{ENGINE_BCS},
|
||||
{ENGINE_VCS},
|
||||
{ENGINE_VECS},
|
||||
};
|
||||
}};
|
||||
|
||||
static constexpr EngineInstanceT gpgpuEngineInstances[] = {
|
||||
{ENGINE_RCS},
|
||||
};
|
||||
static constexpr std::array<EngineInstanceT, 2> gpgpuEngineInstances = {{
|
||||
{ENGINE_RCS, 0},
|
||||
{ENGINE_RCS, 1},
|
||||
}};
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -87,7 +87,9 @@ Device::~Device() {
|
||||
}
|
||||
|
||||
for (auto &engine : engines) {
|
||||
engine.commandStreamReceiver->flushBatchedSubmissions();
|
||||
if (engine.commandStreamReceiver) {
|
||||
engine.commandStreamReceiver->flushBatchedSubmissions();
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceInfo.sourceLevelDebuggerActive && executionEnvironment->sourceLevelDebugger) {
|
||||
@@ -122,7 +124,7 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
|
||||
return false;
|
||||
}
|
||||
|
||||
outDevice.engines.emplace_back(commandStreamReceiver, osContext);
|
||||
outDevice.engines[0] = {commandStreamReceiver, osContext};
|
||||
|
||||
auto pDevice = &outDevice;
|
||||
if (!pDevice->osTime) {
|
||||
@@ -253,7 +255,9 @@ bool Device::isSourceLevelDebuggerActive() const {
|
||||
|
||||
void Device::initMaxPowerSavingMode() {
|
||||
for (auto &engine : engines) {
|
||||
engine.commandStreamReceiver->peekKmdNotifyHelper()->initMaxPowerSavingMode();
|
||||
if (engine.commandStreamReceiver) {
|
||||
engine.commandStreamReceiver->peekKmdNotifyHelper()->initMaxPowerSavingMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -157,7 +157,7 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
std::unique_ptr<DriverInfo> driverInfo;
|
||||
std::unique_ptr<PerformanceCounters> performanceCounters;
|
||||
|
||||
std::vector<EngineControl> engines;
|
||||
std::array<EngineControl, gpgpuEngineInstances.size()> engines = {{}};
|
||||
|
||||
void *slmWindowStartAddress = nullptr;
|
||||
|
||||
|
||||
@@ -37,9 +37,6 @@ bool ExecutionEnvironment::initializeCommandStreamReceiver(const HardwareInfo *p
|
||||
if (deviceIndex + 1 > commandStreamReceivers.size()) {
|
||||
commandStreamReceivers.resize(deviceIndex + 1);
|
||||
}
|
||||
if (deviceCsrIndex + 1 > commandStreamReceivers[deviceIndex].size()) {
|
||||
commandStreamReceivers[deviceIndex].resize(deviceCsrIndex + 1);
|
||||
}
|
||||
|
||||
if (this->commandStreamReceivers[deviceIndex][deviceCsrIndex]) {
|
||||
return true;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "engine_node.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
#include "runtime/utilities/reference_tracked_object.h"
|
||||
|
||||
@@ -23,7 +24,7 @@ class BuiltIns;
|
||||
struct HardwareInfo;
|
||||
class OSInterface;
|
||||
|
||||
using CsrContainer = std::vector<std::unique_ptr<CommandStreamReceiver>>;
|
||||
using CsrContainer = std::array<std::unique_ptr<CommandStreamReceiver>, gpgpuEngineInstances.size()>;
|
||||
|
||||
class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment> {
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user