Initial open source release of OpenCL 1.2 CTS.

This commit is contained in:
Kedar Patil
2017-05-16 19:04:36 +05:30
parent 6911ba5116
commit f74871b7a3
563 changed files with 202074 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
# VS2005 AMD64 WAR (basic_test_conversions.c causes internal compiler error)
if(MSVC)
set(CMAKE_C_FLAGS_RELEASE "/Od /Ob0")
set(CMAKE_CXX_FLAGS_RELEASE "/Od /Ob0")
else(MSVC)
set(CMAKE_C_FLAGS_RELEASE "-O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O0")
endif(MSVC)
add_executable(conformance_test_conversions
Sleep.c test_conversions.c basic_test_conversions.c
../../test_common/harness/ThreadPool.c
../../test_common/harness/rounding_mode.c
../../test_common/harness/mt19937.c
../../test_common/harness/msvc9.c
../../test_common/harness/mingw_compat.c
../../test_common/harness/errorHelpers.c
)
if(WIN32)
set_source_files_properties(
Sleep.c test_conversions.c basic_test_conversions.c
../../test_common/harness/ThreadPool.c
../../test_common/harness/rounding_mode.c
../../test_common/harness/mingw_compat.c
../../test_common/harness/msvc9.c
../../test_common/harness/errorHelpers.c
PROPERTIES LANGUAGE CXX)
endif(WIN32)
if(NOT CMAKE_CL_64 AND NOT MSVC)
# -march is needed for CPU atomics, default arch on gcc is i386
# that does not support atomics.
set_source_files_properties(
Sleep.c test_conversions.c basic_test_conversions.c
../../test_common/harness/ThreadPool.c
../../test_common/harness/rounding_mode.c
../../test_common/harness/mingw_compat.c
../../test_common/harness/msvc9.c
../../test_common/harness/errorHelpers.c
COMPILE_FLAGS -march=i686)
endif(NOT CMAKE_CL_64 AND NOT MSVC)
set_source_files_properties(
Sleep.c test_conversions.c basic_test_conversions.c
COMPILE_FLAGS -std=c99)
set_source_files_properties(
Sleep.c test_conversions.c basic_test_conversions.c
COMPILE_FLAGS -msse2)
TARGET_LINK_LIBRARIES(conformance_test_conversions
${CLConform_LIBRARIES})

View File

@@ -0,0 +1,17 @@
project
: requirements
# <toolset>gcc:<cflags>-xc++
<toolset>msvc:<cflags>"/TP"
;
exe test_conversions
: basic_test_conversions.c
Sleep.c
test_conversions.c
;
install dist
: test_conversions
: <variant>debug:<location>$(DIST)/debug/tests/test_conformance/conversions
<variant>release:<location>$(DIST)/release/tests/test_conformance/conversions
;

View File

@@ -0,0 +1,50 @@
ifdef BUILD_WITH_ATF
ATF = -framework ATF
USE_ATF = -DUSE_ATF
endif
# We do not use dependencies in this Makefile
SRCFILES = Sleep.c test_conversions.c ../../test_common/harness/mt19937.c ../../test_common/harness/ThreadPool.c ../../test_common/harness/rounding_mode.c
CC = cc
CFLAGS = -g -std=c99 -Wall -Wshorten-64-to-32 $(COMPILERFLAGS) \
${RC_CFLAGS} ${USE_ATF}
INCLUDES = -I../../test_common/harness \
${RC_CFLAGS} ${ATF}
LIBRARIES = -framework OpenCL -framework CoreFoundation -framework IOKit
release:
echo "Build Release"
$(CC) -c basic_test_conversions.c -Os $(CFLAGS) -o basic_test_conversions.o
$(CC) $(SRCFILES) -Os $(CFLAGS) basic_test_conversions.o -o test_conversions $(INCLUDES) $(LIBRARIES)
debug:
echo "Build Debug"
$(CC) -c basic_test_conversions.c -O0 $(CFLAGS) -o basic_test_conversions.o
$(CC) test_conversions.c -c -O0 -g $(CFLAGS) $(INCLUDES) -o test_conversions.o
$(CC) Sleep.c -c -O0 -g $(CFLAGS) $(INCLUDES) -o Sleep.o
$(CC) ../../test_common/harness/mt19937.c -c -O0 -g $(INCLUDES) $(CFLAGS) -o mt19937.o
$(CC) ../../test_common/harness/ThreadPool.c -c -O0 -g $(INCLUDES) $(CFLAGS) -o ThreadPool.o
$(CC) ../../test_common/harness/rounding_mode.c -c -O0 -g $(INCLUDES) $(CFLAGS) -o rounding_mode.o
$(CC) *.o -g -O0 -o test_conversions_debug $(LIBRARIES) -arch i386 -arch x86_64
clean:
rm -f test_conversions
rm -f *.o
rm -f test_conversions_debug
test: release
arch -i386 ./test_conversions -c > cpu.out &
arch -i386 ./test_conversions -g > gpu.out &
echo "Testing 32-bit mode conversions for CPU and GPU, which takes a day or three. Results may be found in cpu.out and gpu.out\n"
test64: release
arch -x86_64 ./test_conversions_64 -c > cpu64.out &
arch -x86_64 ./test_conversions_64 -g > gpu64.out &
echo "Testing 64-bit mode conversions for CPU and GPU, which takes a day or three. Results may be found in cpu64.out and gpu64.out\n"
all: release

View File

@@ -0,0 +1,120 @@
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#if defined( __APPLE__ )
#include "Sleep.h"
#include <IOKit/pwr_mgt/IOPMLib.h>
#include <IOKit/IOMessage.h>
#include "basic_test_conversions.h"
#define UNUSED __attribute__((unused))
struct
{
io_connect_t connection;
IONotificationPortRef port;
io_object_t iterator;
}sleepInfo;
void sleepCallback( void * refcon,
io_service_t service,
natural_t messageType,
void * messageArgument );
void sleepCallback( void * refcon UNUSED,
io_service_t service UNUSED,
natural_t messageType,
void * messageArgument )
{
IOReturn result;
/*
service -- The IOService whose state has changed.
messageType -- A messageType enum, defined by IOKit/IOMessage.h or by the IOService's family.
messageArgument -- An argument for the message, dependent on the messageType.
*/
switch ( messageType )
{
case kIOMessageSystemWillSleep:
// Handle demand sleep (such as sleep caused by running out of
// batteries, closing the lid of a laptop, or selecting
// sleep from the Apple menu.
IOAllowPowerChange(sleepInfo.connection,(long)messageArgument);
vlog( "Hard sleep occurred.\n" );
break;
case kIOMessageCanSystemSleep:
// In this case, the computer has been idle for several minutes
// and will sleep soon so you must either allow or cancel
// this notification. Important: if you dont respond, there will
// be a 30-second timeout before the computer sleeps.
// IOCancelPowerChange(root_port,(long)messageArgument);
result = IOCancelPowerChange(sleepInfo.connection,(long)messageArgument);
if( kIOReturnSuccess != result )
vlog( "sleep prevention failed. (%d)\n", result);
break;
case kIOMessageSystemHasPoweredOn:
// Handle wakeup.
break;
}
}
void PreventSleep( void )
{
vlog( "Disabling sleep... " );
sleepInfo.iterator = (io_object_t) 0;
sleepInfo.port = NULL;
sleepInfo.connection = IORegisterForSystemPower
(
&sleepInfo, //void * refcon,
&sleepInfo.port, //IONotificationPortRef * thePortRef,
sleepCallback, //IOServiceInterestCallback callback,
&sleepInfo.iterator //io_object_t * notifier
);
if( (io_connect_t) 0 == sleepInfo.connection )
vlog( "failed.\n" );
else
vlog( "done.\n" );
CFRunLoopAddSource(CFRunLoopGetCurrent(),
IONotificationPortGetRunLoopSource(sleepInfo.port),
kCFRunLoopDefaultMode);
}
void ResumeSleep( void )
{
IOReturn result = IODeregisterForSystemPower ( &sleepInfo.iterator );
if( 0 != result )
vlog( "Got error %d restoring sleep \n", result );
else
vlog( "Sleep restored.\n" );
}
#else /* not __APPLE__ */
#if defined(__cplusplus)
extern "C" {
#endif
void PreventSleep( void ) {}
void ResumeSleep( void ) {}
#if defined(__cplusplus)
}
#endif //__cplusplus
#endif

View File

@@ -0,0 +1,32 @@
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef SLEEP_H
#define SLEEP_H
#if defined(__cplusplus)
extern "C" {
#endif
void PreventSleep( void );
void ResumeSleep( void );
#if defined(__cplusplus)
}
#endif //__cplusplus
#endif /* SLEEP_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef BASIC_TEST_CONVERSIONS_H
#define BASIC_TEST_CONVERSIONS_H
#if !defined(_WIN32)
#include <unistd.h>
#include <stdint.h>
#endif
#include "../../test_common/harness/compat.h"
#include "../../test_common/harness/errorHelpers.h"
#include "../../test_common/harness/rounding_mode.h"
#include <stdio.h>
#if defined( __APPLE__ )
#include <OpenCL/opencl.h>
#else
#include <CL/opencl.h>
#endif
#include "../../test_common/harness/mt19937.h"
typedef void (*Convert)( void *dest, void *src, size_t );
#define kVectorSizeCount 6
#define kMaxVectorSize 16
typedef enum
{
kUnsaturated = 0,
kSaturated,
kSaturationModeCount
}SaturationMode;
extern Convert gConversions[kTypeCount][kTypeCount]; // [dest format][source format]
extern Convert gSaturatedConversions[kTypeCount][kTypeCount]; // [dest format][source format]
extern const char *gTypeNames[ kTypeCount ];
extern const char *gRoundingModeNames[ kRoundingModeCount ]; // { "", "_rte", "_rtp", "_rtn", "_rtz" }
extern const char *gSaturationNames[ kSaturationModeCount ]; // { "", "_sat" }
extern const char *gVectorSizeNames[kVectorSizeCount]; // { "", "2", "4", "8", "16" }
extern size_t gTypeSizes[ kTypeCount ];
//Functions for clamping floating point numbers into the representable range for the type
typedef float (*clampf)( float );
typedef double (*clampd)( double );
extern clampf gClampFloat[ kTypeCount ][kRoundingModeCount];
extern clampd gClampDouble[ kTypeCount ][kRoundingModeCount];
typedef void (*InitDataFunc)( void *dest, SaturationMode, RoundingMode, Type destType, uint64_t start, int count, MTdata d );
extern InitDataFunc gInitFunctions[ kTypeCount ];
typedef int (*CheckResults)( void *out1, void *out2, void *allowZ, uint32_t count, int vectorSize );
extern CheckResults gCheckResults[ kTypeCount ];
#endif /* BASIC_TEST_CONVERSIONS_H */

View File

@@ -0,0 +1,16 @@
#!/usr/bin/csh
#
# This runs the conversions in 32- and 64-bit modes, split into 9 processes for better throughput.
# It is intended to allow for quicker debugging turnaround for code development purposes
#
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 0 100 > 0_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 0 100 > 0_64.txt &
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 100 100 > 1_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 100 100 > 1_64.txt &
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 200 100 > 2_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 200 100 > 2_64.txt &
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 300 100 > 3_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 300 100 > 3_64.txt &
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 400 100 > 4_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 400 100 > 4_64.txt &
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 500 100 > 5_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 500 100 > 5_64.txt &
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 600 100 > 6_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 600 100 > 6_64.txt &
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 700 100 > 7_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 700 100 > 7_64.txt &
/usr/bin/arch -i386 ./test_conversions CL_DEVICE_TYPE_CPU 800 100 > 8_32.txt; /usr/bin/arch -x86_64 ./test_conversions CL_DEVICE_TYPE_CPU 800 100 > 8_64.txt &

File diff suppressed because it is too large Load Diff