From 6114e6612414afe2abeb668d0cdbfdab2c68fc8d Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Thu, 13 Apr 2023 10:31:17 +0200 Subject: [PATCH] broadcom/compiler: only use last thread switch flag to detect final section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit 'c98ddc778a3 broadcom/compiler: force a last thrsw for spilling' we always ensure we signal the last thread section explicitly with a last thread switch. Relying on VPM stores to detect the last thread section is particularly bad, because we can have VPM stores occurring quite early in a shader program, which would disable TMU spilling almost entirely. Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/compiler/vir_register_allocate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/broadcom/compiler/vir_register_allocate.c b/src/broadcom/compiler/vir_register_allocate.c index 66fe35371df..b22f915d1df 100644 --- a/src/broadcom/compiler/vir_register_allocate.c +++ b/src/broadcom/compiler/vir_register_allocate.c @@ -294,10 +294,6 @@ v3d_choose_spill_node(struct v3d_compile *c) if (inst->is_last_thrsw) started_last_seg = true; - if (v3d_qpu_writes_vpm(&inst->qpu) || - v3d_qpu_uses_tlb(&inst->qpu)) - started_last_seg = true; - /* Track when we're in between a TMU setup and the * final LDTMU or TMUWT from that TMU setup. We * penalize spills during that time. @@ -310,6 +306,11 @@ v3d_choose_spill_node(struct v3d_compile *c) } } + /* We always emit a "last thrsw" to ensure all our spilling occurs + * before the last thread section. See vir_emit_last_thrsw. + */ + assert(started_last_seg); + for (unsigned i = 0; i < c->num_temps; i++) { if (BITSET_TEST(c->spillable, i)) { ra_set_node_spill_cost(c->g, temp_to_node(i),