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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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