ac/nir: Add bool return value to ac_nir_lower_task_outputs_to_mem.

And fixup its NIR counterparts too.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33609>
This commit is contained in:
Timur Kristóf 2025-02-18 17:09:54 +01:00
parent 65645f6841
commit 9e7609b0ff
3 changed files with 17 additions and 10 deletions

View file

@ -194,7 +194,7 @@ ac_nir_lower_ngg_mesh(nir_shader *shader,
bool has_query,
bool fast_launch_2);
void
bool
ac_nir_lower_task_outputs_to_mem(nir_shader *shader,
unsigned task_payload_entry_bytes,
unsigned task_num_entries,

View file

@ -275,18 +275,19 @@ lower_task_intrinsics(nir_builder *b,
}
}
void
bool
ac_nir_lower_task_outputs_to_mem(nir_shader *shader,
unsigned task_payload_entry_bytes,
unsigned task_num_entries,
bool has_query)
{
assert(util_is_power_of_two_nonzero(task_num_entries));
bool progress = false;
nir_lower_task_shader_options lower_ts_opt = {
.payload_to_shared_for_atomics = true,
};
nir_lower_task_shader(shader, lower_ts_opt);
progress |= nir_lower_task_shader(shader, lower_ts_opt);
lower_tsms_io_state state = {
.draw_entry_bytes = 16,
@ -295,15 +296,20 @@ ac_nir_lower_task_outputs_to_mem(nir_shader *shader,
.has_query = has_query,
};
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
progress |= nir_shader_lower_instructions(shader,
filter_task_intrinsics,
lower_task_intrinsics,
&state);
nir_shader_lower_instructions(shader,
filter_task_intrinsics,
lower_task_intrinsics,
&state);
if (progress) {
/* The nir_shader_lower_instructions pass can't detect the CF changes
* that are made by lower_task_launch_mesh_workgroups.
*/
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_metadata_preserve(impl, nir_metadata_none);
}
nir_metadata_preserve(impl, nir_metadata_none);
nir_validate_shader(shader, "after lowering task shader outputs to memory stores");
return progress;
}
static bool

View file

@ -446,6 +446,7 @@ nir_lower_task_shader(nir_shader *shader,
nir_block *last_block = nir_impl_last_block(impl);
builder.cursor = nir_after_block_before_jump(last_block);
nir_launch_mesh_workgroups(&builder, nir_imm_zero(&builder, 3, 32));
nir_metadata_preserve(impl, nir_metadata_control_flow);
}
bool atomics = options.payload_to_shared_for_atomics;