From f648190e5a9ddddf879fe0be18355fb7e0cc1d33 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Thu, 13 Mar 2025 13:31:43 +0100 Subject: [PATCH 01/15] test/support/utils_invoke.h - simplify new_kernel_name implementation in tests --- test/support/utils_invoke.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/utils_invoke.h b/test/support/utils_invoke.h index 90ea9cf8966..dbb750a96c9 100644 --- a/test/support/utils_invoke.h +++ b/test/support/utils_invoke.h @@ -35,7 +35,7 @@ template struct unique_kernel_name; template -using new_kernel_name = unique_kernel_name<::std::decay_t, idx>; +using new_kernel_name = unique_kernel_name::kernel_name, idx>; /** * make_policy functions test wrappers From dbeb7af18ab3d25e461fabdc6b13d8287aae9098 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Thu, 13 Mar 2025 13:31:53 +0100 Subject: [PATCH 02/15] test/support/test_dynamic_selection_utils.h - simplify new_kernel_name implementation in tests --- test/support/test_dynamic_selection_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/test_dynamic_selection_utils.h b/test/support/test_dynamic_selection_utils.h index 2ab64f13f2c..70879bd9065 100644 --- a/test/support/test_dynamic_selection_utils.h +++ b/test/support/test_dynamic_selection_utils.h @@ -23,7 +23,7 @@ template struct unique_kernel_name; template -using new_kernel_name = unique_kernel_name, idx>; +using new_kernel_name = unique_kernel_name::kernel_name, idx>; } // namespace TestUtils static inline void From b11791e40164026d0d2d7a06be56deff2c3dabe5 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Thu, 13 Mar 2025 13:32:01 +0100 Subject: [PATCH 03/15] test/support/test_dynamic_load_utils.h - simplify new_kernel_name implementation in tests --- test/support/test_dynamic_load_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/test_dynamic_load_utils.h b/test/support/test_dynamic_load_utils.h index e63701c3c7a..2b6a234ab3f 100644 --- a/test/support/test_dynamic_load_utils.h +++ b/test/support/test_dynamic_load_utils.h @@ -26,7 +26,7 @@ template struct unique_kernel_name; template -using new_kernel_name = unique_kernel_name, idx>; +using new_kernel_name = unique_kernel_name::kernel_name, idx>; } // namespace TestUtils int From b2f149382e46adbf64cd5dfad3a7a965f086f643 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Thu, 13 Mar 2025 17:10:05 +0100 Subject: [PATCH 04/15] Fix review comment: consolidate this to a single instance of this implementation --- test/support/test_dynamic_load_utils.h | 10 +--------- test/support/test_dynamic_selection_utils.h | 11 ++--------- test/support/utils_invoke.h | 17 ++++------------- test/support/utils_sycl_defs.h | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 31 deletions(-) diff --git a/test/support/test_dynamic_load_utils.h b/test/support/test_dynamic_load_utils.h index 2b6a234ab3f..b9dc220f325 100644 --- a/test/support/test_dynamic_load_utils.h +++ b/test/support/test_dynamic_load_utils.h @@ -19,15 +19,7 @@ #include #if TEST_DYNAMIC_SELECTION_AVAILABLE - -namespace TestUtils -{ -template -struct unique_kernel_name; - -template -using new_kernel_name = unique_kernel_name::kernel_name, idx>; -} // namespace TestUtils +#include "utils_sycl_defs.h" int test_dl_initialization(const std::vector& u) diff --git a/test/support/test_dynamic_selection_utils.h b/test/support/test_dynamic_selection_utils.h index 70879bd9065..5fdb1f72d3c 100644 --- a/test/support/test_dynamic_selection_utils.h +++ b/test/support/test_dynamic_selection_utils.h @@ -15,16 +15,9 @@ #include #include #include -#if TEST_DYNAMIC_SELECTION_AVAILABLE - -namespace TestUtils -{ -template -struct unique_kernel_name; -template -using new_kernel_name = unique_kernel_name::kernel_name, idx>; -} // namespace TestUtils +#if TEST_DYNAMIC_SELECTION_AVAILABLE +#include "utils_sycl_defs.h" static inline void build_universe(std::vector& u) diff --git a/test/support/utils_invoke.h b/test/support/utils_invoke.h index dbb750a96c9..f4fb51d1c5f 100644 --- a/test/support/utils_invoke.h +++ b/test/support/utils_invoke.h @@ -20,22 +20,13 @@ #include "iterator_utils.h" -namespace TestUtils -{ #if TEST_DPCPP_BACKEND_PRESENT +#include "utils_sycl_defs.h" +#endif -template -constexpr ::std::size_t -uniq_kernel_index() +namespace TestUtils { - return static_cast<::std::underlying_type_t>(alloc_type); -} - -template -struct unique_kernel_name; - -template -using new_kernel_name = unique_kernel_name::kernel_name, idx>; +#if TEST_DPCPP_BACKEND_PRESENT /** * make_policy functions test wrappers diff --git a/test/support/utils_sycl_defs.h b/test/support/utils_sycl_defs.h index 91d4008fd0e..44c28a38a2a 100644 --- a/test/support/utils_sycl_defs.h +++ b/test/support/utils_sycl_defs.h @@ -36,4 +36,22 @@ # define TEST_LIBSYCL_VERSION 0 #endif +namespace TestUtils +{ + +template +constexpr ::std::size_t +uniq_kernel_index() +{ + return static_cast<::std::underlying_type_t>(alloc_type); +} + +template +struct unique_kernel_name; + +template +using new_kernel_name = unique_kernel_name::kernel_name, idx>; + +} /* namespace TestUtils */ + #endif // _UTILS_SYCL_DEFS_H From 110983e8dbfa04a9135aaf29c686e244fd3e5bd7 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 10 Jun 2025 10:10:46 +0200 Subject: [PATCH 05/15] test/support/utils_invoke.h - remove 'using new_kernel_name' as defined now in utils_sycl_defs.h --- test/support/utils_invoke.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/support/utils_invoke.h b/test/support/utils_invoke.h index 0bb0a4b2476..abfae1f9ee6 100644 --- a/test/support/utils_invoke.h +++ b/test/support/utils_invoke.h @@ -18,6 +18,7 @@ #include +#include "utils_sycl_defs.h" #include "iterator_utils.h" #ifdef ONEDPL_USE_PREDEFINED_POLICIES @@ -43,9 +44,6 @@ uniq_kernel_index() template struct unique_kernel_name; -template -using new_kernel_name = unique_kernel_name<::std::decay_t, idx>; - /** * make_policy functions test wrappers * The main purpose of this function wrapper in TestUtils namespace - to cut template params from From 59dc650cf65866e9baa3119aebd57023765c1a4c Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 10 Jun 2025 10:11:05 +0200 Subject: [PATCH 06/15] test/support/utils_invoke.h - remove 'struct unique_kernel_name' as defined now in utils_sycl_defs.h --- test/support/utils_invoke.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/support/utils_invoke.h b/test/support/utils_invoke.h index abfae1f9ee6..14881744db3 100644 --- a/test/support/utils_invoke.h +++ b/test/support/utils_invoke.h @@ -41,9 +41,6 @@ uniq_kernel_index() return static_cast<::std::underlying_type_t>(alloc_type); } -template -struct unique_kernel_name; - /** * make_policy functions test wrappers * The main purpose of this function wrapper in TestUtils namespace - to cut template params from From d4846e736458a27fdb30bd6318e7e40ebacfdb98 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 10 Jun 2025 10:11:29 +0200 Subject: [PATCH 07/15] test/support/utils_invoke.h - remove 'uniq_kernel_index()' as defined now in utils_sycl_defs.h --- test/support/utils_invoke.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/support/utils_invoke.h b/test/support/utils_invoke.h index 14881744db3..5fdfbe9bad7 100644 --- a/test/support/utils_invoke.h +++ b/test/support/utils_invoke.h @@ -34,13 +34,6 @@ namespace TestUtils // Implemented in utils_sycl.h, required to include this file. sycl::queue get_test_queue(); -template -constexpr ::std::size_t -uniq_kernel_index() -{ - return static_cast<::std::underlying_type_t>(alloc_type); -} - /** * make_policy functions test wrappers * The main purpose of this function wrapper in TestUtils namespace - to cut template params from From 0633f022a94926983463df129e273f1d1143e40e Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 10 Jun 2025 10:12:14 +0200 Subject: [PATCH 08/15] test/support/utils_sycl_defs.h - remove extra :: before std namespace --- test/support/utils_sycl_defs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/support/utils_sycl_defs.h b/test/support/utils_sycl_defs.h index 44c28a38a2a..805bd58dae7 100644 --- a/test/support/utils_sycl_defs.h +++ b/test/support/utils_sycl_defs.h @@ -40,13 +40,13 @@ namespace TestUtils { template -constexpr ::std::size_t +constexpr std::size_t uniq_kernel_index() { - return static_cast<::std::underlying_type_t>(alloc_type); + return static_cast>(alloc_type); } -template +template struct unique_kernel_name; template From 7d1e6339d8287fa0726f73de94be767e09302ceb Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Fri, 13 Jun 2025 17:12:16 +0200 Subject: [PATCH 09/15] test/support/utils_sycl_defs.h - fix review comment --- test/support/utils_sycl_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/utils_sycl_defs.h b/test/support/utils_sycl_defs.h index 805bd58dae7..51c5fe3d6a2 100644 --- a/test/support/utils_sycl_defs.h +++ b/test/support/utils_sycl_defs.h @@ -49,7 +49,7 @@ uniq_kernel_index() template struct unique_kernel_name; -template +template using new_kernel_name = unique_kernel_name::kernel_name, idx>; } /* namespace TestUtils */ From 24496bfbda17bdbaf8679856d457f5481c76e092 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 7 Oct 2025 14:08:02 +0200 Subject: [PATCH 10/15] test/support/test_dynamic_load_utils.h - add missed include --- test/support/test_dynamic_load_utils.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/support/test_dynamic_load_utils.h b/test/support/test_dynamic_load_utils.h index 27853d3543e..05b7409ab13 100644 --- a/test/support/test_dynamic_load_utils.h +++ b/test/support/test_dynamic_load_utils.h @@ -18,6 +18,8 @@ #include #include +#include "support/utils_sycl_defs.h" // for TestUtils::unique_kernel_name and etc. + #if TEST_DYNAMIC_SELECTION_AVAILABLE class load1; From 3259c723c5c243287791c60125c14e7ed202f5db Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 18 Nov 2025 16:48:17 +0100 Subject: [PATCH 11/15] test/support/utils_sycl_defs.h - fix compile error: incomplete type 'TestUtils::TestPolicyName' named in nested name specifier Building CXX object test/CMakeFiles/header_inclusion_order_async_0.pass.dir/general/header_inclusion_order_async_0.pass.cpp.o In file included from /test/general/header_inclusion_order_async_0.pass.cpp:19: In file included from /test/support/utils.h:47: In file included from /test/support/utils_test_base.h:25: In file included from /test/support/utils_invoke.h:25: /test/support/utils_sycl_defs.h:53:1: error: incomplete type 'TestUtils::TestPolicyName' named in nested name specifier 53 | using new_kernel_name = unique_kernel_name::kernel_name, idx>; | ^~~~~ /test/support/utils_invoke.h:132:39: note: in instantiation of template type alias 'new_kernel_name' requested here 132 | using _NewKernelName = TestUtils::new_kernel_name; | ^ /test/general/header_inclusion_order_async_0.pass.cpp:26:30: note: in instantiation of function template specialization 'TestUtils::get_dpcpp_test_policy<0, TestUtils::TestPolicyName>' requested here 26 | auto policy = TestUtils::get_dpcpp_test_policy(); | ^ /test/support/utils_invoke.h:126:8: note: forward declaration of 'TestUtils::TestPolicyName' 126 | struct TestPolicyName; | ^ 1 error generated. --- test/support/utils_sycl_defs.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/support/utils_sycl_defs.h b/test/support/utils_sycl_defs.h index 51c5fe3d6a2..f38cb8d033e 100644 --- a/test/support/utils_sycl_defs.h +++ b/test/support/utils_sycl_defs.h @@ -49,8 +49,30 @@ uniq_kernel_index() template struct unique_kernel_name; +template > +struct has_kernel_name : std::false_type +{ +}; + +template +struct has_kernel_name> : std::true_type +{ +}; + +template +struct new_kernel_name_impl +{ + using type = unique_kernel_name, CallNumber>; +}; + +template +struct new_kernel_name_impl>::value>> +{ + using type = unique_kernel_name::kernel_name, CallNumber>; +}; + template -using new_kernel_name = unique_kernel_name::kernel_name, idx>; +using new_kernel_name = typename new_kernel_name_impl::type; } /* namespace TestUtils */ From b5f855d10dd19c97504fd86b88f2d46c63dabece Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 18 Nov 2025 16:55:25 +0100 Subject: [PATCH 12/15] test/support/utils_sycl_defs.h - fix compile error In file included from test/xpu_api/language.support/support.limits/limits/quiet_NaN.pass.cpp:20: In file included from test/support/test_complex.h:23: In file included from test/support/utils.h:47: In file included from test/support/utils_test_base.h:25: In file included from test/support/utils_invoke.h:25: test/support/utils_sycl_defs.h:24:14: fatal error: 'CL/sycl.hpp' file not found 24 | # include | ^~~~~~~~~~~~~ --- test/support/utils_sycl_defs.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/support/utils_sycl_defs.h b/test/support/utils_sycl_defs.h index f38cb8d033e..5618fcc1d6c 100644 --- a/test/support/utils_sycl_defs.h +++ b/test/support/utils_sycl_defs.h @@ -18,10 +18,12 @@ #ifndef _UTILS_SYCL_DEFS_H #define _UTILS_SYCL_DEFS_H -#if __has_include() -# include -#else -# include +#if _ONEDPL_BACKEND_SYCL +# if __has_include() +# include +# else +# include +# endif #endif #if ONEDPL_FPGA_DEVICE @@ -38,13 +40,14 @@ namespace TestUtils { - +#if _ONEDPL_BACKEND_SYCL template constexpr std::size_t uniq_kernel_index() { return static_cast>(alloc_type); } +#endif template struct unique_kernel_name; From b0cc672e164f419f7902fe1121272c8a5e2df705 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 18 Nov 2025 17:06:08 +0100 Subject: [PATCH 13/15] test/support/utils_sycl_defs.h - fix review comment: the uniq_kernel_index function should be marked inline to avoid potential ODR (One Definition Rule) violations when this header is included in multiple translation units --- test/support/utils_sycl_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/utils_sycl_defs.h b/test/support/utils_sycl_defs.h index 5618fcc1d6c..01b7be56077 100644 --- a/test/support/utils_sycl_defs.h +++ b/test/support/utils_sycl_defs.h @@ -42,7 +42,7 @@ namespace TestUtils { #if _ONEDPL_BACKEND_SYCL template -constexpr std::size_t +inline constexpr std::size_t uniq_kernel_index() { return static_cast>(alloc_type); From 516b267e7b317505a444d2931b840044145884f6 Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 18 Nov 2025 17:07:29 +0100 Subject: [PATCH 14/15] test/support/utils_sycl_defs.h - fix review comment: [nitpick] The template parameter name idx is inconsistent with CallNumber used in other templates in this file --- test/support/utils_sycl_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/support/utils_sycl_defs.h b/test/support/utils_sycl_defs.h index 01b7be56077..5da0101fe5b 100644 --- a/test/support/utils_sycl_defs.h +++ b/test/support/utils_sycl_defs.h @@ -74,8 +74,8 @@ struct new_kernel_name_impl::kernel_name, CallNumber>; }; -template -using new_kernel_name = typename new_kernel_name_impl::type; +template +using new_kernel_name = typename new_kernel_name_impl::type; } /* namespace TestUtils */ From c6361105a9bca2f026c8752a8c94e4a1a59960af Mon Sep 17 00:00:00 2001 From: Sergey Kopienko Date: Tue, 18 Nov 2025 17:24:46 +0100 Subject: [PATCH 15/15] Update test/support/utils_invoke.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- test/support/utils_invoke.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/support/utils_invoke.h b/test/support/utils_invoke.h index 92a32e0a625..24875ae5e02 100644 --- a/test/support/utils_invoke.h +++ b/test/support/utils_invoke.h @@ -22,9 +22,9 @@ #include // for std::once_flag #include // for std::logic_error -#include "utils_sycl_defs.h" #include "iterator_utils.h" #include "compile_only_checks.h" +#include "utils_sycl_defs.h" #ifdef ONEDPL_USE_PREDEFINED_POLICIES # define TEST_USE_PREDEFINED_POLICIES ONEDPL_USE_PREDEFINED_POLICIES