@@ -175,11 +175,8 @@ void MemoryManager::storeAllocation(std::unique_ptr<GraphicsAllocation> gfxAlloc
175175 uint32_t taskCount = gfxAllocation->taskCount ;
176176
177177 if (allocationUsage == REUSABLE_ALLOCATION) {
178- if (csr) {
179- taskCount = csr->peekTaskCount ();
180- } else {
181- taskCount = 0 ;
182- }
178+ UNRECOVERABLE_IF (!csr);
179+ taskCount = csr->peekTaskCount ();
183180 }
184181
185182 storeAllocation (std::move (gfxAllocation), allocationUsage, taskCount);
@@ -201,8 +198,9 @@ void MemoryManager::storeAllocation(std::unique_ptr<GraphicsAllocation> gfxAlloc
201198}
202199
203200std::unique_ptr<GraphicsAllocation> MemoryManager::obtainReusableAllocation (size_t requiredSize, bool internalAllocation) {
201+ UNRECOVERABLE_IF (!csr);
204202 std::lock_guard<decltype (mtx)> lock (mtx);
205- auto allocation = allocationsForReuse.detachAllocation (requiredSize, csr ? csr ->getTagAddress () : nullptr , internalAllocation);
203+ auto allocation = allocationsForReuse.detachAllocation (requiredSize, csr->getTagAddress (), internalAllocation);
206204 return allocation;
207205}
208206
@@ -322,32 +320,27 @@ RequirementsStatus MemoryManager::checkAllocationsForOverlapping(AllocationRequi
322320 checkedFragments->fragments [i] = hostPtrManager.getFragmentAndCheckForOverlaps (requirements->AllocationFragments [i].allocationPtr , requirements->AllocationFragments [i].allocationSize , checkedFragments->status [i]);
323321 if (checkedFragments->status [i] == OverlapStatus::FRAGMENT_OVERLAPING_AND_BIGGER_THEN_STORED_FRAGMENT) {
324322 // clean temporary allocations
325- if (csr != nullptr ) {
326- uint32_t taskCount = *csr->getTagAddress ();
323+ UNRECOVERABLE_IF (!csr);
324+ uint32_t taskCount = *csr->getTagAddress ();
325+ cleanAllocationList (taskCount, TEMPORARY_ALLOCATION);
326+
327+ // check overlapping again
328+ checkedFragments->fragments [i] = hostPtrManager.getFragmentAndCheckForOverlaps (requirements->AllocationFragments [i].allocationPtr , requirements->AllocationFragments [i].allocationSize , checkedFragments->status [i]);
329+
330+ if (checkedFragments->status [i] == OverlapStatus::FRAGMENT_OVERLAPING_AND_BIGGER_THEN_STORED_FRAGMENT) {
331+ // Wait for completion
332+ while (*csr->getTagAddress () < csr->peekLatestSentTaskCount ()) {
333+ }
334+
335+ taskCount = *csr->getTagAddress ();
327336 cleanAllocationList (taskCount, TEMPORARY_ALLOCATION);
328337
329- // check overlapping again
338+ // check overlapping last time
330339 checkedFragments->fragments [i] = hostPtrManager.getFragmentAndCheckForOverlaps (requirements->AllocationFragments [i].allocationPtr , requirements->AllocationFragments [i].allocationSize , checkedFragments->status [i]);
331-
332340 if (checkedFragments->status [i] == OverlapStatus::FRAGMENT_OVERLAPING_AND_BIGGER_THEN_STORED_FRAGMENT) {
333- // Wait for completion
334- while (*csr->getTagAddress () < csr->peekLatestSentTaskCount ()) {
335- }
336-
337- taskCount = *csr->getTagAddress ();
338- cleanAllocationList (taskCount, TEMPORARY_ALLOCATION);
339-
340- // check overlapping last time
341- checkedFragments->fragments [i] = hostPtrManager.getFragmentAndCheckForOverlaps (requirements->AllocationFragments [i].allocationPtr , requirements->AllocationFragments [i].allocationSize , checkedFragments->status [i]);
342- if (checkedFragments->status [i] == OverlapStatus::FRAGMENT_OVERLAPING_AND_BIGGER_THEN_STORED_FRAGMENT) {
343- status = RequirementsStatus::FATAL;
344- break ;
345- }
341+ status = RequirementsStatus::FATAL;
342+ break ;
346343 }
347- } else {
348- // This path is tested in ULTs
349- status = RequirementsStatus::FATAL;
350- break ;
351344 }
352345 }
353346 }
0 commit comments