Remove "C" linkages (#781)

* Remove extern C linkages

* Update crc32 to cpp and remove extern C linkage
This commit is contained in:
Ankit Goyal
2020-05-20 18:46:19 +05:30
committed by GitHub
parent 223c43b7d9
commit 4fbcd96e7f
74 changed files with 140 additions and 440 deletions

View File

@@ -6,7 +6,7 @@ set(HARNESS_SOURCES
harness/conversions.cpp harness/conversions.cpp
harness/rounding_mode.cpp harness/rounding_mode.cpp
harness/msvc9.c harness/msvc9.c
harness/crc32.c harness/crc32.cpp
harness/errorHelpers.cpp harness/errorHelpers.cpp
harness/genericThread.cpp harness/genericThread.cpp
harness/imageHelpers.cpp harness/imageHelpers.cpp

View File

@@ -22,10 +22,6 @@
#include <CL/cl.h> #include <CL/cl.h>
#endif #endif
#if defined(__cplusplus)
extern "C" {
#endif
// //
// An atomic add operator // An atomic add operator
cl_int ThreadPool_AtomicAdd( volatile cl_int *a, cl_int b ); // returns old value cl_int ThreadPool_AtomicAdd( volatile cl_int *a, cl_int b ); // returns old value
@@ -68,9 +64,5 @@ cl_uint GetThreadCount( void );
// otherwise the behavior is indefined. It may not be called from a TPFuncPtr. // otherwise the behavior is indefined. It may not be called from a TPFuncPtr.
void SetThreadCount( int count ); void SetThreadCount( int count );
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* THREAD_POOL_H */ #endif /* THREAD_POOL_H */

View File

@@ -25,10 +25,6 @@
#include <stdio.h> #include <stdio.h>
#include "errorHelpers.h" #include "errorHelpers.h"
#ifdef __cplusplus
extern "C" {
#endif
// helper function to replace clCreateImage2D , to make the existing code use // helper function to replace clCreateImage2D , to make the existing code use
// the functions of version 1.2 and veriosn 1.1 respectively // the functions of version 1.2 and veriosn 1.1 respectively
@@ -283,8 +279,4 @@ extern "C" {
} }
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@@ -25,10 +25,6 @@
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#if defined(__cplusplus)
extern "C" {
#endif
/* Note: the next three all have to match in size and order!! */ /* Note: the next three all have to match in size and order!! */
enum ExplicitTypes enum ExplicitTypes
@@ -122,10 +118,6 @@ static inline int IsHalfSubnormal( cl_half x )
return ( ( x & 0x7fffU ) - 1U ) < 0x03ffU; return ( ( x & 0x7fffU ) - 1U ) < 0x03ffU;
} }
#if defined(__cplusplus)
}
#endif
#endif // _conversions_h #endif // _conversions_h

View File

@@ -1,104 +0,0 @@
/*-
* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
* code or tables extracted from it, as desired without restriction.
*
* First, the polynomial itself and its table of feedback terms. The
* polynomial is
* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
*
* Note that we take it "backwards" and put the highest-order term in
* the lowest-order bit. The X^32 term is "implied"; the LSB is the
* X^31 term, etc. The X^0 term (usually shown as "+1") results in
* the MSB being 1
*
* Note that the usual hardware shift register implementation, which
* is what we're using (we're merely optimizing it by doing eight-bit
* chunks at a time) shifts bits into the lowest-order term. In our
* implementation, that means shifting towards the right. Why do we
* do it this way? Because the calculated CRC must be transmitted in
* order from highest-order term to lowest-order term. UARTs transmit
* characters in order from LSB to MSB. By storing the CRC this way
* we hand it to the UART in the order low-byte to high-byte; the UART
* sends each low-bit to hight-bit; and the result is transmission bit
* by bit from highest- to lowest-order term without requiring any bit
* shuffling on our part. Reception works similarly
*
* The feedback terms table consists of 256, 32-bit entries. Notes
*
* The table can be generated at runtime if desired; code to do so
* is shown later. It might not be obvious, but the feedback
* terms simply represent the results of eight shift/xor opera
* tions for all combinations of data and CRC register values
*
* The values must be right-shifted by eight bits by the "updcrc
* logic; the shift must be unsigned (bring in zeroes). On some
* hardware you could probably optimize the shift in assembler by
* using byte-swap instructions
* polynomial $edb88320
*
*
* CRC32 code derived from work by Gary S. Brown.
*/
#include "crc32.h"
static uint32_t crc32_tab[] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
uint32_t
crc32(const void *buf, size_t size)
{
const uint8_t *p;
p = (const uint8_t*)buf;
uint32_t crc = ~0U;
while (size--)
crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
return crc ^ ~0U;
}

View File

@@ -0,0 +1,101 @@
/*-
* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
* code or tables extracted from it, as desired without restriction.
*
* First, the polynomial itself and its table of feedback terms. The
* polynomial is
* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
*
* Note that we take it "backwards" and put the highest-order term in
* the lowest-order bit. The X^32 term is "implied"; the LSB is the
* X^31 term, etc. The X^0 term (usually shown as "+1") results in
* the MSB being 1
*
* Note that the usual hardware shift register implementation, which
* is what we're using (we're merely optimizing it by doing eight-bit
* chunks at a time) shifts bits into the lowest-order term. In our
* implementation, that means shifting towards the right. Why do we
* do it this way? Because the calculated CRC must be transmitted in
* order from highest-order term to lowest-order term. UARTs transmit
* characters in order from LSB to MSB. By storing the CRC this way
* we hand it to the UART in the order low-byte to high-byte; the UART
* sends each low-bit to hight-bit; and the result is transmission bit
* by bit from highest- to lowest-order term without requiring any bit
* shuffling on our part. Reception works similarly
*
* The feedback terms table consists of 256, 32-bit entries. Notes
*
* The table can be generated at runtime if desired; code to do so
* is shown later. It might not be obvious, but the feedback
* terms simply represent the results of eight shift/xor opera
* tions for all combinations of data and CRC register values
*
* The values must be right-shifted by eight bits by the "updcrc
* logic; the shift must be unsigned (bring in zeroes). On some
* hardware you could probably optimize the shift in assembler by
* using byte-swap instructions
* polynomial $edb88320
*
*
* CRC32 code derived from work by Gary S. Brown.
*/
#include "crc32.h"
static uint32_t crc32_tab[] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
uint32_t crc32(const void *buf, size_t size)
{
const uint8_t *p;
p = (const uint8_t *)buf;
uint32_t crc = ~0U;
while (size--) crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
return crc ^ ~0U;
}

View File

@@ -21,14 +21,6 @@ executed between Khronos and the recipient.
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
uint32_t crc32(const void *buf, size_t size); uint32_t crc32(const void *buf, size_t size);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@@ -23,17 +23,9 @@
#include <CL/opencl.h> #include <CL/opencl.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/* Determines if an extension is supported by a device. */ /* Determines if an extension is supported by a device. */
int is_extension_available(cl_device_id device, const char *extensionName); int is_extension_available(cl_device_id device, const char *extensionName);
#ifdef __cplusplus
}
#endif // __cplusplus
/* Returns a string containing the supported extensions list for a device. */ /* Returns a string containing the supported extensions list for a device. */
std::string get_device_extensions_string(cl_device_id device); std::string get_device_extensions_string(cl_device_id device);

View File

@@ -24,10 +24,6 @@
#include <CL/opencl.h> #include <CL/opencl.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#define LOWER_IS_BETTER 0 #define LOWER_IS_BETTER 0
#define HIGHER_IS_BETTER 1 #define HIGHER_IS_BETTER 1
@@ -150,10 +146,6 @@ static int vlog_win32(const char *format, ...)
#endif #endif
#ifdef __cplusplus
}
#endif
#endif // _errorHelpers_h #endif // _errorHelpers_h

View File

@@ -40,10 +40,6 @@
#include "deviceInfo.h" #include "deviceInfo.h"
#include "harness/alloc.h" #include "harness/alloc.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/* /*
* The below code is intended to be used at the top of kernels that appear inline in files to set line and file info for the kernel: * The below code is intended to be used at the top of kernels that appear inline in files to set line and file info for the kernel:
* *
@@ -177,8 +173,4 @@ cl_device_fp_config get_default_rounding_mode( cl_device_id device );
/* Prints out the standard device header for all tests given the device to print for */ /* Prints out the standard device header for all tests given the device to print for */
extern int printDeviceHeader( cl_device_id device ); extern int printDeviceHeader( cl_device_id device );
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // _kernelHelpers_h #endif // _kernelHelpers_h

View File

@@ -55,10 +55,6 @@
#include <CL/cl_platform.h> #include <CL/cl_platform.h>
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
/* /*
* Interfaces here have been modified from original sources so that they * Interfaces here have been modified from original sources so that they
* are safe to call reentrantly, so long as a different MTdata is used * are safe to call reentrantly, so long as a different MTdata is used
@@ -92,10 +88,6 @@ double genrand_real3( MTdata /*data*/);
double genrand_res53( MTdata /*data*/ ); double genrand_res53( MTdata /*data*/ );
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus #ifdef __cplusplus
#include <cassert> #include <cassert>

View File

@@ -37,17 +37,9 @@
// C interface. // C interface.
// ------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
char * get_err_msg( int err ); // Returns system error message. Subject to free. char * get_err_msg( int err ); // Returns system error message. Subject to free.
char * get_dir_sep(); // Returns dir separator. Subject to free. char * get_dir_sep(); // Returns dir separator. Subject to free.
char * get_exe_path(); // Returns path of current executable. Subject to free. char * get_exe_path(); // Returns path of current executable. Subject to free.
char * get_exe_dir(); // Returns dir of current executable. Subject to free. char * get_exe_dir(); // Returns dir of current executable. Subject to free.
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __os_helpers_h__ #endif // __os_helpers_h__

View File

@@ -51,19 +51,11 @@ typedef enum
kTypeCount kTypeCount
}Type; }Type;
#ifdef __cplusplus
extern "C" {
#endif
extern RoundingMode set_round( RoundingMode r, Type outType ); extern RoundingMode set_round( RoundingMode r, Type outType );
extern RoundingMode get_round( void ); extern RoundingMode get_round( void );
extern void *FlushToZero( void ); extern void *FlushToZero( void );
extern void UnFlushToZero( void *p); extern void UnFlushToZero( void *p);
#ifdef __cplusplus
}
#endif
#endif /* __ROUNDING_MODE_H__ */ #endif /* __ROUNDING_MODE_H__ */

View File

@@ -48,10 +48,6 @@ private:
Version get_device_cl_version(cl_device_id device); Version get_device_cl_version(cl_device_id device);
#ifdef __cplusplus
extern "C" {
#endif
#define ADD_TEST(fn) \ #define ADD_TEST(fn) \
{ \ { \
test_##fn, #fn, Version(1, 0) \ test_##fn, #fn, Version(1, 0) \
@@ -152,9 +148,6 @@ extern int gIsOpenCL_C_1_0_Device; // This is set to 1 if the device suppor
void memset_pattern4(void *, const void *, size_t); void memset_pattern4(void *, const void *, size_t);
#endif #endif
#ifdef __cplusplus
}
#endif
extern void PrintArch(void); extern void PrintArch(void);

View File

@@ -29,9 +29,6 @@
#include "errorHelpers.h" #include "errorHelpers.h"
#include "kernelHelpers.h" #include "kernelHelpers.h"
extern "C" cl_uint gReSeed;
extern "C" cl_uint gRandomSeed;
/* cl_context wrapper */ /* cl_context wrapper */
class clContextWrapper class clContextWrapper

View File

@@ -19,8 +19,6 @@
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
extern cl_uint gRandomSeed;
const char *sample_single_param_kernel[] = { const char *sample_single_param_kernel[] = {
"__kernel void sample_test(__global int *src)\n" "__kernel void sample_test(__global int *src)\n"
"{\n" "{\n"

View File

@@ -22,8 +22,6 @@
#include "harness/conversions.h" #include "harness/conversions.h"
extern cl_uint gRandomSeed;
int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
{ {
int error; int error;

View File

@@ -15,8 +15,6 @@
// //
#include "testBase.h" #include "testBase.h"
extern "C" { extern cl_uint gRandomSeed;}
// This test is designed to stress changing kernel arguments between execute calls (that are asynchronous and thus // This test is designed to stress changing kernel arguments between execute calls (that are asynchronous and thus
// potentially overlapping) to make sure each kernel gets the right arguments // potentially overlapping) to make sure each kernel gets the right arguments

View File

@@ -27,8 +27,6 @@ const char *multi_arg_kernel_source_pattern =
" dst3[tid] = src3[tid];\n" " dst3[tid] = src3[tid];\n"
"}\n"; "}\n";
extern cl_uint gRandomSeed;
#define MAX_ERROR_TOLERANCE 0.0005f #define MAX_ERROR_TOLERANCE 0.0005f
int test_multi_arg_set(cl_device_id device, cl_context context, cl_command_queue queue, int test_multi_arg_set(cl_device_id device, cl_context context, cl_command_queue queue,

View File

@@ -17,8 +17,6 @@
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
#include "harness/conversions.h" #include "harness/conversions.h"
extern cl_uint gRandomSeed;
const char *sample_single_test_kernel[] = { const char *sample_single_test_kernel[] = {
"__kernel void sample_test(__global float *src, __global int *dst)\n" "__kernel void sample_test(__global float *src, __global int *dst)\n"
"{\n" "{\n"

View File

@@ -17,8 +17,6 @@
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
#include "harness/testHarness.h" #include "harness/testHarness.h"
extern cl_uint gRandomSeed;
#define TEST_MEM_OBJECT_PARAM( mem, paramName, val, expected, name, type, cast ) \ #define TEST_MEM_OBJECT_PARAM( mem, paramName, val, expected, name, type, cast ) \
error = clGetMemObjectInfo( mem, paramName, sizeof( val ), &val, &size ); \ error = clGetMemObjectInfo( mem, paramName, sizeof( val ), &val, &size ); \

View File

@@ -21,8 +21,6 @@
#include "harness/conversions.h" #include "harness/conversions.h"
extern cl_uint gRandomSeed;
static void CL_CALLBACK test_native_kernel_fn( void *userData ) static void CL_CALLBACK test_native_kernel_fn( void *userData )
{ {
struct arg_struct { struct arg_struct {

View File

@@ -23,8 +23,6 @@
#define LONG_TEST_VALUE 515154531254381446LL #define LONG_TEST_VALUE 515154531254381446LL
extern cl_uint gRandomSeed;
const char *atomic_global_pattern[] = { const char *atomic_global_pattern[] = {
"__kernel void test_atomic_fn(volatile __global %s *destMemory, __global %s *oldValues)\n" "__kernel void test_atomic_fn(volatile __global %s *destMemory, __global %s *oldValues)\n"
"{\n" "{\n"

View File

@@ -16,8 +16,6 @@
#include "testBase.h" #include "testBase.h"
#include "harness/conversions.h" #include "harness/conversions.h"
extern cl_uint gRandomSeed;
const char * atomic_index_source = const char * atomic_index_source =
"#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable\n" "#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable\n"
"// Counter keeps track of which index in counts we are using.\n" "// Counter keeps track of which index in counts we are using.\n"

View File

@@ -66,8 +66,6 @@ extern bool gDebug; // print OpenCL kernel code
extern int gInternalIterations; // internal test iterations for atomic operation, sufficient to verify atomicity extern int gInternalIterations; // internal test iterations for atomic operation, sufficient to verify atomicity
extern int gMaxDeviceThreads; // maximum number of threads executed on OCL device extern int gMaxDeviceThreads; // maximum number of threads executed on OCL device
extern cl_uint gRandomSeed;
extern const char *get_memory_order_type_name(TExplicitMemoryOrderType orderType); extern const char *get_memory_order_type_name(TExplicitMemoryOrderType orderType);
extern const char *get_memory_scope_type_name(TExplicitMemoryScopeType scopeType); extern const char *get_memory_scope_type_name(TExplicitMemoryScopeType scopeType);

View File

@@ -48,8 +48,8 @@ static const char *smoothstep4_kernel_code =
#define MAX_ERR (1e-5f) #define MAX_ERR (1e-5f)
extern "C" float float verify_smoothstep(float *edge0, float *edge1, float *x, float *outptr,
verify_smoothstep(float *edge0, float *edge1, float *x, float *outptr, int n, int veclen) int n, int veclen)
{ {
float r, t, delta, max_err = 0.0f; float r, t, delta, max_err = 0.0f;
int i, j; int i, j;

View File

@@ -22,8 +22,6 @@
#endif #endif
#include "harness/conversions.h" #include "harness/conversions.h"
extern cl_uint gRandomSeed;
#define MAX_LINE_SIZE_IN_PROGRAM 1024 #define MAX_LINE_SIZE_IN_PROGRAM 1024
#define MAX_LOG_SIZE_IN_PROGRAM 2048 #define MAX_LOG_SIZE_IN_PROGRAM 2048

View File

@@ -16,8 +16,6 @@
#include "testBase.h" #include "testBase.h"
#include "harness/os_helpers.h" #include "harness/os_helpers.h"
extern cl_uint gRandomSeed;
const char *define_kernel_code[] = { const char *define_kernel_code[] = {
" #define VALUE\n" " #define VALUE\n"
"__kernel void define_test(__global int *src, __global int *dstA, __global int *dstB)\n" "__kernel void define_test(__global int *src, __global int *dstA, __global int *dstB)\n"

View File

@@ -104,17 +104,9 @@
} }
#else /* not __APPLE__ */ #else /* not __APPLE__ */
#if defined(__cplusplus)
extern "C" {
#endif
void PreventSleep( void ) {} void PreventSleep( void ) {}
void ResumeSleep( void ) {} void ResumeSleep( void ) {}
#if defined(__cplusplus)
}
#endif //__cplusplus
#endif #endif

View File

@@ -16,17 +16,9 @@
#ifndef SLEEP_H #ifndef SLEEP_H
#define SLEEP_H #define SLEEP_H
#if defined(__cplusplus)
extern "C" {
#endif
void PreventSleep( void ); void PreventSleep( void );
void ResumeSleep( void ); void ResumeSleep( void );
#if defined(__cplusplus)
}
#endif //__cplusplus
#endif /* SLEEP_H */ #endif /* SLEEP_H */

View File

@@ -15,10 +15,6 @@
// //
#include "harness/testHarness.h" #include "harness/testHarness.h"
#ifdef __cplusplus
extern "C" {
#endif
extern int test_device_info(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); extern int test_device_info(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
extern int test_device_queue(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); extern int test_device_queue(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
extern int test_execute_block(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); extern int test_execute_block(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
@@ -33,8 +29,4 @@ extern int test_host_queue_order(cl_device_id device, cl_context context, cl_com
extern int test_execution_stress(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); extern int test_execution_stress(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
#ifdef __cplusplus
}
#endif

View File

@@ -108,10 +108,6 @@
#include <GL/glew.h> #include <GL/glew.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int32_t EGLint; typedef int32_t EGLint;
typedef unsigned int EGLBoolean; typedef unsigned int EGLBoolean;
@@ -2611,8 +2607,4 @@ GLEWAPI GLboolean GLEWAPIENTRY eglewIsSupported (const char *name);
GLEWAPI GLboolean GLEWAPIENTRY eglewGetExtension (const char *name); GLEWAPI GLboolean GLEWAPIENTRY eglewGetExtension (const char *name);
#ifdef __cplusplus
}
#endif
#endif /* __eglew_h__ */ #endif /* __eglew_h__ */

View File

@@ -266,10 +266,6 @@ typedef _W64 int ptrdiff_t;
#define GLEW_VAR_EXPORT GLEWAPI #define GLEW_VAR_EXPORT GLEWAPI
#define GLEW_FUN_EXPORT GLEWAPI #define GLEW_FUN_EXPORT GLEWAPI
#ifdef __cplusplus
extern "C" {
#endif
/* ----------------------------- GL_VERSION_1_1 ---------------------------- */ /* ----------------------------- GL_VERSION_1_1 ---------------------------- */
#ifndef GL_VERSION_1_1 #ifndef GL_VERSION_1_1
@@ -23661,10 +23657,6 @@ GLEWAPI GLboolean GLEWAPIENTRY glewGetExtension (const char *name);
GLEWAPI const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error); GLEWAPI const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error);
GLEWAPI const GLubyte * GLEWAPIENTRY glewGetString (GLenum name); GLEWAPI const GLubyte * GLEWAPIENTRY glewGetString (GLenum name);
#ifdef __cplusplus
}
#endif
#ifdef GLEW_APIENTRY_DEFINED #ifdef GLEW_APIENTRY_DEFINED
#undef GLEW_APIENTRY_DEFINED #undef GLEW_APIENTRY_DEFINED
#undef APIENTRY #undef APIENTRY

View File

@@ -100,10 +100,6 @@
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <GL/glew.h> #include <GL/glew.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ---------------------------- GLX_VERSION_1_0 --------------------------- */ /* ---------------------------- GLX_VERSION_1_0 --------------------------- */
#ifndef GLX_VERSION_1_0 #ifndef GLX_VERSION_1_0
@@ -1768,8 +1764,4 @@ GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);
GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name); GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name);
#ifdef __cplusplus
}
#endif
#endif /* __glxew_h__ */ #endif /* __glxew_h__ */

View File

@@ -85,10 +85,6 @@
# endif # endif
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
/* -------------------------- WGL_3DFX_multisample ------------------------- */ /* -------------------------- WGL_3DFX_multisample ------------------------- */
#ifndef WGL_3DFX_multisample #ifndef WGL_3DFX_multisample
@@ -1438,10 +1434,6 @@ GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);
GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name); GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name);
#ifdef __cplusplus
}
#endif
#undef GLEWAPI #undef GLEWAPI
#endif /* __wglew_h__ */ #endif /* __wglew_h__ */

View File

@@ -21,8 +21,6 @@
#include <CL/cl_gl.h> #include <CL/cl_gl.h>
#endif #endif
extern "C" { extern cl_uint gRandomSeed; };
static const char *bufferKernelPattern = static const char *bufferKernelPattern =
"__kernel void sample_test( __global %s%s *source, __global %s%s *clDest, __global %s%s *glDest )\n" "__kernel void sample_test( __global %s%s *source, __global %s%s *clDest, __global %s%s *glDest )\n"
"{\n" "{\n"

View File

@@ -26,8 +26,6 @@
using namespace std; using namespace std;
extern "C" { extern cl_uint gRandomSeed; }
#pragma mark - #pragma mark -
#pragma mark _2D read tests #pragma mark _2D read tests

View File

@@ -26,8 +26,6 @@
using namespace std; using namespace std;
extern "C" { extern cl_uint gRandomSeed; };
#pragma mark - #pragma mark -
#pragma mark _3D read test #pragma mark _3D read test

View File

@@ -27,8 +27,6 @@
using namespace std; using namespace std;
extern "C" { extern cl_uint gRandomSeed; }
#pragma mark - #pragma mark -
#pragma mark _2D depth read tests #pragma mark _2D depth read tests

View File

@@ -23,8 +23,6 @@
#include <CL/cl_gl.h> #include <CL/cl_gl.h>
#endif #endif
extern "C" { extern cl_uint gRandomSeed; };
extern int supportsHalf(cl_context context, bool* supports_half); extern int supportsHalf(cl_context context, bool* supports_half);
static int test_image_info( cl_context context, cl_command_queue queue, static int test_image_info( cl_context context, cl_command_queue queue,

View File

@@ -23,8 +23,6 @@
#include <CL/cl_gl.h> #include <CL/cl_gl.h>
#endif #endif
extern "C" { extern cl_uint gRandomSeed; };
extern int supportsHalf(cl_context context, bool* supports_half); extern int supportsHalf(cl_context context, bool* supports_half);
extern int supportsMsaa(cl_context context, bool* supports_msaa); extern int supportsMsaa(cl_context context, bool* supports_msaa);
extern int supportsDepth(cl_context context, bool* supports_depth); extern int supportsDepth(cl_context context, bool* supports_depth);

View File

@@ -24,8 +24,6 @@
#include <CL/cl_gl.h> #include <CL/cl_gl.h>
#endif #endif
extern "C" { extern cl_uint gRandomSeed; };
#pragma mark - #pragma mark -
#pragma mark Write test kernels #pragma mark Write test kernels

View File

@@ -52,8 +52,6 @@ gluCheckExtension(const GLubyte *extension, const GLubyte *extensions)
#endif #endif
extern "C" { extern cl_uint gRandomSeed; };
// This is defined in the write common code: // This is defined in the write common code:
extern int test_cl_image_write( cl_context context, cl_command_queue queue, extern int test_cl_image_write( cl_context context, cl_command_queue queue,
GLenum target, cl_mem clImage, size_t width, size_t height, size_t depth, GLenum target, cl_mem clImage, size_t width, size_t height, size_t depth,

View File

@@ -21,8 +21,6 @@
#include <CL/cl_gl.h> #include <CL/cl_gl.h>
#endif #endif
extern "C" {extern cl_uint gRandomSeed;};
static int test_renderbuffer_object_info( cl_context context, cl_command_queue queue, static int test_renderbuffer_object_info( cl_context context, cl_command_queue queue,
GLsizei width, GLsizei height, GLenum attachment, GLsizei width, GLsizei height, GLenum attachment,
GLenum format, GLenum internalFormat, GLenum format, GLenum internalFormat,

View File

@@ -24,8 +24,6 @@
#include <CL/cl_gl.h> #include <CL/cl_gl.h>
#endif #endif
extern "C" { extern cl_uint gRandomSeed; };
static const char *bufferKernelPattern = static const char *bufferKernelPattern =
"__kernel void sample_test( __global %s%s *source, __global %s%s *clDest, __global %s%s *glDest )\n" "__kernel void sample_test( __global %s%s *source, __global %s%s *clDest, __global %s%s *glDest )\n"
"{\n" "{\n"

View File

@@ -17,8 +17,6 @@
#include "gl_headers.h" #include "gl_headers.h"
extern "C" { extern cl_uint gRandomSeed; }
static const char *imageReadKernelPattern = static const char *imageReadKernelPattern =
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" /* added support for half floats */ "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" /* added support for half floats */
"__kernel void sample_test( read_only image2d_t source, sampler_t sampler, __global %s4 *results )\n" "__kernel void sample_test( read_only image2d_t source, sampler_t sampler, __global %s4 *results )\n"

View File

@@ -17,8 +17,6 @@
#include "gl_headers.h" #include "gl_headers.h"
extern "C" {extern cl_uint gRandomSeed;};
static int test_image_read( cl_context context, cl_command_queue queue, GLenum glTarget, GLuint glTexture, static int test_image_read( cl_context context, cl_command_queue queue, GLenum glTarget, GLuint glTexture,
size_t imageWidth, size_t imageHeight, cl_image_format *outFormat, size_t imageWidth, size_t imageHeight, cl_image_format *outFormat,
ExplicitType *outType, void **outResultBuffer ) ExplicitType *outType, void **outResultBuffer )

View File

@@ -17,8 +17,6 @@
#include "gl_headers.h" #include "gl_headers.h"
extern "C" { extern cl_uint gRandomSeed; };
static const char *imageReadKernelPattern = static const char *imageReadKernelPattern =
"__kernel void sample_test( read_only image3d_t source, sampler_t sampler, __global %s4 *results )\n" "__kernel void sample_test( read_only image3d_t source, sampler_t sampler, __global %s4 *results )\n"
"{\n" "{\n"

View File

@@ -16,8 +16,6 @@
#include "gl_headers.h" #include "gl_headers.h"
#include "testBase.h" #include "testBase.h"
extern "C" {extern cl_uint gRandomSeed;};
static int test_image_read( cl_context context, cl_command_queue queue, GLenum glTarget, GLuint glTexture, static int test_image_read( cl_context context, cl_command_queue queue, GLenum glTarget, GLuint glTexture,
size_t imageWidth, size_t imageHeight, size_t imageDepth, cl_image_format *outFormat, ExplicitType *outType, void **outResultBuffer ) size_t imageWidth, size_t imageHeight, size_t imageDepth, cl_image_format *outFormat, ExplicitType *outType, void **outResultBuffer )
{ {

View File

@@ -18,8 +18,6 @@
#include "gl_headers.h" #include "gl_headers.h"
extern "C" { extern cl_uint gRandomSeed; };
extern int test_cl_image_write( cl_context context, cl_command_queue queue, cl_mem clImage, extern int test_cl_image_write( cl_context context, cl_command_queue queue, cl_mem clImage,
size_t imageWidth, size_t imageHeight, cl_image_format *outFormat, size_t imageWidth, size_t imageHeight, cl_image_format *outFormat,
ExplicitType *outType, void **outSourceBuffer, MTdata d ); ExplicitType *outType, void **outSourceBuffer, MTdata d );

View File

@@ -16,8 +16,6 @@
#include "gl_headers.h" #include "gl_headers.h"
#include "testBase.h" #include "testBase.h"
extern "C" {extern cl_uint gRandomSeed;};
static int test_renderbuffer_object_info( cl_context context, cl_command_queue queue, static int test_renderbuffer_object_info( cl_context context, cl_command_queue queue,
GLsizei width, GLsizei height, GLenum attachment, GLsizei width, GLsizei height, GLenum attachment,
GLenum rbFormat, GLenum rbType, GLenum rbFormat, GLenum rbType,

View File

@@ -59,9 +59,6 @@
#define HALF_ENTRY( _name, _ulp, _embedded_ulp, _rmode, _type ) { "half_" STRINGIFY(_name), "half_" STRINGIFY(_name), {(void*)reference_##_name}, {NULL}, {NULL}, _ulp, _ulp, _embedded_ulp, INFINITY, _rmode, RELAXED_OFF, _type } #define HALF_ENTRY( _name, _ulp, _embedded_ulp, _rmode, _type ) { "half_" STRINGIFY(_name), "half_" STRINGIFY(_name), {(void*)reference_##_name}, {NULL}, {NULL}, _ulp, _ulp, _embedded_ulp, INFINITY, _rmode, RELAXED_OFF, _type }
#define OPERATOR_ENTRY(_name, _operator, _ulp, _embedded_ulp, _rmode, _type) { STRINGIFY(_name), _operator, {(void*)reference_##_name}, {(void*)reference_##_name##l}, {NULL}, _ulp, _ulp, _embedded_ulp, INFINITY, _rmode, RELAXED_OFF, _type } #define OPERATOR_ENTRY(_name, _operator, _ulp, _embedded_ulp, _rmode, _type) { STRINGIFY(_name), _operator, {(void*)reference_##_name}, {(void*)reference_##_name##l}, {NULL}, _ulp, _ulp, _embedded_ulp, INFINITY, _rmode, RELAXED_OFF, _type }
#if defined( __cplusplus )
extern "C" {
#endif
extern const vtbl _unary; // float foo( float ) extern const vtbl _unary; // float foo( float )
extern const vtbl _unary_u; // float foo( uint ), double foo( ulong ) extern const vtbl _unary_u; // float foo( uint ), double foo( ulong )
extern const vtbl _i_unary; // int foo( float ) extern const vtbl _i_unary; // int foo( float )
@@ -76,9 +73,6 @@ extern const vtbl _unary_two_results; // float foo( float, float * )
extern const vtbl _unary_two_results_i; // float foo( float, int * ) extern const vtbl _unary_two_results_i; // float foo( float, int * )
extern const vtbl _binary_two_results_i; // float foo( float, float, int * ) extern const vtbl _binary_two_results_i; // float foo( float, float, int * )
extern const vtbl _mad_tbl; // float mad( float, float, float ) extern const vtbl _mad_tbl; // float mad( float, float, float )
#if defined( __cplusplus)
}
#endif
#define unaryF &_unary #define unaryF &_unary
#define i_unaryF &_i_unary #define i_unaryF &_i_unary

View File

@@ -30,10 +30,6 @@
#include "harness/mt19937.h" #include "harness/mt19937.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef union fptr typedef union fptr
{ {
void *p; void *p;
@@ -97,10 +93,6 @@ extern const Func functionList[];
extern const size_t functionListCount; extern const size_t functionListCount;
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@@ -90,16 +90,10 @@ extern cl_device_fp_config gDoubleCapabilities;
#define scalbnl( _a, _i ) ldexpl( _a, _i ) #define scalbnl( _a, _i ) ldexpl( _a, _i )
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
float Abs_Error( float test, double reference ); float Abs_Error( float test, double reference );
float Ulp_Error( float test, double reference ); float Ulp_Error( float test, double reference );
//float Ulp_Error_Half( float test, double reference ); //float Ulp_Error_Half( float test, double reference );
float Bruteforce_Ulp_Error_Double( double test, long double reference ); float Bruteforce_Ulp_Error_Double( double test, long double reference );
#ifdef __cplusplus
} //extern "C"
#endif
uint64_t GetTime( void ); uint64_t GetTime( void );
double SubtractTime( uint64_t endTime, uint64_t startTime ); double SubtractTime( uint64_t endTime, uint64_t startTime );
@@ -230,11 +224,7 @@ static inline void Force64BitFPUPrecision(void)
#endif #endif
} }
#ifdef __cplusplus
extern "C"
#else
extern extern
#endif
void memset_pattern4(void *dest, const void *src_pattern, size_t bytes ); void memset_pattern4(void *dest, const void *src_pattern, size_t bytes );
typedef union typedef union

View File

@@ -28,15 +28,13 @@ int TestFunc_Double_Double_Double_common(const Func *f, MTdata, int isNextafter)
const float twoToMinus126 = MAKE_HEX_FLOAT(0x1p-126f, 1, -126); const float twoToMinus126 = MAKE_HEX_FLOAT(0x1p-126f, 1, -126);
const double twoToMinus1022 = MAKE_HEX_DOUBLE(0x1p-1022, 1, -1022); const double twoToMinus1022 = MAKE_HEX_DOUBLE(0x1p-1022, 1, -1022);
#if defined( __cplusplus ) extern const vtbl _binary = { "binary", TestFunc_Float_Float_Float,
extern "C" TestFunc_Double_Double_Double };
#endif
const vtbl _binary = { "binary", TestFunc_Float_Float_Float, TestFunc_Double_Double_Double };
#if defined( __cplusplus ) extern const vtbl _binary_nextafter = {
extern "C" "binary_nextafter", TestFunc_Float_Float_Float_nextafter,
#endif TestFunc_Double_Double_Double_nextafter
const vtbl _binary_nextafter = { "binary_nextafter", TestFunc_Float_Float_Float_nextafter, TestFunc_Double_Double_Double_nextafter }; };
static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );

View File

@@ -21,11 +21,9 @@
int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata); int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata);
int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata); int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata);
#if defined(__cplusplus) extern const vtbl _binary_operator = { "binaryOperator",
extern "C" TestFunc_Float_Float_Float_Operator,
#endif TestFunc_Double_Double_Double_Operator };
const vtbl _binary_operator = { "binaryOperator", TestFunc_Float_Float_Float_Operator, TestFunc_Double_Double_Double_Operator };
static int BuildKernel( const char *name, const char *operator_symbol, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, const char *operator_symbol, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, const char *operator_symbol, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, const char *operator_symbol, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );

View File

@@ -22,10 +22,8 @@
int TestFunc_Float_Float_Int(const Func *f, MTdata); int TestFunc_Float_Float_Int(const Func *f, MTdata);
int TestFunc_Double_Double_Int(const Func *f, MTdata); int TestFunc_Double_Double_Int(const Func *f, MTdata);
#if defined( __cplusplus) extern const vtbl _binary_i = { "binary_i", TestFunc_Float_Float_Int,
extern "C" TestFunc_Double_Double_Int };
#endif
const vtbl _binary_i = { "binary_i", TestFunc_Float_Float_Int, TestFunc_Double_Double_Int };
static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );

View File

@@ -24,10 +24,9 @@
int TestFunc_FloatI_Float_Float(const Func *f, MTdata); int TestFunc_FloatI_Float_Float(const Func *f, MTdata);
int TestFunc_DoubleI_Double_Double(const Func *f, MTdata); int TestFunc_DoubleI_Double_Double(const Func *f, MTdata);
#if defined( __cplusplus ) extern const vtbl _binary_two_results_i = { "binary_two_results_i",
extern "C" TestFunc_FloatI_Float_Float,
#endif TestFunc_DoubleI_Double_Double };
const vtbl _binary_two_results_i = { "binary_two_results_i", TestFunc_FloatI_Float_Float, TestFunc_DoubleI_Double_Double };
static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p );

View File

@@ -21,10 +21,8 @@
int TestFunc_Int_Float(const Func *f, MTdata); int TestFunc_Int_Float(const Func *f, MTdata);
int TestFunc_Int_Double(const Func *f, MTdata); int TestFunc_Int_Double(const Func *f, MTdata);
#if defined( __cplusplus) extern const vtbl _i_unary = { "i_unary", TestFunc_Int_Float,
extern "C" TestFunc_Int_Double };
#endif
const vtbl _i_unary = { "i_unary", TestFunc_Int_Float, TestFunc_Int_Double };
static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p );

View File

@@ -21,10 +21,8 @@
int TestMacro_Int_Float_Float(const Func *f, MTdata); int TestMacro_Int_Float_Float(const Func *f, MTdata);
int TestMacro_Int_Double_Double(const Func *f, MTdata); int TestMacro_Int_Double_Double(const Func *f, MTdata);
#if defined( __cplusplus) extern const vtbl _macro_binary = { "macro_binary", TestMacro_Int_Float_Float,
extern "C" TestMacro_Int_Double_Double };
#endif
const vtbl _macro_binary = { "macro_binary", TestMacro_Int_Float_Float, TestMacro_Int_Double_Double };
static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );

View File

@@ -21,10 +21,8 @@
int TestMacro_Int_Float(const Func *f, MTdata); int TestMacro_Int_Float(const Func *f, MTdata);
int TestMacro_Int_Double(const Func *f, MTdata); int TestMacro_Int_Double(const Func *f, MTdata);
#if defined( __cplusplus) extern const vtbl _macro_unary = { "macro_unary", TestMacro_Int_Float,
extern "C" TestMacro_Int_Double };
#endif
const vtbl _macro_unary = { "macro_unary", TestMacro_Int_Float, TestMacro_Int_Double };
static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );

View File

@@ -21,10 +21,7 @@
int TestFunc_mad(const Func *f, MTdata); int TestFunc_mad(const Func *f, MTdata);
int TestFunc_mad_Double(const Func *f, MTdata); int TestFunc_mad_Double(const Func *f, MTdata);
#if defined( __cplusplus) extern const vtbl _mad_tbl = { "ternary", TestFunc_mad, TestFunc_mad_Double };
extern "C"
#endif
const vtbl _mad_tbl = { "ternary", TestFunc_mad, TestFunc_mad_Double };
static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p );

View File

@@ -24,10 +24,8 @@
int TestFunc_Float_Float_Float_Float(const Func *f, MTdata); int TestFunc_Float_Float_Float_Float(const Func *f, MTdata);
int TestFunc_Double_Double_Double_Double(const Func *f, MTdata); int TestFunc_Double_Double_Double_Double(const Func *f, MTdata);
#if defined( __cplusplus) extern const vtbl _ternary = { "ternary", TestFunc_Float_Float_Float_Float,
extern "C" TestFunc_Double_Double_Double_Double };
#endif
const vtbl _ternary = { "ternary", TestFunc_Float_Float_Float_Float, TestFunc_Double_Double_Double_Double };
static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p );

View File

@@ -25,10 +25,8 @@
int TestFunc_Float_Float(const Func *f, MTdata); int TestFunc_Float_Float(const Func *f, MTdata);
int TestFunc_Double_Double(const Func *f, MTdata); int TestFunc_Double_Double(const Func *f, MTdata);
#if defined( __cplusplus) extern const vtbl _unary = { "unary", TestFunc_Float_Float,
extern "C" TestFunc_Double_Double };
#endif
const vtbl _unary = { "unary", TestFunc_Float_Float, TestFunc_Double_Double };
static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_uint kernel_count, cl_kernel *k, cl_program *p );

View File

@@ -21,10 +21,9 @@
int TestFunc_Float2_Float(const Func *f, MTdata); int TestFunc_Float2_Float(const Func *f, MTdata);
int TestFunc_Double2_Double(const Func *f, MTdata); int TestFunc_Double2_Double(const Func *f, MTdata);
#if defined(__cplusplus) extern const vtbl _unary_two_results = { "unary_two_results",
extern "C" TestFunc_Float2_Float,
#endif TestFunc_Double2_Double };
const vtbl _unary_two_results = { "unary_two_results", TestFunc_Float2_Float, TestFunc_Double2_Double };
static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p );

View File

@@ -22,10 +22,9 @@
int TestFunc_FloatI_Float(const Func *f, MTdata); int TestFunc_FloatI_Float(const Func *f, MTdata);
int TestFunc_DoubleI_Double(const Func *f, MTdata); int TestFunc_DoubleI_Double(const Func *f, MTdata);
#if defined(__cplusplus) extern const vtbl _unary_two_results_i = { "unary_two_results_i",
extern "C" TestFunc_FloatI_Float,
#endif TestFunc_DoubleI_Double };
const vtbl _unary_two_results_i = { "unary_two_results_i", TestFunc_FloatI_Float, TestFunc_DoubleI_Double };
static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p );
static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernelDouble( const char *name, int vectorSize, cl_kernel *k, cl_program *p );

View File

@@ -21,10 +21,8 @@
int TestFunc_Float_UInt(const Func *f, MTdata); int TestFunc_Float_UInt(const Func *f, MTdata);
int TestFunc_Double_ULong(const Func *f, MTdata); int TestFunc_Double_ULong(const Func *f, MTdata);
#if defined( __cplusplus) extern const vtbl _unary_u = { "unary_u", TestFunc_Float_UInt,
extern "C" TestFunc_Double_ULong };
#endif
const vtbl _unary_u = { "unary_u", TestFunc_Float_UInt, TestFunc_Double_ULong };
static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p ); static int BuildKernel( const char *name, int vectorSize, cl_kernel *k, cl_program *p );

View File

@@ -17,8 +17,6 @@
#include "harness/conversions.h" #include "harness/conversions.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
extern "C" { extern cl_uint gRandomSeed; };
#define TEST_SIZE 512 #define TEST_SIZE 512
const char *equivTestKernelPattern_double = const char *equivTestKernelPattern_double =

View File

@@ -17,8 +17,6 @@
#include "harness/conversions.h" #include "harness/conversions.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
extern "C" { extern cl_uint gRandomSeed;};
#define TEST_SIZE 512 #define TEST_SIZE 512
const char *equivTestKernelPattern_float = const char *equivTestKernelPattern_float =
@@ -63,7 +61,7 @@ const char *equivTestKernelPatternLessGreater_float3 =
"}\n"; "}\n";
typedef bool (*equivVerifyFn)( float inDataA, float inDataB ); typedef bool (*equivVerifyFn)( float inDataA, float inDataB );
extern "C" { extern int gInfNanSupport; }; extern int gInfNanSupport;
int IsFloatInfinity(float x) int IsFloatInfinity(float x)
{ {

View File

@@ -38,8 +38,6 @@ const char *anyAllTestKernelPatternVload =
#define TEST_SIZE 512 #define TEST_SIZE 512
extern "C" {extern cl_uint gRandomSeed;};
typedef int (*anyAllVerifyFn)( ExplicitType vecType, unsigned int vecSize, void *inData ); typedef int (*anyAllVerifyFn)( ExplicitType vecType, unsigned int vecSize, void *inData );
int test_any_all_kernel(cl_context context, cl_command_queue queue, int test_any_all_kernel(cl_context context, cl_command_queue queue,

View File

@@ -36,8 +36,6 @@ enum ShuffleMode
kBuiltInDualInputFnMode kBuiltInDualInputFnMode
}; };
extern "C" { extern cl_uint gRandomSeed;};
static const char *shuffleKernelPattern[3] = { static const char *shuffleKernelPattern[3] = {
"__kernel void sample_test( __global %s%s *source, __global %s%s *dest )\n" "__kernel void sample_test( __global %s%s *source, __global %s%s *dest )\n"
"{\n" "{\n"

View File

@@ -93,38 +93,6 @@ void DataGenerator::setArgGenerator(const KernelArgInfo& argInfo,
m_argGenerators[argInfo.getTypeName()] = pGen; m_argGenerators[argInfo.getTypeName()] = pGen;
} }
float get_random_float(float low, float high, MTdata d)
{
float t = (float)((double)genrand_int32(d) / (double)0xFFFFFFFF);
return (1.0f - t) * low + t * high;
}
double get_random_double(double low, double high, MTdata d)
{
cl_ulong u = (cl_ulong) genrand_int32(d) | ((cl_ulong) genrand_int32(d) << 32 );
double t = (double) u * MAKE_HEX_DOUBLE( 0x1.0p-64, 0x1, -64);
return (1.0f - t) * low + t * high;
}
size_t get_random_size_t(size_t low, size_t high, MTdata d)
{
enum { N = sizeof(size_t)/sizeof(int) };
union {
int word[N];
size_t size;
} u;
for (unsigned i=0; i != N; ++i) {
u.word[i] = genrand_int32(d);
}
assert(low <= high && "Invalid random number range specified");
size_t range = high - low;
return (range) ? low + ((u.size - low) % range) : low;
}
size_t get_random_int32(int low, int high, MTdata d) size_t get_random_int32(int low, int high, MTdata d)
{ {
int v = genrand_int32(d); int v = genrand_int32(d);

View File

@@ -100,7 +100,8 @@ void get_kernel_name (const char *test_name, std::string &kernel_name)
kernel_name.assign(temp_str); kernel_name.assign(temp_str);
} }
extern "C" void CL_CALLBACK notify_callback(const char *errInfo, const void *privateInfo, size_t cb, void *userData); void CL_CALLBACK notify_callback(const char* errInfo, const void* privateInfo,
size_t cb, void* userData);
void create_context_and_queue(cl_device_id device, cl_context *out_context, cl_command_queue *out_queue) void create_context_and_queue(cl_device_id device, cl_context *out_context, cl_command_queue *out_queue)
{ {

View File

@@ -26,10 +26,6 @@
extern MTdata gMTdata; extern MTdata gMTdata;
#ifdef __cplusplus
extern "C" {
#endif
extern int test_sub_group_info(cl_device_id device, cl_context context, extern int test_sub_group_info(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements); cl_command_queue queue, int num_elements);
extern int test_work_item_functions(cl_device_id device, cl_context context, extern int test_work_item_functions(cl_device_id device, cl_context context,
@@ -41,8 +37,4 @@ extern int test_barrier_functions(cl_device_id device, cl_context context,
extern int test_pipe_functions(cl_device_id device, cl_context context, extern int test_pipe_functions(cl_device_id device, cl_context context,
cl_command_queue queue, int num_elements); cl_command_queue queue, int num_elements);
#ifdef __cplusplus
}
#endif
#endif /*_procs_h*/ #endif /*_procs_h*/