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