diff --git a/src/amd/common/nir/ac_nir.c b/src/amd/common/nir/ac_nir.c index 818f52b8427..b652dfcf996 100644 --- a/src/amd/common/nir/ac_nir.c +++ b/src/amd/common/nir/ac_nir.c @@ -227,7 +227,7 @@ ac_nir_lower_indirect_derefs(nir_shader *shader, /* Lower large variables to scratch first so that we won't bloat the * shader by generating large if ladders for them. */ - NIR_PASS(progress, shader, nir_lower_vars_to_scratch, nir_var_function_temp, 256, + NIR_PASS(progress, shader, nir_lower_vars_to_scratch, 256, glsl_get_natural_size_align_bytes, glsl_get_natural_size_align_bytes); /* This lowers indirect indexing to if-else ladders. */ diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 5d90fd8c57b..78b473db873 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -3685,7 +3685,7 @@ agx_preprocess_nir(nir_shader *nir) NIR_PASS(_, nir, nir_lower_vars_to_ssa); /* Lower large arrays to scratch and small arrays to csel */ - NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 256, + NIR_PASS(_, nir, nir_lower_vars_to_scratch, 256, glsl_get_natural_size_align_bytes, glsl_get_word_size_align_bytes); NIR_PASS(_, nir, nir_lower_indirect_derefs_to_if_else_trees, nir_var_function_temp, ~0); @@ -3801,7 +3801,7 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, /* Optimize scratch access for silly internal CL shaders */ if (nir->info.internal) { NIR_PASS(_, nir, nir_lower_scratch_to_var); - NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 256, + NIR_PASS(_, nir, nir_lower_vars_to_scratch, 256, glsl_get_natural_size_align_bytes, glsl_get_natural_size_align_bytes); NIR_PASS(_, nir, nir_lower_indirect_derefs_to_if_else_trees, diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index 801daeef001..a6e5c415830 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -1839,7 +1839,6 @@ v3d_attempt_compile(struct v3d_compile *c) } NIR_PASS(_, c->s, nir_lower_vars_to_scratch, - nir_var_function_temp, 0, glsl_get_natural_size_align_bytes, glsl_get_natural_size_align_bytes); diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 29d4d8b9928..d31219ff2b5 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -5190,7 +5190,6 @@ bool nir_lower_io_vars_to_temporaries(nir_shader *shader, nir_variable_mode modes); bool nir_lower_vars_to_scratch(nir_shader *shader, - nir_variable_mode modes, int size_threshold, glsl_type_size_align_func variable_size_align, glsl_type_size_align_func scratch_layout_size_align); diff --git a/src/compiler/nir/nir_lower_scratch.c b/src/compiler/nir/nir_lower_scratch.c index b0046a1218e..151c63edb11 100644 --- a/src/compiler/nir/nir_lower_scratch.c +++ b/src/compiler/nir/nir_lower_scratch.c @@ -93,7 +93,6 @@ only_used_for_load_store(nir_deref_instr *deref) bool nir_lower_vars_to_scratch(nir_shader *shader, - nir_variable_mode modes, int size_threshold, glsl_type_size_align_func variable_size_align, glsl_type_size_align_func scratch_layout_size_align) @@ -115,7 +114,7 @@ nir_lower_vars_to_scratch(nir_shader *shader, continue; nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]); - if (!nir_deref_mode_is_one_of(deref, modes)) + if (!nir_deref_mode_is_one_of(deref, nir_var_function_temp)) continue; if (!nir_deref_instr_has_indirect(nir_src_as_deref(intrin->src[0]))) @@ -227,3 +226,4 @@ nir_lower_vars_to_scratch(nir_shader *shader, return progress; } + diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index 92bcc45dd51..814a3c42aac 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -1199,7 +1199,7 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, * expensive. */ if (so->compiler->has_pvtmem) { - progress |= OPT(s, nir_lower_vars_to_scratch, nir_var_function_temp, + progress |= OPT(s, nir_lower_vars_to_scratch, 16 * 16 /* bytes */, ir3_get_variable_size_align_bytes, glsl_get_natural_size_align_bytes); } diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp index a5fc37bf548..b831f54ca88 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp @@ -869,7 +869,6 @@ r600_lower_and_optimize_nir(nir_shader *sh, NIR_PASS(_, sh, nir_lower_vars_to_scratch, - nir_var_function_temp, 64, r600_get_scratch_size_align, r600_get_scratch_size_align); diff --git a/src/imagination/pco/pco_nir.c b/src/imagination/pco/pco_nir.c index e05eeb2c5f5..c674119fc94 100644 --- a/src/imagination/pco/pco_nir.c +++ b/src/imagination/pco/pco_nir.c @@ -596,7 +596,6 @@ void pco_preprocess_nir(pco_ctx *ctx, nir_shader *nir) NIR_PASS(_, nir, nir_lower_vars_to_scratch, - nir_var_function_temp, 8, glsl_get_natural_size_align_bytes, glsl_get_word_size_align_bytes); diff --git a/src/kosmickrisp/compiler/nir_to_msl.c b/src/kosmickrisp/compiler/nir_to_msl.c index 05ae9eca9a3..96ae7cfac44 100644 --- a/src/kosmickrisp/compiler/nir_to_msl.c +++ b/src/kosmickrisp/compiler/nir_to_msl.c @@ -1931,7 +1931,7 @@ msl_preprocess_nir(struct nir_shader *nir) NIR_PASS(_, nir, nir_lower_indirect_derefs_to_if_else_trees, nir_var_shader_in | nir_var_shader_out, UINT32_MAX); - NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 0, + NIR_PASS(_, nir, nir_lower_vars_to_scratch, 0, glsl_get_natural_size_align_bytes, glsl_get_natural_size_align_bytes); diff --git a/src/kosmickrisp/vulkan/kk_shader.c b/src/kosmickrisp/vulkan/kk_shader.c index 2e2d845cf50..f3bbbb92c29 100644 --- a/src/kosmickrisp/vulkan/kk_shader.c +++ b/src/kosmickrisp/vulkan/kk_shader.c @@ -442,7 +442,7 @@ kk_lower_nir(struct kk_device *dev, nir_shader *nir, /* kk_nir_lower_vs_multiview may create a temporary array to assign the * correct view index. Since we don't handle derefs, we need to get rid of * them. */ - NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 0, + NIR_PASS(_, nir, nir_lower_vars_to_scratch, 0, glsl_get_natural_size_align_bytes, glsl_get_natural_size_align_bytes); diff --git a/src/panfrost/compiler/bifrost/bifrost_compile.c b/src/panfrost/compiler/bifrost/bifrost_compile.c index 559b870c03c..a64be1dde5a 100644 --- a/src/panfrost/compiler/bifrost/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost/bifrost_compile.c @@ -6238,7 +6238,7 @@ bifrost_preprocess_nir(nir_shader *nir, unsigned gpu_id) : glsl_get_natural_size_align_bytes; /* Lower large arrays to scratch and small arrays to bcsel */ NIR_PASS(_, nir, nir_lower_scratch_to_var); - NIR_PASS(_, nir, nir_lower_vars_to_scratch, nir_var_function_temp, 256, + NIR_PASS(_, nir, nir_lower_vars_to_scratch, 256, vars_to_scratch_size_align_func, vars_to_scratch_size_align_func); NIR_PASS(_, nir, nir_lower_indirect_derefs_to_if_else_trees, nir_var_function_temp, ~0);