From b18181d924dc607bc0206b65280adc6cbf0a3dc0 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 13 Oct 2023 06:45:46 -0400 Subject: [PATCH] agx: Check for spilling in release builds Don't smash stack -- explain to the user what happened. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_register_allocate.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c index 18f3f577bdd..18088abd13c 100644 --- a/src/asahi/compiler/agx_register_allocate.c +++ b/src/asahi/compiler/agx_register_allocate.c @@ -1145,6 +1145,19 @@ agx_ra(agx_context *ctx) unsigned demand = ALIGN_POT(agx_calc_register_demand(ctx, ncomps), reg_file_alignment); + /* TODO: Spilling. Abort so we don't smash the stack in release builds. */ + if (demand > AGX_NUM_REGS) { + fprintf(stderr, "\n"); + fprintf(stderr, "------------------------------------------------\n"); + fprintf(stderr, "Asahi Linux shader compiler limitation!\n"); + fprintf(stderr, "We ran out of registers! Nyaaaa 😿\n"); + fprintf(stderr, "Do not report this as a bug.\n"); + fprintf(stderr, "We know -- we're working on it!\n"); + fprintf(stderr, "------------------------------------------------\n"); + fprintf(stderr, "\n"); + abort(); + } + /* Round up the demand to the maximum number of registers we can use without * affecting occupancy. This reduces live range splitting. */