mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Create separate command stream receiver for every device.
Change-Id: I8073380941e2a3bfe57610e6e437bdc177dcc2d5
This commit is contained in:
committed by
sys_ocldev
parent
3f6a94175b
commit
8e33ec04c5
@@ -360,9 +360,6 @@ void CommandStreamReceiver::setExperimentalCmdBuffer(std::unique_ptr<Experimenta
|
||||
}
|
||||
|
||||
bool CommandStreamReceiver::initializeTagAllocation() {
|
||||
if (tagAllocation) {
|
||||
return true;
|
||||
}
|
||||
auto tagAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t));
|
||||
if (!tagAllocation) {
|
||||
return false;
|
||||
|
||||
@@ -103,8 +103,8 @@ Device::~Device() {
|
||||
performanceCounters->shutdown();
|
||||
}
|
||||
|
||||
if (executionEnvironment->commandStreamReceiver) {
|
||||
executionEnvironment->commandStreamReceiver->flushBatchedSubmissions();
|
||||
if (commandStreamReceiver) {
|
||||
commandStreamReceiver->flushBatchedSubmissions();
|
||||
}
|
||||
|
||||
if (deviceInfo.sourceLevelDebuggerActive && executionEnvironment->sourceLevelDebugger) {
|
||||
@@ -126,15 +126,15 @@ Device::~Device() {
|
||||
bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
|
||||
auto executionEnvironment = outDevice.executionEnvironment;
|
||||
executionEnvironment->initGmm(pHwInfo);
|
||||
if (!executionEnvironment->initializeCommandStreamReceiver(pHwInfo)) {
|
||||
if (!executionEnvironment->initializeCommandStreamReceiver(pHwInfo, outDevice.getDeviceIndex())) {
|
||||
return false;
|
||||
}
|
||||
executionEnvironment->initializeMemoryManager(outDevice.getEnabled64kbPages(), outDevice.getHardwareCapabilities().localMemorySupported);
|
||||
executionEnvironment->initializeMemoryManager(outDevice.getEnabled64kbPages(), outDevice.getHardwareCapabilities().localMemorySupported, outDevice.getDeviceIndex());
|
||||
|
||||
outDevice.osContext = new OsContext(executionEnvironment->osInterface.get());
|
||||
executionEnvironment->memoryManager->registerOsContext(outDevice.osContext);
|
||||
|
||||
outDevice.commandStreamReceiver = executionEnvironment->commandStreamReceiver.get();
|
||||
outDevice.commandStreamReceiver = executionEnvironment->commandStreamReceivers[outDevice.getDeviceIndex()].get();
|
||||
if (!outDevice.commandStreamReceiver->initializeTagAllocation()) {
|
||||
return false;
|
||||
}
|
||||
@@ -246,7 +246,7 @@ unique_ptr_if_unused<Device> Device::release() {
|
||||
|
||||
bool Device::isSimulation() const {
|
||||
bool simulation = hwInfo.capabilityTable.isSimulation(hwInfo.pPlatform->usDeviceID);
|
||||
if (executionEnvironment->commandStreamReceiver->getType() != CommandStreamReceiverType::CSR_HW) {
|
||||
if (commandStreamReceiver->getType() != CommandStreamReceiverType::CSR_HW) {
|
||||
simulation = true;
|
||||
}
|
||||
if (hwInfo.pSkuTable->ftrSimulationMode) {
|
||||
|
||||
@@ -41,29 +41,32 @@ void ExecutionEnvironment::initGmm(const HardwareInfo *hwInfo) {
|
||||
gmmHelper.reset(new GmmHelper(hwInfo));
|
||||
}
|
||||
}
|
||||
bool ExecutionEnvironment::initializeCommandStreamReceiver(const HardwareInfo *pHwInfo) {
|
||||
if (this->commandStreamReceiver) {
|
||||
bool ExecutionEnvironment::initializeCommandStreamReceiver(const HardwareInfo *pHwInfo, uint32_t deviceIndex) {
|
||||
if (deviceIndex + 1 > commandStreamReceivers.size()) {
|
||||
commandStreamReceivers.resize(deviceIndex + 1);
|
||||
}
|
||||
|
||||
if (this->commandStreamReceivers[deviceIndex]) {
|
||||
return true;
|
||||
}
|
||||
CommandStreamReceiver *commandStreamReceiver = createCommandStream(pHwInfo, *this);
|
||||
std::unique_ptr<CommandStreamReceiver> commandStreamReceiver(createCommandStream(pHwInfo, *this));
|
||||
if (!commandStreamReceiver) {
|
||||
return false;
|
||||
}
|
||||
if (pHwInfo->capabilityTable.ftrRenderCompressedBuffers || pHwInfo->capabilityTable.ftrRenderCompressedImages) {
|
||||
commandStreamReceiver->createPageTableManager();
|
||||
}
|
||||
this->commandStreamReceiver.reset(commandStreamReceiver);
|
||||
this->commandStreamReceivers[deviceIndex] = std::move(commandStreamReceiver);
|
||||
return true;
|
||||
}
|
||||
void ExecutionEnvironment::initializeMemoryManager(bool enable64KBpages, bool enableLocalMemory) {
|
||||
void ExecutionEnvironment::initializeMemoryManager(bool enable64KBpages, bool enableLocalMemory, uint32_t deviceIndex) {
|
||||
if (this->memoryManager) {
|
||||
commandStreamReceiver->setMemoryManager(this->memoryManager.get());
|
||||
commandStreamReceivers[deviceIndex]->setMemoryManager(this->memoryManager.get());
|
||||
return;
|
||||
}
|
||||
|
||||
memoryManager.reset(commandStreamReceiver->createMemoryManager(enable64KBpages, enableLocalMemory));
|
||||
commandStreamReceiver->setMemoryManager(memoryManager.get());
|
||||
|
||||
memoryManager.reset(commandStreamReceivers[deviceIndex]->createMemoryManager(enable64KBpages, enableLocalMemory));
|
||||
commandStreamReceivers[deviceIndex]->setMemoryManager(memoryManager.get());
|
||||
DEBUG_BREAK_IF(!this->memoryManager);
|
||||
}
|
||||
void ExecutionEnvironment::initSourceLevelDebugger(const HardwareInfo &hwInfo) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "runtime/utilities/reference_tracked_object.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
namespace OCLRT {
|
||||
class GmmHelper;
|
||||
@@ -48,8 +49,8 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
||||
~ExecutionEnvironment() override;
|
||||
|
||||
void initGmm(const HardwareInfo *hwInfo);
|
||||
bool initializeCommandStreamReceiver(const HardwareInfo *pHwInfo);
|
||||
void initializeMemoryManager(bool enable64KBpages, bool enableLocalMemory);
|
||||
bool initializeCommandStreamReceiver(const HardwareInfo *pHwInfo, uint32_t deviceIndex);
|
||||
void initializeMemoryManager(bool enable64KBpages, bool enableLocalMemory, uint32_t deviceIndex);
|
||||
void initSourceLevelDebugger(const HardwareInfo &hwInfo);
|
||||
|
||||
GmmHelper *getGmmHelper() const;
|
||||
@@ -58,7 +59,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
||||
|
||||
std::unique_ptr<OSInterface> osInterface;
|
||||
std::unique_ptr<MemoryManager> memoryManager;
|
||||
std::unique_ptr<CommandStreamReceiver> commandStreamReceiver;
|
||||
std::vector<std::unique_ptr<CommandStreamReceiver>> commandStreamReceivers;
|
||||
std::unique_ptr<BuiltIns> builtins;
|
||||
std::unique_ptr<CompilerInterface> compilerInterface;
|
||||
std::unique_ptr<SourceLevelDebugger> sourceLevelDebugger;
|
||||
|
||||
Reference in New Issue
Block a user