@@ -86,6 +86,9 @@ inline auto createExceptionHandler() {
86
86
template <class , class , bool > class TestID ;
87
87
88
88
template <class SpmdT , class SimdElemT , bool IsUniform> bool test (queue q) {
89
+ std::cout << " Testing SpmdT='" << typeid (SpmdT).name () << " ', SimdElemT='"
90
+ << typeid (SimdElemT).name () << " ', uniform=" << IsUniform << " ... " ;
91
+
89
92
// 3 subgroups per workgroup
90
93
unsigned GroupSize = VL * 3 ;
91
94
unsigned NGroups = 7 ;
@@ -121,6 +124,7 @@ template <class SpmdT, class SimdElemT, bool IsUniform> bool test(queue q) {
121
124
} catch (sycl::exception const &e) {
122
125
std::cout << " SYCL exception caught: " << e.what () << ' \n ' ;
123
126
sycl::free (A, q);
127
+ std::cout << " failed\n " ;
124
128
return false ;
125
129
}
126
130
int err_cnt = 0 ;
@@ -141,6 +145,7 @@ template <class SpmdT, class SimdElemT, bool IsUniform> bool test(queue q) {
141
145
<< (Size - err_cnt) << " /" << Size << " )\n " ;
142
146
}
143
147
sycl::free (A, q);
148
+ std::cout << (err_cnt ? " failed\n " : " passed\n " );
144
149
return err_cnt == 0 ;
145
150
}
146
151
@@ -155,26 +160,38 @@ int main(void) {
155
160
constexpr bool UNIFORM = true ;
156
161
constexpr bool NON_UNIFORM = false ;
157
162
163
+ const bool SupportsDouble = dev.has (aspect::fp64);
164
+
158
165
// With uniform parameters SPMD actual argument corresponds to SIMD scalar
159
166
// argument, and standard C++ arithmetic conversion are implicitly
160
167
// applied by the compiler. Any aritimetic type can be implicitly coverted to
161
168
// any other arithmetic type.
162
169
170
+ #ifndef TEST_DOUBLE_TYPE
163
171
passed &= test<int , float , UNIFORM>(q);
164
172
passed &= test<unsigned char , uint64_t , UNIFORM>(q);
165
- passed &= test<char , double , UNIFORM>(q);
166
- passed &= test<double , char , UNIFORM>(q);
173
+ #else
174
+ if (SupportsDouble) {
175
+ passed &= test<char , double , UNIFORM>(q);
176
+ passed &= test<double , char , UNIFORM>(q);
177
+ }
178
+ #endif // TEST_DOUBLE_TYPE
167
179
168
180
// With non-uniform parameters, SPMD actual argument of type T is "widened" to
169
181
// std::simd<T, VL> and then convered to SIMD vector argument
170
182
// (std::simd<T1, VL>) using std::simd implicit conversion constructors. They
171
183
// allow only non-narrowing conversions (e.g. int -> float is narrowing and
172
184
// hence is prohibited).
173
185
186
+ #ifndef TEST_DOUBLE_TYPE
174
187
passed &= test<char , long , NON_UNIFORM>(q);
175
188
passed &= test<short , short , NON_UNIFORM>(q);
176
- passed &= test<float , double , NON_UNIFORM>(q);
189
+ #else
190
+ if (SupportsDouble) {
191
+ passed &= test<float , double , NON_UNIFORM>(q);
192
+ }
193
+ #endif // TEST_DOUBLE_TYPE
177
194
178
- std::cout << (passed ? " Passed \n " : " FAILED\n " );
195
+ std::cout << (passed ? " Test passed \n " : " TEST FAILED\n " );
179
196
return passed ? 0 : 1 ;
180
197
}
0 commit comments