From 625084195c7afe51e0bb623c72d2b8adc48c058d Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 19 Nov 2024 13:37:31 +0100 Subject: [PATCH 1/4] Align is_complex implementation with STL wrappers of DPC++ compiler --- dpctl/tensor/libtensor/include/utils/type_utils.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dpctl/tensor/libtensor/include/utils/type_utils.hpp b/dpctl/tensor/libtensor/include/utils/type_utils.hpp index 8207f7a68d..232cfc6e0f 100644 --- a/dpctl/tensor/libtensor/include/utils/type_utils.hpp +++ b/dpctl/tensor/libtensor/include/utils/type_utils.hpp @@ -35,13 +35,22 @@ namespace tensor namespace type_utils { -template struct is_complex : std::false_type +template +struct is_complex : public std::false_type { }; -template struct is_complex> : std::true_type + +template +struct is_complex, std::complex> || + std::is_same_v, std::complex> || + std::is_same_v, std::complex>>> + : public std::true_type { }; +template +constexpr bool is_complex_v = is_complex::value; + template dstTy convert_impl(const srcTy &v) { if constexpr (std::is_same::value) { From 0e67a5ceca1151153c057a82d2031c2fc7e17aad Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 19 Nov 2024 13:49:44 +0100 Subject: [PATCH 2/4] Add changelog entry --- CHANGELOG.md | 1 + dpctl/tensor/libtensor/include/utils/type_utils.hpp | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e36b85bf29..d060301404 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fix warning in documentation generation caused by `diff` docstring [gh-1855](https://github.com/IntelPython/dpctl/pull/1855) * Fix additional warnings when generating docs [gh-1861](https://github.com/IntelPython/dpctl/pull/1861) * Add missing include of SYCL header to "math_utils.hpp" [gh-1899](https://github.com/IntelPython/dpctl/pull/1899) +* Add support of cv-qualifiers and sycl::half type in `is_complex` helper [gh-1900](https://github.com/IntelPython/dpctl/pull/1900) ## [0.18.1] - Oct. 11, 2024 diff --git a/dpctl/tensor/libtensor/include/utils/type_utils.hpp b/dpctl/tensor/libtensor/include/utils/type_utils.hpp index 232cfc6e0f..bca71b6344 100644 --- a/dpctl/tensor/libtensor/include/utils/type_utils.hpp +++ b/dpctl/tensor/libtensor/include/utils/type_utils.hpp @@ -41,15 +41,17 @@ struct is_complex : public std::false_type }; template -struct is_complex, std::complex> || - std::is_same_v, std::complex> || - std::is_same_v, std::complex>>> +struct is_complex< + T, + std::enable_if_t< + std::is_same_v, std::complex> || + std::is_same_v, std::complex> || + std::is_same_v, std::complex>>> : public std::true_type { }; -template -constexpr bool is_complex_v = is_complex::value; +template constexpr bool is_complex_v = is_complex::value; template dstTy convert_impl(const srcTy &v) { From febc5dc9d0346e20e02725f112da8ad7272afb1c Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 19 Nov 2024 15:14:30 +0100 Subject: [PATCH 3/4] Remove support of sycl::complex type --- CHANGELOG.md | 2 +- dpctl/tensor/libtensor/include/utils/type_utils.hpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d060301404..9b50f2e640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fix warning in documentation generation caused by `diff` docstring [gh-1855](https://github.com/IntelPython/dpctl/pull/1855) * Fix additional warnings when generating docs [gh-1861](https://github.com/IntelPython/dpctl/pull/1861) * Add missing include of SYCL header to "math_utils.hpp" [gh-1899](https://github.com/IntelPython/dpctl/pull/1899) -* Add support of cv-qualifiers and sycl::half type in `is_complex` helper [gh-1900](https://github.com/IntelPython/dpctl/pull/1900) +* Add support of CV-qualifiers in `is_complex` helper [gh-1900](https://github.com/IntelPython/dpctl/pull/1900) ## [0.18.1] - Oct. 11, 2024 diff --git a/dpctl/tensor/libtensor/include/utils/type_utils.hpp b/dpctl/tensor/libtensor/include/utils/type_utils.hpp index bca71b6344..93073c47f5 100644 --- a/dpctl/tensor/libtensor/include/utils/type_utils.hpp +++ b/dpctl/tensor/libtensor/include/utils/type_utils.hpp @@ -43,10 +43,8 @@ struct is_complex : public std::false_type template struct is_complex< T, - std::enable_if_t< - std::is_same_v, std::complex> || - std::is_same_v, std::complex> || - std::is_same_v, std::complex>>> + std::enable_if_t, std::complex> || + std::is_same_v, std::complex>>> : public std::true_type { }; From 2e39e98f9a06080576ac281d4f0b499b10c3808f Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 19 Nov 2024 19:33:42 +0100 Subject: [PATCH 4/4] Add missing type_traits include --- dpctl/tensor/libtensor/include/utils/type_utils.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dpctl/tensor/libtensor/include/utils/type_utils.hpp b/dpctl/tensor/libtensor/include/utils/type_utils.hpp index 93073c47f5..2ab5392ebd 100644 --- a/dpctl/tensor/libtensor/include/utils/type_utils.hpp +++ b/dpctl/tensor/libtensor/include/utils/type_utils.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace dpctl