diff --git a/test_common/harness/imageHelpers.cpp b/test_common/harness/imageHelpers.cpp index ef92e8b6..84fb2c9f 100644 --- a/test_common/harness/imageHelpers.cpp +++ b/test_common/harness/imageHelpers.cpp @@ -28,7 +28,7 @@ static cl_ushort float2half_rte( float f ); static cl_ushort float2half_rtz( float f ); cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT; - +bool gTestRounding = false; double sRGBmap(float fc) { @@ -1186,7 +1186,6 @@ cl_ulong get_image_size_mb( image_descriptor const *imageInfo ) } -extern bool gTestRounding; uint64_t gRoundingStartValue = 0; diff --git a/test_common/harness/imageHelpers.h b/test_common/harness/imageHelpers.h index e9d7d084..99f8216b 100644 --- a/test_common/harness/imageHelpers.h +++ b/test_common/harness/imageHelpers.h @@ -41,6 +41,7 @@ #include "clImageHelper.h" extern cl_device_type gDeviceType; +extern bool gTestRounding; // Number of iterations per image format to test if not testing max images, rounding, or small images #define NUM_IMAGE_ITERATIONS 3 diff --git a/test_common/harness/testHarness.c b/test_common/harness/testHarness.c index 5d0393ba..19dcca60 100644 --- a/test_common/harness/testHarness.c +++ b/test_common/harness/testHarness.c @@ -26,6 +26,7 @@ #include "kernelHelpers.h" #include "fpcontrol.h" #include "typeWrappers.h" +#include "imageHelpers.h" #include "parseParameters.h" #if !defined(_WIN32) @@ -234,16 +235,18 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def } } - switch( device_type ) - { - case CL_DEVICE_TYPE_GPU: log_info( "Requesting GPU device " ); break; - case CL_DEVICE_TYPE_CPU: log_info( "Requesting CPU device " ); break; - case CL_DEVICE_TYPE_ACCELERATOR: log_info( "Requesting Accelerator device " ); break; - case CL_DEVICE_TYPE_DEFAULT: log_info( "Requesting Default device " ); break; - default: log_error( "Requesting unknown device "); return EXIT_FAILURE; - } - log_info( based_on_env_var ? "based on environment variable " : "based on command line " ); - log_info( "for platform index %d and device index %d\n", choosen_platform_index, choosen_device_index); + gDeviceType = device_type; + + switch (device_type) + { + case CL_DEVICE_TYPE_GPU: log_info("Requesting GPU device "); break; + case CL_DEVICE_TYPE_CPU: log_info("Requesting CPU device "); break; + case CL_DEVICE_TYPE_ACCELERATOR: log_info("Requesting Accelerator device "); break; + case CL_DEVICE_TYPE_DEFAULT: log_info("Requesting Default device "); break; + default: log_error("Requesting unknown device "); return EXIT_FAILURE; + } + log_info(based_on_env_var ? "based on environment variable " : "based on command line "); + log_info("for platform index %d and device index %d\n", choosen_platform_index, choosen_device_index); #if defined( __APPLE__ ) #if defined( __i386__ ) || defined( __x86_64__ ) diff --git a/test_conformance/api/main.c b/test_conformance/api/main.c index 81bc64ae..9d084040 100644 --- a/test_conformance/api/main.c +++ b/test_conformance/api/main.c @@ -28,7 +28,6 @@ // FIXME: To use certain functions in harness/imageHelpers.h // (for example, generate_random_image_data()), the tests are required to declare // the following variables (): -bool gTestRounding = false; test_definition test_list[] = { ADD_TEST( get_platform_info ), diff --git a/test_conformance/basic/main.c b/test_conformance/basic/main.c index 3202dd38..a3dd7780 100644 --- a/test_conformance/basic/main.c +++ b/test_conformance/basic/main.c @@ -25,11 +25,6 @@ #include "harness/testHarness.h" #include "procs.h" -// FIXME: To use certain functions in harness/imageHelpers.h -// (for example, generate_random_image_data()), the tests are required to declare -// the following variables (): -bool gTestRounding = false; - test_definition test_list[] = { ADD_TEST( hostptr ), ADD_TEST( fpmath_float ), diff --git a/test_conformance/clcpp/images/common.hpp b/test_conformance/clcpp/images/common.hpp index 9ca06552..957d266d 100644 --- a/test_conformance/clcpp/images/common.hpp +++ b/test_conformance/clcpp/images/common.hpp @@ -21,9 +21,6 @@ #include "../common.hpp" #include "../funcs_test_utils.hpp" -// This global variable is used by read_image_pixel from harness/imageHelpers -bool gTestRounding = false; - #include "../harness/imageHelpers.h" diff --git a/test_conformance/gl/main.cpp b/test_conformance/gl/main.cpp index e4e2689b..1320ff76 100644 --- a/test_conformance/gl/main.cpp +++ b/test_conformance/gl/main.cpp @@ -153,10 +153,9 @@ test_definition test_list32[] = { const int test_num = ARRAY_SIZE( test_list ); const int test_num32 = ARRAY_SIZE( test_list32 ); -bool gTestRounding = true; - int main(int argc, const char *argv[]) { + gTestRounding = true; int error = 0; int numErrors = 0; @@ -169,7 +168,6 @@ int main(int argc, const char *argv[]) } cl_device_type requestedDeviceType = CL_DEVICE_TYPE_DEFAULT; - checkDeviceTypeOverride(&requestedDeviceType); /* Do we have a CPU/GPU specification? */ if( argc > 1 ) diff --git a/test_conformance/images/clCopyImage/main.cpp b/test_conformance/images/clCopyImage/main.cpp index c4f95e84..0218b23d 100644 --- a/test_conformance/images/clCopyImage/main.cpp +++ b/test_conformance/images/clCopyImage/main.cpp @@ -30,7 +30,6 @@ bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; bool gUseRamp; -bool gTestRounding; bool gEnablePitch; bool gTestMipmaps; int gTypesToTest; @@ -109,8 +108,6 @@ int main(int argc, const char *argv[]) cl_channel_type chanType; cl_channel_order chanOrder; - checkDeviceTypeOverride( &gDeviceType ); - const char ** argList = (const char **)calloc( argc, sizeof( char*) ); if( NULL == argList ) diff --git a/test_conformance/images/clCopyImage/test_copy_1D.cpp b/test_conformance/images/clCopyImage/test_copy_1D.cpp index c35c1455..ab223202 100644 --- a/test_conformance/images/clCopyImage/test_copy_1D.cpp +++ b/test_conformance/images/clCopyImage/test_copy_1D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clCopyImage/test_copy_1D_array.cpp b/test_conformance/images/clCopyImage/test_copy_1D_array.cpp index e9e6e9c3..62eed3fd 100644 --- a/test_conformance/images/clCopyImage/test_copy_1D_array.cpp +++ b/test_conformance/images/clCopyImage/test_copy_1D_array.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clCopyImage/test_copy_2D.cpp b/test_conformance/images/clCopyImage/test_copy_2D.cpp index 94236934..7af2fe3e 100644 --- a/test_conformance/images/clCopyImage/test_copy_2D.cpp +++ b/test_conformance/images/clCopyImage/test_copy_2D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clCopyImage/test_copy_2D_2D_array.cpp b/test_conformance/images/clCopyImage/test_copy_2D_2D_array.cpp index e35b9b24..52aac29f 100644 --- a/test_conformance/images/clCopyImage/test_copy_2D_2D_array.cpp +++ b/test_conformance/images/clCopyImage/test_copy_2D_2D_array.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gTestRounding, gEnablePitch, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clCopyImage/test_copy_2D_3D.cpp b/test_conformance/images/clCopyImage/test_copy_2D_3D.cpp index 1908c0a4..55a938d6 100644 --- a/test_conformance/images/clCopyImage/test_copy_2D_3D.cpp +++ b/test_conformance/images/clCopyImage/test_copy_2D_3D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gTestRounding, gEnablePitch, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clCopyImage/test_copy_2D_array.cpp b/test_conformance/images/clCopyImage/test_copy_2D_array.cpp index f75daccd..5624245a 100644 --- a/test_conformance/images/clCopyImage/test_copy_2D_array.cpp +++ b/test_conformance/images/clCopyImage/test_copy_2D_array.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/clCopyImage/test_copy_3D.cpp b/test_conformance/images/clCopyImage/test_copy_3D.cpp index 8ca9110d..fb176233 100644 --- a/test_conformance/images/clCopyImage/test_copy_3D.cpp +++ b/test_conformance/images/clCopyImage/test_copy_3D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/clCopyImage/test_copy_3D_2D_array.cpp b/test_conformance/images/clCopyImage/test_copy_3D_2D_array.cpp index 8f048333..7d63c5c7 100644 --- a/test_conformance/images/clCopyImage/test_copy_3D_2D_array.cpp +++ b/test_conformance/images/clCopyImage/test_copy_3D_2D_array.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gTestRounding, gEnablePitch, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clCopyImage/test_copy_generic.cpp b/test_conformance/images/clCopyImage/test_copy_generic.cpp index 7fe46a15..75963b36 100644 --- a/test_conformance/images/clCopyImage/test_copy_generic.cpp +++ b/test_conformance/images/clCopyImage/test_copy_generic.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gTestRounding, gEnablePitch, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clFillImage/main.cpp b/test_conformance/images/clFillImage/main.cpp index 352207fa..a4c8ca0c 100644 --- a/test_conformance/images/clFillImage/main.cpp +++ b/test_conformance/images/clFillImage/main.cpp @@ -29,7 +29,6 @@ bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; -bool gTestRounding; bool gEnablePitch; int gTypesToTest; cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; diff --git a/test_conformance/images/clFillImage/test_fill_1D.cpp b/test_conformance/images/clFillImage/test_fill_1D.cpp index 767596b0..51eb822b 100644 --- a/test_conformance/images/clFillImage/test_fill_1D.cpp +++ b/test_conformance/images/clFillImage/test_fill_1D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clFillImage/test_fill_1D_array.cpp b/test_conformance/images/clFillImage/test_fill_1D_array.cpp index 9885cb33..edbcacd9 100644 --- a/test_conformance/images/clFillImage/test_fill_1D_array.cpp +++ b/test_conformance/images/clFillImage/test_fill_1D_array.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clFillImage/test_fill_2D.cpp b/test_conformance/images/clFillImage/test_fill_2D.cpp index a4f25aed..8e76e86c 100644 --- a/test_conformance/images/clFillImage/test_fill_2D.cpp +++ b/test_conformance/images/clFillImage/test_fill_2D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clFillImage/test_fill_2D_array.cpp b/test_conformance/images/clFillImage/test_fill_2D_array.cpp index be2a8159..260b869f 100644 --- a/test_conformance/images/clFillImage/test_fill_2D_array.cpp +++ b/test_conformance/images/clFillImage/test_fill_2D_array.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestRounding; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/clFillImage/test_fill_3D.cpp b/test_conformance/images/clFillImage/test_fill_3D.cpp index 3fa8f4ed..298db0e7 100644 --- a/test_conformance/images/clFillImage/test_fill_3D.cpp +++ b/test_conformance/images/clFillImage/test_fill_3D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestRounding; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/clFillImage/test_fill_generic.cpp b/test_conformance/images/clFillImage/test_fill_generic.cpp index bb378d14..2f30f2a2 100644 --- a/test_conformance/images/clFillImage/test_fill_generic.cpp +++ b/test_conformance/images/clFillImage/test_fill_generic.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gTestRounding, gEnablePitch; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clGetInfo/main.cpp b/test_conformance/images/clGetInfo/main.cpp index 5a98386a..55aaa538 100644 --- a/test_conformance/images/clGetInfo/main.cpp +++ b/test_conformance/images/clGetInfo/main.cpp @@ -28,7 +28,6 @@ bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; -bool gTestRounding; int gTypesToTest; cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; diff --git a/test_conformance/images/clReadWriteImage/main.cpp b/test_conformance/images/clReadWriteImage/main.cpp index 8bf974fb..a41c41dd 100644 --- a/test_conformance/images/clReadWriteImage/main.cpp +++ b/test_conformance/images/clReadWriteImage/main.cpp @@ -29,7 +29,6 @@ bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; bool gUseRamp; -bool gTestRounding; bool gTestMipmaps; int gTypesToTest; cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; diff --git a/test_conformance/images/clReadWriteImage/test_read_1D.cpp b/test_conformance/images/clReadWriteImage/test_read_1D.cpp index e85e7c7d..7d9eb845 100644 --- a/test_conformance/images/clReadWriteImage/test_read_1D.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_1D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clReadWriteImage/test_read_1D_array.cpp b/test_conformance/images/clReadWriteImage/test_read_1D_array.cpp index 059ed122..3f845564 100644 --- a/test_conformance/images/clReadWriteImage/test_read_1D_array.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_1D_array.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clReadWriteImage/test_read_2D.cpp b/test_conformance/images/clReadWriteImage/test_read_2D.cpp index 4388a8d0..0eae51b5 100644 --- a/test_conformance/images/clReadWriteImage/test_read_2D.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_2D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; diff --git a/test_conformance/images/clReadWriteImage/test_read_2D_array.cpp b/test_conformance/images/clReadWriteImage/test_read_2D_array.cpp index 99cd27c7..547e5eb4 100644 --- a/test_conformance/images/clReadWriteImage/test_read_2D_array.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_2D_array.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/clReadWriteImage/test_read_3D.cpp b/test_conformance/images/clReadWriteImage/test_read_3D.cpp index 34df35a3..16baeebf 100644 --- a/test_conformance/images/clReadWriteImage/test_read_3D.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_3D.cpp @@ -18,7 +18,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/kernel_image_methods/main.cpp b/test_conformance/images/kernel_image_methods/main.cpp index 076d92f6..bbc7ad8d 100644 --- a/test_conformance/images/kernel_image_methods/main.cpp +++ b/test_conformance/images/kernel_image_methods/main.cpp @@ -29,7 +29,6 @@ bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; -bool gTestRounding; int gTypesToTest; bool gDeviceLt20 = false; diff --git a/test_conformance/images/kernel_read_write/main.cpp b/test_conformance/images/kernel_read_write/main.cpp index 01689731..5586f064 100644 --- a/test_conformance/images/kernel_read_write/main.cpp +++ b/test_conformance/images/kernel_read_write/main.cpp @@ -41,7 +41,6 @@ bool gExtraValidateInfo; bool gDisableOffsets; bool gTestSmallImages; bool gTestMaxImages; -bool gTestRounding; bool gTestImage2DFromBuffer; bool gTestMipmaps; bool gDeviceLt20 = false; diff --git a/test_conformance/images/kernel_read_write/test_iterations.cpp b/test_conformance/images/kernel_read_write/test_iterations.cpp index 9011b206..5de5f357 100644 --- a/test_conformance/images/kernel_read_write/test_iterations.cpp +++ b/test_conformance/images/kernel_read_write/test_iterations.cpp @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestImage2DFromBuffer, gTestMipmaps; +extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestImage2DFromBuffer, gTestMipmaps; extern bool gUseKernelSamplers; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/kernel_read_write/test_read_1D.cpp b/test_conformance/images/kernel_read_write/test_read_1D.cpp index 7577cf27..18572c87 100644 --- a/test_conformance/images/kernel_read_write/test_read_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_read_1D.cpp @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern bool gUseKernelSamplers; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/kernel_read_write/test_read_1D_array.cpp b/test_conformance/images/kernel_read_write/test_read_1D_array.cpp index 5a95ae55..91885eea 100644 --- a/test_conformance/images/kernel_read_write/test_read_1D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_read_1D_array.cpp @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern bool gUseKernelSamplers; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/kernel_read_write/test_read_2D_array.cpp b/test_conformance/images/kernel_read_write/test_read_2D_array.cpp index 540e6d4b..ccfe7e88 100644 --- a/test_conformance/images/kernel_read_write/test_read_2D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_read_2D_array.cpp @@ -19,7 +19,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern bool gUseKernelSamplers; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/kernel_read_write/test_read_3D.cpp b/test_conformance/images/kernel_read_write/test_read_3D.cpp index d03f5d18..bca93702 100644 --- a/test_conformance/images/kernel_read_write/test_read_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_read_3D.cpp @@ -19,7 +19,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern bool gUseKernelSamplers; extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; diff --git a/test_conformance/images/kernel_read_write/test_write_1D.cpp b/test_conformance/images/kernel_read_write/test_write_1D.cpp index 8a928d03..86592c4c 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D.cpp @@ -19,7 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; diff --git a/test_conformance/images/kernel_read_write/test_write_1D_array.cpp b/test_conformance/images/kernel_read_write/test_write_1D_array.cpp index cd5385e8..62b688c4 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D_array.cpp @@ -19,7 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; diff --git a/test_conformance/images/kernel_read_write/test_write_2D_array.cpp b/test_conformance/images/kernel_read_write/test_write_2D_array.cpp index 106e102c..cd1c8495 100644 --- a/test_conformance/images/kernel_read_write/test_write_2D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_write_2D_array.cpp @@ -19,7 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; diff --git a/test_conformance/images/kernel_read_write/test_write_3D.cpp b/test_conformance/images/kernel_read_write/test_write_3D.cpp index 08f1c87b..2dc818ca 100644 --- a/test_conformance/images/kernel_read_write/test_write_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_3D.cpp @@ -19,7 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; diff --git a/test_conformance/images/kernel_read_write/test_write_image.cpp b/test_conformance/images/kernel_read_write/test_write_image.cpp index ef6f87fd..8d231445 100644 --- a/test_conformance/images/kernel_read_write/test_write_image.cpp +++ b/test_conformance/images/kernel_read_write/test_write_image.cpp @@ -19,7 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gTestImage2DFromBuffer, gTestMipmaps; +extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestImage2DFromBuffer, gTestMipmaps; extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; diff --git a/test_conformance/images/samplerlessReads/main.cpp b/test_conformance/images/samplerlessReads/main.cpp index 99b85bd5..e034163c 100644 --- a/test_conformance/images/samplerlessReads/main.cpp +++ b/test_conformance/images/samplerlessReads/main.cpp @@ -38,7 +38,6 @@ bool gTestReadWrite; bool gDebugTrace; bool gTestMaxImages; bool gTestSmallImages; -bool gTestRounding; int gTypesToTest; cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; cl_channel_order gChannelOrderToUse = (cl_channel_order)-1; diff --git a/test_conformance/images/samplerlessReads/test_iterations.cpp b/test_conformance/images/samplerlessReads/test_iterations.cpp index 22849bc7..5d9ea439 100644 --- a/test_conformance/images/samplerlessReads/test_iterations.cpp +++ b/test_conformance/images/samplerlessReads/test_iterations.cpp @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; extern bool gTestReadWrite; #define MAX_TRIES 1 diff --git a/test_conformance/images/samplerlessReads/test_read_1D.cpp b/test_conformance/images/samplerlessReads/test_read_1D.cpp index 0e277109..fe2f3328 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D.cpp @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; extern bool gTestReadWrite; #define MAX_TRIES 1 diff --git a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp index 9ba85d29..61f811dd 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; extern bool gTestReadWrite; #define MAX_TRIES 1 diff --git a/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp b/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp index 92442967..b775c90c 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp @@ -25,7 +25,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gTestRounding, gDeviceLt20; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; #define MAX_TRIES 1 #define MAX_CLAMPED 1 diff --git a/test_conformance/images/samplerlessReads/test_read_2D_array.cpp b/test_conformance/images/samplerlessReads/test_read_2D_array.cpp index 9b9d5aa0..54628ce1 100644 --- a/test_conformance/images/samplerlessReads/test_read_2D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_2D_array.cpp @@ -19,7 +19,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; extern bool gTestReadWrite; const char *read2DArrayKernelSourcePattern = diff --git a/test_conformance/images/samplerlessReads/test_read_3D.cpp b/test_conformance/images/samplerlessReads/test_read_3D.cpp index 0ebada9b..2dde1fa7 100644 --- a/test_conformance/images/samplerlessReads/test_read_3D.cpp +++ b/test_conformance/images/samplerlessReads/test_read_3D.cpp @@ -19,7 +19,7 @@ #define MAX_ERR 0.005f #define MAX_HALF_LINEAR_ERR 0.3f -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestRounding, gDeviceLt20; +extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; extern bool gTestReadWrite; const char *read3DKernelSourcePattern = diff --git a/test_conformance/mem_host_flags/main.cpp b/test_conformance/mem_host_flags/main.cpp index 57649d83..01bad676 100644 --- a/test_conformance/mem_host_flags/main.cpp +++ b/test_conformance/mem_host_flags/main.cpp @@ -43,12 +43,9 @@ test_definition test_list[] = { const int test_num = ARRAY_SIZE( test_list ); -cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT; -bool gTestRounding = true; - int main(int argc, const char *argv[]) { log_info("1st part, non gl-sharing objects...\n"); - + gTestRounding = true; return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); } diff --git a/test_conformance/profiling/main.c b/test_conformance/profiling/main.c index e4fed884..bd367976 100644 --- a/test_conformance/profiling/main.c +++ b/test_conformance/profiling/main.c @@ -23,7 +23,6 @@ // FIXME: To use certain functions in harness/imageHelpers.h // (for example, generate_random_image_data()), the tests are required to declare // the following variables (): -bool gTestRounding = false; test_definition test_list[] = { ADD_TEST( read_array_int ), diff --git a/test_extensions/media_sharing/utils.cpp b/test_extensions/media_sharing/utils.cpp index a2d8f39f..0b553294 100644 --- a/test_extensions/media_sharing/utils.cpp +++ b/test_extensions/media_sharing/utils.cpp @@ -1585,217 +1585,6 @@ bool MediaSurfaceCreate(cl_dx9_media_adapter_type_khr adapterType, unsigned int return true; } -int DetectFloatToHalfRoundingMode( cl_command_queue q ) // Returns CL_SUCCESS on success -{ - cl_int err = CL_SUCCESS; - - if( gFloatToHalfRoundingMode == kDefaultRoundingMode ) - { - // Some numbers near 0.5f, that we look at to see how the values are rounded. - static const cl_uint inData[4*4] = { 0x3f000fffU, 0x3f001000U, 0x3f001001U, 0U, 0x3f001fffU, 0x3f002000U, 0x3f002001U, 0U, - 0x3f002fffU, 0x3f003000U, 0x3f003001U, 0U, 0x3f003fffU, 0x3f004000U, 0x3f004001U, 0U }; - static const size_t count = sizeof( inData ) / (4*sizeof( inData[0] )); - const float *inp = (const float*) inData; - cl_context context = NULL; - - // Create an input buffer - err = clGetCommandQueueInfo( q, CL_QUEUE_CONTEXT, sizeof(context), &context, NULL ); - if( err ) - { - log_error( "Error: could not get context from command queue in DetectFloatToHalfRoundingMode (%d)", err ); - return err; - } - - cl_mem inBuf = clCreateBuffer( context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_ALLOC_HOST_PTR, sizeof( inData ), (void*) inData, &err ); - if( NULL == inBuf || err ) - { - log_error( "Error: could not create input buffer in DetectFloatToHalfRoundingMode (err: %d)", err ); - return err; - } - - // Create a small output image - cl_image_format fmt = { CL_RGBA, CL_HALF_FLOAT }; - cl_image_desc imageDesc = { 0 }; - imageDesc.image_type = CL_MEM_OBJECT_IMAGE2D; - imageDesc.image_width = count; - imageDesc.image_height = 1; - - cl_mem outImage = clCreateImage(context, CL_MEM_READ_WRITE, &fmt, &imageDesc, 0, &err); - if( NULL == outImage || err ) - { - log_error( "Error: could not create half float out image in DetectFloatToHalfRoundingMode (err: %d)", err ); - clReleaseMemObject( inBuf ); - return err; - } - - // Create our program, and a kernel - const char *kernel[1] = { - "kernel void detect_round( global float4 *in, write_only image2d_t out )\n" - "{\n" - " write_imagef( out, (int2)(get_global_id(0),0), in[get_global_id(0)] );\n" - "}\n" }; - cl_program program = clCreateProgramWithSource( context, 1, kernel, NULL, &err ); - if( NULL == program || err ) - { - log_error( "Error: could not create program in DetectFloatToHalfRoundingMode (err: %d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - return err; - } - - cl_device_id device = NULL; - err = clGetCommandQueueInfo( q, CL_QUEUE_DEVICE, sizeof(device), &device, NULL ); - if( err ) - { - log_error( "Error: could not get device from command queue in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseProgram( program ); - return err; - } - - err = clBuildProgram( program, 1, &device, "", NULL, NULL ); - if( err ) - { - log_error( "Error: could not build program in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseProgram( program ); - return err; - } - - cl_kernel k = clCreateKernel( program, "detect_round", &err ); - if( NULL == k || err ) - { - log_error( "Error: could not create kernel in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseProgram( program ); - return err; - } - - err = clSetKernelArg( k, 0, sizeof( cl_mem ), &inBuf ); - if( err ) - { - log_error( "Error: could not set argument 0 of kernel in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseProgram( program ); - clReleaseKernel( k ); - return err; - } - - err = clSetKernelArg( k, 1, sizeof( cl_mem ), &outImage ); - if( err ) - { - log_error( "Error: could not set argument 1 of kernel in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseProgram( program ); - clReleaseKernel( k ); - return err; - } - - // Run the kernel - size_t global_work_size = count; - err = clEnqueueNDRangeKernel( q, k, 1, NULL, &global_work_size, NULL, 0, NULL, NULL ); - if( err ) - { - log_error( "Error: could not enqueue kernel in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseProgram( program ); - clReleaseKernel( k ); - return err; - } - - // read the results - cl_ushort outBuf[count*4]; - memset( outBuf, -1, sizeof( outBuf ) ); - size_t origin[3] = {0,0,0}; - size_t region[3] = {count,1,1}; - err = clEnqueueReadImage( q, outImage, CL_TRUE, origin, region, 0, 0, outBuf, 0, NULL, NULL ); - if( err ) - { - log_error( "Error: could not read output image in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseProgram( program ); - clReleaseKernel( k ); - return err; - } - - // Generate our list of reference results - cl_ushort rte_ref[count*4]; - cl_ushort rtz_ref[count*4]; - for( size_t i = 0; i < 4 * count; i++ ) - { - rte_ref[i] = float2half_rte( inp[i] ); - rtz_ref[i] = float2half_rtz( inp[i] ); - } - - // Verify that we got something in either rtz or rte mode - if( 0 == memcmp( rte_ref, outBuf, sizeof( rte_ref )) ) - { - log_info( "Autodetected float->half rounding mode to be rte\n" ); - gFloatToHalfRoundingMode = kRoundToNearestEven; - } - else if ( 0 == memcmp( rtz_ref, outBuf, sizeof( rtz_ref )) ) - { - log_info( "Autodetected float->half rounding mode to be rtz\n" ); - gFloatToHalfRoundingMode = kRoundTowardZero; - } - else - { - log_error( "ERROR: float to half conversions proceed with invalid rounding mode!\n" ); - log_info( "\nfor:" ); - for( size_t i = 0; i < count; i++ ) - log_info( " {%a, %a, %a, %a},", inp[4*i], inp[4*i+1], inp[4*i+2], inp[4*i+3] ); - log_info( "\ngot:" ); - for( size_t i = 0; i < count; i++ ) - log_info( " {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", outBuf[4*i], outBuf[4*i+1], outBuf[4*i+2], outBuf[4*i+3] ); - log_info( "\nrte:" ); - for( size_t i = 0; i < count; i++ ) - log_info( " {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", rte_ref[4*i], rte_ref[4*i+1], rte_ref[4*i+2], rte_ref[4*i+3] ); - log_info( "\nrtz:" ); - for( size_t i = 0; i < count; i++ ) - log_info( " {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", rtz_ref[4*i], rtz_ref[4*i+1], rtz_ref[4*i+2], rtz_ref[4*i+3] ); - log_info( "\n" ); - err = -1; - gFloatToHalfRoundingMode = kRoundingModeCount; // illegal value - } - - // clean up - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseProgram( program ); - clReleaseKernel( k ); - return err; - } - - // Make sure that the rounding mode was successfully detected, if we checked earlier - if( gFloatToHalfRoundingMode != kRoundToNearestEven && gFloatToHalfRoundingMode != kRoundTowardZero) - return -2; - - return err; -} - -cl_ushort convert_float_to_half( float f ) -{ - switch( gFloatToHalfRoundingMode ) - { - case kRoundToNearestEven: - return float2half_rte( f ); - case kRoundTowardZero: - return float2half_rtz( f ); - default: - log_error( "ERROR: Test internal error -- unhandled or unknown float->half rounding mode.\n" ); - exit(-1); - return 0xffff; - } - -} - cl_ushort float2half_rte( float f ) { union{ float f; cl_uint u; } u = {f}; @@ -1880,62 +1669,6 @@ cl_ushort float2half_rtz( float f ) return (u.u >> (24-11)) | sign; } -float convert_half_to_float( unsigned short halfValue ) -{ - // We have to take care of a few special cases, but in general, we just extract - // the same components from the half that exist in the float and re-stuff them - // For a description of the actual half format, see http://en.wikipedia.org/wiki/Half_precision - // Note: we store these in 32-bit ints to make the bit manipulations easier later - int sign = ( halfValue >> 15 ) & 0x0001; - int exponent = ( halfValue >> 10 ) & 0x001f; - int mantissa = ( halfValue ) & 0x03ff; - - // Note: we use a union here to be able to access the bits of a float directly - union - { - unsigned int bits; - float floatValue; - } outFloat; - - // Special cases first - if( exponent == 0 ) - { - if( mantissa == 0 ) - { - // If both exponent and mantissa are 0, the number is +/- 0 - outFloat.bits = sign << 31; - return outFloat.floatValue; // Already done! - } - - // If exponent is 0, it's a denormalized number, so we renormalize it - // Note: this is not terribly efficient, but oh well - while( ( mantissa & 0x00000400 ) == 0 ) - { - mantissa <<= 1; - exponent--; - } - - // The first bit is implicit, so we take it off and inc the exponent accordingly - exponent++; - mantissa &= ~(0x00000400); - } - else if( exponent == 31 ) // Special-case "numbers" - { - // If the exponent is 31, it's a special case number (+/- infinity or NAN). - // If the mantissa is 0, it's infinity, else it's NAN, but in either case, the packing - // method is the same - outFloat.bits = ( sign << 31 ) | 0x7f800000 | ( mantissa << 13 ); - return outFloat.floatValue; - } - - // Plain ol' normalized number, so adjust to the ranges a 32-bit float expects and repack - exponent += ( 127 - 15 ); - mantissa <<= 13; - - outFloat.bits = ( sign << 31 ) | ( exponent << 23 ) | mantissa; - return outFloat.floatValue; -} - cl_int deviceExistForCLTest(cl_platform_id platform, cl_dx9_media_adapter_type_khr media_adapters_type, void *media_adapters,