@@ -183,13 +183,12 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
183183
184184 spaceForResidency += residencyContainerSpaceForTagWrite;
185185
186- residencyContainer .reserve (spaceForResidency);
186+ csr-> getResidencyAllocations () .reserve (spaceForResidency);
187187
188188 auto scratchSpaceController = csr->getScratchSpaceController ();
189189 bool gsbaStateDirty = false ;
190190 bool frontEndStateDirty = false ;
191- handleScratchSpace (residencyContainer,
192- heapContainer,
191+ handleScratchSpace (heapContainer,
193192 scratchSpaceController,
194193 gsbaStateDirty, frontEndStateDirty,
195194 perThreadScratchSpaceSize);
@@ -223,26 +222,26 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
223222
224223 const auto globalFenceAllocation = csr->getGlobalFenceAllocation ();
225224 if (globalFenceAllocation) {
226- residencyContainer. push_back ( globalFenceAllocation);
225+ csr-> makeResident (* globalFenceAllocation);
227226 }
228227 const auto workPartitionAllocation = csr->getWorkPartitionAllocation ();
229228 if (workPartitionAllocation) {
230- residencyContainer. push_back ( workPartitionAllocation);
229+ csr-> makeResident (* workPartitionAllocation);
231230 }
232231
233232 if (NEO::DebugManager.flags .EnableSWTags .get ()) {
234233 NEO::SWTagsManager *tagsManager = neoDevice->getRootDeviceEnvironment ().tagsManager .get ();
235234 UNRECOVERABLE_IF (tagsManager == nullptr );
236- residencyContainer. push_back ( tagsManager->getBXMLHeapAllocation ());
237- residencyContainer. push_back ( tagsManager->getSWTagHeapAllocation ());
235+ csr-> makeResident (* tagsManager->getBXMLHeapAllocation ());
236+ csr-> makeResident (* tagsManager->getSWTagHeapAllocation ());
238237 tagsManager->insertBXMLHeapAddress <GfxFamily>(child);
239238 tagsManager->insertSWTagHeapAddress <GfxFamily>(child);
240239 }
241240
242241 csr->programHardwareContext (child);
243242
244243 if (NEO::Debugger::isDebugEnabled (internalUsage) && device->getL0Debugger ()) {
245- residencyContainer. push_back ( device->getL0Debugger ()->getSbaTrackingBuffer (csr->getOsContext ().getContextId ()));
244+ csr-> makeResident (* device->getL0Debugger ()->getSbaTrackingBuffer (csr->getOsContext ().getContextId ()));
246245 }
247246
248247 if (!isCopyOnlyCommandQueue) {
@@ -281,17 +280,17 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
281280 (neoDevice->getDebugger () != nullptr && NEO::Debugger::isDebugEnabled (internalUsage));
282281
283282 if (devicePreemption == NEO::PreemptionMode::MidThread) {
284- residencyContainer. push_back ( csr->getPreemptionAllocation ());
283+ csr-> makeResident (* csr->getPreemptionAllocation ());
285284 }
286285
287286 if (sipKernelUsed) {
288287 auto sipIsa = NEO::SipKernel::getSipKernel (*neoDevice).getSipAllocation ();
289- residencyContainer. push_back ( sipIsa);
288+ csr-> makeResident (* sipIsa);
290289 }
291290
292291 if (NEO::Debugger::isDebugEnabled (internalUsage) && neoDevice->getDebugger ()) {
293292 UNRECOVERABLE_IF (device->getDebugSurface () == nullptr );
294- residencyContainer. push_back ( device->getDebugSurface ());
293+ csr-> makeResident (* device->getDebugSurface ());
295294 }
296295 }
297296
@@ -355,9 +354,9 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
355354 commandList->getPrintfFunctionContainer ().end ());
356355
357356 for (auto alloc : commandList->commandContainer .getResidencyContainer ()) {
358- if (residencyContainer .end () ==
359- std::find (residencyContainer .begin (), residencyContainer .end (), alloc)) {
360- residencyContainer. push_back ( alloc);
357+ if (csr-> getResidencyAllocations () .end () ==
358+ std::find (csr-> getResidencyAllocations () .begin (), csr-> getResidencyAllocations () .end (), alloc)) {
359+ csr-> makeResident (* alloc);
361360
362361 if (performMigration) {
363362 if (alloc &&
@@ -385,7 +384,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
385384 commandQueuePreemptionMode = statePreemption;
386385
387386 if (hFence) {
388- residencyContainer. push_back (& fence->getAllocation ());
387+ csr-> makeResident ( fence->getAllocation ());
389388 if (isCopyOnlyCommandQueue) {
390389 NEO::EncodeMiFlushDW<GfxFamily>::programMiFlushDw (child, fence->getGpuAddress (), Fence::STATE_SIGNALED, false , true );
391390 } else {
@@ -401,7 +400,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
401400
402401 dispatchTaskCountWrite (child, true );
403402
404- residencyContainer. push_back ( csr->getTagAllocation ());
403+ csr-> makeResident (* csr->getTagAllocation ());
405404 void *endingCmd = nullptr ;
406405 if (directSubmissionEnabled) {
407406 endingCmd = child.getSpace (0 );
@@ -417,17 +416,16 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
417416 memset (paddingPtr, 0 , padding);
418417 }
419418
420- submitBatchBuffer (ptrDiff (child.getCpuBase (), commandStream->getCpuBase ()), residencyContainer , endingCmd);
419+ submitBatchBuffer (ptrDiff (child.getCpuBase (), commandStream->getCpuBase ()), csr-> getResidencyAllocations () , endingCmd);
421420
422421 this ->taskCount = csr->peekTaskCount ();
423422
424- csr->makeSurfacePackNonResident (residencyContainer );
423+ csr->makeSurfacePackNonResident (csr-> getResidencyAllocations () );
425424
426425 if (getSynchronousMode () == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS) {
427426 this ->synchronize (std::numeric_limits<uint64_t >::max ());
428427 }
429428
430- this ->residencyContainer .clear ();
431429 this ->heapContainer .clear ();
432430
433431 return ZE_RESULT_SUCCESS;
0 commit comments