diff --git a/core/base/mixed_precision_types.hpp b/core/base/mixed_precision_types.hpp index 0f1f9869f91..ebf4291c053 100644 --- a/core/base/mixed_precision_types.hpp +++ b/core/base/mixed_precision_types.hpp @@ -15,97 +15,97 @@ #define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT1(_macro, ...) \ - GKO_ADAPT_HF(_macro(float, half, half, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(float, half, float, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(float, half, double, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(float, float, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(float, half, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(float, half, float, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(float, half, double, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(float, float, half, __VA_ARGS__)); \ template _macro(float, float, float, __VA_ARGS__); \ template _macro(float, float, double, __VA_ARGS__); \ - GKO_ADAPT_HF(_macro(float, double, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(float, double, half, __VA_ARGS__)); \ template _macro(float, double, float, __VA_ARGS__); \ template _macro(float, double, double, __VA_ARGS__) #define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT2(_macro, ...) \ - GKO_ADAPT_HF(_macro(double, half, half, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(double, half, float, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(double, half, double, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(double, float, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(double, half, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(double, half, float, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(double, half, double, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(double, float, half, __VA_ARGS__)); \ template _macro(double, float, float, __VA_ARGS__); \ template _macro(double, float, double, __VA_ARGS__); \ - GKO_ADAPT_HF(_macro(double, double, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(double, double, half, __VA_ARGS__)); \ template _macro(double, double, float, __VA_ARGS__); \ template _macro(double, double, double, __VA_ARGS__) -#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT3(_macro, ...) \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - template _macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__); \ - template _macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - template _macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__); \ - template _macro(std::complex, std::complex, \ +#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT3(_macro, ...) \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__); \ + template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__); \ + template _macro(std::complex, std::complex, \ std::complex, __VA_ARGS__) -#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT4(_macro, ...) \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - template _macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__); \ - template _macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - template _macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__); \ - template _macro(std::complex, std::complex, \ +#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT4(_macro, ...) \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__); \ + template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__); \ + template _macro(std::complex, std::complex, \ std::complex, __VA_ARGS__) #define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT5(_macro, ...) \ - GKO_ADAPT_HF(_macro(half, half, half, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, half, float, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, half, double, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, float, half, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, float, float, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, float, double, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, double, half, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, double, float, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, double, double, __VA_ARGS__)) - -#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT6(_macro, ...) \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)) + GKO_ADAPT_HF(template _macro(half, half, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, half, float, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, half, double, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, float, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, float, float, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, float, double, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, double, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, double, float, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, double, double, __VA_ARGS__)) + +#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT6(_macro, ...) \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)) #else @@ -125,11 +125,11 @@ std::complex, __VA_ARGS__) #define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT5(_macro, ...) \ - GKO_ADAPT_HF(_macro(half, half, half, __VA_ARGS__)) + GKO_ADAPT_HF(template _macro(half, half, half, __VA_ARGS__)) -#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT6(_macro, ...) \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, \ - std::complex, __VA_ARGS__)) +#define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_SPLIT6(_macro, ...) \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + std::complex, __VA_ARGS__)) #endif @@ -151,34 +151,36 @@ #ifdef GINKGO_MIXED_PRECISION #define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_2(_macro, ...) \ - GKO_ADAPT_HF(_macro(half, half, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, float, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(half, double, __VA_ARGS__)); \ - GKO_ADAPT_HF(_macro(float, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, float, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, double, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(float, half, __VA_ARGS__)); \ template _macro(float, float, __VA_ARGS__); \ template _macro(float, double, __VA_ARGS__); \ - GKO_ADAPT_HF(_macro(double, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(double, half, __VA_ARGS__)); \ template _macro(double, float, __VA_ARGS__); \ template _macro(double, double, __VA_ARGS__); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF( \ - _macro(std::complex, std::complex, __VA_ARGS__)); \ - GKO_ADAPT_HF( \ - _macro(std::complex, std::complex, __VA_ARGS__)); \ GKO_ADAPT_HF( \ - _macro(std::complex, std::complex, __VA_ARGS__)); \ + template _macro(std::complex, std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + __VA_ARGS__)); \ template _macro(std::complex, std::complex, __VA_ARGS__); \ template _macro(std::complex, std::complex, __VA_ARGS__); \ - GKO_ADAPT_HF( \ - _macro(std::complex, std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex, \ + __VA_ARGS__)); \ template _macro(std::complex, std::complex, __VA_ARGS__); \ template _macro(std::complex, std::complex, __VA_ARGS__) #else #define GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_2(_macro, ...) \ - GKO_ADAPT_HF(_macro(half, half, __VA_ARGS__)); \ + GKO_ADAPT_HF(template _macro(half, half, __VA_ARGS__)); \ template _macro(float, float, __VA_ARGS__); \ template _macro(double, double, __VA_ARGS__); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex, __VA_ARGS__)); \ + GKO_ADAPT_HF( \ + template _macro(std::complex, std::complex, __VA_ARGS__)); \ template _macro(std::complex, std::complex, __VA_ARGS__); \ template _macro(std::complex, std::complex, __VA_ARGS__) #endif diff --git a/include/ginkgo/core/base/types.hpp b/include/ginkgo/core/base/types.hpp index 8862784ca66..8db01e9555d 100644 --- a/include/ginkgo/core/base/types.hpp +++ b/include/ginkgo/core/base/types.hpp @@ -431,7 +431,7 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, // cuda half operation is supported from arch 5.3 #if GINKGO_ENABLE_HALF && (!defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 530) -#define GKO_ADAPT_HF(_macro) template _macro +#define GKO_ADAPT_HF(_macro) _macro #else #define GKO_ADAPT_HF(_macro) \ static_assert(true, \ @@ -450,13 +450,13 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, */ #if GINKGO_DPCPP_SINGLE_MODE #define GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_TYPE(_macro) \ - GKO_ADAPT_HF(_macro(half)); \ + GKO_ADAPT_HF(template _macro(half)); \ template _macro(float); \ template <> \ _macro(double) GKO_NOT_IMPLEMENTED #else #define GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_TYPE(_macro) \ - GKO_ADAPT_HF(_macro(half)); \ + GKO_ADAPT_HF(template _macro(half)); \ template _macro(float); \ template _macro(double) #endif @@ -477,14 +477,14 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, #if GINKGO_DPCPP_SINGLE_MODE #define GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(_macro) \ GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_TYPE(_macro); \ - GKO_ADAPT_HF(_macro(std::complex)); \ + GKO_ADAPT_HF(template _macro(std::complex)); \ template _macro(std::complex); \ template <> \ _macro(std::complex) GKO_NOT_IMPLEMENTED #else #define GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(_macro) \ GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_TYPE(_macro); \ - GKO_ADAPT_HF(_macro(std::complex)); \ + GKO_ADAPT_HF(template _macro(std::complex)); \ template _macro(std::complex); \ template _macro(std::complex) #endif @@ -507,28 +507,28 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, */ #if GINKGO_DPCPP_SINGLE_MODE #define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_SCALAR_TYPE(_macro) \ - GKO_ADAPT_HF(_macro(half, half)); \ + GKO_ADAPT_HF(template _macro(half, half)); \ template _macro(float, float); \ template <> \ _macro(double, double) GKO_NOT_IMPLEMENTED; \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ template _macro(std::complex, std::complex); \ template <> \ _macro(std::complex, std::complex) GKO_NOT_IMPLEMENTED; \ - GKO_ADAPT_HF(_macro(std::complex, half)); \ + GKO_ADAPT_HF(template _macro(std::complex, half)); \ template _macro(std::complex, float); \ template <> \ _macro(std::complex, double) GKO_NOT_IMPLEMENTED; #else -#define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_SCALAR_TYPE(_macro) \ - GKO_ADAPT_HF(_macro(half, half)); \ - template _macro(float, float); \ - template _macro(double, double); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - template _macro(std::complex, std::complex); \ - template _macro(std::complex, std::complex); \ - GKO_ADAPT_HF(_macro(std::complex, half)); \ - template _macro(std::complex, float); \ +#define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_SCALAR_TYPE(_macro) \ + GKO_ADAPT_HF(template _macro(half, half)); \ + template _macro(float, float); \ + template _macro(double, double); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + template _macro(std::complex, std::complex); \ + template _macro(std::complex, std::complex); \ + GKO_ADAPT_HF(template _macro(std::complex, half)); \ + template _macro(std::complex, float); \ template _macro(std::complex, double) #endif @@ -557,38 +557,40 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, */ #if GINKGO_DPCPP_SINGLE_MODE #define GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_AND_INDEX_TYPE(_macro) \ - GKO_ADAPT_HF(_macro(half, int32)); \ + GKO_ADAPT_HF(template _macro(half, int32)); \ template _macro(float, int32); \ template <> \ _macro(double, int32) GKO_NOT_IMPLEMENTED; \ - GKO_ADAPT_HF(_macro(half, int64)); \ + GKO_ADAPT_HF(template _macro(half, int64)); \ template _macro(float, int64); \ template <> \ _macro(double, int64) GKO_NOT_IMPLEMENTED #else #define GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_AND_INDEX_TYPE(_macro) \ - GKO_ADAPT_HF(_macro(half, int32)); \ + GKO_ADAPT_HF(template _macro(half, int32)); \ template _macro(float, int32); \ template _macro(double, int32); \ - GKO_ADAPT_HF(_macro(half, int64)); \ + GKO_ADAPT_HF(template _macro(half, int64)); \ template _macro(float, int64); \ template _macro(double, int64) #endif #if GINKGO_DPCPP_SINGLE_MODE #define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INT32_TYPE(_macro) \ + GKO_ADAPT_HF(template _macro(half, int32)); \ template _macro(float, int32); \ template <> \ _macro(double, int32) GKO_NOT_IMPLEMENTED; \ + GKO_ADAPT_HF(template _macro(std::complex, int32)); \ template _macro(std::complex, int32); \ template <> \ _macro(std::complex, int32) GKO_NOT_IMPLEMENTED #else #define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INT32_TYPE(_macro) \ - GKO_ADAPT_HF(_macro(half, int32)); \ + GKO_ADAPT_HF(template _macro(half, int32)); \ template _macro(float, int32); \ template _macro(double, int32); \ - GKO_ADAPT_HF(_macro(std::complex, int32)); \ + GKO_ADAPT_HF(template _macro(std::complex, int32)); \ template _macro(std::complex, int32); \ template _macro(std::complex, int32) #endif @@ -605,21 +607,21 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, #if GINKGO_DPCPP_SINGLE_MODE #define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(_macro) \ GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_AND_INDEX_TYPE(_macro); \ - GKO_ADAPT_HF(_macro(std::complex, int32)); \ + GKO_ADAPT_HF(template _macro(std::complex, int32)); \ template _macro(std::complex, int32); \ template <> \ _macro(std::complex, int32) GKO_NOT_IMPLEMENTED; \ - GKO_ADAPT_HF(_macro(std::complex, int64)); \ + GKO_ADAPT_HF(template _macro(std::complex, int64)); \ template _macro(std::complex, int64); \ template <> \ _macro(std::complex, int64) GKO_NOT_IMPLEMENTED #else #define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(_macro) \ GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_AND_INDEX_TYPE(_macro); \ - GKO_ADAPT_HF(_macro(std::complex, int32)); \ + GKO_ADAPT_HF(template _macro(std::complex, int32)); \ template _macro(std::complex, int32); \ template _macro(std::complex, int32); \ - GKO_ADAPT_HF(_macro(std::complex, int64)); \ + GKO_ADAPT_HF(template _macro(std::complex, int64)); \ template _macro(std::complex, int64); \ template _macro(std::complex, int64) #endif @@ -637,9 +639,9 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, #if GINKGO_DPCPP_SINGLE_MODE #define GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE( \ _macro) \ - GKO_ADAPT_HF(_macro(half, int32, int32)); \ - GKO_ADAPT_HF(_macro(half, int32, int64)); \ - GKO_ADAPT_HF(_macro(half, int64, int64)); \ + GKO_ADAPT_HF(template _macro(half, int32, int32)); \ + GKO_ADAPT_HF(template _macro(half, int32, int64)); \ + GKO_ADAPT_HF(template _macro(half, int64, int64)); \ template _macro(float, int32, int32); \ template _macro(float, int32, int64); \ template _macro(float, int64, int64); \ @@ -652,9 +654,9 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, #else #define GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE( \ _macro) \ - GKO_ADAPT_HF(_macro(half, int32, int32)); \ - GKO_ADAPT_HF(_macro(half, int32, int64)); \ - GKO_ADAPT_HF(_macro(half, int64, int64)); \ + GKO_ADAPT_HF(template _macro(half, int32, int32)); \ + GKO_ADAPT_HF(template _macro(half, int32, int64)); \ + GKO_ADAPT_HF(template _macro(half, int64, int64)); \ template _macro(float, int32, int32); \ template _macro(float, int32, int64); \ template _macro(float, int64, int64); \ @@ -676,9 +678,9 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, #define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE(_macro) \ GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE( \ _macro); \ - GKO_ADAPT_HF(_macro(std::complex, int32, int32)); \ - GKO_ADAPT_HF(_macro(std::complex, int32, int64)); \ - GKO_ADAPT_HF(_macro(std::complex, int64, int64)); \ + GKO_ADAPT_HF(template _macro(std::complex, int32, int32)); \ + GKO_ADAPT_HF(template _macro(std::complex, int32, int64)); \ + GKO_ADAPT_HF(template _macro(std::complex, int64, int64)); \ template _macro(std::complex, int32, int32); \ template _macro(std::complex, int32, int64); \ template _macro(std::complex, int64, int64); \ @@ -692,9 +694,9 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, #define GKO_INSTANTIATE_FOR_EACH_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE(_macro) \ GKO_INSTANTIATE_FOR_EACH_NON_COMPLEX_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE( \ _macro); \ - GKO_ADAPT_HF(_macro(std::complex, int32, int32)); \ - GKO_ADAPT_HF(_macro(std::complex, int32, int64)); \ - GKO_ADAPT_HF(_macro(std::complex, int64, int64)); \ + GKO_ADAPT_HF(template _macro(std::complex, int32, int32)); \ + GKO_ADAPT_HF(template _macro(std::complex, int32, int64)); \ + GKO_ADAPT_HF(template _macro(std::complex, int64, int64)); \ template _macro(std::complex, int32, int32); \ template _macro(std::complex, int32, int64); \ template _macro(std::complex, int64, int64); \ @@ -705,38 +707,36 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, #if GINKGO_DPCPP_SINGLE_MODE -#define GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION(_macro) \ - template <> \ - _macro(float, double) GKO_NOT_IMPLEMENTED; \ - template <> \ - _macro(double, float) GKO_NOT_IMPLEMENTED; \ - template <> \ - _macro(half, double) GKO_NOT_IMPLEMENTED; \ - template <> \ - _macro(double, half) GKO_NOT_IMPLEMENTED; \ - GKO_ADAPT_HF(_macro(float, half)); \ - GKO_ADAPT_HF(_macro(half, float)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - template <> \ - _macro(std::complex, std::complex) GKO_NOT_IMPLEMENTED; \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - template <> \ - _macro(std::complex, std::complex) GKO_NOT_IMPLEMENTED; \ - template <> \ - _macro(std::complex, std::complex) GKO_NOT_IMPLEMENTED; \ - template <> \ +#define GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION(_macro) \ + template <> \ + _macro(float, double) GKO_NOT_IMPLEMENTED; \ + template <> \ + _macro(double, float) GKO_NOT_IMPLEMENTED; \ + GKO_ADAPT_HF(template <> _macro(half, double) GKO_NOT_IMPLEMENTED); \ + GKO_ADAPT_HF(template <> _macro(double, half) GKO_NOT_IMPLEMENTED); \ + GKO_ADAPT_HF(template _macro(float, half)); \ + GKO_ADAPT_HF(template _macro(half, float)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + GKO_ADAPT_HF(template <> _macro(std::complex, std::complex) \ + GKO_NOT_IMPLEMENTED); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + GKO_ADAPT_HF(template <> _macro(std::complex, std::complex) \ + GKO_NOT_IMPLEMENTED); \ + template <> \ + _macro(std::complex, std::complex) GKO_NOT_IMPLEMENTED; \ + template <> \ _macro(std::complex, std::complex) GKO_NOT_IMPLEMENTED -#define GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION_OR_COPY(_macro) \ - GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION(_macro); \ - GKO_ADAPT_HF(_macro(half, half)); \ - template _macro(float, float); \ - template <> \ - _macro(double, double) GKO_NOT_IMPLEMENTED; \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - template _macro(std::complex, std::complex); \ - template <> \ +#define GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION_OR_COPY(_macro) \ + GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION(_macro); \ + GKO_ADAPT_HF(template _macro(half, half)); \ + template _macro(float, float); \ + template <> \ + _macro(double, double) GKO_NOT_IMPLEMENTED; \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + template _macro(std::complex, std::complex); \ + template <> \ _macro(std::complex, std::complex) GKO_NOT_IMPLEMENTED #else /** @@ -748,18 +748,18 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, * Should take two arguments `src` and `dst`, which * are replaced by the source and destination value type. */ -#define GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION(_macro) \ - template _macro(float, double); \ - template _macro(double, float); \ - GKO_ADAPT_HF(_macro(half, double)); \ - GKO_ADAPT_HF(_macro(double, half)); \ - GKO_ADAPT_HF(_macro(float, half)); \ - GKO_ADAPT_HF(_macro(half, float)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - template _macro(std::complex, std::complex); \ +#define GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION(_macro) \ + template _macro(float, double); \ + template _macro(double, float); \ + GKO_ADAPT_HF(template _macro(half, double)); \ + GKO_ADAPT_HF(template _macro(double, half)); \ + GKO_ADAPT_HF(template _macro(float, half)); \ + GKO_ADAPT_HF(template _macro(half, float)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + template _macro(std::complex, std::complex); \ template _macro(std::complex, std::complex) @@ -772,13 +772,13 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, * Should take two arguments `src` and `dst`, which * are replaced by the source and destination value type. */ -#define GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION_OR_COPY(_macro) \ - GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION(_macro); \ - GKO_ADAPT_HF(_macro(half, half)); \ - template _macro(float, float); \ - template _macro(double, double); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - template _macro(std::complex, std::complex); \ +#define GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION_OR_COPY(_macro) \ + GKO_INSTANTIATE_FOR_EACH_VALUE_CONVERSION(_macro); \ + GKO_ADAPT_HF(template _macro(half, half)); \ + template _macro(float, float); \ + template _macro(double, double); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + template _macro(std::complex, std::complex); \ template _macro(std::complex, std::complex) #endif @@ -791,15 +791,15 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, * Should take two arguments, which are replaced by the * value and index types. */ -#define GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_PAIR(_macro) \ - GKO_ADAPT_HF(_macro(half, half)); \ - template _macro(float, float); \ - template _macro(double, double); \ - GKO_ADAPT_HF(_macro(std::complex, half)); \ - template _macro(std::complex, float); \ - template _macro(std::complex, double); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - template _macro(std::complex, std::complex); \ +#define GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_PAIR(_macro) \ + GKO_ADAPT_HF(template _macro(half, half)); \ + template _macro(float, float); \ + template _macro(double, double); \ + GKO_ADAPT_HF(template _macro(std::complex, half)); \ + template _macro(std::complex, float); \ + template _macro(std::complex, double); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + template _macro(std::complex, std::complex); \ template _macro(std::complex, std::complex) @@ -812,18 +812,18 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, * Should take two arguments, which are replaced by the * value and index types. */ -#define GKO_INSTANTIATE_FOR_EACH_COMBINED_VALUE_AND_INDEX_TYPE(_macro) \ - template _macro(char, char); \ - template _macro(int32, int32); \ - template _macro(int64, int64); \ - template _macro(unsigned int, unsigned int); \ - template _macro(unsigned long, unsigned long); \ - GKO_ADAPT_HF(_macro(half, half)); \ - template _macro(float, float); \ - template _macro(double, double); \ - template _macro(long double, long double); \ - GKO_ADAPT_HF(_macro(std::complex, std::complex)); \ - template _macro(std::complex, std::complex); \ +#define GKO_INSTANTIATE_FOR_EACH_COMBINED_VALUE_AND_INDEX_TYPE(_macro) \ + template _macro(char, char); \ + template _macro(int32, int32); \ + template _macro(int64, int64); \ + template _macro(unsigned int, unsigned int); \ + template _macro(unsigned long, unsigned long); \ + GKO_ADAPT_HF(template _macro(half, half)); \ + template _macro(float, float); \ + template _macro(double, double); \ + template _macro(long double, long double); \ + GKO_ADAPT_HF(template _macro(std::complex, std::complex)); \ + template _macro(std::complex, std::complex); \ template _macro(std::complex, std::complex) /** @@ -834,16 +834,16 @@ GKO_ATTRIBUTES constexpr bool operator!=(precision_reduction x, * Should take two arguments, which are replaced by the * value and index types. */ -#define GKO_INSTANTIATE_FOR_EACH_POD_TYPE(_macro) \ - GKO_ADAPT_HF(_macro(half)); \ - template _macro(float); \ - template _macro(double); \ - GKO_ADAPT_HF(_macro(std::complex)); \ - template _macro(std::complex); \ - template _macro(std::complex); \ - template _macro(size_type); \ - template _macro(bool); \ - template _macro(int32); \ +#define GKO_INSTANTIATE_FOR_EACH_POD_TYPE(_macro) \ + GKO_ADAPT_HF(template _macro(half)); \ + template _macro(float); \ + template _macro(double); \ + GKO_ADAPT_HF(template _macro(std::complex)); \ + template _macro(std::complex); \ + template _macro(std::complex); \ + template _macro(size_type); \ + template _macro(bool); \ + template _macro(int32); \ template _macro(int64)