Nikhil Joshi 07b055cd68 Cap CL_DEVICE_MAX_MEM_ALLOC_SIZE to SIZE_MAX (#1501)
* Fix enqueue_flags test to use correct barrier type.

Currently, enqueue_flags test uses CLK_LOCAL_MEM_FENCE.
Use CLK_GLOBAL_MEM_FENCE instead as all threads across work-groups
need to wait here.

* Add check for support for Read-Wrie images

Read-Write images have required OpenCL 2.x.
Read-Write image tests are already being skipped
for 1.x devices.
With OpenCL 3.0, read-write images being optional,
the tests should be run or skipped
depending on the implementation support.

Add a check to decide if Read-Write images are
supported or required to be supported depending
on OpenCL version and decide if the tests should
be run on skipped.

Fixes issue #894

* Fix formatting in case of Read-Write image checks.

Fix formatting in case of Read-write image checks.
Also, combine two ifs into one in case of
kerne_read_write tests

* Fix some more formatting for RW-image checks

Remove unnecessary spaces at various places.
Also, fix lengthy lines.

* Fix malloc-size calculation in test imagedim

unsigned char size is silently assumed to be 1
in imagedim test of test_basic.
Pass sizeof(type) in malloc size calculation.
Also, change loop variable from signed to unsigned.
Add checks for null pointer for malloced memory.

* Cap CL_DEVICE_MAX_MEM_ALLOC_SIZE to SIZE_MAX

Cap CL_DEVICE_MAX_MEM_ALLOC_SIZE to SIZE_MAX
when CL_DEVICE_GLOBAL_MEM_SIZE is capped with SIZE_MAX.
test_allocation caps the value of GLOBAL_MEM_SIZE to SIZE_MAX
if it exceeds the value of SIZE_MAX(value depends on platform bitness),
but doesn’t modify MAX_ALLOC_SIZE the same way.
Due to this MAX_ALLOC_SIZE becomes greater than GLOBAL_MEM_SIZE
and the test fails.

Modify MAX_MEM_ALLOC_SIZE as GLOBAL_MEM_SIZE when it exceeds SIZE_MAX

OpenCL-CTS #1022
2022-10-04 09:13:18 -07:00
2018-10-10 16:02:58 -04:00
2022-05-17 08:54:39 -07:00

OpenCL Conformance Test Suite (CTS)

This it the OpenCL CTS for all versions of the Khronos OpenCL standard.

Building the CTS

The CTS supports Linux, Windows, macOS, and Android platforms. In particular, GitHub Actions CI builds against Ubuntu 20.04, Windows-latest, and macos-latest.

Compiling the CTS requires the following CMake configuration options to be set:

  • CL_INCLUDE_DIR Points to the unified OpenCL-Headers.
  • CL_LIB_DIR Directory containing the OpenCL library to build against.
  • OPENCL_LIBRARIES Name of the OpenCL library to link.

It is advised that the OpenCL ICD-Loader is used as the OpenCL library to build against. Where CL_LIB_DIR points to a build of the ICD loader and OPENCL_LIBRARIES is "OpenCL".

Example Build

Steps on a Linux platform to clone dependencies from GitHub sources, configure a build, and compile.

git clone https://github.com/KhronosGroup/OpenCL-CTS.git
git clone https://github.com/KhronosGroup/OpenCL-Headers.git
git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git

mkdir OpenCL-ICD-Loader/build
cmake -S OpenCL-ICD-Loader -B OpenCL-ICD-Loader/build \
      -DOPENCL_ICD_LOADER_HEADERS_DIR=$PWD/OpenCL-Headers
cmake --build ./OpenCL-ICD-Loader/build --config Release

mkdir OpenCL-CTS/build
cmake -S OpenCL-CTS -B OpenCL-CTS/build \
      -DCL_INCLUDE_DIR=$PWD/OpenCL-Headers \
      -DCL_LIB_DIR=$PWD/OpenCL-ICD-Loader/build \
      -DOPENCL_LIBRARIES=OpenCL
cmake --build OpenCL-CTS/build --config Release

Running the CTS

A build of the CTS contains multiple executables representing the directories in the test_conformance folder. Each of these executables contains sub-tests, and possibly smaller granularities of testing within the sub-tests.

See the --help output on each executable for the list of sub-tests available, as well as other options for configuring execution.

If the OpenCL library built against is the ICD Loader, and the vendor library to be tested is not registered in the default ICD Loader location then the OCL_ICD_FILENAMES environment variable will need to be set for the ICD Loader to detect the OpenCL library to use at runtime. For example, to run the basic tests on a Linux platform:

OCL_ICD_FILENAMES=/path/to/vendor_lib.so ./test_basic

Offline Compilation

Testing OpenCL drivers which do not have a runtime compiler can be done by using additional command line arguments provided by the test harness for tests which require compilation, these are:

  • --compilation-mode Selects if OpenCL-C source code should be compiled using an external tool before being passed on to the OpenCL driver in that form for testing. Online is the default mode, but also accepts the values spir-v, and binary.

  • --compilation-cache-mode Controls how the compiled OpenCL-C source code should be cached on disk.

  • --compilation-cache-path Accepts a path to a directory where the compiled binary cache should be stored on disk.

  • --compilation-program Accepts a path to an executable (default: cl_offline_compiler) invoked by the test harness to perform offline compilation of OpenCL-C source code. This executable must match the interface description.

Generating a Conformance Report

The Khronos Conformance Process Document details the steps required for a conformance submissions. In this repository opencl_conformance_tests_full.csv defines the full list of tests which must be run for conformance. The output log of which must be included alongside a filled in submission details template.

Utility script run_conformance.py can be used to help generating the submission log, although it is not required.

Git tags are used to define the version of the repository conformance submissions are made against.

Contributing

Contributions are welcome to the project from Khronos members and non-members alike via GitHub Pull Requests (PR). Alternatively, if you've found a bug or have a questions please file an issue in the GitHub project. First time contributors will be required to sign the Khronos Contributor License Agreement (CLA) before their PR can be merged.

PRs to the repository are required to be clang-format clean to pass CI. Developers can either use the git-clang-format tool locally to verify this before contributing, or update their PR based on the diff provided by a failing CI job.

Description
No description provided
Readme 44 MiB
Languages
C++ 84.5%
C 14.7%
CMake 0.5%
Python 0.3%