nir: rename nir_lower_io_to_scalar_early -> nir_lower_io_vars_to_scalar

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35760>
This commit is contained in:
Marek Olšák 2025-06-25 17:45:31 -04:00 committed by Marge Bot
parent b83f618fb2
commit 439d805291
11 changed files with 20 additions and 20 deletions

View file

@ -61,7 +61,7 @@ bool radv_nir_lower_viewport_to_zero(nir_shader *nir);
bool radv_nir_export_multiview(nir_shader *nir);
void radv_nir_lower_io_to_scalar_early(nir_shader *nir, nir_variable_mode mask);
void radv_nir_lower_io_vars_to_scalar(nir_shader *nir, nir_variable_mode mask);
unsigned radv_map_io_driver_location(unsigned semantic);

View file

@ -22,11 +22,11 @@ type_size_vec4(const struct glsl_type *type, bool bindless)
}
void
radv_nir_lower_io_to_scalar_early(nir_shader *nir, nir_variable_mode mask)
radv_nir_lower_io_vars_to_scalar(nir_shader *nir, nir_variable_mode mask)
{
bool progress = false;
NIR_PASS(progress, nir, nir_lower_io_to_scalar_early, mask);
NIR_PASS(progress, nir, nir_lower_io_vars_to_scalar, mask);
if (progress) {
/* Optimize the new vector code and then remove dead vars */
NIR_PASS(_, nir, nir_copy_prop);

View file

@ -1196,8 +1196,8 @@ radv_link_shaders(const struct radv_device *device, struct radv_shader_stage *pr
nir_validate_shader(producer, "after nir_lower_io_arrays_to_elements");
nir_validate_shader(consumer, "after nir_lower_io_arrays_to_elements");
radv_nir_lower_io_to_scalar_early(producer, nir_var_shader_out);
radv_nir_lower_io_to_scalar_early(consumer, nir_var_shader_in);
radv_nir_lower_io_vars_to_scalar(producer, nir_var_shader_out);
radv_nir_lower_io_vars_to_scalar(consumer, nir_var_shader_in);
/* Remove PSIZ from shaders when it's not needed.
* This is typically produced by translation layers like Zink or D9VK.

View file

@ -1018,7 +1018,7 @@ v3d_nir_lower_vs_early(struct v3d_compile *c)
/* Split our I/O vars and dead code eliminate the unused
* components.
*/
NIR_PASS(_, c->s, nir_lower_io_to_scalar_early,
NIR_PASS(_, c->s, nir_lower_io_vars_to_scalar,
nir_var_shader_in | nir_var_shader_out);
uint64_t used_outputs[4] = {0};
for (int i = 0; i < c->vs_key->num_used_outputs; i++) {
@ -1060,7 +1060,7 @@ v3d_nir_lower_gs_early(struct v3d_compile *c)
/* Split our I/O vars and dead code eliminate the unused
* components.
*/
NIR_PASS(_, c->s, nir_lower_io_to_scalar_early,
NIR_PASS(_, c->s, nir_lower_io_vars_to_scalar,
nir_var_shader_in | nir_var_shader_out);
uint64_t used_outputs[4] = {0};
for (int i = 0; i < c->gs_key->num_used_outputs; i++) {

View file

@ -1744,8 +1744,8 @@ link_shaders(nir_shader *producer, nir_shader *consumer)
assert(consumer);
if (producer->options->lower_to_scalar) {
NIR_PASS(_, producer, nir_lower_io_to_scalar_early, nir_var_shader_out);
NIR_PASS(_, consumer, nir_lower_io_to_scalar_early, nir_var_shader_in);
NIR_PASS(_, producer, nir_lower_io_vars_to_scalar, nir_var_shader_out);
NIR_PASS(_, consumer, nir_lower_io_vars_to_scalar, nir_var_shader_in);
}
nir_lower_io_arrays_to_elements(producer, consumer);

View file

@ -4008,8 +4008,8 @@ link_shader_opts(struct varying_matches *vm,
*/
if (producer->options->lower_to_scalar && !vm->disable_varying_packing &&
!vm->disable_xfb_packing) {
NIR_PASS(_, producer, nir_lower_io_to_scalar_early, nir_var_shader_out);
NIR_PASS(_, consumer, nir_lower_io_to_scalar_early, nir_var_shader_in);
NIR_PASS(_, producer, nir_lower_io_vars_to_scalar, nir_var_shader_out);
NIR_PASS(_, consumer, nir_lower_io_vars_to_scalar, nir_var_shader_in);
}
gl_nir_opts(producer);

View file

@ -5312,7 +5312,7 @@ void nir_lower_io_arrays_to_elements(nir_shader *producer, nir_shader *consumer)
bool nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader,
bool outputs_only);
bool nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask, nir_instr_filter_cb filter, void *filter_data);
bool nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask);
bool nir_lower_io_vars_to_scalar(nir_shader *shader, nir_variable_mode mask);
bool nir_lower_io_to_vector(nir_shader *shader, nir_variable_mode mask);
bool nir_vectorize_tess_levels(nir_shader *shader);
nir_shader *nir_create_passthrough_tcs_impl(const nir_shader_compiler_options *options,

View file

@ -493,7 +493,7 @@ struct io_to_scalar_early_state {
};
static bool
nir_lower_io_to_scalar_early_instr(nir_builder *b, nir_instr *instr, void *data)
nir_lower_io_vars_to_scalar_instr(nir_builder *b, nir_instr *instr, void *data)
{
struct io_to_scalar_early_state *state = data;
@ -580,7 +580,7 @@ nir_lower_io_to_scalar_early_instr(nir_builder *b, nir_instr *instr, void *data)
* i.e. before nir_lower_io() is called.
*/
bool
nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask)
nir_lower_io_vars_to_scalar(nir_shader *shader, nir_variable_mode mask)
{
struct io_to_scalar_early_state state = {
.split_inputs = _mesa_pointer_hash_table_create(NULL),
@ -589,7 +589,7 @@ nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask)
};
bool progress = nir_shader_instructions_pass(shader,
nir_lower_io_to_scalar_early_instr,
nir_lower_io_vars_to_scalar_instr,
nir_metadata_control_flow,
&state);

View file

@ -2786,7 +2786,7 @@ static void
lower_io_to_scalar_early(nir_shader *nir, nir_variable_mode mask)
{
bool progress = false;
NIR_PASS(progress, nir, nir_lower_io_to_scalar_early, mask);
NIR_PASS(progress, nir, nir_lower_io_vars_to_scalar, mask);
if (progress) {
/* Optimize the new vector code and then remove dead vars. */

View file

@ -1489,8 +1489,8 @@ brw_nir_link_shaders(const struct brw_compiler *compiler,
nir_validate_shader(producer, "after nir_lower_io_arrays_to_elements");
nir_validate_shader(consumer, "after nir_lower_io_arrays_to_elements");
NIR_PASS(_, producer, nir_lower_io_to_scalar_early, nir_var_shader_out);
NIR_PASS(_, consumer, nir_lower_io_to_scalar_early, nir_var_shader_in);
NIR_PASS(_, producer, nir_lower_io_vars_to_scalar, nir_var_shader_out);
NIR_PASS(_, consumer, nir_lower_io_vars_to_scalar, nir_var_shader_in);
brw_nir_optimize(producer, devinfo);
brw_nir_optimize(consumer, devinfo);

View file

@ -1152,8 +1152,8 @@ elk_nir_link_shaders(const struct elk_compiler *compiler,
const bool c_is_scalar = compiler->scalar_stage[consumer->info.stage];
if (p_is_scalar && c_is_scalar) {
NIR_PASS(_, producer, nir_lower_io_to_scalar_early, nir_var_shader_out);
NIR_PASS(_, consumer, nir_lower_io_to_scalar_early, nir_var_shader_in);
NIR_PASS(_, producer, nir_lower_io_vars_to_scalar, nir_var_shader_out);
NIR_PASS(_, consumer, nir_lower_io_vars_to_scalar, nir_var_shader_in);
elk_nir_optimize(producer, p_is_scalar, devinfo);
elk_nir_optimize(consumer, c_is_scalar, devinfo);
}