From daafdac555381b5bb1e7c50cd0587b51cfd531ac Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Fri, 20 Dec 2019 12:30:03 +0100 Subject: [PATCH] Fixes issue #497 - Image tests from master branch on OCL 1.2 device (#501) * Fixes issue #497 - Image tests from master branch on OCL 1.2 device * Fixes issue #497 - use get_device_cl_version --- .../images/kernel_image_methods/main.cpp | 6 +++-- .../images/kernel_image_methods/test_1D.cpp | 7 +++--- .../kernel_image_methods/test_1D_array.cpp | 6 ++--- .../images/kernel_image_methods/test_2D.cpp | 6 ++--- .../kernel_image_methods/test_2D_array.cpp | 6 ++--- .../images/kernel_image_methods/test_3D.cpp | 4 +-- .../kernel_image_methods/test_loops.cpp | 25 +++++++++++-------- .../images/kernel_read_write/main.cpp | 14 ++++++++++- .../kernel_read_write/test_iterations.cpp | 5 ++-- .../images/kernel_read_write/test_loops.cpp | 3 ++- .../images/kernel_read_write/test_read_1D.cpp | 5 ++-- .../kernel_read_write/test_read_1D_array.cpp | 5 ++-- .../kernel_read_write/test_read_2D_array.cpp | 5 ++-- .../images/kernel_read_write/test_read_3D.cpp | 5 ++-- .../kernel_read_write/test_write_1D.cpp | 5 ++-- .../kernel_read_write/test_write_1D_array.cpp | 5 ++-- .../kernel_read_write/test_write_2D_array.cpp | 5 ++-- .../kernel_read_write/test_write_3D.cpp | 5 ++-- .../kernel_read_write/test_write_image.cpp | 5 ++-- .../images/samplerlessReads/main.cpp | 3 ++- .../samplerlessReads/test_iterations.cpp | 6 ++--- .../images/samplerlessReads/test_loops.cpp | 12 ++++++++- .../images/samplerlessReads/test_read_1D.cpp | 6 ++--- .../samplerlessReads/test_read_1D_array.cpp | 6 ++--- .../samplerlessReads/test_read_1D_buffer.cpp | 6 ++--- .../samplerlessReads/test_read_2D_array.cpp | 6 ++--- .../images/samplerlessReads/test_read_3D.cpp | 6 ++--- 27 files changed, 109 insertions(+), 69 deletions(-) diff --git a/test_conformance/images/kernel_image_methods/main.cpp b/test_conformance/images/kernel_image_methods/main.cpp index 765386ee..88625a68 100644 --- a/test_conformance/images/kernel_image_methods/main.cpp +++ b/test_conformance/images/kernel_image_methods/main.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -31,6 +31,8 @@ bool gTestSmallImages; bool gTestMaxImages; bool gTestRounding; int gTypesToTest; +bool gDeviceLt20 = false; + cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT; @@ -81,7 +83,7 @@ int main(int argc, const char *argv[]) test_finish(); return -1; } - + checkDeviceTypeOverride( &gDeviceType ); const char ** argList = (const char **)calloc( argc, sizeof( char*) ); diff --git a/test_conformance/images/kernel_image_methods/test_1D.cpp b/test_conformance/images/kernel_image_methods/test_1D.cpp index 7265a9be..07e9cf42 100644 --- a/test_conformance/images/kernel_image_methods/test_1D.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; +extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; typedef struct image_kernel_data { @@ -65,7 +65,6 @@ static int test_get_1Dimage_info_single( cl_context context, cl_command_queue qu // Construct testing source if( gDebugTrace ) log_info( " - Creating 1D image %d ...\n", (int)imageInfo->width ); - image = create_image_1d( context, (cl_mem_flags)(CL_MEM_READ_ONLY), imageInfo->format, imageInfo->width, 0, NULL, NULL, &error ); if( image == NULL ) { @@ -94,7 +93,7 @@ static int test_get_1Dimage_info_single( cl_context context, cl_command_queue qu if (error) print_error(error, "clFinish failed.\n"); const char *ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create kernel to test against" ); // Create an output buffer diff --git a/test_conformance/images/kernel_image_methods/test_1D_array.cpp b/test_conformance/images/kernel_image_methods/test_1D_array.cpp index 2c1b33cb..83594a2b 100644 --- a/test_conformance/images/kernel_image_methods/test_1D_array.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D_array.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; +extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; typedef struct image_kernel_data { @@ -97,7 +97,7 @@ int test_get_1Dimage_array_info_single( cl_context context, cl_command_queue que if (error) print_error(error, "clFinish failed.\n"); const char *ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create kernel to test against" ); // Create an output buffer diff --git a/test_conformance/images/kernel_image_methods/test_2D.cpp b/test_conformance/images/kernel_image_methods/test_2D.cpp index ca89b49f..ab9138d5 100644 --- a/test_conformance/images/kernel_image_methods/test_2D.cpp +++ b/test_conformance/images/kernel_image_methods/test_2D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; +extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; typedef struct image_kernel_data { @@ -121,7 +121,7 @@ int test_get_image_info_single( cl_context context, cl_command_queue queue, imag if (error) print_error(error, "clFinish failed.\n"); const char *ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create kernel to test against" ); // Create an output buffer diff --git a/test_conformance/images/kernel_image_methods/test_2D_array.cpp b/test_conformance/images/kernel_image_methods/test_2D_array.cpp index 47099f80..f621cd6d 100644 --- a/test_conformance/images/kernel_image_methods/test_2D_array.cpp +++ b/test_conformance/images/kernel_image_methods/test_2D_array.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; +extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; typedef struct image_kernel_data { @@ -101,7 +101,7 @@ int test_get_2Dimage_array_info_single( cl_context context, cl_command_queue que if (error) print_error(error, "clFinish failed.\n"); const char *ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create kernel to test against" ); // Create an output buffer diff --git a/test_conformance/images/kernel_image_methods/test_3D.cpp b/test_conformance/images/kernel_image_methods/test_3D.cpp index b3cee0d3..390bf8f6 100644 --- a/test_conformance/images/kernel_image_methods/test_3D.cpp +++ b/test_conformance/images/kernel_image_methods/test_3D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; +extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; extern int test_get_image_info_single( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ); diff --git a/test_conformance/images/kernel_image_methods/test_loops.cpp b/test_conformance/images/kernel_image_methods/test_loops.cpp index 5dd7c62e..0e8210a5 100644 --- a/test_conformance/images/kernel_image_methods/test_loops.cpp +++ b/test_conformance/images/kernel_image_methods/test_loops.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -20,7 +20,7 @@ extern cl_addressing_mode gAddressModeToUse; extern int gTypesToTest; extern int gNormalizedModeToUse; extern cl_channel_type gChannelTypeToUse; - +extern bool gDeviceLt20; extern bool gDebugTrace; @@ -199,14 +199,19 @@ int test_image_type( cl_device_id device, cl_context context, cl_command_queue q int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, cl_mem_object_type imageType ) { int version_check; - if ((version_check = check_opencl_version(device,1,2))) { - switch (imageType) { - case CL_MEM_OBJECT_IMAGE1D: - test_missing_feature(version_check, "image_1D"); - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - test_missing_feature(version_check, "image_1D_array"); - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - test_missing_feature(version_check, "image_2D_array"); + auto version = get_device_cl_version(device); + if (version < Version(2, 0)) { + gDeviceLt20 = true; + } + + if ((version_check = check_opencl_version(device,1,2))) { + switch (imageType) { + case CL_MEM_OBJECT_IMAGE1D: + test_missing_feature(version_check, "image_1D"); + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + test_missing_feature(version_check, "image_1D_array"); + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + test_missing_feature(version_check, "image_2D_array"); } } diff --git a/test_conformance/images/kernel_read_write/main.cpp b/test_conformance/images/kernel_read_write/main.cpp index 74bbde6f..78363c24 100644 --- a/test_conformance/images/kernel_read_write/main.cpp +++ b/test_conformance/images/kernel_read_write/main.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -44,6 +44,7 @@ bool gTestMaxImages; bool gTestRounding; bool gTestImage2DFromBuffer; bool gTestMipmaps; +bool gDeviceLt20 = false; cl_filter_mode gFilterModeToUse = (cl_filter_mode)-1; // Default is CL_MEM_USE_HOST_PTR for the test cl_mem_flags gMemFlagsToUse = CL_MEM_USE_HOST_PTR; @@ -118,6 +119,10 @@ static int doTest( cl_device_id device, cl_context context, cl_command_queue que bool tDisableOffsets = false; bool tNormalizedModeToUse = false; cl_filter_mode tFilterModeToUse = (cl_filter_mode)-1; + auto version = get_device_cl_version(device); + if (version < Version(2, 0)) { + gDeviceLt20 = true; + } if( testTypesToRun & kReadTests ) { @@ -174,6 +179,13 @@ static int doTest( cl_device_id device, cl_context context, cl_command_queue que } } + if (testTypesToRun & kReadWriteTests) { + if (gDeviceLt20) { + log_info("TEST skipped, Opencl 2.0 + requried for this test"); + return ret; + } + } + if( ( testTypesToRun & kReadWriteTests ) && !gTestMipmaps ) { gtestTypesToRun = kReadWriteTests; diff --git a/test_conformance/images/kernel_read_write/test_iterations.cpp b/test_conformance/images/kernel_read_write/test_iterations.cpp index 6d064af8..1f54c70d 100644 --- a/test_conformance/images/kernel_read_write/test_iterations.cpp +++ b/test_conformance/images/kernel_read_write/test_iterations.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -33,6 +33,7 @@ extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; #define MAX_TRIES 1 #define MAX_CLAMPED 1 @@ -1643,7 +1644,7 @@ int test_read_image_set_2D( cl_device_id device, cl_context context, cl_command_ gTestMipmaps?", lod":" "); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); if( gTestSmallImages ) diff --git a/test_conformance/images/kernel_read_write/test_loops.cpp b/test_conformance/images/kernel_read_write/test_loops.cpp index 152bfd00..4cdff580 100644 --- a/test_conformance/images/kernel_read_write/test_loops.cpp +++ b/test_conformance/images/kernel_read_write/test_loops.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -26,6 +26,7 @@ extern bool gDebugTrace; extern bool gTestMipmaps; extern int gtestTypesToRun; +extern bool gDeviceLt20; extern int test_read_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, image_sampler_data *imageSampler, bool floatCoords, ExplicitType outputType ); diff --git a/test_conformance/images/kernel_read_write/test_read_1D.cpp b/test_conformance/images/kernel_read_write/test_read_1D.cpp index 07ad4c7d..f7eaa4e7 100644 --- a/test_conformance/images/kernel_read_write/test_read_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_read_1D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -33,6 +33,7 @@ extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; #define MAX_TRIES 1 #define MAX_CLAMPED 1 @@ -1056,7 +1057,7 @@ int test_read_image_set_1D( cl_device_id device, cl_context context, cl_command_ ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); if(error) { exit(1); diff --git a/test_conformance/images/kernel_read_write/test_read_1D_array.cpp b/test_conformance/images/kernel_read_write/test_read_1D_array.cpp index de01e9ed..7cb7c56e 100644 --- a/test_conformance/images/kernel_read_write/test_read_1D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_read_1D_array.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -33,6 +33,7 @@ extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; #define MAX_TRIES 1 #define MAX_CLAMPED 1 @@ -1165,7 +1166,7 @@ int test_read_image_set_1D_array( cl_device_id device, cl_context context, cl_co gTestMipmaps ? ", lod" : "" ); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); if( gTestSmallImages ) diff --git a/test_conformance/images/kernel_read_write/test_read_2D_array.cpp b/test_conformance/images/kernel_read_write/test_read_2D_array.cpp index 1e2700b0..e288bc06 100644 --- a/test_conformance/images/kernel_read_write/test_read_2D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_read_2D_array.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -26,6 +26,7 @@ extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; #define MAX_TRIES 1 #define MAX_CLAMPED 1 @@ -1357,7 +1358,7 @@ int test_read_image_set_2D_array( cl_device_id device, cl_context context, cl_co gTestMipmaps ? ", lod" : " " ); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); // Run tests diff --git a/test_conformance/images/kernel_read_write/test_read_3D.cpp b/test_conformance/images/kernel_read_write/test_read_3D.cpp index 8c6630ec..993490f5 100644 --- a/test_conformance/images/kernel_read_write/test_read_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_read_3D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -27,6 +27,7 @@ extern cl_addressing_mode gAddressModeToUse; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; #define MAX_TRIES 1 #define MAX_CLAMPED 1 @@ -1201,7 +1202,7 @@ int test_read_image_set_3D( cl_device_id device, cl_context context, cl_command_ gTestMipmaps? ",lod":" "); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); // Run tests diff --git a/test_conformance/images/kernel_read_write/test_write_1D.cpp b/test_conformance/images/kernel_read_write/test_write_1D.cpp index 1f3cfd60..8a928d03 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -24,6 +24,7 @@ extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; extern bool validate_float_write_results( float *expected, float *actual, image_descriptor *imageInfo ); @@ -584,7 +585,7 @@ int test_write_image_1D_set( cl_device_id device, cl_context context, cl_command gTestMipmaps ? ", lod" :"" ); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); // Run tests diff --git a/test_conformance/images/kernel_read_write/test_write_1D_array.cpp b/test_conformance/images/kernel_read_write/test_write_1D_array.cpp index c0f3e45b..cd5385e8 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D_array.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -23,6 +23,7 @@ extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePi extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; extern bool validate_float_write_results( float *expected, float *actual, image_descriptor *imageInfo ); @@ -607,7 +608,7 @@ int test_write_image_1D_array_set( cl_device_id device, cl_context context, cl_c gTestMipmaps ? ", lod" :"" ); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); // Run tests diff --git a/test_conformance/images/kernel_read_write/test_write_2D_array.cpp b/test_conformance/images/kernel_read_write/test_write_2D_array.cpp index 84292fdd..106e102c 100644 --- a/test_conformance/images/kernel_read_write/test_write_2D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_write_2D_array.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -24,6 +24,7 @@ extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; extern bool validate_float_write_results( float *expected, float *actual, image_descriptor *imageInfo ); @@ -631,7 +632,7 @@ int test_write_image_2D_array_set( cl_device_id device, cl_context context, cl_c gTestMipmaps ? ", lod" : "" ); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); // Run tests diff --git a/test_conformance/images/kernel_read_write/test_write_3D.cpp b/test_conformance/images/kernel_read_write/test_write_3D.cpp index 14510f59..08f1c87b 100644 --- a/test_conformance/images/kernel_read_write/test_write_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_3D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -24,6 +24,7 @@ extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; extern bool validate_float_write_results( float *expected, float *actual, image_descriptor *imageInfo ); @@ -637,7 +638,7 @@ int test_write_image_3D_set( cl_device_id device, cl_context context, cl_command gTestMipmaps ? ", lod" : "" ); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); // Run tests diff --git a/test_conformance/images/kernel_read_write/test_write_image.cpp b/test_conformance/images/kernel_read_write/test_write_image.cpp index ffb73db1..ef6f87fd 100644 --- a/test_conformance/images/kernel_read_write/test_write_image.cpp +++ b/test_conformance/images/kernel_read_write/test_write_image.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -23,6 +23,7 @@ extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePi extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; +extern bool gDeviceLt20; extern int test_write_image_1D_set( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType inputType, MTdata d ); extern int test_write_image_3D_set( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType inputType, MTdata d ); @@ -683,7 +684,7 @@ int test_write_image_set( cl_device_id device, cl_context context, cl_command_qu gTestMipmaps ? ", lod" : "" ); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0"); test_error( error, "Unable to create testing kernel" ); // Run tests diff --git a/test_conformance/images/samplerlessReads/main.cpp b/test_conformance/images/samplerlessReads/main.cpp index 5b0d3110..fb8df7de 100644 --- a/test_conformance/images/samplerlessReads/main.cpp +++ b/test_conformance/images/samplerlessReads/main.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -44,6 +44,7 @@ cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; cl_channel_order gChannelOrderToUse = (cl_channel_order)-1; bool gEnablePitch = false; cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT; +bool gDeviceLt20 = false; #define MAX_ALLOWED_STD_DEVIATION_IN_MB 8.0 diff --git a/test_conformance/images/samplerlessReads/test_iterations.cpp b/test_conformance/images/samplerlessReads/test_iterations.cpp index a4d68543..1c745061 100644 --- a/test_conformance/images/samplerlessReads/test_iterations.cpp +++ b/test_conformance/images/samplerlessReads/test_iterations.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; extern cl_device_type gDeviceType; extern bool gTestReadWrite; @@ -261,7 +261,7 @@ int test_read_image_set_2D( cl_device_id device, cl_context context, cl_command_ } ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create testing kernel" ); if ( gTestSmallImages ) diff --git a/test_conformance/images/samplerlessReads/test_loops.cpp b/test_conformance/images/samplerlessReads/test_loops.cpp index c7311a94..a56fb22f 100644 --- a/test_conformance/images/samplerlessReads/test_loops.cpp +++ b/test_conformance/images/samplerlessReads/test_loops.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -20,6 +20,7 @@ extern cl_channel_type gChannelTypeToUse; extern cl_channel_order gChannelOrderToUse; extern bool gDebugTrace; +extern bool gDeviceLt20; extern bool gTestReadWrite; @@ -209,6 +210,15 @@ int test_image_set( cl_device_id device, cl_context context, cl_command_queue qu cl_image_format *formatList; bool *filterFlags; unsigned int numFormats; + auto version = get_device_cl_version(device); + if (version < Version(2, 0)) { + gDeviceLt20 = true; + } + + if (gDeviceLt20 && gTestReadWrite) { + log_info("TEST skipped, Opencl 2.0 + requried for this test"); + return ret; + } // This flag is only for querying the list of supported formats // The flag for creating image will be set explicitly in test functions diff --git a/test_conformance/images/samplerlessReads/test_read_1D.cpp b/test_conformance/images/samplerlessReads/test_read_1D.cpp index 7018ca66..6d58625f 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; extern cl_device_type gDeviceType; extern bool gTestReadWrite; @@ -259,7 +259,7 @@ int test_read_image_set_1D( cl_device_id device, cl_context context, cl_command_ ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create testing kernel" ); if ( gTestSmallImages ) diff --git a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp index b2f6bde2..5670b5dd 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; extern cl_device_type gDeviceType; extern bool gTestReadWrite; @@ -256,7 +256,7 @@ int test_read_image_set_1D_array( cl_device_id device, cl_context context, cl_co ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create testing kernel" ); if ( gTestSmallImages ) diff --git a/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp b/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp index a014eb5c..fe8e10b6 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gTestRounding, gDeviceLt20; extern cl_device_type gDeviceType; #define MAX_TRIES 1 @@ -256,7 +256,7 @@ int test_read_image_set_1D_buffer( cl_device_id device, cl_context context, cl_c readFormat ); ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create testing kernel" ); if ( gTestSmallImages ) diff --git a/test_conformance/images/samplerlessReads/test_read_2D_array.cpp b/test_conformance/images/samplerlessReads/test_read_2D_array.cpp index 4d2b40a7..5741ff01 100644 --- a/test_conformance/images/samplerlessReads/test_read_2D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_2D_array.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -19,7 +19,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; extern cl_device_type gDeviceType; extern bool gTestReadWrite; @@ -245,7 +245,7 @@ int test_read_image_set_2D_array( cl_device_id device, cl_context context, cl_co ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create testing kernel" ); diff --git a/test_conformance/images/samplerlessReads/test_read_3D.cpp b/test_conformance/images/samplerlessReads/test_read_3D.cpp index f6e274a7..e80dec9c 100644 --- a/test_conformance/images/samplerlessReads/test_read_3D.cpp +++ b/test_conformance/images/samplerlessReads/test_read_3D.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -19,7 +19,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; extern cl_device_type gDeviceType; extern bool gTestReadWrite; @@ -248,7 +248,7 @@ int test_read_image_set_3D( cl_device_id device, cl_context context, cl_command_ ptr = programSrc; - error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", "-cl-std=CL2.0" ); + error = create_single_kernel_helper_with_build_options( context, &program, &kernel, 1, &ptr, "sample_kernel", gDeviceLt20 ? "" : "-cl-std=CL2.0" ); test_error( error, "Unable to create testing kernel" );