aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2020-05-05 08:57:12 -0700
committerMarge Bot <[email protected]>2020-05-18 21:09:17 +0000
commitd89c28d314b909ebbe94203170b76b82acaa249c (patch)
tree207c6cc284a244f14ba42645c1e72b63f0344b5a
parentd50069ab08a917705b40641b46594e088734c2f5 (diff)
nir: Use deref intrinsics to set writes_memory when gathering info
Reviewed-by: Kenneth Graunke <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4815>
-rw-r--r--src/compiler/nir/nir_gather_info.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index f62adb6e1f4..09ecc28554b 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -280,6 +280,20 @@ try_mask_partial_io(nir_shader *shader, nir_variable *var,
}
static void
+update_memory_written_for_deref(nir_shader *shader, nir_deref_instr *deref)
+{
+ switch (deref->mode) {
+ case nir_var_mem_ssbo:
+ case nir_var_mem_global:
+ shader->info.writes_memory = true;
+ break;
+ default:
+ /* Nothing to do. */
+ break;
+ }
+}
+
+static void
gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
void *dead_ctx)
{
@@ -326,6 +340,8 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
}
}
}
+ if (instr->intrinsic == nir_intrinsic_store_deref)
+ update_memory_written_for_deref(shader, deref);
break;
}
@@ -471,6 +487,19 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
shader->info.writes_memory = true;
break;
+ case nir_intrinsic_deref_atomic_add:
+ case nir_intrinsic_deref_atomic_imin:
+ case nir_intrinsic_deref_atomic_umin:
+ case nir_intrinsic_deref_atomic_imax:
+ case nir_intrinsic_deref_atomic_umax:
+ case nir_intrinsic_deref_atomic_and:
+ case nir_intrinsic_deref_atomic_or:
+ case nir_intrinsic_deref_atomic_xor:
+ case nir_intrinsic_deref_atomic_exchange:
+ case nir_intrinsic_deref_atomic_comp_swap:
+ update_memory_written_for_deref(shader, nir_src_as_deref(instr->src[0]));
+ break;
+
default:
break;
}