Reduce diff with master branch (#399)

A first round of whitespace, formatting and uncontroversial changes.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
Kévin Petit
2019-07-30 09:51:03 +01:00
committed by GitHub
parent 284680936d
commit 996dd659fc
8 changed files with 189 additions and 165 deletions

View File

@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.1)
set( CONFORMANCE_SUFFIX "" )
set(CLConform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
project(CLConform${CONFORMANCE_SUFFIX})
@@ -26,6 +25,7 @@ add_definitions(-DCL_USE_DEPRECATED_OPENCL_2_1_APIS=1)
add_definitions(-DCL_USE_DEPRECATED_OPENCL_2_0_APIS=1)
add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_2_APIS=1)
add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS=1)
add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_0_APIS=1)
# Support both VS2008 and VS2012.
@@ -103,14 +103,11 @@ if(APPLE)
list(APPEND CLConform_LIBRARIES ${iokit})
endif(APPLE)
list(APPEND CLConform_INCLUDE_DIR ${OPENCL_INCLUDE_DIR})
include_directories (${CLConform_SOURCE_DIR}/test_common/harness
${CLConform_SOURCE_DIR}/test_common/gles
${CLConform_SOURCE_DIR}/test_common/gl
${CLConform_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/test_common/harness
)
include_directories(SYSTEM ${OPENCL_INCLUDE_DIR})
include_directories(${CLConform_SOURCE_DIR}/test_common/harness
${CLConform_SOURCE_DIR}/test_common/gles
${CLConform_SOURCE_DIR}/test_common/gl
${CMAKE_CURRENT_SOURCE_DIR}/test_common/harness)
if(CMAKE_BUILD_TYPE STREQUAL "release")
set (BUILD_FLAVOR "release")
@@ -128,13 +125,13 @@ set (DLL_FILES "${VS_BUILD_DIR}/Debug/*.dll")
set (DST_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/")
if (WIN32)
set (COPY "echo")
add_custom_target( COPY_DLL${CONFORMANCE_SUFFIX} ALL
COMMAND ${COPY} \"${DLL_FILES}\" \"${DST_DIR}\"
COMMENT "Copying dll files.. ")
set (COPY "echo")
add_custom_target(COPY_DLL${CONFORMANCE_SUFFIX} ALL
COMMAND ${COPY} "${DLL_FILES}" "${DST_DIR}"
COMMENT "Copying dll files.. ")
else (WIN32)
set (COPY cp)
add_custom_target( COPY_DLL${CONFORMANCE_SUFFIX} )
set (COPY cp)
add_custom_target(COPY_DLL${CONFORMANCE_SUFFIX})
endif(WIN32)
set_property(TARGET COPY_DLL${CONFORMANCE_SUFFIX} PROPERTY FOLDER "CONFORMANCE${CONFORMANCE_SUFFIX}")
@@ -163,4 +160,4 @@ if(MSVC)
endif(MSVC)
set_property(TARGET COPY_FILES${CONFORMANCE_SUFFIX} PROPERTY FOLDER "CONFORMANCE${CONFORMANCE_SUFFIX}")
add_subdirectory( "test_extensions" )
add_subdirectory( "test_extensions" )

View File

@@ -25,11 +25,8 @@ IF NOT EXIST CLConform.sln (
echo "Solution file found CLConform.sln "
)
echo Building CLConform.sln...
%VCPATH% CLConform.sln /build
GOTO:EOF

View File

@@ -312,17 +312,17 @@ static int invoke_offline_compiler(cl_context context,
const std::string &sourceFilename,
const std::string &outputFilename)
{
std::string scriptToRunString =
std::string runString =
get_offline_compilation_command(device_address_space_size, compilationMode, bOptions,
sourceFilename, outputFilename);
// execute script
log_info("Executing command: %s\n", scriptToRunString.c_str());
log_info("Executing command: %s\n", runString.c_str());
fflush(stdout);
int returnCode = system(scriptToRunString.c_str());
int returnCode = system(runString.c_str());
if (returnCode != 0)
{
log_error("Command finished with error: 0x%x\n", returnCode);
log_error("ERROR: Command finished with error: 0x%x\n", returnCode);
return CL_COMPILE_PROGRAM_FAILURE;
}
@@ -568,139 +568,151 @@ int create_single_kernel_helper(cl_context context, cl_program *outProgram, cl_k
test_error(error, "Create program failed");
/* Compile the program */
int buildProgramFailed = 0;
int printedSource = 0;
error = clBuildProgram(*outProgram, 0, NULL, buildOptions, NULL, NULL);
if (error != CL_SUCCESS)
{
unsigned int i;
print_error(error, "clBuildProgram failed");
buildProgramFailed = 1;
printedSource = 1;
log_error( "Build options: %s\n", buildOptions );
log_error( "Original source is: ------------\n" );
for( i = 0; i < numKernelLines; i++ )
log_error( "%s", kernelProgram[ i ] );
}
// Verify the build status on all devices
cl_uint deviceCount = 0;
error = clGetProgramInfo( *outProgram, CL_PROGRAM_NUM_DEVICES, sizeof( deviceCount ), &deviceCount, NULL );
if (error != CL_SUCCESS) {
print_error(error, "clGetProgramInfo CL_PROGRAM_NUM_DEVICES failed");
return error;
}
if (deviceCount == 0) {
log_error("No devices found for program.\n");
return -1;
}
cl_device_id *devices = (cl_device_id*) malloc( deviceCount * sizeof( cl_device_id ) );
if( NULL == devices )
return -1;
BufferOwningPtr<cl_device_id> devicesBuf(devices);
memset( devices, 0, deviceCount * sizeof( cl_device_id ));
error = clGetProgramInfo( *outProgram, CL_PROGRAM_DEVICES, sizeof( cl_device_id ) * deviceCount, devices, NULL );
if (error != CL_SUCCESS) {
print_error(error, "clGetProgramInfo CL_PROGRAM_DEVICES failed");
return error;
}
cl_uint z;
bool buildFailed = false;
for( z = 0; z < deviceCount; z++ )
{
char deviceName[4096] = "";
error = clGetDeviceInfo(devices[z], CL_DEVICE_NAME, sizeof( deviceName), deviceName, NULL);
if (error != CL_SUCCESS || deviceName[0] == '\0') {
log_error("Device \"%d\" failed to return a name\n", z);
print_error(error, "clGetDeviceInfo CL_DEVICE_NAME failed");
}
cl_build_status buildStatus;
error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL);
if (error != CL_SUCCESS) {
print_error(error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_STATUS failed");
return error;
}
if (buildStatus == CL_BUILD_SUCCESS && buildProgramFailed && deviceCount == 1)
int buildProgramFailed = 0;
int printedSource = 0;
error = clBuildProgram(*outProgram, 0, NULL, buildOptions, NULL, NULL);
if (error != CL_SUCCESS)
{
buildFailed = true;
log_error("clBuildProgram returned an error, but buildStatus is marked as CL_BUILD_SUCCESS.\n");
unsigned int i;
print_error(error, "clBuildProgram failed");
buildProgramFailed = 1;
printedSource = 1;
log_error("Build options: %s\n", buildOptions);
log_error("Original source is: ------------\n");
for (i = 0; i < numKernelLines; i++)
log_error("%s", kernelProgram[i]);
}
if (buildStatus != CL_BUILD_SUCCESS) {
// Verify the build status on all devices
cl_uint deviceCount = 0;
error = clGetProgramInfo(*outProgram, CL_PROGRAM_NUM_DEVICES, sizeof(deviceCount), &deviceCount, NULL);
if (error != CL_SUCCESS)
{
print_error(error, "clGetProgramInfo CL_PROGRAM_NUM_DEVICES failed");
return error;
}
char statusString[64] = "";
if (buildStatus == (cl_build_status)CL_BUILD_SUCCESS)
sprintf(statusString, "CL_BUILD_SUCCESS");
else if (buildStatus == (cl_build_status)CL_BUILD_NONE)
sprintf(statusString, "CL_BUILD_NONE");
else if (buildStatus == (cl_build_status)CL_BUILD_ERROR)
sprintf(statusString, "CL_BUILD_ERROR");
else if (buildStatus == (cl_build_status)CL_BUILD_IN_PROGRESS)
sprintf(statusString, "CL_BUILD_IN_PROGRESS");
else
sprintf(statusString, "UNKNOWN (%d)", buildStatus);
if (deviceCount == 0)
{
log_error("No devices found for program.\n");
return -1;
}
if (buildStatus != CL_BUILD_SUCCESS) log_error("Build not successful for device \"%s\", status: %s\n", deviceName, statusString);
size_t paramSize = 0;
error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_LOG, 0, NULL, &paramSize);
if (error != CL_SUCCESS) {
cl_device_id *devices = (cl_device_id *)malloc(deviceCount * sizeof(cl_device_id));
if (NULL == devices)
return -1;
BufferOwningPtr<cl_device_id> devicesBuf(devices);
print_error(error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_LOG failed");
memset(devices, 0, deviceCount * sizeof(cl_device_id));
error = clGetProgramInfo(*outProgram, CL_PROGRAM_DEVICES, sizeof(cl_device_id) * deviceCount, devices, NULL);
if (error != CL_SUCCESS)
{
print_error(error, "clGetProgramInfo CL_PROGRAM_DEVICES failed");
return error;
}
cl_uint z;
bool buildFailed = false;
for (z = 0; z < deviceCount; z++)
{
char deviceName[4096] = "";
error = clGetDeviceInfo(devices[z], CL_DEVICE_NAME, sizeof(deviceName), deviceName, NULL);
if (error != CL_SUCCESS || deviceName[0] == '\0')
{
log_error("Device \"%d\" failed to return a name\n", z);
print_error(error, "clGetDeviceInfo CL_DEVICE_NAME failed");
}
cl_build_status buildStatus;
error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL);
if (error != CL_SUCCESS)
{
print_error(error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_STATUS failed");
return error;
}
std::string log;
log.resize(paramSize / sizeof(char));
error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_LOG, paramSize, &log[0], NULL);
if (error != CL_SUCCESS || log[0] == '\0'){
log_error("Device %d (%s) failed to return a build log\n", z, deviceName);
if (error) {
if (buildStatus == CL_BUILD_SUCCESS && buildProgramFailed && deviceCount == 1)
{
buildFailed = true;
log_error("clBuildProgram returned an error, but buildStatus is marked as CL_BUILD_SUCCESS.\n");
}
if (buildStatus != CL_BUILD_SUCCESS)
{
char statusString[64] = "";
if (buildStatus == (cl_build_status)CL_BUILD_SUCCESS)
sprintf(statusString, "CL_BUILD_SUCCESS");
else if (buildStatus == (cl_build_status)CL_BUILD_NONE)
sprintf(statusString, "CL_BUILD_NONE");
else if (buildStatus == (cl_build_status)CL_BUILD_ERROR)
sprintf(statusString, "CL_BUILD_ERROR");
else if (buildStatus == (cl_build_status)CL_BUILD_IN_PROGRESS)
sprintf(statusString, "CL_BUILD_IN_PROGRESS");
else
sprintf(statusString, "UNKNOWN (%d)", buildStatus);
if (buildStatus != CL_BUILD_SUCCESS)
log_error("Build not successful for device \"%s\", status: %s\n", deviceName, statusString);
size_t paramSize = 0;
error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_LOG, 0, NULL, &paramSize);
if (error != CL_SUCCESS)
{
print_error(error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_LOG failed");
return error;
} else {
log_error("clGetProgramBuildInfo returned an empty log.\n");
return -1;
}
std::string log;
log.resize(paramSize / sizeof(char));
error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_LOG, paramSize, &log[0], NULL);
if (error != CL_SUCCESS || log[0] == '\0')
{
log_error("Device %d (%s) failed to return a build log\n", z, deviceName);
if (error)
{
print_error(error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_LOG failed");
return error;
}
else
{
log_error("clGetProgramBuildInfo returned an empty log.\n");
return -1;
}
}
// In this case we've already printed out the code above.
if (!printedSource)
{
unsigned int i;
log_error("Original source is: ------------\n");
for (i = 0; i < numKernelLines; i++)
log_error("%s", kernelProgram[i]);
printedSource = 1;
}
log_error("Build log for device \"%s\" is: ------------\n", deviceName);
log_error("%s\n", log.c_str());
log_error("\n----------\n");
return -1;
}
// In this case we've already printed out the code above.
if (!printedSource)
{
unsigned int i;
log_error("Original source is: ------------\n");
for (i = 0; i < numKernelLines; i++)
log_error("%s", kernelProgram[i]);
printedSource = 1;
}
log_error("Build log for device \"%s\" is: ------------\n", deviceName);
log_error("%s\n", log.c_str());
log_error("\n----------\n");
}
if (buildFailed)
{
return -1;
}
}
if (buildFailed)
{
return -1;
}
/* And create a kernel from it */
if (kernelName != NULL)
{
*outKernel = clCreateKernel(*outProgram, kernelName, &error);
if (*outKernel == NULL || error != CL_SUCCESS)
{
print_error(error, "Unable to create kernel");
return error;
}
}
/* And create a kernel from it */
if (kernelName != NULL)
{
*outKernel = clCreateKernel(*outProgram, kernelName, &error);
if (*outKernel == NULL || error != CL_SUCCESS)
{
print_error(error, "Unable to create kernel");
return error;
}
}
return 0;
return 0;
}
int get_device_version( cl_device_id id, size_t* major, size_t* minor)

View File

@@ -61,10 +61,25 @@ extern "C" {
const int MAX_LEN_FOR_KERNEL_LIST = 20;
/* Helper that creates a single program and kernel from a single-kernel program source */
extern int create_single_kernel_helper( cl_context context, cl_program *outProgram, cl_kernel *outKernel, unsigned int numKernelLines, const char **kernelProgram, const char *kernelName, const char *buildOptions=NULL );
extern int create_single_kernel_helper_with_build_options( cl_context context, cl_program *outProgram, cl_kernel *outKernel, unsigned int numKernelLines,
const char **kernelProgram, const char *kernelName, const char *buildOptions );
extern int create_single_kernel_helper_create_program(cl_context context, cl_program *outProgram, unsigned int numKernelLines, const char **kernelProgram, const char *buildOptions = NULL);
extern int create_single_kernel_helper(cl_context context,
cl_program *outProgram,
cl_kernel *outKernel,
unsigned int numKernelLines,
const char **kernelProgram,
const char *kernelName,
const char *buildOptions = NULL);
extern int create_single_kernel_helper_with_build_options(cl_context context,
cl_program *outProgram,
cl_kernel *outKernel,
unsigned int numKernelLines,
const char **kernelProgram,
const char *kernelName,
const char *buildOptions);
extern int create_single_kernel_helper_create_program(cl_context context,
cl_program *outProgram,
unsigned int numKernelLines,
const char **kernelProgram,
const char *buildOptions = NULL);
/* Helper to obtain the biggest fit work group size for all the devices in a given group and for the given global thread size */
extern int get_max_common_work_group_size( cl_context context, cl_kernel kernel, size_t globalThreadSize, size_t *outSize );

View File

@@ -1,5 +1,4 @@
set_source_files_properties(
COMPILE_FLAGS -msse2)
set_source_files_properties(COMPILE_FLAGS -msse2)
string(TOLOWER ${MODULE_NAME} MODULE_NAME_LOWER)

View File

@@ -1,4 +1,4 @@
# Remember curren source directory (`test_conformance').
# Remember current source directory (`test_conformance').
set( CLConf_Install_Base_Dir "${CMAKE_CURRENT_SOURCE_DIR}" )
add_subdirectory( allocations )

View File

@@ -67,6 +67,10 @@ Headers (cl.h standalone), headers/test_cl_h
Headers (cl_platform.h standalone), headers/test_cl_platform_h
Headers (cl_gl.h standalone), headers/test_cl_gl_h
Headers (opencl.h standalone), headers/test_opencl_h
Headers (cl.h standalone C99), headers/test_cl_h_c99
Headers (cl_platform.h standalone C99), headers/test_cl_platform_h_c99
Headers (cl_gl.h standalone C99), headers/test_cl_gl_h_c99
Headers (opencl.h standalone C99), headers/test_opencl_h_c99
# #########################################
# CPU is required to pass linear and normalized image filtering
@@ -118,4 +122,4 @@ SPIR,spir/test_spir
Mipmaps (Kernel),images/kernel_read_write/test_image_streams test_mipmaps CL_FILTER_NEAREST
Mipmaps (clCopyImage),images/clCopyImage/test_cl_copy_images test_mipmaps
Mipmaps (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images test_mipmaps
Subgroups,subgroups/test_subgroups
Subgroups,subgroups/test_subgroups
1 #
67 CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR Headers (opencl.h standalone C99), headers/test_opencl_h_c99
68 CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR # #########################################
69 CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR # CPU is required to pass linear and normalized image filtering
70 # #########################################
71 CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR
72 CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR
73 CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR
74 # #########################################
75 # OpenGL/CL interaction
76 # #########################################
122
123
124
125

View File

@@ -3,7 +3,7 @@
#/******************************************************************
#//
#// OpenCL Conformance Tests
#//
#//
#// Copyright: (c) 2008-2009 by Apple Inc. All Rights Reserved.
#//
#******************************************************************/
@@ -24,15 +24,15 @@ def write_help_info() :
print("run_conformance.py test_list [CL_DEVICE_TYPE(s) to test] [partial-test-names, ...] [log=path/to/log/file/]")
print(" test_list - the .csv file containing the test names and commands to run the tests.")
print(" [partial-test-names, ...] - optional partial strings to select a subset of the tests to run.")
print(" [CL_DEVICE_TYPE(s) to test] - list of CL device types to test, default is CL_DEVICE_TYPE_DEFAULT.")
print(" [log=path/to/log/file/] - provide a path for the test log file, default is in the current directory.")
print(" [CL_DEVICE_TYPE(s) to test] - list of CL device types to test, default is CL_DEVICE_TYPE_DEFAULT.")
print(" [log=path/to/log/file/] - provide a path for the test log file, default is in the current directory.")
print(" (Note: spaces are not allowed in the log file path.")
# Get the time formatted nicely
def get_time() :
return time.strftime("%d-%b %H:%M:%S", time.localtime())
# Write text to the screen and the log file
def write_screen_log(text) :
global log_file
@@ -62,7 +62,7 @@ def get_tests(filename, devices_to_test):
print("Skipping " + device_specific_match.group(2) + " because " + device_specific_match.group(1) + " is not in the list of devices to test.")
continue
match = re.search("^\s*(.+)\s*,\s*(.+)\s*", line)
if (match):
if (match):
test_path = string.replace(match.group(2), '/', os.sep)
test_name = string.replace(match.group(1), '/', os.sep)
tests.append((test_name, test_path))
@@ -107,7 +107,7 @@ def run_test_checking_output(current_directory, test_dir, log_file):
pointer = 0
pointer_at_last_user_update = 0
output_this_run = False
try:
try:
read_output = open(output_name, 'r')
except IOError:
write_screen_log("\n ==> ERROR: could not open output file from test.")
@@ -131,7 +131,7 @@ def run_test_checking_output(current_directory, test_dir, log_file):
p.poll()
if (not done and p.returncode != None):
if (p.returncode < 0):
if (not output_this_run):
if (not output_this_run):
print ""
output_this_run = True
write_screen_log(" ==> ERROR: test killed/crashed: " + str(p.returncode)+ ".")
@@ -148,8 +148,8 @@ def run_test_checking_output(current_directory, test_dir, log_file):
# Look for failures and report them as such
match = re.search(".*(FAILED|ERROR).*", line)
if (match):
if (not output_this_run):
print ""
if (not output_this_run):
print ""
output_this_run = True
print(" ==> " + line.replace('\n',''))
match = re.search(".*FAILED.*", line)
@@ -157,8 +157,8 @@ def run_test_checking_output(current_directory, test_dir, log_file):
failures_this_run = failures_this_run + 1
match = re.search(".*(PASSED).*", line)
if (match):
if (not output_this_run):
print ""
if (not output_this_run):
print ""
output_this_run = True
print(" " + line.replace('\n',''))
# Write it to the log
@@ -171,7 +171,7 @@ def run_test_checking_output(current_directory, test_dir, log_file):
more_to_read = False
read_output.close()
time.sleep(1)
try:
try:
os.fsync(output_fd)
read_output = open(output_name, 'r')
# See if there is more to read. This happens if the process ends and we have data left.
@@ -221,7 +221,7 @@ def run_tests(tests) :
log_file.write(" ----------------------------------------------------------------------------------------\n")
log_file.flush()
sys.stdout.flush()
# Run the test
result = 0
start_time = time.time()
@@ -236,12 +236,12 @@ def run_tests(tests) :
if (answer.find("y") != -1):
write_screen_log("\nUser chose to abort all tests.")
log_file.close()
sys.exit(-1)
sys.exit(-1)
else:
write_screen_log("\nUser chose to continue with other tests. Reporting this test as failed.")
result = 1
result = 1
run_time = (time.time() - start_time)
# Move print the finish status
if (result == 0):
print("("+get_time()+") PASSED " + test_name.ljust(40) +": (" + str(int(run_time)).rjust(3) + "s, test " + str(test_number).rjust(3) + os.sep + str(len(tests)) +")"),
@@ -251,7 +251,7 @@ def run_tests(tests) :
test_number = test_number + 1
log_file.write(" ----------------------------------------------------------------------------------------\n")
log_file.flush()
print("")
if (result != 0):
log_file.write(" *******************************************************************************************\n")
@@ -260,7 +260,7 @@ def run_tests(tests) :
failures = failures + 1
else:
log_file.write(" ("+get_time()+") Test " + test_name +" passed in " + str(run_time) + "s\n")
log_file.write(" ----------------------------------------------------------------------------------------\n")
log_file.write("\n")
return failures