Mesa (staging/20.2): aco: don't move memory accesses to before control barriers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 11 16:44:12 UTC 2020


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Aug  4 19:20:21 2020 +0100

aco: don't move memory accesses to before control barriers

Fixes random failures of dEQP-VK.image.qualifiers.volatile.cube_array.r32i
and similar tests on Vega.

fossil-db (Navi):
Totals from 6 (0.00% of 135946) affected shaders:
VMEM: 1218 -> 1110 (-8.87%); split: +2.46%, -11.33%
SMEM: 174 -> 189 (+8.62%)
Copies: 84 -> 87 (+3.57%)

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Fixes: cd392a10d05 ('radv/aco,aco: use scoped barriers')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6174>
(cherry picked from commit 7b4c24eb679e248894751f30e2ea842dcf3f21f3)

---

 .pick_status.json                  | 2 +-
 src/amd/compiler/aco_scheduler.cpp | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 78049e364d8..15bf5779c57 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -22,7 +22,7 @@
         "description": "aco: don't move memory accesses to before control barriers",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "cd392a10d056833d915ba2912e4dbe58d86bf28f"
     },
diff --git a/src/amd/compiler/aco_scheduler.cpp b/src/amd/compiler/aco_scheduler.cpp
index 52b64f02116..9d6810672b5 100644
--- a/src/amd/compiler/aco_scheduler.cpp
+++ b/src/amd/compiler/aco_scheduler.cpp
@@ -495,6 +495,12 @@ HazardResult perform_hazard_query(hazard_query *query, Instruction *instr, bool
    if (first->bar_classes && second->bar_classes)
       return hazard_fail_barrier;
 
+   /* Don't move memory accesses to before control barriers. I don't think
+    * this is necessary for the Vulkan memory model, but it might be for GLSL450. */
+   unsigned control_classes = storage_buffer | storage_atomic_counter | storage_image | storage_shared;
+   if (first->has_control_barrier && ((second->access_atomic | second->access_relaxed) & control_classes))
+      return hazard_fail_barrier;
+
    /* don't move memory loads/stores past potentially aliasing loads/stores */
    unsigned aliasing_storage = instr->format == Format::SMEM ?
                                query->aliasing_storage_smem :



More information about the mesa-commit mailing list