Allow Attempted Eviction When The Residency LRU Is Empty

Removes an assert when attempting to evict the residency LRU while
empty.

Bug: dawn:415
Change-Id: If346d0f2cc28ec089871b3c5aaf8f5641344f9fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22023
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
diff --git a/src/dawn_native/d3d12/ResidencyManagerD3D12.cpp b/src/dawn_native/d3d12/ResidencyManagerD3D12.cpp
index b790a80..9f9d964 100644
--- a/src/dawn_native/d3d12/ResidencyManagerD3D12.cpp
+++ b/src/dawn_native/d3d12/ResidencyManagerD3D12.cpp
@@ -146,7 +146,14 @@
     // nullptr when nothing further can be evicted.
     ResultOrError<Pageable*> ResidencyManager::RemoveSingleEntryFromLRU(
         MemorySegmentInfo* memorySegment) {
-        ASSERT(!memorySegment->lruCache.empty());
+        // If the LRU is empty, return nullptr to allow execution to continue. Note that fully
+        // emptying the LRU is undesirable, because it can mean either 1) the LRU is not accurately
+        // accounting for Dawn's GPU allocations, or 2) a component external to Dawn is using all of
+        // the process budget and starving Dawn, which will cause thrash.
+        if (memorySegment->lruCache.empty()) {
+            return nullptr;
+        }
+
         Pageable* pageable = memorySegment->lruCache.head()->value();
 
         Serial lastSubmissionSerial = pageable->GetLastSubmission();