From a6c26a6ad94d16ad044c3b64d72ff9daf863b3be Mon Sep 17 00:00:00 2001 From: Pierre Moreau Date: Tue, 13 Apr 2021 22:14:03 +0200 Subject: [PATCH] clover/spirv: Properly size 3-component vector args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This resolves clover returning `CL_INVALID_ARG_SIZE` whenever the OpenCL CTS called `clSetKernelArg()` for 3-component vectors. Fixes: 21473865050 ("clover/spirv: Add functions for parsing arguments, linking programs, etc.") v2: Remove “api/clsetkernelarg/set kernel argument for cl_int3” from the expected fails for llvmpipe Reviewed-by: Karol Herbst Signed-off-by: Pierre Moreau Part-of: --- src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt | 1 - src/gallium/frontends/clover/spirv/invocation.cpp | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt b/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt index 8f16479afaa..44fc9081f54 100644 --- a/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt +++ b/src/gallium/drivers/llvmpipe/ci/llvmpipe-cl.txt @@ -6,7 +6,6 @@ api/clenqueuemigratememobjects: skip api/clgetextensionfunctionaddressforplatform: skip api/clgetkernelarginfo: skip api/cllinkprogram: skip -api/clsetkernelarg/set kernel argument for cl_int3: fail interop/egl_khr_cl_event2: skip program/build/include-directories: fail program/build/math-intrinsics: fail diff --git a/src/gallium/frontends/clover/spirv/invocation.cpp b/src/gallium/frontends/clover/spirv/invocation.cpp index 0723c088a1e..e91126141e2 100644 --- a/src/gallium/frontends/clover/spirv/invocation.cpp +++ b/src/gallium/frontends/clover/spirv/invocation.cpp @@ -331,9 +331,8 @@ namespace { const auto elem_size = types_iter->second.size; const auto elem_nbs = get(inst, 3); - const auto size = elem_size * elem_nbs; - const auto align = elem_size * util_next_power_of_two(elem_nbs); - types[id] = { module::argument::scalar, size, size, align, + const auto size = elem_size * (elem_nbs != 3 ? elem_nbs : 4); + types[id] = { module::argument::scalar, size, size, size, module::argument::zero_ext }; types[id].info.address_qualifier = CL_KERNEL_ARG_ADDRESS_PRIVATE; break;