22// RUN: %{build} -o %t.out
33// RUN: %{run} %t.out
44
5- #include " common_lambda .hpp"
5+ #include " common .hpp"
66
77queue q;
88context ctx = q.get_context();
@@ -11,11 +11,8 @@ constexpr size_t SIZE = 128;
1111
1212template <typename T, typename ... Ts>
1313void test_struct (size_t SIZE, size_t WGSIZE) {
14- if (std::is_same_v<T, half> && !q. get_device (). has (aspect::fp16 ))
14+ if (!check_half_aspect<T>(q) || !check_double_aspect<T>(q ))
1515 return ;
16- if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
17- return ;
18-
1916 S<T> *buf = malloc_shared<S<T>>(WGSIZE, q);
2017 assert (buf && " Shared USM allocation failed!" );
2118 T expected = 0 ;
@@ -78,11 +75,8 @@ void test_union(size_t SIZE, size_t WGSIZE) {
7875
7976template <typename T, typename ... Ts>
8077void test (size_t SIZE, size_t WGSIZE, bool UseHelper) {
81- if (std::is_same_v<sycl::half, T> && !q.get_device ().has (sycl::aspect::fp16))
82- return ;
83- if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
78+ if (!check_half_aspect<T>(q) || !check_double_aspect<T>(q))
8479 return ;
85-
8680 T *buf = malloc_shared<T>(WGSIZE, q);
8781 assert (buf && " Shared USM allocation failed!" );
8882 T expected = 0 ;
@@ -117,11 +111,8 @@ void test(size_t SIZE, size_t WGSIZE, bool UseHelper) {
117111}
118112
119113template <typename T, typename ... Ts> void test_marray () {
120- if (std::is_same_v<sycl::half, T> && !q.get_device ().has (sycl::aspect::fp16))
121- return ;
122- if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
114+ if (!check_half_aspect<T>(q) || !check_double_aspect<T>(q))
123115 return ;
124-
125116 constexpr size_t WGSIZE = SIZE;
126117 T *buf = malloc_shared<T>(WGSIZE, q);
127118 assert (buf && " Shared USM allocation failed!" );
@@ -158,11 +149,8 @@ template <typename T, typename... Ts> void test_marray() {
158149}
159150
160151template <typename T, typename ... Ts> void test_vec () {
161- if (std::is_same_v<sycl::half, T> && !q.get_device ().has (sycl::aspect::fp16))
162- return ;
163- if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
152+ if (!check_half_aspect<T>(q) || !check_double_aspect<T>(q))
164153 return ;
165-
166154 constexpr size_t WGSIZE = 8 ;
167155 T *buf = malloc_shared<T>(WGSIZE, q);
168156 assert (buf && " Shared USM allocation failed!" );
@@ -198,8 +186,6 @@ template <typename T, typename... Ts> void test_vec() {
198186template <typename T, typename ... Ts> void test_atomic_ref () {
199187 assert (sizeof (T) == 4 ||
200188 (sizeof (T) == 8 && q.get_device ().has (aspect::atomic64)));
201- if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
202- return ;
203189 constexpr size_t WGSIZE = 8 ;
204190 T *buf = malloc_shared<T>(WGSIZE, q);
205191 assert (buf && " Shared USM allocation failed!" );
0 commit comments