[Libclc-dev] [PATCH 1/6] Move cl_khr_fp64 exntension enablement to gentype include lists

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Mon Mar 5 09:23:17 PST 2018


On Wed, 2018-02-28 at 14:50 -0500, Jan Vesely wrote:
> This will make adding cl_khr_fp16 support easier
> 
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
>  generic/include/clc/async/gentype.inc              | 3 +++
>  generic/include/clc/geometric/floatn.inc           | 1 +
>  generic/include/clc/math/binary_intrin.inc         | 1 +
>  generic/include/clc/math/ternary_intrin.inc        | 1 +
>  generic/include/clc/math/unary_intrin.inc          | 1 +
>  generic/lib/async/async_work_group_copy.cl         | 5 -----
>  generic/lib/async/async_work_group_strided_copy.cl | 5 -----
>  generic/lib/async/prefetch.cl                      | 5 -----
>  generic/lib/common/mix.cl                          | 4 ----
>  generic/lib/geometric/distance.cl                  | 4 ----
>  generic/lib/math/acos.cl                           | 4 ----
>  generic/lib/math/asin.cl                           | 4 ----
>  generic/lib/math/clc_sqrt.cl                       | 4 ----
>  generic/lib/math/exp10.cl                          | 4 ----
>  generic/lib/math/fdim.cl                           | 4 ----
>  generic/lib/math/fract.cl                          | 4 ----
>  generic/lib/math/frexp.cl                          | 4 ----
>  generic/lib/math/hypot.cl                          | 4 ----
>  generic/lib/math/lgamma_r.cl                       | 4 ----
>  generic/lib/math/log10.cl                          | 4 ----
>  generic/lib/math/mad.cl                            | 4 ----
>  generic/lib/math/modf.cl                           | 4 ----
>  generic/lib/math/sincos.cl                         | 4 ----
>  generic/lib/shared/clamp.cl                        | 4 ----
>  generic/lib/shared/max.cl                          | 4 ----
>  generic/lib/shared/min.cl                          | 4 ----
>  26 files changed, 7 insertions(+), 87 deletions(-)
> 
> diff --git a/generic/include/clc/async/gentype.inc b/generic/include/clc/async/gentype.inc
> index 6b79acd..c08bb6f 100644
> --- a/generic/include/clc/async/gentype.inc
> +++ b/generic/include/clc/async/gentype.inc
> @@ -180,6 +180,7 @@
>  #undef __CLC_GENTYPE
>  
>  #ifdef cl_khr_fp64
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
>  
>  #define __CLC_GENTYPE double
>  #include __CLC_BODY
> @@ -202,3 +203,5 @@
>  #undef __CLC_GENTYPE
>  
>  #endif
> +
> +#undef __CLC_BODY
> diff --git a/generic/include/clc/geometric/floatn.inc b/generic/include/clc/geometric/floatn.inc
> index fe5fba6..f1ec38c 100644
> --- a/generic/include/clc/geometric/floatn.inc
> +++ b/generic/include/clc/geometric/floatn.inc
> @@ -24,6 +24,7 @@
>  
>  #ifndef __FLOAT_ONLY
>  #ifdef cl_khr_fp64
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
>  
>  #define __CLC_FLOAT double
>  #define __CLC_FPSIZE 64
> diff --git a/generic/include/clc/math/binary_intrin.inc b/generic/include/clc/math/binary_intrin.inc
> index cfbe741..dd4440a 100644
> --- a/generic/include/clc/math/binary_intrin.inc
> +++ b/generic/include/clc/math/binary_intrin.inc
> @@ -6,6 +6,7 @@ _CLC_OVERLOAD float8 __CLC_FUNCTION(float8, float8) __asm(__CLC_INTRINSIC ".v8f3
>  _CLC_OVERLOAD float16 __CLC_FUNCTION(float16, float16) __asm(__CLC_INTRINSIC ".v16f32");
>  
>  #ifdef cl_khr_fp64
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
>  _CLC_OVERLOAD double __CLC_FUNCTION(double, double) __asm(__CLC_INTRINSIC ".f64");
>  _CLC_OVERLOAD double2 __CLC_FUNCTION(double2, double2) __asm(__CLC_INTRINSIC ".v2f64");
>  _CLC_OVERLOAD double3 __CLC_FUNCTION(double3, double3) __asm(__CLC_INTRINSIC ".v3f64");
> diff --git a/generic/include/clc/math/ternary_intrin.inc b/generic/include/clc/math/ternary_intrin.inc
> index 9633696..58ce36b 100644
> --- a/generic/include/clc/math/ternary_intrin.inc
> +++ b/generic/include/clc/math/ternary_intrin.inc
> @@ -6,6 +6,7 @@ _CLC_OVERLOAD float8 __CLC_FUNCTION(float8, float8, float8) __asm(__CLC_INTRINSI
>  _CLC_OVERLOAD float16 __CLC_FUNCTION(float16, float16, float16) __asm(__CLC_INTRINSIC ".v16f32");
>  
>  #ifdef cl_khr_fp64
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
>  _CLC_OVERLOAD double __CLC_FUNCTION(double, double, double) __asm(__CLC_INTRINSIC ".f64");
>  _CLC_OVERLOAD double2 __CLC_FUNCTION(double2, double2, double2) __asm(__CLC_INTRINSIC ".v2f64");
>  _CLC_OVERLOAD double3 __CLC_FUNCTION(double3, double3, double3) __asm(__CLC_INTRINSIC ".v3f64");
> diff --git a/generic/include/clc/math/unary_intrin.inc b/generic/include/clc/math/unary_intrin.inc
> index 8c62d88..8e42109 100644
> --- a/generic/include/clc/math/unary_intrin.inc
> +++ b/generic/include/clc/math/unary_intrin.inc
> @@ -6,6 +6,7 @@ _CLC_OVERLOAD float8 __CLC_FUNCTION(float8 f) __asm(__CLC_INTRINSIC ".v8f32");
>  _CLC_OVERLOAD float16 __CLC_FUNCTION(float16 f) __asm(__CLC_INTRINSIC ".v16f32");
>  
>  #ifdef cl_khr_fp64
> +#pragma OPENCL EXTENSION cl_khr_fp64 : enable
>  _CLC_OVERLOAD double __CLC_FUNCTION(double d) __asm(__CLC_INTRINSIC ".f64");
>  _CLC_OVERLOAD double2 __CLC_FUNCTION(double2 d) __asm(__CLC_INTRINSIC ".v2f64");
>  _CLC_OVERLOAD double3 __CLC_FUNCTION(double3 d) __asm(__CLC_INTRINSIC ".v3f64");
> diff --git a/generic/lib/async/async_work_group_copy.cl b/generic/lib/async/async_work_group_copy.cl
> index fe20ecf..bf02713 100644
> --- a/generic/lib/async/async_work_group_copy.cl
> +++ b/generic/lib/async/async_work_group_copy.cl
> @@ -1,9 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <async_work_group_copy.inc>
>  #include <clc/async/gentype.inc>
> -#undef __CLC_BODY
> diff --git a/generic/lib/async/async_work_group_strided_copy.cl b/generic/lib/async/async_work_group_strided_copy.cl
> index 61b8898..57d2d08 100644
> --- a/generic/lib/async/async_work_group_strided_copy.cl
> +++ b/generic/lib/async/async_work_group_strided_copy.cl
> @@ -1,9 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <async_work_group_strided_copy.inc>
>  #include <clc/async/gentype.inc>
> -#undef __CLC_BODY
> diff --git a/generic/lib/async/prefetch.cl b/generic/lib/async/prefetch.cl
> index 45af21b..6d32890 100644
> --- a/generic/lib/async/prefetch.cl
> +++ b/generic/lib/async/prefetch.cl
> @@ -1,9 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <prefetch.inc>
>  #include <clc/async/gentype.inc>
> -#undef __CLC_BODY
> diff --git a/generic/lib/common/mix.cl b/generic/lib/common/mix.cl
> index 294f332..7f3d5b6 100644
> --- a/generic/lib/common/mix.cl
> +++ b/generic/lib/common/mix.cl
> @@ -1,8 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <mix.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/geometric/distance.cl b/generic/lib/geometric/distance.cl
> index 4a5b8e2..0469609 100644
> --- a/generic/lib/geometric/distance.cl
> +++ b/generic/lib/geometric/distance.cl
> @@ -22,9 +22,5 @@
>  
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <distance.inc>
>  #include <clc/geometric/floatn.inc>
> diff --git a/generic/lib/math/acos.cl b/generic/lib/math/acos.cl
> index 3ce9655..f6e2ab5 100644
> --- a/generic/lib/math/acos.cl
> +++ b/generic/lib/math/acos.cl
> @@ -1,8 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <acos.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/asin.cl b/generic/lib/math/asin.cl
> index d56dbd7..7581a50 100644
> --- a/generic/lib/math/asin.cl
> +++ b/generic/lib/math/asin.cl
> @@ -1,8 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <asin.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/clc_sqrt.cl b/generic/lib/math/clc_sqrt.cl
> index 86a874d..92c7f6e 100644
> --- a/generic/lib/math/clc_sqrt.cl
> +++ b/generic/lib/math/clc_sqrt.cl
> @@ -22,10 +22,6 @@
>  
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  // Map the llvm sqrt intrinsic to an OpenCL function.
>  #define __CLC_FUNCTION __clc_llvm_intr_sqrt
>  #define __CLC_INTRINSIC "llvm.sqrt"
> diff --git a/generic/lib/math/exp10.cl b/generic/lib/math/exp10.cl
> index c8039cb..1de25cb 100644
> --- a/generic/lib/math/exp10.cl
> +++ b/generic/lib/math/exp10.cl
> @@ -1,8 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <exp10.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/fdim.cl b/generic/lib/math/fdim.cl
> index cf25a4a..6899cb7 100644
> --- a/generic/lib/math/fdim.cl
> +++ b/generic/lib/math/fdim.cl
> @@ -2,9 +2,5 @@
>  
>  #include "math.h"
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <fdim.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/fract.cl b/generic/lib/math/fract.cl
> index b434071..8d0289e 100644
> --- a/generic/lib/math/fract.cl
> +++ b/generic/lib/math/fract.cl
> @@ -22,9 +22,5 @@
>  
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <fract.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/frexp.cl b/generic/lib/math/frexp.cl
> index acd5d93..da0b0fa 100644
> --- a/generic/lib/math/frexp.cl
> +++ b/generic/lib/math/frexp.cl
> @@ -2,9 +2,5 @@
>  
>  #include "math.h"
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <frexp.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/hypot.cl b/generic/lib/math/hypot.cl
> index eca042c..8be351e 100644
> --- a/generic/lib/math/hypot.cl
> +++ b/generic/lib/math/hypot.cl
> @@ -1,8 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <hypot.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/lgamma_r.cl b/generic/lib/math/lgamma_r.cl
> index a15ff17..3f07845 100644
> --- a/generic/lib/math/lgamma_r.cl
> +++ b/generic/lib/math/lgamma_r.cl
> @@ -3,9 +3,5 @@
>  #include "../clcmacro.h"
>  #include "math.h"
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <lgamma_r.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/log10.cl b/generic/lib/math/log10.cl
> index d65764a..8216f9b 100644
> --- a/generic/lib/math/log10.cl
> +++ b/generic/lib/math/log10.cl
> @@ -1,8 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <log10.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/mad.cl b/generic/lib/math/mad.cl
> index 6c7b90d..86bc70d 100644
> --- a/generic/lib/math/mad.cl
> +++ b/generic/lib/math/mad.cl
> @@ -1,8 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <mad.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/modf.cl b/generic/lib/math/modf.cl
> index 3294fbc..a462cab 100644
> --- a/generic/lib/math/modf.cl
> +++ b/generic/lib/math/modf.cl
> @@ -24,9 +24,5 @@
>  
>  #include "math.h"
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <modf.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/math/sincos.cl b/generic/lib/math/sincos.cl
> index eace5ad..9cae1e4 100644
> --- a/generic/lib/math/sincos.cl
> +++ b/generic/lib/math/sincos.cl
> @@ -1,8 +1,4 @@
>  #include <clc/clc.h>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <sincos.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/shared/clamp.cl b/generic/lib/shared/clamp.cl
> index c79a358..b946220 100644
> --- a/generic/lib/shared/clamp.cl
> +++ b/generic/lib/shared/clamp.cl
> @@ -3,9 +3,5 @@
>  #define __CLC_BODY <clamp.inc>
>  #include <clc/integer/gentype.inc>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <clamp.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/shared/max.cl b/generic/lib/shared/max.cl
> index 1c4457c..eb573cd 100644
> --- a/generic/lib/shared/max.cl
> +++ b/generic/lib/shared/max.cl
> @@ -3,9 +3,5 @@
>  #define __CLC_BODY <max.inc>
>  #include <clc/integer/gentype.inc>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <max.inc>
>  #include <clc/math/gentype.inc>
> diff --git a/generic/lib/shared/min.cl b/generic/lib/shared/min.cl
> index 433087a..19a7d79 100644
> --- a/generic/lib/shared/min.cl
> +++ b/generic/lib/shared/min.cl
> @@ -3,9 +3,5 @@
>  #define __CLC_BODY <min.inc>
>  #include <clc/integer/gentype.inc>
>  
> -#ifdef cl_khr_fp64
> -#pragma OPENCL EXTENSION cl_khr_fp64 : enable
> -#endif
> -
>  #define __CLC_BODY <min.inc>
>  #include <clc/math/gentype.inc>

ping
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20180305/801ea571/attachment.sig>


More information about the Libclc-dev mailing list