Mesa (staging/21.2): clover/nir: Set constant buffer pointer size to host

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 3 18:09:02 UTC 2021


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

Author: Pierre Moreau <dev at pmoreau.org>
Date:   Sun Apr 25 21:59:27 2021 +0200

clover/nir: Set constant buffer pointer size to host

The `argument::size` is supposed to represent the size of a pointer on
the host and not on the device (for which argument::target_size`
exists).

v3: Use `sizeof(buf)` instead of `marg.size`. (Francisco Jerez)

Fixes: 7c6f1d3bf99 ("clover/nir: extract constant buffer into its own section")

Reviewed-by: Francisco Jerez <currojerez at riseup.net>
Signed-off-by: Pierre Moreau <dev at pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10256>
(cherry picked from commit b4e5bf0637e10d0f7c191d4772f06d0432d87415)

---

 .pick_status.json                               | 2 +-
 src/gallium/frontends/clover/core/kernel.cpp    | 2 +-
 src/gallium/frontends/clover/nir/invocation.cpp | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 529e6fd74b8..5ea287ea4c5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -13,7 +13,7 @@
         "description": "clover/nir: Set constant buffer pointer size to host",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "7c6f1d3bf9903fe403b31a995c4dfce726fd3a27"
     },
diff --git a/src/gallium/frontends/clover/core/kernel.cpp b/src/gallium/frontends/clover/core/kernel.cpp
index 36a81ee04e1..983df18b3f3 100644
--- a/src/gallium/frontends/clover/core/kernel.cpp
+++ b/src/gallium/frontends/clover/core/kernel.cpp
@@ -247,7 +247,7 @@ kernel::exec_context::bind(intrusive_ptr<command_queue> _q,
       case module::argument::constant_buffer: {
          auto arg = argument::create(marg);
          cl_mem buf = kern._constant_buffers.at(&q->device()).get();
-         arg->set(q->device().address_bits() / 8, &buf);
+         arg->set(sizeof(buf), &buf);
          arg->bind(*this, marg);
          break;
       }
diff --git a/src/gallium/frontends/clover/nir/invocation.cpp b/src/gallium/frontends/clover/nir/invocation.cpp
index d807e270ce1..f491691abbb 100644
--- a/src/gallium/frontends/clover/nir/invocation.cpp
+++ b/src/gallium/frontends/clover/nir/invocation.cpp
@@ -324,8 +324,8 @@ clover_lower_nir(nir_shader *nir, std::vector<module::argument> &args,
                                          "constant_buffer_addr");
       constant_var->data.location = args.size();
 
-      args.emplace_back(module::argument::global,
-                        pointer_bit_size / 8, pointer_bit_size / 8, pointer_bit_size / 8,
+      args.emplace_back(module::argument::global, sizeof(cl_mem),
+                        pointer_bit_size / 8, pointer_bit_size / 8,
                         module::argument::zero_ext,
                         module::argument::constant_buffer);
    }



More information about the mesa-commit mailing list