mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
nir: remove nir_update_instr_divergence()
This function has obscure limitations. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30787>
This commit is contained in:
parent
ce0a3fe645
commit
421b42637d
5 changed files with 2 additions and 41 deletions
|
|
@ -134,6 +134,7 @@ radv_build_printf(nir_builder *b, nir_def *cond, const char *format_string, ...)
|
|||
|
||||
for (uint32_t i = 0; i < num_args; i++) {
|
||||
nir_def *arg = va_arg(arg_list, nir_def *);
|
||||
bool divergent = arg->divergent;
|
||||
|
||||
if (arg->bit_size == 1)
|
||||
arg = nir_b2i32(b, arg);
|
||||
|
|
@ -143,9 +144,7 @@ radv_build_printf(nir_builder *b, nir_def *cond, const char *format_string, ...)
|
|||
uint32_t arg_size = arg->bit_size == 1 ? 32 : arg->bit_size / 8;
|
||||
format.element_sizes[i] = arg_size;
|
||||
|
||||
nir_update_instr_divergence(b->shader, arg->parent_instr);
|
||||
|
||||
if (arg->divergent) {
|
||||
if (divergent) {
|
||||
strides[i] = nir_imul_imm(b, active_invocation_count, arg_size);
|
||||
format.divergence_mask |= BITFIELD_BIT(i);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -6717,7 +6717,6 @@ bool nir_convert_to_lcssa(nir_shader *shader, bool skip_invariants, bool skip_bo
|
|||
void nir_divergence_analysis_impl(nir_function_impl *impl, nir_divergence_options options);
|
||||
void nir_divergence_analysis(nir_shader *shader);
|
||||
void nir_vertex_divergence_analysis(nir_shader *shader);
|
||||
bool nir_update_instr_divergence(nir_shader *shader, nir_instr *instr);
|
||||
bool nir_has_divergent_loop(nir_shader *shader);
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -385,9 +385,6 @@ nir_builder_instr_insert(nir_builder *build, nir_instr *instr)
|
|||
{
|
||||
nir_instr_insert(build->cursor, instr);
|
||||
|
||||
if (build->update_divergence)
|
||||
nir_update_instr_divergence(build->shader, instr);
|
||||
|
||||
/* Move the cursor forward. */
|
||||
build->cursor = nir_after_instr(instr);
|
||||
}
|
||||
|
|
@ -401,9 +398,6 @@ nir_builder_instr_insert_at_top(nir_builder *build, nir_instr *instr)
|
|||
|
||||
nir_instr_insert(top, instr);
|
||||
|
||||
if (build->update_divergence)
|
||||
nir_update_instr_divergence(build->shader, instr);
|
||||
|
||||
if (at_top)
|
||||
build->cursor = nir_after_instr(instr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,10 +40,6 @@ typedef struct nir_builder {
|
|||
/* Whether new ALU instructions will be marked "exact" */
|
||||
bool exact;
|
||||
|
||||
/* Whether to run divergence analysis on inserted instructions (loop merge
|
||||
* and header phis are not updated). */
|
||||
bool update_divergence;
|
||||
|
||||
/* Float_controls2 bits. See nir_alu_instr for details. */
|
||||
uint32_t fp_fast_math;
|
||||
|
||||
|
|
|
|||
|
|
@ -1302,33 +1302,6 @@ nir_vertex_divergence_analysis(nir_shader *shader)
|
|||
visit_cf_list(&nir_shader_get_entrypoint(shader)->body, &state);
|
||||
}
|
||||
|
||||
bool
|
||||
nir_update_instr_divergence(nir_shader *shader, nir_instr *instr)
|
||||
{
|
||||
nir_foreach_def(instr, set_ssa_def_not_divergent, NULL);
|
||||
|
||||
if (instr->type == nir_instr_type_phi) {
|
||||
nir_cf_node *prev = nir_cf_node_prev(&instr->block->cf_node);
|
||||
/* can only update gamma/if phis */
|
||||
if (!prev || prev->type != nir_cf_node_if)
|
||||
return false;
|
||||
|
||||
nir_if *nif = nir_cf_node_as_if(prev);
|
||||
|
||||
visit_if_merge_phi(nir_instr_as_phi(instr), nir_src_is_divergent(nif->condition), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
struct divergence_state state = {
|
||||
.stage = shader->info.stage,
|
||||
.shader = shader,
|
||||
.options = shader->options->divergence_analysis_options,
|
||||
.first_visit = true,
|
||||
};
|
||||
update_instr_divergence(instr, &state);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nir_has_divergent_loop(nir_shader *shader)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue