From d17dd8332e5f4d0231e0c8298b0efc2fbcefeb14 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 24 Jun 2025 12:09:03 -0400 Subject: [PATCH] hk: sink SSBO loads Seems to hit instr count due to RA lottery but reduce reg pressure a LOT so, probably worth it. Totals from 5305 (9.88% of 53701) affected shaders: MaxWaves: 4487168 -> 4551040 (+1.42%); split: +1.51%, -0.09% Instrs: 6063323 -> 6178678 (+1.90%); split: -0.17%, +2.07% CodeSize: 44356516 -> 44662024 (+0.69%); split: -0.21%, +0.90% Spills: 7321 -> 4034 (-44.90%); split: -45.49%, +0.59% Fills: 8522 -> 5069 (-40.52%); split: -40.87%, +0.35% Scratch: 21940 -> 9856 (-55.08%); split: -55.17%, +0.09% ALU: 4541440 -> 4554906 (+0.30%); split: -0.20%, +0.50% FSCIB: 4541440 -> 4554906 (+0.30%); split: -0.20%, +0.50% IC: 1180150 -> 1184856 (+0.40%); split: -0.01%, +0.41% GPRs: 605023 -> 576336 (-4.74%); split: -5.00%, +0.26% Uniforms: 1421832 -> 1425367 (+0.25%); split: -0.08%, +0.33% Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/vulkan/hk_shader.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/asahi/vulkan/hk_shader.c b/src/asahi/vulkan/hk_shader.c index cc9f6c388ec..40174388edd 100644 --- a/src/asahi/vulkan/hk_shader.c +++ b/src/asahi/vulkan/hk_shader.c @@ -846,6 +846,9 @@ hk_lower_nir(struct hk_device *dev, nir_shader *nir, NIR_PASS(progress, nir, nir_opt_dce); } while (progress); + NIR_PASS(progress, nir, nir_opt_sink, nir_move_load_ssbo); + NIR_PASS(progress, nir, nir_opt_move, nir_move_load_ssbo); + bool soft_fault = agx_has_soft_fault(&dev->dev); NIR_PASS(_, nir, nir_shader_intrinsics_pass, lower_load_global_constant_offset_instr, nir_metadata_none,