Mesa (main): pan/bi: Handle shared atomic exchange on Valhall

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 11 22:15:08 UTC 2022


Module: Mesa
Branch: main
Commit: b683a67328fec23a9543359f315bef982b2c13ee
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b683a67328fec23a9543359f315bef982b2c13ee

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Mar 30 16:18:06 2022 -0400

pan/bi: Handle shared atomic exchange on Valhall

Need to lower the WLS into a segment addition, since the .seg modifier was
dropped on Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16410>

---

 src/panfrost/bifrost/bifrost_compile.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 9d13497a503..81335f7643b 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -978,10 +978,14 @@ bi_emit_axchg_to(bi_builder *b, bi_index dst, bi_index addr, nir_src *arg, enum
         bi_index inout = bi_temp_reg(b->shader);
         bi_make_vec_to(b, inout, data_words, NULL, sz / 32, 32);
 
-        bi_axchg_to(b, sz, inout, inout,
-                        bi_word(addr, 0),
-                        (seg == BI_SEG_NONE) ? bi_word(addr, 1) : bi_zero(),
-                        seg);
+        bi_index addr_hi = bi_word(addr, 1);
+
+        if (b->shader->arch >= 9)
+                bi_handle_segment(b, &addr, &addr_hi, seg, NULL);
+        else if (seg == BI_SEG_WLS)
+                addr_hi = bi_zero();
+
+        bi_axchg_to(b, sz, inout, inout, addr, addr_hi, seg);
 
         bi_index inout_words[] = {
                 bi_word(inout, 0),
@@ -1018,10 +1022,14 @@ bi_emit_acmpxchg_to(bi_builder *b, bi_index dst, bi_index addr, nir_src *arg_1,
         bi_index inout = bi_temp_reg(b->shader);
         bi_make_vec_to(b, inout, data_words, NULL, 2 * (sz / 32), 32);
 
-        bi_acmpxchg_to(b, sz, inout, inout,
-                        bi_word(addr, 0),
-                        (seg == BI_SEG_NONE) ? bi_word(addr, 1) : bi_zero(),
-                        seg);
+        bi_index addr_hi = bi_word(addr, 1);
+
+        if (b->shader->arch >= 9)
+                bi_handle_segment(b, &addr, &addr_hi, seg, NULL);
+        else if (seg == BI_SEG_WLS)
+                addr_hi = bi_zero();
+
+        bi_acmpxchg_to(b, sz, inout, inout, addr, addr_hi, seg);
 
         bi_index inout_words[] = {
                 bi_word(inout, 0),



More information about the mesa-commit mailing list