From 596682ad4b5f0449f463990914fe7895fd414143 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 19 Aug 2023 19:49:09 -0400 Subject: [PATCH] nir/opt_sink: Sink load_constant_agx MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit By the time this runs, we will have already lowered load_ubo and load_vbo to load_constant_agx so we need to handle the backend version. This is very important for reducing register pressure in monolithic VS+GS shaders on AGX. Since no other backend has _agx intrinsics, there's no need for an option to gate this. The additional instruction count is from more frequent wait instructions due to fewer instructions grouped together. This should be mitigated in the future with an ACO-style latency-reducing scheduler in the backend, after register pressure is reduced by opt_sink. total instructions in shared programs: 1793385 -> 1796101 (0.15%) instructions in affected programs: 199816 -> 202532 (1.36%) helped: 3 HURT: 941 Instructions are HURT. total bytes in shared programs: 11799628 -> 11805004 (0.05%) bytes in affected programs: 1345656 -> 1351032 (0.40%) helped: 34 HURT: 919 Bytes are HURT. total halfregs in shared programs: 533151 -> 525818 (-1.38%) halfregs in affected programs: 40335 -> 33002 (-18.18%) helped: 613 HURT: 42 Halfregs are helped. total threads in shared programs: 18910464 -> 18916608 (0.03%) threads in affected programs: 6144 -> 12288 (100.00%) helped: 12 HURT: 0 Threads are helped. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Daniel Schürmann Part-of: --- src/compiler/nir/nir_opt_sink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/nir/nir_opt_sink.c b/src/compiler/nir/nir_opt_sink.c index f6b4cb1..447fa68 100644 --- a/src/compiler/nir/nir_opt_sink.c +++ b/src/compiler/nir/nir_opt_sink.c @@ -65,6 +65,8 @@ nir_can_move_instr(nir_instr *instr, nir_move_options options) return options & nir_move_load_input; case nir_intrinsic_load_uniform: return options & nir_move_load_uniform; + case nir_intrinsic_load_constant_agx: + return true; default: return false; } -- 2.7.4