[Piglit] [PATCH] cl: Add a test for the predefined macros

Serge Martin edb+piglit at sigluy.net
Sat Sep 10 12:27:51 UTC 2016


On Saturday 10 September 2016 11:46:32 Niels Ole Salscheider wrote:
> Signed-off-by: Niels Ole Salscheider <niels_ole at salscheider-online.de>
> ---
>  tests/cl/program/build/cl-defines.cl | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 tests/cl/program/build/cl-defines.cl
> 
> diff --git a/tests/cl/program/build/cl-defines.cl
> b/tests/cl/program/build/cl-defines.cl new file mode 100644
> index 0000000..696e9f0
> --- /dev/null
> +++ b/tests/cl/program/build/cl-defines.cl
> @@ -0,0 +1,22 @@
> +/*!
> +[config]
> +name: OpenCL predefined macros
> +clc_version_min: 10
> +!*/
> +
> +#ifndef __FILE__
> +#error "__FILE__ not defined"
> +#endif
> +
> +#ifndef __LINE__
> +#error "__LINE__ not defined"
> +#endif
> +
> +#ifndef __OPENCL_VERSION__
> +#error "__OPENCL_VERSION__ not defined"
> +#endif
> +
> +#ifndef __ENDIAN_LITTLE__
> +#error "__ENDIAN_LITTLE__ not defined"

This should be undefined if the GPU is big endian an triggering an error would 
be wrong

> +#endif

There is also __OPENCL_C_VERSION__, __kernel_exec that should be check, this 
way.
However, if we go for something different, we could for example run a kernel  
that fills an array and then have the value check by a C program.
This way, you could also check __IMAGE_SUPPORT__, __ENDIAN_LITTLE__, 
CL_VERSION_1_0 (and so on), __OPENCL_VERSION__, __IMAGE_SUPPORT__, 
__FAST_RELAXED_MATH__ based on what is reported by the opencl lib.

Serge

> +



More information about the Piglit mailing list