@@ -20,13 +20,9 @@ context ctx = q.get_context();
2020
2121constexpr size_t SIZE = 128 ;
2222
23- template <typename T> struct S {
24- T val;
25- };
23+ template <typename T> struct S { T val; };
2624
27- template <typename T> struct M {
28- T val;
29- };
25+ template <typename T> struct M { T val; };
3026
3127union U {
3228 S<int > s;
@@ -35,6 +31,11 @@ union U {
3531
3632template <typename T, typename ... Ts>
3733void test_struct (size_t SIZE, size_t WGSIZE) {
34+ if (std::is_same_v<T, half> && !q.get_device ().has (aspect::fp16))
35+ return ;
36+ if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
37+ return ;
38+
3839 S<T> *buf = malloc_shared<S<T>>(WGSIZE, q);
3940 assert (buf && " Shared USM allocation failed!" );
4041 T expected = 0 ;
@@ -44,7 +45,7 @@ void test_struct(size_t SIZE, size_t WGSIZE) {
4445 }
4546 nd_range ndr{{SIZE}, {WGSIZE}};
4647 q.submit ([&](sycl::handler &cgh) {
47- ext::oneapi::experimental::work_group_memory<S<T>[]> mem{ WGSIZE, cgh};
48+ ext::oneapi::experimental::work_group_memory<S<T>[]> mem { WGSIZE, cgh };
4849 ext::oneapi::experimental ::work_group_memory<T> result{cgh};
4950 cgh.parallel_for (ndr, [=](nd_item<> it) {
5051 size_t local_id = it.get_local_id ();
@@ -108,6 +109,9 @@ template <typename T, typename... Ts>
108109void test (size_t SIZE, size_t WGSIZE, bool UseHelper) {
109110 if (std::is_same_v<sycl::half, T> && !q.get_device ().has (sycl::aspect::fp16))
110111 return ;
112+ if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
113+ return ;
114+
111115 T *buf = malloc_shared<T>(WGSIZE, q);
112116 assert (buf && " Shared USM allocation failed!" );
113117 T expected = 0 ;
@@ -144,12 +148,15 @@ void test(size_t SIZE, size_t WGSIZE, bool UseHelper) {
144148template <typename T, typename ... Ts> void test_marray () {
145149 if (std::is_same_v<sycl::half, T> && !q.get_device ().has (sycl::aspect::fp16))
146150 return ;
151+ if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
152+ return ;
153+
147154 constexpr size_t WGSIZE = SIZE;
148155 T *buf = malloc_shared<T>(WGSIZE, q);
149156 assert (buf && " Shared USM allocation failed!" );
150157 T expected = 0 ;
151158 for (int i = 0 ; i < WGSIZE; ++i) {
152- buf[i] = T (i);
159+ buf[i] = T (i) / WGSIZE ;
153160 expected = expected + buf[i];
154161 }
155162 nd_range ndr{{SIZE}, {WGSIZE}};
@@ -182,12 +189,15 @@ template <typename T, typename... Ts> void test_marray() {
182189template <typename T, typename ... Ts> void test_vec () {
183190 if (std::is_same_v<sycl::half, T> && !q.get_device ().has (sycl::aspect::fp16))
184191 return ;
192+ if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
193+ return ;
194+
185195 constexpr size_t WGSIZE = 8 ;
186196 T *buf = malloc_shared<T>(WGSIZE, q);
187197 assert (buf && " Shared USM allocation failed!" );
188198 T expected = 0 ;
189199 for (int i = 0 ; i < WGSIZE; ++i) {
190- buf[i] = ext::intel::math::sqrt ( T (i)) ;
200+ buf[i] = T (i) / WGSIZE ;
191201 expected = expected + buf[i];
192202 }
193203 nd_range ndr{{SIZE}, {WGSIZE}};
@@ -217,6 +227,8 @@ template <typename T, typename... Ts> void test_vec() {
217227template <typename T, typename ... Ts> void test_atomic_ref () {
218228 assert (sizeof (T) == 4 ||
219229 (sizeof (T) == 8 && q.get_device ().has (aspect::atomic64)));
230+ if (std::is_same_v<T, double > && !q.get_device ().has (aspect::fp64))
231+ return ;
220232 constexpr size_t WGSIZE = 8 ;
221233 T *buf = malloc_shared<T>(WGSIZE, q);
222234 assert (buf && " Shared USM allocation failed!" );
0 commit comments