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
This commit is contained in:
Grzegorz Wawiorko
2019-12-20 12:30:03 +01:00
committed by Kévin Petit
parent 841123040e
commit daafdac555
27 changed files with 109 additions and 69 deletions

View File

@@ -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;

View File

@@ -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 )

View File

@@ -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 );

View File

@@ -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);

View File

@@ -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 )

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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