From 4c77f59e8a1841cc7cbfa771865a6e6655f2fe87 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 5 Mar 2024 18:33:06 -0400 Subject: [PATCH] agx/opt_preamble: restrain ourselves hoisting EVERYTHING is counterproductive now that we can remat constants. total instructions in shared programs: 2038818 -> 2038338 (-0.02%) instructions in affected programs: 33002 -> 32522 (-1.45%) helped: 9 HURT: 3 Instructions are helped. total alu in shared programs: 1594051 -> 1593474 (-0.04%) alu in affected programs: 22012 -> 21435 (-2.62%) helped: 12 HURT: 0 Alu are helped. total fscib in shared programs: 1590211 -> 1589634 (-0.04%) fscib in affected programs: 22012 -> 21435 (-2.62%) helped: 12 HURT: 0 Fscib are helped. total bytes in shared programs: 13978022 -> 13975162 (-0.02%) bytes in affected programs: 219746 -> 216886 (-1.30%) helped: 12 HURT: 0 Bytes are helped. total regs in shared programs: 592854 -> 592758 (-0.02%) regs in affected programs: 954 -> 858 (-10.06%) helped: 6 HURT: 0 Regs are helped. total uniforms in shared programs: 1516579 -> 1516534 (<.01%) uniforms in affected programs: 4605 -> 4560 (-0.98%) helped: 9 HURT: 0 Uniforms are helped. total threads in shared programs: 20329216 -> 20329600 (<.01%) threads in affected programs: 3840 -> 4224 (10.00%) helped: 6 HURT: 0 Threads are helped. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_nir_opt_preamble.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/asahi/compiler/agx_nir_opt_preamble.c b/src/asahi/compiler/agx_nir_opt_preamble.c index 79451c8d0a6..de906e555d9 100644 --- a/src/asahi/compiler/agx_nir_opt_preamble.c +++ b/src/asahi/compiler/agx_nir_opt_preamble.c @@ -168,7 +168,12 @@ static const nir_opt_preamble_options preamble_options = { .instr_cost_cb = instr_cost, .rewrite_cost_cb = rewrite_cost, .avoid_instr_cb = avoid_instr, - .preamble_storage_size = 512, + + /* hardware size is 512, but it's polite to leave some wiggle room to push + * hot constants so we don't end up rematerializing all over the place. + * 480 seems to be a sweetspot, based on a few minutes of shader-db. + */ + .preamble_storage_size = 480, }; bool