Store command stream receiver in device.

Change-Id: I133ce4435e189e5bb8473ad4736fe0b02047dffe
This commit is contained in:
Mrozek, Michal
2018-09-11 10:43:50 +02:00
committed by sys_ocldev
parent 2366c41154
commit 1530d7832f
7 changed files with 18 additions and 25 deletions

View File

@@ -134,19 +134,19 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
outDevice.osContext = new OsContext(executionEnvironment->osInterface.get());
executionEnvironment->memoryManager->registerOsContext(outDevice.osContext);
CommandStreamReceiver *commandStreamReceiver = executionEnvironment->commandStreamReceiver.get();
if (!commandStreamReceiver->initializeTagAllocation()) {
outDevice.commandStreamReceiver = executionEnvironment->commandStreamReceiver.get();
if (!outDevice.commandStreamReceiver->initializeTagAllocation()) {
return false;
}
executionEnvironment->memoryManager->csr = commandStreamReceiver;
executionEnvironment->memoryManager->csr = outDevice.commandStreamReceiver;
auto pDevice = &outDevice;
if (!pDevice->osTime) {
pDevice->osTime = OSTime::create(commandStreamReceiver->getOSInterface());
pDevice->osTime = OSTime::create(outDevice.commandStreamReceiver->getOSInterface());
}
pDevice->driverInfo.reset(DriverInfo::create(commandStreamReceiver->getOSInterface()));
pDevice->tagAddress = reinterpret_cast<uint32_t *>(commandStreamReceiver->getTagAllocation()->getUnderlyingBuffer());
pDevice->driverInfo.reset(DriverInfo::create(outDevice.commandStreamReceiver->getOSInterface()));
pDevice->tagAddress = reinterpret_cast<uint32_t *>(outDevice.commandStreamReceiver->getTagAllocation()->getUnderlyingBuffer());
pDevice->initializeCaps();
@@ -158,8 +158,8 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
}
uint32_t deviceHandle = 0;
if (commandStreamReceiver->getOSInterface()) {
deviceHandle = commandStreamReceiver->getOSInterface()->getDeviceHandle();
if (outDevice.commandStreamReceiver->getOSInterface()) {
deviceHandle = outDevice.commandStreamReceiver->getOSInterface()->getDeviceHandle();
}
if (pDevice->deviceInfo.sourceLevelDebuggerActive) {
@@ -176,14 +176,14 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
if (!pDevice->preemptionAllocation) {
return false;
}
commandStreamReceiver->setPreemptionCsrAllocation(pDevice->preemptionAllocation);
outDevice.commandStreamReceiver->setPreemptionCsrAllocation(pDevice->preemptionAllocation);
auto sipType = SipKernel::getSipKernelType(pHwInfo->pPlatform->eRenderCoreFamily, pDevice->isSourceLevelDebuggerActive());
initSipKernel(sipType, *pDevice);
}
if (DebugManager.flags.EnableExperimentalCommandBuffer.get() > 0) {
commandStreamReceiver->setExperimentalCmdBuffer(
std::unique_ptr<ExperimentalCommandBuffer>(new ExperimentalCommandBuffer(commandStreamReceiver, pDevice->getDeviceInfo().profilingTimerResolution)));
outDevice.commandStreamReceiver->setExperimentalCmdBuffer(
std::unique_ptr<ExperimentalCommandBuffer>(new ExperimentalCommandBuffer(outDevice.commandStreamReceiver, pDevice->getDeviceInfo().profilingTimerResolution)));
}
return true;

View File

@@ -88,7 +88,6 @@ class Device : public BaseObject<_cl_device_id> {
}
CommandStreamReceiver &getCommandStreamReceiver();
CommandStreamReceiver *peekCommandStreamReceiver();
volatile uint32_t *getTagAddress() const;
@@ -179,6 +178,7 @@ class Device : public BaseObject<_cl_device_id> {
PreemptionMode preemptionMode;
EngineType engineType;
ExecutionEnvironment *executionEnvironment = nullptr;
CommandStreamReceiver *commandStreamReceiver = nullptr;
};
template <cl_device_info Param>
@@ -190,11 +190,7 @@ inline void Device::getCap(const void *&src,
}
inline CommandStreamReceiver &Device::getCommandStreamReceiver() {
return *executionEnvironment->commandStreamReceiver;
}
inline CommandStreamReceiver *Device::peekCommandStreamReceiver() {
return executionEnvironment->commandStreamReceiver.get();
return *this->commandStreamReceiver;
}
inline volatile uint32_t *Device::getTagAddress() const {