From a9669093b440c3d78e18a5e7a08b5d50966ce50c Mon Sep 17 00:00:00 2001 From: Lorenc Bushi <113361374+lbushi25@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:23:57 -0500 Subject: [PATCH 1/7] Add value_type alias to sycl::vec class --- sycl/include/sycl/types.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sycl/include/sycl/types.hpp b/sycl/include/sycl/types.hpp index 711b297d35ffd..a14b85da4ed2e 100644 --- a/sycl/include/sycl/types.hpp +++ b/sycl/include/sycl/types.hpp @@ -345,7 +345,7 @@ Requested alignment applied, limited at 64.") /// \ingroup sycl_api template class vec { using DataT = Type; - + // This represent type of underlying value. There should be only one field // in the class, so vec should be equal to float16 in memory. using DataType = typename detail::VecStorage::DataType; @@ -546,6 +546,7 @@ template class vec { public: using element_type = DataT; + using value_type = DataT; using rel_t = detail::rel_t; #ifdef __SYCL_DEVICE_ONLY__ From c6c43af5d703dd9eed8e5813ef46f5c2bb68686b Mon Sep 17 00:00:00 2001 From: Lorenc Bushi <113361374+lbushi25@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:25:23 -0500 Subject: [PATCH 2/7] Remove newline --- sycl/include/sycl/types.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/sycl/include/sycl/types.hpp b/sycl/include/sycl/types.hpp index a14b85da4ed2e..03b969f743b81 100644 --- a/sycl/include/sycl/types.hpp +++ b/sycl/include/sycl/types.hpp @@ -345,7 +345,6 @@ Requested alignment applied, limited at 64.") /// \ingroup sycl_api template class vec { using DataT = Type; - // This represent type of underlying value. There should be only one field // in the class, so vec should be equal to float16 in memory. using DataType = typename detail::VecStorage::DataType; From 4b0628b8252ba56e02d8bedf507eb244e12b1881 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi <113361374+lbushi25@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:27:53 -0500 Subject: [PATCH 3/7] Update types.hpp --- sycl/include/sycl/types.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sycl/include/sycl/types.hpp b/sycl/include/sycl/types.hpp index 03b969f743b81..2582d9f626845 100644 --- a/sycl/include/sycl/types.hpp +++ b/sycl/include/sycl/types.hpp @@ -345,6 +345,7 @@ Requested alignment applied, limited at 64.") /// \ingroup sycl_api template class vec { using DataT = Type; + // This represent type of underlying value. There should be only one field // in the class, so vec should be equal to float16 in memory. using DataType = typename detail::VecStorage::DataType; From 330c13385587a6905c74d67d789fd4ae359369a0 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 8 Mar 2024 11:10:15 -0800 Subject: [PATCH 4/7] Fix ambiguous call error --- sycl/include/sycl/detail/generic_type_traits.hpp | 4 +++- sycl/include/sycl/types.hpp | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sycl/include/sycl/detail/generic_type_traits.hpp b/sycl/include/sycl/detail/generic_type_traits.hpp index 33931102c40a8..3d06502dee2d9 100644 --- a/sycl/include/sycl/detail/generic_type_traits.hpp +++ b/sycl/include/sycl/detail/generic_type_traits.hpp @@ -518,7 +518,9 @@ template struct RelConverter { template class TryToGetElementType { static T check(...); template static typename A::element_type check(const A &); - template static typename A::value_type check(const A &); + template >> + static typename A::value_type check(const A &); public: using type = decltype(check(T())); diff --git a/sycl/include/sycl/types.hpp b/sycl/include/sycl/types.hpp index 2582d9f626845..7d904a8246b03 100644 --- a/sycl/include/sycl/types.hpp +++ b/sycl/include/sycl/types.hpp @@ -548,7 +548,6 @@ template class vec { using element_type = DataT; using value_type = DataT; using rel_t = detail::rel_t; - #ifdef __SYCL_DEVICE_ONLY__ #if defined(__INTEL_PREVIEW_BREAKING_CHANGES) using vector_t = From 222ad6c5db548a0d1b6b5cd8cd4960baed1db825 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi Date: Fri, 8 Mar 2024 12:07:24 -0800 Subject: [PATCH 5/7] Add regression test --- sycl/test/regression/vec_value_type.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sycl/test/regression/vec_value_type.cpp diff --git a/sycl/test/regression/vec_value_type.cpp b/sycl/test/regression/vec_value_type.cpp new file mode 100644 index 0000000000000..f66df70c07c1d --- /dev/null +++ b/sycl/test/regression/vec_value_type.cpp @@ -0,0 +1,11 @@ +// RUN: %clangxx -fsycl %s +#include + +using namespace std; +int main() { + static_assert(is_same_v::value_type, int>); + static_assert(is_same_v::value_type, float>); + static_assert(is_same_v::value_type, double>); + static_assert(is_same_v::value_type, sycl::half>); + return 0; +} From e8ca9bbb1c340e6bbe43c8783051398badfafd0e Mon Sep 17 00:00:00 2001 From: Lorenc Bushi <113361374+lbushi25@users.noreply.github.com> Date: Fri, 8 Mar 2024 15:37:45 -0500 Subject: [PATCH 6/7] Update sycl/test/regression/vec_value_type.cpp Co-authored-by: Alexey Bader --- sycl/test/regression/vec_value_type.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test/regression/vec_value_type.cpp b/sycl/test/regression/vec_value_type.cpp index f66df70c07c1d..2183099655ea7 100644 --- a/sycl/test/regression/vec_value_type.cpp +++ b/sycl/test/regression/vec_value_type.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsycl %s +// RUN: %clangxx -fsycl -fsyntax-only %s #include using namespace std; From 94eac25390d75f42567ddbd548bece69b90fd918 Mon Sep 17 00:00:00 2001 From: Lorenc Bushi <113361374+lbushi25@users.noreply.github.com> Date: Fri, 8 Mar 2024 15:54:57 -0500 Subject: [PATCH 7/7] Include type_traits --- sycl/test/regression/vec_value_type.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sycl/test/regression/vec_value_type.cpp b/sycl/test/regression/vec_value_type.cpp index 2183099655ea7..6a0636d15eabe 100644 --- a/sycl/test/regression/vec_value_type.cpp +++ b/sycl/test/regression/vec_value_type.cpp @@ -1,6 +1,6 @@ // RUN: %clangxx -fsycl -fsyntax-only %s #include - +#include using namespace std; int main() { static_assert(is_same_v::value_type, int>);