From 4df3654c7914118f9ccba1224fb46e928bb07177 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 21 Oct 2020 16:43:16 +0100 Subject: [PATCH] nir/load_store_vectorize: assume CAN_REORDER ops don't alias with stores fossil-db (GFX10.3): Totals from 20 (0.01% of 139391) affected shaders: SGPRs: 688 -> 712 (+3.49%); split: -1.16%, +4.65% CodeSize: 35488 -> 34424 (-3.00%); split: -3.04%, +0.05% Instrs: 6405 -> 6259 (-2.28%); split: -2.44%, +0.16% Cycles: 51768 -> 51268 (-0.97%); split: -1.21%, +0.24% Signed-off-by: Rhys Perry Reviewed-by: Eric Anholt Part-of: --- src/compiler/nir/nir_opt_load_store_vectorize.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_opt_load_store_vectorize.c b/src/compiler/nir/nir_opt_load_store_vectorize.c index aae6609422a..279b1264b36 100644 --- a/src/compiler/nir/nir_opt_load_store_vectorize.c +++ b/src/compiler/nir/nir_opt_load_store_vectorize.c @@ -593,6 +593,9 @@ create_entry(struct vectorize_ctx *ctx, else if (entry->key->var) entry->access = entry->key->var->data.access; + if (nir_intrinsic_can_reorder(intrin)) + entry->access |= ACCESS_CAN_REORDER; + uint32_t restrict_modes = nir_var_shader_in | nir_var_shader_out; restrict_modes |= nir_var_shader_temp | nir_var_function_temp; restrict_modes |= nir_var_uniform | nir_var_mem_push_const; @@ -920,6 +923,9 @@ may_alias(struct entry *a, struct entry *b) assert(mode_to_index(get_variable_mode(a)) == mode_to_index(get_variable_mode(b))); + if ((a->access | b->access) & ACCESS_CAN_REORDER) + return false; + /* if the resources/variables are definitively different and both have * ACCESS_RESTRICT, we can assume they do not alias. */ bool res_different = a->key->var != b->key->var ||