nir/deref: stop assuming coherent accesses of different SSBOs may alias

Whether it's coherent should be irrelevant and the ACCESS_RESTRICT check
above should consider all cases aliasing unless NIR makes it clear they're
not.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894>
This commit is contained in:
Rhys Perry 2022-05-20 14:28:29 +01:00 committed by Marge Bot
parent 5ebb014bdf
commit cb5c1bcb7c
1 changed files with 0 additions and 32 deletions

View File

@ -442,28 +442,6 @@ modes_may_alias(nir_variable_mode a, nir_variable_mode b)
return a & b;
}
static bool
deref_path_contains_coherent_decoration(nir_deref_path *path)
{
assert(path->path[0]->deref_type == nir_deref_type_var);
if (path->path[0]->var->data.access & ACCESS_COHERENT)
return true;
for (nir_deref_instr **p = &path->path[1]; *p; p++) {
if ((*p)->deref_type != nir_deref_type_struct)
continue;
const struct glsl_type *struct_type = (*(p - 1))->type;
const struct glsl_struct_field *field =
glsl_get_struct_field_data(struct_type, (*p)->strct.index);
if (field->memory_coherent)
return true;
}
return false;
}
nir_deref_compare_result
nir_compare_deref_paths(nir_deref_path *a_path,
nir_deref_path *b_path)
@ -485,16 +463,6 @@ nir_compare_deref_paths(nir_deref_path *a_path,
!(b_path->path[0]->modes & ~temp_var_modes))
return nir_derefs_do_not_alias;
/* If they are both declared coherent or have coherent somewhere in
* their path (due to a member of an interface being declared
* coherent), we have to assume we that we could have any kind of
* aliasing. Otherwise, they could still alias but the client didn't
* tell us and that's their fault.
*/
if (deref_path_contains_coherent_decoration(a_path) &&
deref_path_contains_coherent_decoration(b_path))
return nir_derefs_may_alias_bit;
/* Per SPV_KHR_workgroup_memory_explicit_layout and GL_EXT_shared_memory_block,
* shared blocks alias each other.
*/