mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
nir: Allow atomics as non-complex uses for var-splitting passes
The var splitting pass can rearrange the variables as long as their position in memory doesn't matter. For block-arranged variables, or things like memcpys or casts, the layout matters, but atomics don't imply anything about the layout of the overall variable, so don't treat them as "complex" for this use case. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23173>
This commit is contained in:
parent
cf9ea94958
commit
bb311ce370
3 changed files with 10 additions and 2 deletions
|
|
@ -1811,6 +1811,7 @@ bool nir_deref_instr_is_known_out_of_bounds(nir_deref_instr *instr);
|
|||
typedef enum {
|
||||
nir_deref_instr_has_complex_use_allow_memcpy_src = (1 << 0),
|
||||
nir_deref_instr_has_complex_use_allow_memcpy_dst = (1 << 1),
|
||||
nir_deref_instr_has_complex_use_allow_atomics = (1 << 2),
|
||||
} nir_deref_instr_has_complex_use_options;
|
||||
|
||||
bool nir_deref_instr_has_complex_use(nir_deref_instr *instr,
|
||||
|
|
|
|||
|
|
@ -227,6 +227,12 @@ nir_deref_instr_has_complex_use(nir_deref_instr *deref,
|
|||
continue;
|
||||
return true;
|
||||
|
||||
case nir_intrinsic_deref_atomic:
|
||||
case nir_intrinsic_deref_atomic_swap:
|
||||
if (opts & nir_deref_instr_has_complex_use_allow_atomics)
|
||||
continue;
|
||||
return true;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ get_complex_used_vars(nir_shader *shader, void *mem_ctx)
|
|||
* nir_deref_instr_has_complex_use is recursive.
|
||||
*/
|
||||
if (deref->deref_type == nir_deref_type_var &&
|
||||
nir_deref_instr_has_complex_use(deref, 0))
|
||||
nir_deref_instr_has_complex_use(deref,
|
||||
nir_deref_instr_has_complex_use_allow_atomics))
|
||||
_mesa_set_add(complex_vars, deref->var);
|
||||
}
|
||||
}
|
||||
|
|
@ -1080,7 +1081,7 @@ mark_deref_if_complex(nir_deref_instr *deref,
|
|||
if (!(deref->var->data.mode & modes))
|
||||
return;
|
||||
|
||||
if (!nir_deref_instr_has_complex_use(deref, 0))
|
||||
if (!nir_deref_instr_has_complex_use(deref, nir_deref_instr_has_complex_use_allow_atomics))
|
||||
return;
|
||||
|
||||
struct vec_var_usage *usage =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue