diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/abs.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/abs.hpp index 3f8b792105..411040bada 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/abs.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/abs.hpp @@ -118,6 +118,8 @@ template struct AbsOutputType td_ns::TypeMapResultEntry, float>, td_ns::TypeMapResultEntry, double>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -139,9 +141,7 @@ template struct AbsContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AbsOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -190,9 +190,7 @@ template struct AbsStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AbsOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/acos.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/acos.hpp index c4cadd00fc..a90f4e699f 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/acos.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/acos.hpp @@ -152,6 +152,8 @@ template struct AcosOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -173,9 +175,7 @@ template struct AcosContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AcosOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -221,9 +221,7 @@ template struct AcosStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AcosOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/acosh.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/acosh.hpp index 1efd099c8a..8af3708427 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/acosh.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/acosh.hpp @@ -179,6 +179,8 @@ template struct AcoshOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -200,9 +202,7 @@ template struct AcoshContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AcoshOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -248,9 +248,7 @@ template struct AcoshStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AcoshOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/add.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/add.hpp index f37bf14954..c06e98f3e5 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/add.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/add.hpp @@ -192,6 +192,8 @@ template struct AddOutputType std::complex, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct AddContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AddOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -272,9 +272,7 @@ template struct AddStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AddOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -323,12 +321,12 @@ struct AddContigMatrixContigRowBroadcastFactory { fnT get() { - using resT = typename AddOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!AddOutputType::is_defined) { fnT fn = nullptr; return fn; } else { + using resT = typename AddOutputType::value_type; if constexpr (dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value) @@ -370,12 +368,12 @@ struct AddContigRowContigMatrixBroadcastFactory { fnT get() { - using resT = typename AddOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!AddOutputType::is_defined) { fnT fn = nullptr; return fn; } else { + using resT = typename AddOutputType::value_type; if constexpr (dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value) diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/angle.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/angle.hpp index 4f426529a9..034b71438f 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/angle.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/angle.hpp @@ -95,6 +95,8 @@ template struct AngleOutputType td_ns::TypeMapResultEntry, float>, td_ns::TypeMapResultEntry, double>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -116,9 +118,7 @@ template struct AngleContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AngleOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -164,9 +164,7 @@ template struct AngleStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AngleOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/asin.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/asin.hpp index 63efbc4ea5..35c381aa84 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/asin.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/asin.hpp @@ -172,6 +172,8 @@ template struct AsinOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -193,9 +195,7 @@ template struct AsinContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AsinOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -241,9 +241,7 @@ template struct AsinStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AsinOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/asinh.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/asinh.hpp index 0c73a1e408..7373dc39d5 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/asinh.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/asinh.hpp @@ -155,6 +155,8 @@ template struct AsinhOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -176,9 +178,7 @@ template struct AsinhContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AsinhOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -224,9 +224,7 @@ template struct AsinhStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AsinhOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atan.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atan.hpp index 760528882c..fbba3fc436 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atan.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atan.hpp @@ -162,6 +162,8 @@ template struct AtanOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -183,9 +185,7 @@ template struct AtanContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AtanOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -231,9 +231,7 @@ template struct AtanStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AtanOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atan2.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atan2.hpp index 2db186346e..1a694527dd 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atan2.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atan2.hpp @@ -99,6 +99,8 @@ template struct Atan2OutputType td_ns::BinaryTypeMapResultEntry, td_ns::BinaryTypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct Atan2ContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename Atan2OutputType::value_type, void>) - { + if constexpr (!Atan2OutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -148,7 +148,6 @@ template struct Atan2TypeMapFactory std::enable_if_t::value, int> get() { using rT = typename Atan2OutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -182,9 +181,7 @@ template struct Atan2StridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename Atan2OutputType::value_type, void>) - { + if constexpr (!Atan2OutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atanh.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atanh.hpp index 91f32eef3d..340e72b11c 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atanh.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/atanh.hpp @@ -156,6 +156,8 @@ template struct AtanhOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -177,9 +179,7 @@ template struct AtanhContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AtanhOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -225,9 +225,7 @@ template struct AtanhStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!AtanhOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp index 504d1a9c24..da32b17183 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_and.hpp @@ -156,6 +156,8 @@ template struct BitwiseAndOutputType std::int64_t, std::int64_t>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct BitwiseAndContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename BitwiseAndOutputType::value_type, - void>) - { + if constexpr (!BitwiseAndOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -243,10 +242,7 @@ struct BitwiseAndStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename BitwiseAndOutputType::value_type, - void>) - { + if constexpr (!BitwiseAndOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp index e63c61b945..d6c1bc72db 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_invert.hpp @@ -111,6 +111,8 @@ template struct BitwiseInvertOutputType td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -134,10 +136,7 @@ template struct BitwiseInvertContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename BitwiseInvertOutputType::value_type, - void>) - { + if constexpr (!BitwiseInvertOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -185,10 +184,7 @@ template struct BitwiseInvertStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename BitwiseInvertOutputType::value_type, - void>) - { + if constexpr (!BitwiseInvertOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp index afe49a9a11..a987c8d604 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_left_shift.hpp @@ -165,6 +165,8 @@ template struct BitwiseLeftShiftOutputType std::uint64_t, std::uint64_t>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template ::value_type, - void>) - { + if constexpr (!BitwiseLeftShiftOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -254,10 +253,7 @@ struct BitwiseLeftShiftStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!BitwiseLeftShiftOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp index 7af41b0c78..71f3e809d9 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_or.hpp @@ -155,6 +155,8 @@ template struct BitwiseOrOutputType std::int64_t, std::int64_t>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct BitwiseOrContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename BitwiseOrOutputType::value_type, - void>) - { + if constexpr (!BitwiseOrOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -239,10 +238,7 @@ template struct BitwiseOrStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename BitwiseOrOutputType::value_type, - void>) - { + if constexpr (!BitwiseOrOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp index 77da98654e..e4dfee2ed6 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_right_shift.hpp @@ -167,6 +167,8 @@ template struct BitwiseRightShiftOutputType std::uint64_t, std::uint64_t>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template ::value_type, - void>) - { + if constexpr (!BitwiseRightShiftOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -256,10 +255,7 @@ struct BitwiseRightShiftStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!BitwiseRightShiftOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp index 4f364393b3..d035b31170 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/bitwise_xor.hpp @@ -156,6 +156,8 @@ template struct BitwiseXorOutputType std::int64_t, std::int64_t>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct BitwiseXorContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename BitwiseXorOutputType::value_type, - void>) - { + if constexpr (!BitwiseXorOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -243,10 +242,7 @@ struct BitwiseXorStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename BitwiseXorOutputType::value_type, - void>) - { + if constexpr (!BitwiseXorOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cbrt.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cbrt.hpp index 613bccd71d..4f2634f17a 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cbrt.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cbrt.hpp @@ -87,6 +87,8 @@ template struct CbrtOutputType td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -108,9 +110,7 @@ template struct CbrtContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!CbrtOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -156,9 +156,7 @@ template struct CbrtStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!CbrtOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/ceil.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/ceil.hpp index bbdc7bf6e5..59bc630720 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/ceil.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/ceil.hpp @@ -108,6 +108,8 @@ template struct CeilOutputType td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -129,9 +131,7 @@ template struct CeilContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!CeilOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -177,9 +177,7 @@ template struct CeilStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!CeilOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp index ec51367d62..4953feedb2 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/conj.hpp @@ -115,6 +115,8 @@ template struct ConjOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -136,9 +138,7 @@ template struct ConjContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!ConjOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -184,9 +184,7 @@ template struct ConjStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!ConjOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/copysign.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/copysign.hpp index 121b125ef7..92997b572b 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/copysign.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/copysign.hpp @@ -113,6 +113,8 @@ template struct CopysignOutputType td_ns::BinaryTypeMapResultEntry, td_ns::BinaryTypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct CopysignContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename CopysignOutputType::value_type, - void>) - { + if constexpr (!CopysignOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -196,10 +195,7 @@ template struct CopysignStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename CopysignOutputType::value_type, - void>) - { + if constexpr (!CopysignOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cos.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cos.hpp index d7b1306809..8b6b0c5fbe 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cos.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cos.hpp @@ -188,6 +188,8 @@ template struct CosOutputType td_ns:: TypeMapResultEntry, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -209,9 +211,7 @@ template struct CosContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!CosOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -256,9 +256,7 @@ template struct CosStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!CosOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cosh.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cosh.hpp index ff8d2e09e6..cff1038ed9 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cosh.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/cosh.hpp @@ -177,6 +177,8 @@ template struct CoshOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -198,9 +200,7 @@ template struct CoshContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!CoshOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -246,9 +246,7 @@ template struct CoshStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!CoshOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/equal.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/equal.hpp index 5d9c539b21..d368658afc 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/equal.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/equal.hpp @@ -185,6 +185,8 @@ template struct EqualOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct EqualContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename EqualOutputType::value_type, void>) - { + if constexpr (!EqualOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -267,9 +267,7 @@ template struct EqualStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename EqualOutputType::value_type, void>) - { + if constexpr (!EqualOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp.hpp index 915e067924..7e613c9731 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp.hpp @@ -146,6 +146,8 @@ template struct ExpOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -167,9 +169,7 @@ template struct ExpContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!ExpOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -214,9 +214,7 @@ template struct ExpStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!ExpOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp2.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp2.hpp index f9c50d641c..b436bb3855 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp2.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/exp2.hpp @@ -148,6 +148,8 @@ template struct Exp2OutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -169,9 +171,7 @@ template struct Exp2ContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Exp2OutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -217,9 +217,7 @@ template struct Exp2StridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Exp2OutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/expm1.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/expm1.hpp index d3b15575a6..9a9d0a1562 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/expm1.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/expm1.hpp @@ -161,6 +161,8 @@ template struct Expm1OutputType td_ns:: TypeMapResultEntry, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -182,9 +184,7 @@ template struct Expm1ContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Expm1OutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -201,7 +201,6 @@ template struct Expm1TypeMapFactory std::enable_if_t::value, int> get() { using rT = typename Expm1OutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -231,9 +230,7 @@ template struct Expm1StridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Expm1OutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/floor.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/floor.hpp index ed879cb607..530dd3d9aa 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/floor.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/floor.hpp @@ -108,6 +108,8 @@ template struct FloorOutputType td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -129,9 +131,7 @@ template struct FloorContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!FloorOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -177,9 +177,7 @@ template struct FloorStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!FloorOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/floor_divide.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/floor_divide.hpp index 4f6b83ac04..72ee3a789a 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/floor_divide.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/floor_divide.hpp @@ -197,6 +197,8 @@ template struct FloorDivideOutputType td_ns::BinaryTypeMapResultEntry, td_ns::BinaryTypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template ::value_type, - void>) - { + if constexpr (!FloorDivideOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -284,10 +283,7 @@ struct FloorDivideStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename FloorDivideOutputType::value_type, - void>) - { + if constexpr (!FloorDivideOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/greater.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/greater.hpp index a7d3a52c23..05c2a36b0c 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/greater.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/greater.hpp @@ -186,6 +186,8 @@ template struct GreaterOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct GreaterContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename GreaterOutputType::value_type, void>) - { + if constexpr (!GreaterOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -268,9 +268,7 @@ template struct GreaterStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename GreaterOutputType::value_type, void>) - { + if constexpr (!GreaterOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/greater_equal.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/greater_equal.hpp index 1f34c061bd..43e4e98db1 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/greater_equal.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/greater_equal.hpp @@ -187,6 +187,8 @@ template struct GreaterEqualOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template ::value_type, - void>) - { + if constexpr (!GreaterEqualOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -275,10 +274,7 @@ struct GreaterEqualStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename GreaterEqualOutputType::value_type, - void>) - { + if constexpr (!GreaterEqualOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/hypot.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/hypot.hpp index 28e927eb45..c5b68644a9 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/hypot.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/hypot.hpp @@ -115,6 +115,8 @@ template struct HypotOutputType td_ns::BinaryTypeMapResultEntry, td_ns::BinaryTypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct HypotContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename HypotOutputType::value_type, void>) - { + if constexpr (!HypotOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -164,7 +164,6 @@ template struct HypotTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename HypotOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -198,9 +197,7 @@ template struct HypotStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename HypotOutputType::value_type, void>) - { + if constexpr (!HypotOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/imag.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/imag.hpp index 68769362a6..e918bc0ac7 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/imag.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/imag.hpp @@ -111,6 +111,8 @@ template struct ImagOutputType td_ns::TypeMapResultEntry, float>, td_ns::TypeMapResultEntry, double>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -132,9 +134,7 @@ template struct ImagContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!ImagOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -180,9 +180,7 @@ template struct ImagStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!ImagOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/less.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/less.hpp index 2a1fd173ae..0b26342563 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/less.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/less.hpp @@ -184,6 +184,8 @@ template struct LessOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct LessContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename LessOutputType::value_type, void>) - { + if constexpr (!LessOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -266,9 +266,7 @@ template struct LessStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename LessOutputType::value_type, void>) - { + if constexpr (!LessOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/less_equal.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/less_equal.hpp index ae318b5b82..01289ae98f 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/less_equal.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/less_equal.hpp @@ -185,6 +185,8 @@ template struct LessEqualOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct LessEqualContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename LessEqualOutputType::value_type, - void>) - { + if constexpr (!LessEqualOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -268,10 +267,7 @@ template struct LessEqualStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename LessEqualOutputType::value_type, - void>) - { + if constexpr (!LessEqualOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log.hpp index c61b25c599..a3e28ef5d7 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log.hpp @@ -103,6 +103,8 @@ template struct LogOutputType td_ns:: TypeMapResultEntry, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -124,9 +126,7 @@ template struct LogContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!LogOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -143,7 +143,6 @@ template struct LogTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename LogOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -172,9 +171,7 @@ template struct LogStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!LogOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log10.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log10.hpp index c4eca37a7e..793b910f69 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log10.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log10.hpp @@ -122,6 +122,8 @@ template struct Log10OutputType td_ns:: TypeMapResultEntry, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -143,9 +145,7 @@ template struct Log10ContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Log10OutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -162,7 +162,6 @@ template struct Log10TypeMapFactory std::enable_if_t::value, int> get() { using rT = typename Log10OutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -192,9 +191,7 @@ template struct Log10StridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Log10OutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log1p.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log1p.hpp index 7e43851101..19238e7e37 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log1p.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log1p.hpp @@ -127,6 +127,8 @@ template struct Log1pOutputType td_ns:: TypeMapResultEntry, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -148,9 +150,7 @@ template struct Log1pContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Log1pOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -167,7 +167,6 @@ template struct Log1pTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename Log1pOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -197,9 +196,7 @@ template struct Log1pStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Log1pOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log2.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log2.hpp index c9943be00f..69d0022c72 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log2.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/log2.hpp @@ -123,6 +123,8 @@ template struct Log2OutputType td_ns:: TypeMapResultEntry, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -144,9 +146,7 @@ template struct Log2ContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Log2OutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -163,7 +163,6 @@ template struct Log2TypeMapFactory std::enable_if_t::value, int> get() { using rT = typename Log2OutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -193,9 +192,7 @@ template struct Log2StridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!Log2OutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp index 7b1e0c4d39..b0be45ea54 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logaddexp.hpp @@ -130,6 +130,8 @@ template struct LogAddExpOutputType td_ns::BinaryTypeMapResultEntry, td_ns::BinaryTypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct LogAddExpContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename LogAddExpOutputType::value_type, - void>) - { + if constexpr (!LogAddExpOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -180,7 +179,6 @@ template struct LogAddExpTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename LogAddExpOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -214,10 +212,7 @@ template struct LogAddExpStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename LogAddExpOutputType::value_type, - void>) - { + if constexpr (!LogAddExpOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_and.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_and.hpp index 1712113933..f15caa02e6 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_and.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_and.hpp @@ -155,6 +155,8 @@ template struct LogicalAndOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct LogicalAndContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename LogicalAndOutputType::value_type, - void>) - { + if constexpr (!LogicalAndOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -242,10 +241,7 @@ struct LogicalAndStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename LogicalAndOutputType::value_type, - void>) - { + if constexpr (!LogicalAndOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_or.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_or.hpp index e93a3f2682..43e02f2102 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_or.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_or.hpp @@ -154,6 +154,8 @@ template struct LogicalOrOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct LogicalOrContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename LogicalOrOutputType::value_type, - void>) - { + if constexpr (!LogicalOrOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -238,10 +237,7 @@ template struct LogicalOrStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename LogicalOrOutputType::value_type, - void>) - { + if constexpr (!LogicalOrOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_xor.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_xor.hpp index 38acb0f874..dc41760985 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_xor.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/logical_xor.hpp @@ -156,6 +156,8 @@ template struct LogicalXorOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct LogicalXorContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename LogicalXorOutputType::value_type, - void>) - { + if constexpr (!LogicalXorOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -243,10 +242,7 @@ struct LogicalXorStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename LogicalXorOutputType::value_type, - void>) - { + if constexpr (!LogicalXorOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/maximum.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/maximum.hpp index 69f76f8ca1..e73704bad8 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/maximum.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/maximum.hpp @@ -178,6 +178,8 @@ template struct MaximumOutputType std::complex, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct MaximumContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename MaximumOutputType::value_type, void>) - { + if constexpr (!MaximumOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -227,7 +227,6 @@ template struct MaximumTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename MaximumOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -261,9 +260,7 @@ template struct MaximumStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename MaximumOutputType::value_type, void>) - { + if constexpr (!MaximumOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/minimum.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/minimum.hpp index ee6da63083..590c0b6486 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/minimum.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/minimum.hpp @@ -178,6 +178,8 @@ template struct MinimumOutputType std::complex, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct MinimumContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename MinimumOutputType::value_type, void>) - { + if constexpr (!MinimumOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -227,7 +227,6 @@ template struct MinimumTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename MinimumOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -261,9 +260,7 @@ template struct MinimumStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename MinimumOutputType::value_type, void>) - { + if constexpr (!MinimumOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/multiply.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/multiply.hpp index 8eb20abdd9..1af284f55b 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/multiply.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/multiply.hpp @@ -180,6 +180,8 @@ template struct MultiplyOutputType std::complex, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct MultiplyContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename MultiplyOutputType::value_type, - void>) - { + if constexpr (!MultiplyOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -230,7 +229,6 @@ template struct MultiplyTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename MultiplyOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -264,10 +262,7 @@ template struct MultiplyStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename MultiplyOutputType::value_type, - void>) - { + if constexpr (!MultiplyOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -316,12 +311,12 @@ struct MultiplyContigMatrixContigRowBroadcastFactory { fnT get() { - using resT = typename MultiplyOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!MultiplyOutputType::is_defined) { fnT fn = nullptr; return fn; } else { + using resT = typename MultiplyOutputType::value_type; if constexpr (dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value) @@ -364,12 +359,12 @@ struct MultiplyContigRowContigMatrixBroadcastFactory { fnT get() { - using resT = typename MultiplyOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!MultiplyOutputType::is_defined) { fnT fn = nullptr; return fn; } else { + using resT = typename MultiplyOutputType::value_type; if constexpr (dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value) diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/negative.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/negative.hpp index b88f1b956d..83f17dd47b 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/negative.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/negative.hpp @@ -93,6 +93,8 @@ template struct NegativeOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -115,9 +117,7 @@ template struct NegativeContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!NegativeOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -134,7 +134,6 @@ template struct NegativeTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename NegativeOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -169,9 +168,7 @@ template struct NegativeStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!NegativeOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/nextafter.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/nextafter.hpp index cde36d96cd..5dc9ea40b3 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/nextafter.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/nextafter.hpp @@ -113,6 +113,8 @@ template struct NextafterOutputType td_ns::BinaryTypeMapResultEntry, td_ns::BinaryTypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct NextafterContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename NextafterOutputType::value_type, - void>) - { + if constexpr (!NextafterOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -163,7 +162,6 @@ template struct NextafterTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename NextafterOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -197,10 +195,7 @@ template struct NextafterStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename NextafterOutputType::value_type, - void>) - { + if constexpr (!NextafterOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/not_equal.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/not_equal.hpp index b1627b1fd0..c1b920193b 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/not_equal.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/not_equal.hpp @@ -169,6 +169,8 @@ template struct NotEqualOutputType std::complex, bool>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct NotEqualContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename NotEqualOutputType::value_type, - void>) - { + if constexpr (!NotEqualOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -252,10 +251,7 @@ template struct NotEqualStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename NotEqualOutputType::value_type, - void>) - { + if constexpr (!NotEqualOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/positive.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/positive.hpp index bcfe647608..ae2711ed0e 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/positive.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/positive.hpp @@ -108,6 +108,8 @@ template struct PositiveOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -130,9 +132,7 @@ template struct PositiveContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!PositiveOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -149,7 +149,6 @@ template struct PositiveTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename PositiveOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -184,9 +183,7 @@ template struct PositiveStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!PositiveOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/pow.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/pow.hpp index 4f3e501afe..bb462dceae 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/pow.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/pow.hpp @@ -232,6 +232,8 @@ template struct PowOutputType std::complex, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct PowContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!PowOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -281,7 +281,6 @@ template struct PowTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename PowOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -313,9 +312,7 @@ template struct PowStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!PowOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/proj.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/proj.hpp index 74560758be..2c3dce0c9c 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/proj.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/proj.hpp @@ -112,6 +112,8 @@ template struct ProjOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -133,9 +135,7 @@ template struct ProjContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!ProjOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -187,9 +187,7 @@ template struct ProjStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!ProjOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/real.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/real.hpp index 6dfbaa9d5f..c66e4003cb 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/real.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/real.hpp @@ -111,6 +111,8 @@ template struct RealOutputType td_ns::TypeMapResultEntry, float>, td_ns::TypeMapResultEntry, double>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -132,9 +134,7 @@ template struct RealContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!RealOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -180,9 +180,7 @@ template struct RealStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!RealOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/reciprocal.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/reciprocal.hpp index 194eba4b9b..4d4b70fd4f 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/reciprocal.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/reciprocal.hpp @@ -108,6 +108,8 @@ template struct ReciprocalOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -130,9 +132,7 @@ template struct ReciprocalContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename ReciprocalOutputType::value_type, void>) - { + if constexpr (!ReciprocalOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -180,9 +180,7 @@ template struct ReciprocalStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename ReciprocalOutputType::value_type, void>) - { + if constexpr (!ReciprocalOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp index c610cb28c3..7bb070cc00 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/remainder.hpp @@ -215,6 +215,8 @@ template struct RemainderOutputType td_ns::BinaryTypeMapResultEntry, td_ns::BinaryTypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct RemainderContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename RemainderOutputType::value_type, - void>) - { + if constexpr (!RemainderOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -298,10 +297,7 @@ template struct RemainderStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename RemainderOutputType::value_type, - void>) - { + if constexpr (!RemainderOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/round.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/round.hpp index 80a2dad02c..241f75c1bb 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/round.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/round.hpp @@ -119,6 +119,8 @@ template struct RoundOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -140,9 +142,7 @@ template struct RoundContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!RoundOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -188,9 +188,7 @@ template struct RoundStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!RoundOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/rsqrt.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/rsqrt.hpp index c2a44a3683..61aafb13d9 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/rsqrt.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/rsqrt.hpp @@ -90,6 +90,8 @@ template struct RsqrtOutputType td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -111,9 +113,7 @@ template struct RsqrtContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!RsqrtOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -159,9 +159,7 @@ template struct RsqrtStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!RsqrtOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp index d9a4ebb2cd..651f7d5d9a 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sign.hpp @@ -131,6 +131,8 @@ template struct SignOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -152,9 +154,7 @@ template struct SignContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SignOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -171,7 +171,6 @@ template struct SignTypeMapFactory std::enable_if_t::value, int> get() { using rT = typename SignOutputType::value_type; - ; return td_ns::GetTypeid{}.get(); } }; @@ -205,9 +204,7 @@ template struct SignStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SignOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/signbit.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/signbit.hpp index c2a76c3543..e8ac7709ad 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/signbit.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/signbit.hpp @@ -96,6 +96,8 @@ template struct SignbitOutputType td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -117,9 +119,7 @@ template struct SignbitContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SignbitOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -166,9 +166,7 @@ template struct SignbitStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SignbitOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sin.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sin.hpp index 6ee5617c41..8bc12097a8 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sin.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sin.hpp @@ -210,6 +210,8 @@ template struct SinOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -231,9 +233,7 @@ template struct SinContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SinOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -278,9 +278,7 @@ template struct SinStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SinOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sinh.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sinh.hpp index 99dde60212..e83626e56d 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sinh.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sinh.hpp @@ -179,6 +179,8 @@ template struct SinhOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -200,9 +202,7 @@ template struct SinhContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SinhOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -248,9 +248,7 @@ template struct SinhStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SinhOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sqrt.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sqrt.hpp index 4f320a443f..5adb41b20d 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sqrt.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/sqrt.hpp @@ -105,6 +105,8 @@ template struct SqrtOutputType td_ns:: TypeMapResultEntry, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -126,9 +128,7 @@ template struct SqrtContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SqrtOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -174,9 +174,7 @@ template struct SqrtStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SqrtOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/square.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/square.hpp index 47cf710703..4b096cc291 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/square.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/square.hpp @@ -130,6 +130,8 @@ template struct SquareOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -151,9 +153,7 @@ template struct SquareContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SquareOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -199,9 +199,7 @@ template struct SquareStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!SquareOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/subtract.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/subtract.hpp index 42d7900204..4ee3ae089b 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/subtract.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/subtract.hpp @@ -166,6 +166,8 @@ template struct SubtractOutputType std::complex, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct SubtractContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename SubtractOutputType::value_type, - void>) - { + if constexpr (!SubtractOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -249,10 +248,7 @@ template struct SubtractStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename SubtractOutputType::value_type, - void>) - { + if constexpr (!SubtractOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -312,10 +308,7 @@ struct SubtractContigMatrixContigRowBroadcastFactory { fnT get() { - if constexpr (std::is_same_v< - typename SubtractOutputType::value_type, - void>) - { + if constexpr (!SubtractOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -365,12 +358,12 @@ struct SubtractContigRowContigMatrixBroadcastFactory { fnT get() { - using resT = typename SubtractOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!SubtractOutputType::is_defined) { fnT fn = nullptr; return fn; } else { + using resT = typename SubtractOutputType::value_type; if constexpr (dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value) diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/tan.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/tan.hpp index 0109a21786..4364d81fb7 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/tan.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/tan.hpp @@ -154,6 +154,8 @@ template struct TanOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -175,9 +177,7 @@ template struct TanContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!TanOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -222,9 +222,7 @@ template struct TanStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!TanOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/tanh.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/tanh.hpp index 99377ce867..0af4e4e628 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/tanh.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/tanh.hpp @@ -148,6 +148,8 @@ template struct TanhOutputType td_ns::TypeMapResultEntry>, td_ns::TypeMapResultEntry>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -169,9 +171,7 @@ template struct TanhContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!TanhOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -217,9 +217,7 @@ template struct TanhStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!TanhOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/true_divide.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/true_divide.hpp index 010d50b3d4..53db1e163c 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/true_divide.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/true_divide.hpp @@ -173,6 +173,8 @@ template struct TrueDivideOutputType double, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct TrueDivideContigFactory { fnT get() { - if constexpr (std::is_same_v< - typename TrueDivideOutputType::value_type, - void>) - { + if constexpr (!TrueDivideOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -259,10 +258,7 @@ struct TrueDivideStridedFactory { fnT get() { - if constexpr (std::is_same_v< - typename TrueDivideOutputType::value_type, - void>) - { + if constexpr (!TrueDivideOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -322,10 +318,7 @@ struct TrueDivideContigMatrixContigRowBroadcastFactory { fnT get() { - if constexpr (std::is_same_v< - typename TrueDivideOutputType::value_type, - void>) - { + if constexpr (!TrueDivideOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -375,12 +368,12 @@ struct TrueDivideContigRowContigMatrixBroadcastFactory { fnT get() { - using resT = typename TrueDivideOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!TrueDivideOutputType::is_defined) { fnT fn = nullptr; return fn; } else { + using resT = typename TrueDivideOutputType::value_type; if constexpr (dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value || dpctl::tensor::type_utils::is_complex::value) diff --git a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/trunc.hpp b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/trunc.hpp index 2d6289f9fe..55c8493880 100644 --- a/dpctl/tensor/libtensor/include/kernels/elementwise_functions/trunc.hpp +++ b/dpctl/tensor/libtensor/include/kernels/elementwise_functions/trunc.hpp @@ -105,6 +105,8 @@ template struct TruncOutputType td_ns::TypeMapResultEntry, td_ns::TypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template @@ -126,9 +128,7 @@ template struct TruncContigFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!TruncOutputType::is_defined) { fnT fn = nullptr; return fn; } @@ -174,9 +174,7 @@ template struct TruncStridedFactory { fnT get() { - if constexpr (std::is_same_v::value_type, - void>) - { + if constexpr (!TruncOutputType::is_defined) { fnT fn = nullptr; return fn; } diff --git a/dpctl/tensor/libtensor/source/linalg_functions/dot_dispatch.hpp b/dpctl/tensor/libtensor/source/linalg_functions/dot_dispatch.hpp index 96ffc7a8a9..35d2ada54a 100644 --- a/dpctl/tensor/libtensor/source/linalg_functions/dot_dispatch.hpp +++ b/dpctl/tensor/libtensor/source/linalg_functions/dot_dispatch.hpp @@ -78,6 +78,8 @@ template struct DotAtomicOutputType td_ns::BinaryTypeMapResultEntry, td_ns::BinaryTypeMapResultEntry, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; // add separate type support lists for atomic vs. temps @@ -159,6 +161,8 @@ template struct DotNoAtomicOutputType std::complex, std::complex>, td_ns::DefaultResultEntry>::result_type; + + static constexpr bool is_defined = !std::is_same_v; }; template struct DotTypeMapFactory @@ -177,13 +181,13 @@ template struct GemmBatchAtomicFactory { fnT get() { - using T3 = typename DotAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::gemm_batch_impl; + using T3 = typename DotAtomicOutputType::value_type; fnT fn = gemm_batch_impl; return fn; } @@ -195,13 +199,13 @@ struct GemmBatchContigAtomicFactory { fnT get() { - using T3 = typename DotAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::gemm_batch_contig_impl; + using T3 = typename DotAtomicOutputType::value_type; fnT fn = gemm_batch_contig_impl; return fn; } @@ -212,13 +216,13 @@ template struct GemmAtomicFactory { fnT get() { - using T3 = typename DotAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::gemm_impl; + using T3 = typename DotAtomicOutputType::value_type; fnT fn = gemm_impl; return fn; } @@ -229,13 +233,13 @@ template struct GemmContigAtomicFactory { fnT get() { - using T3 = typename DotAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::gemm_contig_impl; + using T3 = typename DotAtomicOutputType::value_type; fnT fn = gemm_contig_impl; return fn; } @@ -246,13 +250,13 @@ template struct GemmTempsFactory { fnT get() { - using T3 = typename DotNoAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotNoAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::gemm_tree_impl; + using T3 = typename DotNoAtomicOutputType::value_type; fnT fn = gemm_tree_impl; return fn; } @@ -263,13 +267,13 @@ template struct GemmContigTempsFactory { fnT get() { - using T3 = typename DotNoAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotNoAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::gemm_contig_tree_impl; + using T3 = typename DotNoAtomicOutputType::value_type; fnT fn = gemm_contig_tree_impl; return fn; } @@ -280,13 +284,13 @@ template struct GemmBatchTempsFactory { fnT get() { - using T3 = typename DotNoAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotNoAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::gemm_batch_tree_impl; + using T3 = typename DotNoAtomicOutputType::value_type; fnT fn = gemm_batch_tree_impl; return fn; } @@ -298,13 +302,13 @@ struct GemmBatchContigTempsFactory { fnT get() { - using T3 = typename DotNoAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotNoAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::gemm_batch_contig_tree_impl; + using T3 = typename DotNoAtomicOutputType::value_type; fnT fn = gemm_batch_contig_tree_impl; return fn; } @@ -315,13 +319,13 @@ template struct DotProductAtomicFactory { fnT get() { - using T3 = typename DotAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::dot_product_impl; + using T3 = typename DotAtomicOutputType::value_type; fnT fn = dot_product_impl; return fn; } @@ -333,13 +337,13 @@ struct DotProductNoAtomicFactory { fnT get() { - using T3 = typename DotNoAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotNoAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::dot_product_tree_impl; + using T3 = typename DotNoAtomicOutputType::value_type; fnT fn = dot_product_tree_impl; return fn; } @@ -351,13 +355,13 @@ struct DotProductContigAtomicFactory { fnT get() { - using T3 = typename DotAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::dot_product_contig_impl; + using T3 = typename DotAtomicOutputType::value_type; fnT fn = dot_product_contig_impl; return fn; } @@ -369,13 +373,13 @@ struct DotProductContigNoAtomicFactory { fnT get() { - using T3 = typename DotNoAtomicOutputType::value_type; - if constexpr (std::is_same_v) { + if constexpr (!DotNoAtomicOutputType::is_defined) { fnT fn = nullptr; return fn; } else { using dpctl::tensor::kernels::dot_product_contig_tree_impl; + using T3 = typename DotNoAtomicOutputType::value_type; fnT fn = dot_product_contig_tree_impl; return fn; }