Fix CL_INVALID_WORK_ITEM_SIZE for “reduce” test (#143)
- Fix CL_INVALID_WORK_ITEM_SIZE for “reduce” test
The work-group size (WGS) may exceed the maximum allowed per-dimension limit reported by CL_DEVICE_MAX_WORK_ITEM_SIZES[0], leading to clEnqueueNDRangeKernel failing with CL_INVALID_WORK_GROUP_SIZE.
This patch queries the device’s max work-item sizes and clamps WGS to the valid maximum for the x-dimension. This ensures correct behavior on devices with smaller limits and improves portability.
Signed-off-by: Xin Jin xin.jin@arm.com
- Clamp WGS to CL_DEVICE_MAX_WORK_ITEM_SIZES[0] in reduce.cpp
The work-group size (WGS) may exceed the maximum allowed per-dimension limit reported by CL_DEVICE_MAX_WORK_ITEM_SIZES[0], leading to clEnqueueNDRangeKernel failing with CL_INVALID_WORK_GROUP_SIZE.
The reduce sample launches kernels with a 1-D NDRange over a flat array of integers, so only the x-dimension limit is relevant. This patch queries the device’s max work-item sizes and clamps WGS to the valid maximum for the x-dimension. This ensures correct behavior on devices with smaller limits and improves portability.
Signed-off-by: Xin Jin xin.jin@arm.com
Signed-off-by: Xin Jin xin.jin@arm.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
OpenCLTM SDK (in development)
This is the Khronos OpenCL SDK. It brings together all the components needed to develop OpenCL applications:
external/OpenCL-Headers/)external/OpenCL-CLHPP/include)external/OpenCL-ICD-Loader)lib/include)It also contains resources useful to OpenCL developers:
samples/)docs/)Build Instructions
Dependencies
This repository uses sub-modules for the OpenCL Headers, OpenCL C++ bindings, and OpenCL ICD Loader and some of their transitive dependencies.
To clone a new repository with all sub-modules included, use the
--recursiveoption. Note that this option clones all sub-modules and their dependencies, which are not strictly required for the OpenCL SDK:Alternatively, to clone only the sub-modules for the OpenCL SDK, first clone this repository without sub-modules included then setup submodules non-recursively:
The SDK uses CMake for its build system. If CMake is not provided by your build system or OS package manager, please consult the CMake website.
The SDK samples depend on
Example Build
In most cases, the following steps may be used to build the OpenCL SDK.
Clone this repo and update submodules:
Create a “build” directory:
Generate build files inside of the “build” directory:
Build the OpenCL SDK and copy files to an “install” directory:
Or, build the OpenCL SDK using the generated build files directly.
To customize a build, the following CMake variables are supported. To specify one of these variables via the command line generator, use the CMake syntax
-D<variable>=<value>. See your CMake documentation for more details.TRUETRUEFALSEFALSETRUE