diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-06-28 22:32:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-28 22:32:25 +0200 |
commit | 7c13bacf129291e3e295ecb6e833788477085fa0 (patch) | |
tree | d114eeca418444d0b1c70cc9cce983de041235c9 /src/kernels/common.opencl | |
parent | 181eb20bbf15cf11baaf6112b6965050c49dd543 (diff) | |
parent | 577f0ee1179014ece853af39d6f0ff0c87316eb3 (diff) |
Merge pull request #70 from CNugteren/development
Update to version 0.8.0
Diffstat (limited to 'src/kernels/common.opencl')
-rw-r--r-- | src/kernels/common.opencl | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/kernels/common.opencl b/src/kernels/common.opencl index b9e52e17..08c47d87 100644 --- a/src/kernels/common.opencl +++ b/src/kernels/common.opencl @@ -19,20 +19,36 @@ R"( // Parameters set by the tuner or by the database. Here they are given a basic default value in case // this file is used outside of the CLBlast library. #ifndef PRECISION - #define PRECISION 32 // Data-types: single or double precision, complex or regular + #define PRECISION 32 // Data-types: half, single or double precision, complex or regular #endif // ================================================================================================= // Enable support for double-precision +#if PRECISION == 16 + #pragma OPENCL EXTENSION cl_khr_fp16: enable +#endif + +// Enable support for double-precision #if PRECISION == 64 || PRECISION == 6464 #if __OPENCL_VERSION__ <= CL_VERSION_1_1 #pragma OPENCL EXTENSION cl_khr_fp64: enable #endif #endif +// Half-precision +#if PRECISION == 16 + typedef half real; + typedef half2 real2; + typedef half4 real4; + typedef half8 real8; + typedef half16 real16; + #define ZERO 0 + #define ONE 1 + #define SMALLEST -1.0e14 + // Single-precision -#if PRECISION == 32 +#elif PRECISION == 32 typedef float real; typedef float2 real2; typedef float4 real4; @@ -68,7 +84,7 @@ R"( #define ONE 1.0f #define SMALLEST -1.0e37f -// Complex Double-precision +// Complex double-precision #elif PRECISION == 6464 typedef struct cdouble {double x; double y;} real; typedef struct cdouble2 {real x; real y;} real2; |