Mesa (staging/19.1): nir/lower_non_uniform: safely iterate over blocks
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 4 14:25:29 UTC 2019
Module: Mesa
Branch: staging/19.1
Commit: 4c7dfaba9c49e2a37e0019833e356908422084c8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c7dfaba9c49e2a37e0019833e356908422084c8
Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date: Tue May 28 08:52:50 2019 +0100
nir/lower_non_uniform: safely iterate over blocks
This fixes a problem where the same instruction gets replaced twice.
This was happening when the replaced instruction would be at the end
of a block.
Replacement of :
if ssa_8 {
....
intrinsic bindless_image_store (ssa_44, ssa_16, ssa_0, ssa_15) (5, 0, 34836, 32) /* image_dim=Buf */ /* image_array=false */ /* format=34836 */ /* access=32 */
}
Would be :
if ssa_8 {
loop {
vec1 32 ssa_47 = intrinsic read_first_invocation (ssa_44) ()
vec1 1 ssa_48 = ieq ssa_47, ssa_44
if ssa_48 {
loop {
vec1 32 ssa_49 = intrinsic read_first_invocation (ssa_44) ()
vec1 1 ssa_50 = ieq ssa_49, ssa_44
if ssa_50 {
intrinsic bindless_image_store (ssa_44, ssa_16, ssa_0, ssa_15) (5, 0, 34836, 32) /* image_dim=Buf */ /* image_array=false */ /* format=34836 */ /* access=32 */
break
} else {
....
}
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: 3bd545764151 ("nir: Add a lowering pass for non-uniform resource access")
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
(cherry picked from commit 366811bedb67ae7d31a02ea9b1f9fa942fb93602)
---
src/compiler/nir/nir_lower_non_uniform_access.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_lower_non_uniform_access.c b/src/compiler/nir/nir_lower_non_uniform_access.c
index 6367f5670e8..0ab32100ef2 100644
--- a/src/compiler/nir/nir_lower_non_uniform_access.c
+++ b/src/compiler/nir/nir_lower_non_uniform_access.c
@@ -129,7 +129,7 @@ nir_lower_non_uniform_access_impl(nir_function_impl *impl,
nir_builder b;
nir_builder_init(&b, impl);
- nir_foreach_block(block, impl) {
+ nir_foreach_block_safe(block, impl) {
nir_foreach_instr_safe(instr, block) {
switch (instr->type) {
case nir_instr_type_tex: {
More information about the mesa-commit
mailing list