From 00930b90db8e5f063d86d52a3e9515712c9aba1a 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 f67b0e5f782..c82816b3a0e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -310,7 +310,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 3f58973ff05..c265b4b3764 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 197eda8b976..1982af04c53 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); }