Mesa (staging/21.3): zink: use SpvScopeDevice over SpvScopeWorkgroup for atomic shader ops

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 2 21:21:48 UTC 2022


Module: Mesa
Branch: staging/21.3
Commit: 3bf0340ae19984cf58279c4976c94307af7186af
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3bf0340ae19984cf58279c4976c94307af7186af

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Jan 18 10:39:25 2022 -0500

zink: use SpvScopeDevice over SpvScopeWorkgroup for atomic shader ops

Workgroup is only allowed in compute shaders, and Device should be more
in line with the intended use here

the alternative would be to keep using Workgroup for compute and use Device
otherwise, but this would effectively make atomic ops non-atomic, which seems
like it isn't desirable

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14690>
(cherry picked from commit 6f38ea4ac73302fb040ef27f84633e34da3567ac)

---

 .pick_status.json                                    | 2 +-
 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index fc8660952ed..593426b3ebb 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1003,7 +1003,7 @@
         "description": "zink: use SpvScopeDevice over SpvScopeWorkgroup for atomic shader ops",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 1476b52e75e..587ba6183cf 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -1408,16 +1408,16 @@ static SpvId
 emit_atomic(struct ntv_context *ctx, SpvId op, SpvId type, SpvId src0, SpvId src1, SpvId src2)
 {
    if (op == SpvOpAtomicLoad)
-      return spirv_builder_emit_triop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeWorkgroup),
+      return spirv_builder_emit_triop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeDevice),
                                        emit_uint_const(ctx, 32, 0));
    if (op == SpvOpAtomicCompareExchange)
-      return spirv_builder_emit_hexop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeWorkgroup),
+      return spirv_builder_emit_hexop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeDevice),
                                        emit_uint_const(ctx, 32, 0),
                                        emit_uint_const(ctx, 32, 0),
                                        /* these params are intentionally swapped */
                                        src2, src1);
 
-   return spirv_builder_emit_quadop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeWorkgroup),
+   return spirv_builder_emit_quadop(&ctx->builder, op, type, src0, emit_uint_const(ctx, 32, SpvScopeDevice),
                                     emit_uint_const(ctx, 32, 0), src1);
 }
 



More information about the mesa-commit mailing list