Mesa (master): nir/opt_access: ignore barriers and coherent qualifier
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Dec 9 14:58:42 UTC 2020
Module: Mesa
Branch: master
Commit: e646f6d30e0cbac905356e8229d114abb9648ebf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e646f6d30e0cbac905356e8229d114abb9648ebf
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Tue Dec 1 14:30:22 2020 +0000
nir/opt_access: ignore barriers and coherent qualifier
It shouldn't matter whether an access/variable is coherent or not, just
that it's not written. The coherent qualifier doesn't mean anything with
read-only memory.
Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>
---
src/compiler/nir/nir_opt_access.c | 39 +--------------------------------------
1 file changed, 1 insertion(+), 38 deletions(-)
diff --git a/src/compiler/nir/nir_opt_access.c b/src/compiler/nir/nir_opt_access.c
index b12b263e823..c420cdf3590 100644
--- a/src/compiler/nir/nir_opt_access.c
+++ b/src/compiler/nir/nir_opt_access.c
@@ -30,9 +30,6 @@
* - Either there are no writes, or ACCESS_NON_WRITEABLE and ACCESS_RESTRICT
* are both set. In either case there are no writes to the underlying
* memory.
- * - If ACCESS_COHERENT is set, then there must be no memory barriers
- * involving the access. Coherent accesses may return different results
- * before and after barriers.
* - ACCESS_VOLATILE is not set.
*
* If these conditions are true, then image and buffer reads may be treated as
@@ -44,8 +41,6 @@ struct access_state {
struct set *vars_written;
bool images_written;
bool buffers_written;
- bool image_barriers;
- bool buffer_barriers;
};
static void
@@ -122,30 +117,6 @@ gather_intrinsic(struct access_state *state, nir_intrinsic_instr *instr)
state->buffers_written = true;
break;
- case nir_intrinsic_memory_barrier:
- state->buffer_barriers = true;
- state->image_barriers = true;
- break;
-
- case nir_intrinsic_memory_barrier_buffer:
- state->buffer_barriers = true;
- break;
-
- case nir_intrinsic_memory_barrier_image:
- state->image_barriers = true;
- break;
-
- case nir_intrinsic_scoped_barrier:
- /* TODO: Could be more granular if we had nir_var_mem_image. */
- if (nir_intrinsic_memory_modes(instr) & (nir_var_mem_ubo |
- nir_var_mem_ssbo |
- nir_var_uniform |
- nir_var_mem_global)) {
- state->buffer_barriers = true;
- state->image_barriers = true;
- }
- break;
-
default:
break;
}
@@ -183,15 +154,7 @@ can_reorder(struct access_state *state, enum gl_access_qualifier access,
if (!is_any_written ||
((access & ACCESS_NON_WRITEABLE) &&
(access & ACCESS_RESTRICT))) {
- /* Note: memoryBarrierBuffer() is only guaranteed to flush buffer
- * variables and not imageBuffer's, so we only consider the GL-level
- * type here.
- */
- bool is_any_barrier = is_ssbo ?
- state->buffer_barriers : state->image_barriers;
-
- return (!is_any_barrier || !(access & ACCESS_COHERENT)) &&
- !(access & ACCESS_VOLATILE);
+ return !(access & ACCESS_VOLATILE);
}
return false;
More information about the mesa-commit
mailing list