mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-06 12:48:16 +02:00
nir/lower_non_uniform_access: fix fusing loops for same index but different array variable
struct nu_handle is hashed and deduplicated using struct nu_handle_key, which ignored
parent_deref. That means all instructions will use the first parent_deref when rewriting
the sources.
Avoid this by not including the parent deref in the struct, and instead querying it
when needed.
Fixes: 4d09cd7fa5 ("nir/lower_non_uniform_access: Group accesses using the same resource")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15173
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40654>
This commit is contained in:
parent
6fb261147b
commit
e7077e8f5c
1 changed files with 8 additions and 7 deletions
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
struct nu_handle {
|
||||
nir_def *handle;
|
||||
nir_deref_instr *parent_deref;
|
||||
nir_def *first;
|
||||
};
|
||||
|
||||
|
|
@ -81,7 +80,6 @@ nu_handle_init(struct nu_handle *h, nir_src *src)
|
|||
return false;
|
||||
|
||||
h->handle = deref->arr.index.ssa;
|
||||
h->parent_deref = parent;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -89,7 +87,6 @@ nu_handle_init(struct nu_handle *h, nir_src *src)
|
|||
return false;
|
||||
|
||||
h->handle = src->ssa;
|
||||
h->parent_deref = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -123,11 +120,15 @@ nu_handle_compare(const nir_lower_non_uniform_access_options *options,
|
|||
static void
|
||||
nu_handle_rewrite(nir_builder *b, struct nu_handle *h, nir_src *src)
|
||||
{
|
||||
if (h->parent_deref) {
|
||||
if (nir_src_is_deref(*src)) {
|
||||
nir_deref_instr *deref = nir_src_as_deref(*src);
|
||||
assert(deref->deref_type == nir_deref_type_array);
|
||||
nir_deref_instr *parent = nir_deref_instr_parent(deref);
|
||||
|
||||
/* Replicate the deref. */
|
||||
nir_deref_instr *deref =
|
||||
nir_build_deref_array(b, h->parent_deref, h->first);
|
||||
nir_src_rewrite(src, &deref->def);
|
||||
nir_deref_instr *new_deref =
|
||||
nir_build_deref_array(b, parent, h->first);
|
||||
nir_src_rewrite(src, &new_deref->def);
|
||||
} else {
|
||||
nir_src_rewrite(src, h->first);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue