@@ -86,8 +86,8 @@ Device::~Device() {
8686 performanceCounters->shutdown ();
8787 }
8888
89- for (auto &csr : commandStreamReceiver ) {
90- csr ->flushBatchedSubmissions ();
89+ for (auto &engine : engines ) {
90+ engine. commandStreamReceiver ->flushBatchedSubmissions ();
9191 }
9292
9393 if (deviceInfo.sourceLevelDebuggerActive && executionEnvironment->sourceLevelDebugger ) {
@@ -116,21 +116,20 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
116116 executionEnvironment->initializeMemoryManager (outDevice.getEnabled64kbPages (), outDevice.getEnableLocalMemory (),
117117 outDevice.getDeviceIndex (), deviceCsrIndex);
118118
119- outDevice.osContext = new OsContext (executionEnvironment->osInterface .get (), outDevice.getDeviceIndex ());
120- executionEnvironment->memoryManager ->registerOsContext (outDevice.osContext );
121-
122- outDevice.commandStreamReceiver .resize (1 );
123- outDevice.commandStreamReceiver [deviceCsrIndex] = executionEnvironment->commandStreamReceivers [outDevice.getDeviceIndex ()][deviceCsrIndex].get ();
124- if (!outDevice.commandStreamReceiver [deviceCsrIndex]->initializeTagAllocation ()) {
119+ auto osContext = executionEnvironment->memoryManager ->createAndRegisterOsContext ();
120+ auto commandStreamReceiver = executionEnvironment->commandStreamReceivers [outDevice.getDeviceIndex ()][deviceCsrIndex].get ();
121+ if (!commandStreamReceiver->initializeTagAllocation ()) {
125122 return false ;
126123 }
127124
125+ outDevice.engines .emplace_back (commandStreamReceiver, osContext);
126+
128127 auto pDevice = &outDevice;
129128 if (!pDevice->osTime ) {
130- pDevice->osTime = OSTime::create (outDevice. commandStreamReceiver [deviceCsrIndex] ->getOSInterface ());
129+ pDevice->osTime = OSTime::create (commandStreamReceiver->getOSInterface ());
131130 }
132- pDevice->driverInfo .reset (DriverInfo::create (outDevice. commandStreamReceiver [deviceCsrIndex] ->getOSInterface ()));
133- pDevice->tagAddress = reinterpret_cast <uint32_t *>(outDevice. commandStreamReceiver [deviceCsrIndex] ->getTagAllocation ()->getUnderlyingBuffer ());
131+ pDevice->driverInfo .reset (DriverInfo::create (commandStreamReceiver->getOSInterface ()));
132+ pDevice->tagAddress = reinterpret_cast <uint32_t *>(commandStreamReceiver->getTagAllocation ()->getUnderlyingBuffer ());
134133
135134 pDevice->initializeCaps ();
136135
@@ -142,8 +141,8 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
142141 }
143142
144143 uint32_t deviceHandle = 0 ;
145- if (outDevice. commandStreamReceiver [deviceCsrIndex] ->getOSInterface ()) {
146- deviceHandle = outDevice. commandStreamReceiver [deviceCsrIndex] ->getOSInterface ()->getDeviceHandle ();
144+ if (commandStreamReceiver->getOSInterface ()) {
145+ deviceHandle = commandStreamReceiver->getOSInterface ()->getDeviceHandle ();
147146 }
148147
149148 if (pDevice->deviceInfo .sourceLevelDebuggerActive ) {
@@ -160,14 +159,14 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
160159 if (!pDevice->preemptionAllocation ) {
161160 return false ;
162161 }
163- outDevice. commandStreamReceiver [deviceCsrIndex] ->setPreemptionCsrAllocation (pDevice->preemptionAllocation );
162+ commandStreamReceiver->setPreemptionCsrAllocation (pDevice->preemptionAllocation );
164163 auto sipType = SipKernel::getSipKernelType (pHwInfo->pPlatform ->eRenderCoreFamily , pDevice->isSourceLevelDebuggerActive ());
165164 initSipKernel (sipType, *pDevice);
166165 }
167166
168167 if (DebugManager.flags .EnableExperimentalCommandBuffer .get () > 0 ) {
169- outDevice. commandStreamReceiver [deviceCsrIndex] ->setExperimentalCmdBuffer (
170- std::unique_ptr<ExperimentalCommandBuffer>( new ExperimentalCommandBuffer (outDevice. commandStreamReceiver [deviceCsrIndex] , pDevice->getDeviceInfo ().profilingTimerResolution )));
168+ commandStreamReceiver->setExperimentalCmdBuffer (std::unique_ptr<ExperimentalCommandBuffer> (
169+ new ExperimentalCommandBuffer (commandStreamReceiver, pDevice->getDeviceInfo ().profilingTimerResolution )));
171170 }
172171
173172 return true ;
@@ -230,7 +229,7 @@ unique_ptr_if_unused<Device> Device::release() {
230229
231230bool Device::isSimulation () const {
232231 bool simulation = hwInfo.capabilityTable .isSimulation (hwInfo.pPlatform ->usDeviceID );
233- if (commandStreamReceiver [0 ]->getType () != CommandStreamReceiverType::CSR_HW) {
232+ if (engines [0 ]. commandStreamReceiver ->getType () != CommandStreamReceiverType::CSR_HW) {
234233 simulation = true ;
235234 }
236235 if (hwInfo.pSkuTable ->ftrSimulationMode ) {
0 commit comments