Module: Mesa
Branch: staging/20.0
Commit: f0ac5321f838960a801ddd37105f3137195f2c5a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0ac5321f838960a801ddd37105f3137195f2c5a

Author: Bas Nieuwenhuizen <[email protected]>
Date:   Fri Mar 13 20:48:27 2020 +0100

amd/llvm: Fix divergent descriptor regressions with radeonsi.

piglit/bin/arb_bindless_texture-limit -auto -fbo:
  Needed to deal with non-NULL dynamic_index without deref in tex instructions.

piglit/bin/shader_runner 
tests/spec/arb_bindless_texture/execution/images/multiple-resident-images-reading.shader_test
 -auto:
  Need to deal with non-deref images in enter_waterfall_imae.

Fixes: b83c9aca4a5 "amd/llvm: Fix divergent descriptor indexing. (v3)"
Acked-by: Marek Olšák <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Tested-by: Marge Bot 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4191>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4191>
(cherry picked from commit 8e4e2cedcf53d0f9649d51fc3acccaada96172bb)

---

 .pick_status.json             |  2 +-
 src/amd/llvm/ac_nir_to_llvm.c | 24 +++++++++++++-----------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 1302176ed96..2096fed1a45 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -76,7 +76,7 @@
         "description": "amd/llvm: Fix divergent descriptor regressions with 
radeonsi.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "b83c9aca4a5fd02d920c90c1799137fed52dc1d9"
     },
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index 78db5e38786..f8f4d7e8206 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -2679,7 +2679,11 @@ static LLVMValueRef enter_waterfall_image(struct 
ac_nir_context *ctx,
                                          struct waterfall_context *wctx,
                                          const nir_intrinsic_instr *instr)
 {
-       nir_deref_instr *deref_instr = 
nir_instr_as_deref(instr->src[0].ssa->parent_instr);
+       nir_deref_instr *deref_instr = NULL;
+
+       if (instr->src[0].ssa->parent_instr->type == nir_instr_type_deref)
+               deref_instr = 
nir_instr_as_deref(instr->src[0].ssa->parent_instr);
+
        LLVMValueRef value = get_sampler_desc_index(ctx, deref_instr, 
&instr->instr, true);
        return enter_waterfall(ctx, wctx, value, nir_intrinsic_access(instr) & 
ACCESS_NON_UNIFORM);
 }
@@ -4201,20 +4205,18 @@ static void tex_fetch_ptrs(struct ac_nir_context *ctx,
                }
        }
 
+       LLVMValueRef texture_dynamic_index = get_sampler_desc_index(ctx, 
texture_deref_instr,
+                                                                   
&instr->instr, false);
        if (!sampler_deref_instr)
                sampler_deref_instr = texture_deref_instr;
 
-       LLVMValueRef texture_dynamic_index = NULL, sampler_dynamic_index = NULL;
-       if (texture_deref_instr) {
-               texture_dynamic_index = get_sampler_desc_index(ctx, 
texture_deref_instr, &instr->instr, false);
-               texture_dynamic_index = enter_waterfall(ctx, wctx + 0, 
texture_dynamic_index, instr->texture_non_uniform);
-       }
+        LLVMValueRef sampler_dynamic_index = get_sampler_desc_index(ctx, 
sampler_deref_instr,
+                                                                   
&instr->instr, false);
+       if (instr->texture_non_uniform)
+               texture_dynamic_index = enter_waterfall(ctx, wctx + 0, 
texture_dynamic_index, true);
 
-       if (sampler_deref_instr && sampler_deref_instr != texture_deref_instr) {
-               sampler_dynamic_index = get_sampler_desc_index(ctx, 
sampler_deref_instr, &instr->instr, false);
-               sampler_dynamic_index = enter_waterfall(ctx, wctx + 1, 
sampler_dynamic_index, instr->sampler_non_uniform);
-       } else
-               sampler_dynamic_index = texture_dynamic_index;
+       if (instr->sampler_non_uniform)
+               sampler_dynamic_index = enter_waterfall(ctx, wctx + 1, 
sampler_dynamic_index, true);
 
        enum ac_descriptor_type main_descriptor = instr->sampler_dim  == 
GLSL_SAMPLER_DIM_BUF ? AC_DESC_BUFFER : AC_DESC_IMAGE;
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to