From ecfa127381df2e0118d9d24c844dc48d1412c6ee Mon Sep 17 00:00:00 2001 From: Pierre Moreau Date: Sun, 25 Apr 2021 21:59:27 +0200 Subject: [PATCH] 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 Signed-off-by: Pierre Moreau Part-of: (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 _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 &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); }