目录
Xin Jin

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

3个月前74次提交

OpenCLTM SDK (in development)

This is the Khronos OpenCL SDK. It brings together all the components needed to develop OpenCL applications:

  • OpenCL Headers (external/OpenCL-Headers/)
  • OpenCL C++ bindings (external/OpenCL-CLHPP/include)
  • OpenCL Loader (external/OpenCL-ICD-Loader)
  • OpenCL utility library (lib/include)

It also contains resources useful to OpenCL developers:

  • Code samples (samples/)
  • Documentation (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 --recursive option. Note that this option clones all sub-modules and their dependencies, which are not strictly required for the OpenCL SDK:

      git clone --recursive https://github.com/KhronosGroup/OpenCL-SDK.git
    • Alternatively, to clone only the sub-modules for the OpenCL SDK, first clone this repository without sub-modules included then setup submodules non-recursively:

      git clone https://github.com/KhronosGroup/OpenCL-SDK.git
      git submodule init
      git submodule update
  • 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.

  1. Clone this repo and update submodules:

     git clone https://github.com/KhronosGroup/OpenCL-SDK.git
     git submodule init
     git submodule update
  2. Create a “build” directory:

     mkdir build
     cd build
  3. Generate build files inside of the “build” directory:

     cmake .. -DCMAKE_BUILD_TYPE=Release
  4. Build the OpenCL SDK and copy files to an “install” directory:

     cmake --build . --target install --config Release

    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.

Variable Type Description
CMAKE_BUILD_TYPE STRING Specifies the build type. Does not affect multi-configuration generators, such as Visual Studio solution files.
CMAKE_INSTALL_PREFIX PATH Install directory prefix.
OPENCL_SDK_BUILD_UTILITY_LIBRARIES BOOL Enables building OpenCL SDK utility libraries. Default: TRUE
OPENCL_SDK_BUILD_SAMPLES BOOL Enables building OpenCL SDK samples. Default: TRUE
OPENCL_SDK_BUILD_OPENGL_SAMPLES BOOL Enables building OpenCL SDK samples that interoperate with OpenGL. Default: FALSE
OPENCL_SDK_BUILD_VULKAN_SAMPLES BOOL Enables building OpenCL SDK samples that interoperate with Vulkan. Default: FALSE
OPENCL_SDK_TEST_SAMPLES BOOL Enables a target to test the OpenCL SDK samples. Default: TRUE
关于

跨平台并行计算框架,用于GPU/FPGA等异构硬件加速科学计算。

2.8 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号