From 7ab7b9770e313f52f08621f26cf122f53bedfc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Mon, 21 Nov 2022 11:20:28 +0100 Subject: [PATCH] r300: allow more copy propagation with relative addressing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are now extremelly careful when copy propagating a mov that uses relative addressing. The search for readers will trigger abort when it sees any other instruction using a relative addressing, irrespective of the actual used registers or whether an address register load was seen. Additionally, since ntt switch all movs using the relative addressing are actually used only once right on the next line, and are result of ntt converting vec4 32 ssa_10 = intrinsic load_ubo_vec4 (ssa_0, ssa_9) (access=0, base=11, component=0) into 5: ARL ADDR[0].x, TEMP[0].xxxx 6: MOV TEMP[2], CONST[0][ADDR[0].x+11] RV530 shader-db: total instructions in shared programs: 132966 -> 131904 (-0.80%) instructions in affected programs: 29896 -> 28834 (-3.55%) helped: 234 HURT: 2 total temps in shared programs: 16969 -> 16905 (-0.38%) temps in affected programs: 604 -> 540 (-10.60%) helped: 68 HURT: 12 Partial fix for: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7723 Signed-off-by: Pavel Ondračka Reviewed-by: Filip Gawin Part-of: --- src/gallium/drivers/r300/compiler/radeon_dataflow.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_dataflow.c b/src/gallium/drivers/r300/compiler/radeon_dataflow.c index 94ee92131ce..247106e87ec 100644 --- a/src/gallium/drivers/r300/compiler/radeon_dataflow.c +++ b/src/gallium/drivers/r300/compiler/radeon_dataflow.c @@ -511,18 +511,12 @@ static void add_reader_pair( static unsigned int get_readers_read_callback( struct get_readers_callback_data * cb_data, - unsigned int has_rel_addr, rc_register_file file, unsigned int index, unsigned int swizzle) { unsigned int shared_mask, read_mask; - if (has_rel_addr) { - cb_data->ReaderData->Abort = 1; - return RC_MASK_NONE; - } - shared_mask = rc_src_reads_dst_mask(file, index, swizzle, cb_data->DstFile, cb_data->DstIndex, cb_data->AliveWriteMask); @@ -562,7 +556,6 @@ static void get_readers_pair_read_callback( struct get_readers_callback_data * d = userdata; shared_mask = get_readers_read_callback(d, - 0 /*Pair Instructions don't use RelAddr*/, src->File, src->Index, arg->Swizzle); if (shared_mask == RC_MASK_NONE) @@ -590,7 +583,7 @@ static void get_readers_normal_read_callback( unsigned int shared_mask; shared_mask = get_readers_read_callback(d, - src->RelAddr, src->File, src->Index, src->Swizzle); + src->File, src->Index, src->Swizzle); if (shared_mask == RC_MASK_NONE) return;