agx: Dump register file when failing to allocate
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 24 Jul 2021 18:54:34 +0000 (14:54 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 24 Jul 2021 18:54:34 +0000 (14:54 -0400)
Usually shows a bug.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12053>

src/asahi/compiler/agx_register_allocate.c

index 1d347ac..b5e9000 100644 (file)
@@ -89,6 +89,14 @@ agx_assign_regs(BITSET_WORD *used_regs, unsigned count, unsigned align, unsigned
       }
    }
 
+   /* Couldn't find a free register, dump the state of the register file */
+   fprintf(stderr, "Failed to find register of size %u aligned %u max %u.\n",
+           count, align, max);
+
+   fprintf(stderr, "Register file:\n");
+   for (unsigned i = 0; i < BITSET_WORDS(max); ++i)
+      fprintf(stderr, "    %08X\n", used_regs[i]);
+
    unreachable("Could not find a free register");
 }