mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 14:18:07 +02:00
nir/peephole_select: add option to allow discard without ~0 limit
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33590>
This commit is contained in:
parent
ca8147edbe
commit
cfee9e1d9f
3 changed files with 11 additions and 3 deletions
|
|
@ -6062,6 +6062,7 @@ typedef struct nir_opt_peephole_select_options {
|
|||
unsigned limit; /* Set to max to flatten all control flow. */
|
||||
bool indirect_load_ok;
|
||||
bool expensive_alu_ok;
|
||||
bool discard_ok;
|
||||
} nir_opt_peephole_select_options;
|
||||
|
||||
bool nir_opt_peephole_select(nir_shader *shader,
|
||||
|
|
|
|||
|
|
@ -195,6 +195,14 @@ block_check_for_allowed_instrs(nir_block *block, unsigned *count,
|
|||
return false;
|
||||
break;
|
||||
|
||||
case nir_intrinsic_terminate:
|
||||
case nir_intrinsic_terminate_if:
|
||||
case nir_intrinsic_demote:
|
||||
case nir_intrinsic_demote_if:
|
||||
if (!options->discard_ok)
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
@ -296,9 +304,7 @@ get_options_for_if(nir_if *if_stmt,
|
|||
return if_options;
|
||||
}
|
||||
|
||||
/* If we're moving discards out of the if for non-CF hardware, we need to add
|
||||
* the if's condition to it
|
||||
*/
|
||||
/* If we're moving discards out of the if we need to add the if's condition to it */
|
||||
static void
|
||||
rewrite_discard_conds(nir_instr *instr, nir_def *if_cond, bool is_else)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -592,6 +592,7 @@ fn opt_nir(nir: &mut NirShader, dev: &Device, has_explicit_types: bool) {
|
|||
limit: 8,
|
||||
indirect_load_ok: true,
|
||||
expensive_alu_ok: true,
|
||||
discard_ok: false,
|
||||
};
|
||||
progress |= nir_pass!(nir, nir_opt_peephole_select, &peephole_select_options);
|
||||
progress |= nir_pass!(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue