mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 14:09:03 +00:00
Migrate basic suite to the new test registration framework (#2316)
Contributes to #2181. Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
@@ -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
|
||||
@@ -13,9 +13,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "procs.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include "testBase.h"
|
||||
|
||||
// Test __FILE__, __LINE__, __OPENCL_VERSION__, __OPENCL_C_VERSION__, __ENDIAN_LITTLE__, __ROUNDING_MODE__, __IMAGE_SUPPORT__, __FAST_RELAXED_MATH__
|
||||
// __kernel_exec
|
||||
|
||||
@@ -83,7 +84,7 @@ const char *preprocessor_test = {
|
||||
"}\n"
|
||||
};
|
||||
|
||||
int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
|
||||
REGISTER_TEST(kernel_preprocessor_macros)
|
||||
{
|
||||
clProgramWrapper program;
|
||||
clKernelWrapper kernel;
|
||||
@@ -156,7 +157,7 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
|
||||
/////// Check the integer results
|
||||
|
||||
// We need to check these values against what we know is supported on the device
|
||||
if( checkForImageSupport( deviceID ) == 0 )
|
||||
if (checkForImageSupport(device) == 0)
|
||||
{
|
||||
// If images are supported, the constant should have been defined to the value 1
|
||||
if( results[ 0 ] == 0xf00baa )
|
||||
@@ -182,7 +183,9 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
|
||||
|
||||
// __ENDIAN_LITTLE__ is similar to __IMAGE_SUPPORT__: 1 if it's true, undefined if it isn't
|
||||
cl_bool deviceIsLittleEndian;
|
||||
error = clGetDeviceInfo( deviceID, CL_DEVICE_ENDIAN_LITTLE, sizeof( deviceIsLittleEndian ), &deviceIsLittleEndian, NULL );
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_ENDIAN_LITTLE,
|
||||
sizeof(deviceIsLittleEndian), &deviceIsLittleEndian,
|
||||
NULL);
|
||||
test_error( error, "Unable to get endian property of device to validate against" );
|
||||
|
||||
if( deviceIsLittleEndian )
|
||||
@@ -216,7 +219,7 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
|
||||
|
||||
// The OpenCL version reported by the macro reports the feature level supported by the compiler. Since
|
||||
// this doesn't directly match any property we can query, we just check to see if it's a sane value
|
||||
auto device_cl_version = get_device_cl_version(deviceID);
|
||||
auto device_cl_version = get_device_cl_version(device);
|
||||
int device_cl_version_int = device_cl_version.to_uint() * 10;
|
||||
if ((results[2] < 100) || (results[2] > device_cl_version_int))
|
||||
{
|
||||
@@ -241,11 +244,11 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
|
||||
int cl_c_minor_version = (results[3] / 10) % 10;
|
||||
if ((results[3] < 100)
|
||||
|| (!device_supports_cl_c_version(
|
||||
deviceID,
|
||||
device,
|
||||
Version{ (cl_uint)cl_c_major_version,
|
||||
(cl_uint)cl_c_minor_version })))
|
||||
{
|
||||
auto device_version = get_device_cl_c_version(deviceID);
|
||||
auto device_version = get_device_cl_c_version(device);
|
||||
log_error(
|
||||
"ERROR: Kernel preprocessor __OPENCL_C_VERSION__ does not make "
|
||||
"sense w.r.t. device's version string! "
|
||||
@@ -337,7 +340,7 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
|
||||
test_error( error, "Unable to create test program" );
|
||||
|
||||
// Try compiling
|
||||
error = clBuildProgram( programB, 1, &deviceID, "-cl-fast-relaxed-math", NULL, NULL );
|
||||
error = clBuildProgram( programB, 1, &device, "-cl-fast-relaxed-math", NULL, NULL );
|
||||
test_error( error, "Unable to build program" );
|
||||
|
||||
// Create a kernel again to run against
|
||||
@@ -373,4 +376,3 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user