[Piglit] [PATCH] Fix a bunch of CL tests on MacOS.

Tom Stellard tom at stellard.net
Mon Nov 26 09:54:31 PST 2012


On Sat, Nov 24, 2012 at 09:48:39AM -0600, Aaron Watry wrote:
> Any kernel without arguments is automatically optimized out by the compiler.

This looks good pretty good to me.  I think a lot of these functions will
still be optimized out, but it will happen after the warnings are generated.

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

> ---
>  tests/cl/program/build/disable-warnings.cl         |    6 ++++--
>  tests/cl/program/build/include-directories.cl      |    7 ++-----
>  .../program/build/macro-definitions-with-values.cl |    6 ++----
>  tests/cl/program/build/macro-definitions.cl        |    4 ++--
>  tests/cl/program/build/math-intrinsics.cl          |    4 ++--
>  tests/cl/program/build/mixed-macro-definitions.cl  |    6 ++----
>  tests/cl/program/build/optimization-options.cl     |    2 +-
>  tests/cl/program/build/other-data-types.cl         |    2 +-
>  .../program/build/scalar-and-vector-operators.cl   |    2 +-
>  tests/cl/program/build/scalar-data-types.cl        |    2 +-
>  tests/cl/program/build/scalar-operators.cl         |    2 +-
>  tests/cl/program/build/vector-data-types.cl        |    2 +-
>  tests/cl/program/build/vector-operators.cl         |    2 +-
>  tests/cl/program/build/version-declaration.cl      |    2 +-
>  14 files changed, 22 insertions(+), 27 deletions(-)
> 
> diff --git a/tests/cl/program/build/disable-warnings.cl b/tests/cl/program/build/disable-warnings.cl
> index c5719e3..f9fbaee 100644
> --- a/tests/cl/program/build/disable-warnings.cl
> +++ b/tests/cl/program/build/disable-warnings.cl
> @@ -5,8 +5,10 @@ clc_version_min: 10
>  build_options: -w
>  !*/
>  
> -void dummy_function() { int i = 0; }
> +void dummy_function() {
> +    int i = 0; //unused variable
> +}
>  
> -kernel void dummy_kernel() {
> +kernel void dummy_kernel(global int* out) {
>      dummy_function();
>  }
> \ No newline at end of file
> diff --git a/tests/cl/program/build/include-directories.cl b/tests/cl/program/build/include-directories.cl
> index 59b7882..40ed944 100644
> --- a/tests/cl/program/build/include-directories.cl
> +++ b/tests/cl/program/build/include-directories.cl
> @@ -7,9 +7,6 @@ build_options: -I . -I tests/cl/program/build
>  
>  #include "include_test.h"
>  
> -void dummy_function() {}
> -
> -kernel void dummy_kernel() {
> -    dummy_function();
> -    int test = BUILD_OPT;
> +kernel void dummy_kernel(global int* out) {
> +    *out = BUILD_OPT;
>  }
> diff --git a/tests/cl/program/build/macro-definitions-with-values.cl b/tests/cl/program/build/macro-definitions-with-values.cl
> index eb36d4d..85244a5 100644
> --- a/tests/cl/program/build/macro-definitions-with-values.cl
> +++ b/tests/cl/program/build/macro-definitions-with-values.cl
> @@ -5,8 +5,6 @@ clc_version_min: 10
>  build_options: -D BUILD_OPT1=1 -D BUILD_OPT2=2
>  !*/
>  
> -
> -
> -kernel void dummy_kernel(){
> -    int var1 = BUILD_OPT1; int var2 = BUILD_OPT2;
> +kernel void dummy_kernel(global int* out){
> +    *out = BUILD_OPT1 + BUILD_OPT2;
>  }
> \ No newline at end of file
> diff --git a/tests/cl/program/build/macro-definitions.cl b/tests/cl/program/build/macro-definitions.cl
> index 1758c3f..1ef8808 100644
> --- a/tests/cl/program/build/macro-definitions.cl
> +++ b/tests/cl/program/build/macro-definitions.cl
> @@ -5,6 +5,6 @@ clc_version_min: 10
>  build_options: -D BUILD_OPT1 -D BUILD_OPT2
>  !*/
>  
> -kernel void dummy_kernel(){
> -    int var1 = BUILD_OPT1; int var2 = BUILD_OPT2;
> +kernel void dummy_kernel(global int *out){
> +    *out = BUILD_OPT1 + BUILD_OPT2;
>  }
> diff --git a/tests/cl/program/build/math-intrinsics.cl b/tests/cl/program/build/math-intrinsics.cl
> index 374a05d..19e1f31 100644
> --- a/tests/cl/program/build/math-intrinsics.cl
> +++ b/tests/cl/program/build/math-intrinsics.cl
> @@ -7,6 +7,6 @@ build_options: -cl-single-precision-constant -cl-denorms-are-zero
>  
>  void dummy_function() {}
>  
> -kernel void dummy_kernel() {
> -    dummy_function();
> +kernel void dummy_kernel(global int* out){
> +    *out = 1;
>  }
> \ No newline at end of file
> diff --git a/tests/cl/program/build/mixed-macro-definitions.cl b/tests/cl/program/build/mixed-macro-definitions.cl
> index 274f813..01ee1ac 100644
> --- a/tests/cl/program/build/mixed-macro-definitions.cl
> +++ b/tests/cl/program/build/mixed-macro-definitions.cl
> @@ -5,8 +5,6 @@ clc_version_min: 10
>  build_options: -D BUILD_OPT1 -D BUILD_OPT2=2
>  !*/
>  
> -
> -
> -kernel void dummy_kernel(){
> -    int var1 = BUILD_OPT1; int var2 = BUILD_OPT2;
> +kernel void dummy_kernel(global int* out){
> +    *out = BUILD_OPT1 + BUILD_OPT2;
>  }
> \ No newline at end of file
> diff --git a/tests/cl/program/build/optimization-options.cl b/tests/cl/program/build/optimization-options.cl
> index 90440b0..9d73fb4 100644
> --- a/tests/cl/program/build/optimization-options.cl
> +++ b/tests/cl/program/build/optimization-options.cl
> @@ -7,6 +7,6 @@ build_options: -cl-opt-disable -cl-strict-aliasing -cl-mad-enable -cl-finite-mat
>  
>  void dummy_function() {}
>  
> -kernel void dummy_kernel() {
> +kernel void dummy_kernel(global int* out) {
>      dummy_function();
>  }
> \ No newline at end of file
> diff --git a/tests/cl/program/build/other-data-types.cl b/tests/cl/program/build/other-data-types.cl
> index 31d14a2..b5da11f 100644
> --- a/tests/cl/program/build/other-data-types.cl
> +++ b/tests/cl/program/build/other-data-types.cl
> @@ -7,7 +7,7 @@ name: Other data types declarations (image, sampler, event)
>  clc_version_min: 10
>  !*/
>  
> -kernel void test() {
> +kernel void test(global int* out) {
>  	image2d_t i2;
>  	image3d_t i3;
>  	sampler_t s;
> diff --git a/tests/cl/program/build/scalar-and-vector-operators.cl b/tests/cl/program/build/scalar-and-vector-operators.cl
> index 8583faa..6a099ef 100644
> --- a/tests/cl/program/build/scalar-and-vector-operators.cl
> +++ b/tests/cl/program/build/scalar-and-vector-operators.cl
> @@ -4,7 +4,7 @@ name: Scalar and vector operators
>  clc_version_min: 10
>  !*/
>  
> -void test() {
> +kernel void test(global int* out) {
>  	int a;
>  	int4 b;
>  
> diff --git a/tests/cl/program/build/scalar-data-types.cl b/tests/cl/program/build/scalar-data-types.cl
> index d23ebb1..d3c5061 100644
> --- a/tests/cl/program/build/scalar-data-types.cl
> +++ b/tests/cl/program/build/scalar-data-types.cl
> @@ -4,7 +4,7 @@ name: Scalar data types declarations
>  clc_version_min: 10
>  !*/
>  
> -kernel void test() {
> +kernel void test(global int* out) {
>  	bool b;
>  	char c;
>  	unsigned char uc1; uchar uc2;
> diff --git a/tests/cl/program/build/scalar-operators.cl b/tests/cl/program/build/scalar-operators.cl
> index a46ff70..ae653e4 100644
> --- a/tests/cl/program/build/scalar-operators.cl
> +++ b/tests/cl/program/build/scalar-operators.cl
> @@ -4,7 +4,7 @@ name: Scalar operators
>  clc_version_min: 10
>  !*/
>  
> -void test() {
> +kernel void test(global int* out) {
>  	int a;
>  	int b;
>  
> diff --git a/tests/cl/program/build/vector-data-types.cl b/tests/cl/program/build/vector-data-types.cl
> index 8c84f4c..1d77c59 100644
> --- a/tests/cl/program/build/vector-data-types.cl
> +++ b/tests/cl/program/build/vector-data-types.cl
> @@ -4,7 +4,7 @@ name: Vector data types declarations
>  clc_version_min: 10
>  !*/
>  
> -kernel void test() {
> +kernel void test(global int* out) {
>  	char2    c2; char4    c4; char8    c8; char16    c16;
>  	uchar2  uc2; uchar4  uc4; uchar8  uc8; uchar16  uc16;
>  	short2   s2; short4   s4; short8   s8; short16   s16;
> diff --git a/tests/cl/program/build/vector-operators.cl b/tests/cl/program/build/vector-operators.cl
> index 454486f..f620bcf 100644
> --- a/tests/cl/program/build/vector-operators.cl
> +++ b/tests/cl/program/build/vector-operators.cl
> @@ -4,7 +4,7 @@ name: Vector operators
>  clc_version_min: 10
>  !*/
>  
> -void test() {
> +kernel void test(global int* out) {
>  	int4 a;
>  	int4 b;
>  
> diff --git a/tests/cl/program/build/version-declaration.cl b/tests/cl/program/build/version-declaration.cl
> index a460c97..6ebfcc2 100644
> --- a/tests/cl/program/build/version-declaration.cl
> +++ b/tests/cl/program/build/version-declaration.cl
> @@ -7,6 +7,6 @@ build_options: -cl-std=CL1.1
>  
>  void dummy_function() {}
>  
> -kernel void dummy_kernel() {
> +kernel void dummy_kernel(global int* out) {
>      dummy_function();
>  }
> \ No newline at end of file
> -- 
> 1.7.4.4
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list