Skip to content

Commit 8a2b72e

Browse files
committed
Draft: Disabled checks, added verbosity, to trigger full log in the CI at the end of specific tests
Signed-off-by: Alberto Cabrera <[email protected]>
1 parent d6f957d commit 8a2b72e

File tree

3 files changed

+123
-75
lines changed

3 files changed

+123
-75
lines changed

sycl/test-e2e/syclcompat/math/math_compare.cpp

Lines changed: 63 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,14 @@ void compare_not_equal_vec_kernel(Container *a, Container *b, Container *r) {
9696
*r = syclcompat::compare(*a, *b, std::not_equal_to<>());
9797
}
9898

99-
template <template <typename T, int Dim> typename ContainerT,
100-
typename ValueT> void test_compare_vec() {
99+
template <template <typename T, int Dim> typename ContainerT, typename ValueT>
100+
void test_compare_vec() {
101101
std::cout << __PRETTY_FUNCTION__ << std::endl;
102102
using Container = ContainerT<ValueT, 2>;
103103

104104
constexpr syclcompat::dim3 grid{1};
105105
constexpr syclcompat::dim3 threads{1};
106-
const Container op1 = {static_cast<ValueT>(1.0),
107-
static_cast<ValueT>(2.0)};
106+
const Container op1 = {static_cast<ValueT>(1.0), static_cast<ValueT>(2.0)};
108107
Container op2 = {static_cast<ValueT>(1.0),
109108
sycl::nan(static_cast<unsigned int>(0))};
110109

@@ -178,27 +177,47 @@ void unordered_compare_not_equal_vec_kernel(Container *a, Container *b,
178177
*r = syclcompat::unordered_compare(*a, *b, std::not_equal_to<>());
179178
}
180179

181-
template <template <typename T, int Dim> typename ContainerT,
182-
typename ValueT> void test_unordered_compare_vec() {
180+
template <template <typename T, int Dim> typename ContainerT, typename ValueT>
181+
void test_unordered_compare_vec() {
183182
std::cout << __PRETTY_FUNCTION__ << std::endl;
183+
std::cerr << __PRETTY_FUNCTION__ << std::endl;
184184
using Container = ContainerT<ValueT, 2>;
185185

186186
constexpr syclcompat::dim3 grid{1};
187187
constexpr syclcompat::dim3 threads{1};
188-
const Container op1 = {static_cast<ValueT>(1.0),
189-
static_cast<ValueT>(2.0)};
188+
const Container op1 = {static_cast<ValueT>(1.0), static_cast<ValueT>(2.0)};
190189
Container op2 = {static_cast<ValueT>(1.0),
191190
sycl::nan(static_cast<unsigned int>(0))};
192191

193192
// bool2 does not exist, 1.0 and 0.0 floats are used for true
194193
// and false instead.
195194
// 1.0 == 1.0, 2.0 == NaN -> {true, true}
196195
const Container res1 = {1.0, 1.0};
196+
std::cerr << "- 1.0 == 1.0, 2.0 == NaN -> {true, true}: " << std::endl;
197+
std::cerr << "Op1: " << op1[0] << " " << op1[1] << std::endl;
198+
std::cerr << "op2: " << op2[0] << " " << op2[1] << std::endl;
199+
std::cerr << "Res: " << res1[0] << " " << res1[1] << std::endl;
200+
std::cerr << "BitSet: " << std::bitset<8 * sizeof(ValueT)>(op1[0]) << " "
201+
<< std::bitset<8 * sizeof(ValueT)>(op1[1]) << std::endl;
202+
std::cerr << "BitSet2: " << std::bitset<8 * sizeof(ValueT)>(op2[0]) << " "
203+
<< std::bitset<8 * sizeof(ValueT)>(op2[1]) << std::endl;
204+
std::cerr << "ResBitset: " << std::bitset<8 * sizeof(ValueT)>(res1[0]) << " "
205+
<< std::bitset<8 * sizeof(ValueT)>(res1[1]) << std::endl;
197206
BinaryOpTestLauncher<Container, Container>(grid, threads)
198207
.template launch_test<unordered_compare_equal_vec_kernel<Container>>(
199208
op1, op2, res1);
200209
// 1.0 != 1.0, 2.0 != NaN -> {false, true}
201210
const Container res2 = {0.0, 1.0};
211+
std::cerr << "- 1.0 != 1.0, 2.0 != NaN -> {false, true}: " << std::endl;
212+
std::cerr << "Op1: " << op1[0] << " " << op1[1] << std::endl;
213+
std::cerr << "op2: " << op2[0] << " " << op2[1] << std::endl;
214+
std::cerr << "Res: " << res2[0] << " " << res2[1] << std::endl;
215+
std::cerr << "BitSet: " << std::bitset<8 * sizeof(ValueT)>(op1[0]) << " "
216+
<< std::bitset<8 * sizeof(ValueT)>(op1[1]) << std::endl;
217+
std::cerr << "BitSet2: " << std::bitset<8 * sizeof(ValueT)>(op2[0]) << " "
218+
<< std::bitset<8 * sizeof(ValueT)>(op2[1]) << std::endl;
219+
std::cerr << "ResBitset: " << std::bitset<8 * sizeof(ValueT)>(res2[0]) << " "
220+
<< std::bitset<8 * sizeof(ValueT)>(res2[1]) << std::endl;
202221
BinaryOpTestLauncher<Container, Container>(grid, threads)
203222
.template launch_test<unordered_compare_not_equal_vec_kernel<Container>>(
204223
op1, op2, res2);
@@ -209,15 +228,14 @@ void compare_both_kernel(Container *a, Container *b, bool *r) {
209228
*r = syclcompat::compare_both(*a, *b, std::equal_to<>());
210229
}
211230

212-
template <template <typename T, int Dim> typename ContainerT,
213-
typename ValueT> void test_compare_both() {
231+
template <template <typename T, int Dim> typename ContainerT, typename ValueT>
232+
void test_compare_both() {
214233
std::cout << __PRETTY_FUNCTION__ << std::endl;
215234
using Container = ContainerT<ValueT, 2>;
216235

217236
constexpr syclcompat::dim3 grid{1};
218237
constexpr syclcompat::dim3 threads{1};
219-
const Container op1 = {static_cast<ValueT>(1.0),
220-
static_cast<ValueT>(2.0)};
238+
const Container op1 = {static_cast<ValueT>(1.0), static_cast<ValueT>(2.0)};
221239
Container op2 = {static_cast<ValueT>(1.0),
222240
sycl::nan(static_cast<unsigned int>(0))};
223241

@@ -239,15 +257,14 @@ void unordered_compare_both_kernel(Container *a, Container *b, bool *r) {
239257
*r = syclcompat::unordered_compare_both(*a, *b, std::equal_to<>());
240258
}
241259

242-
template <template <typename T, int Dim> typename ContainerT,
243-
typename ValueT> void test_unordered_compare_both() {
260+
template <template <typename T, int Dim> typename ContainerT, typename ValueT>
261+
void test_unordered_compare_both() {
244262
std::cout << __PRETTY_FUNCTION__ << std::endl;
245263
using Container = ContainerT<ValueT, 2>;
246264

247265
constexpr syclcompat::dim3 grid{1};
248266
constexpr syclcompat::dim3 threads{1};
249-
const Container op1 = {static_cast<ValueT>(1.0),
250-
static_cast<ValueT>(2.0)};
267+
const Container op1 = {static_cast<ValueT>(1.0), static_cast<ValueT>(2.0)};
251268
Container op2 = {static_cast<ValueT>(1.0),
252269
sycl::nan(static_cast<unsigned int>(0))};
253270

@@ -270,21 +287,17 @@ void compare_mask_kernel(Container *a, Container *b, unsigned *r) {
270287
*r = syclcompat::compare_mask(*a, *b, std::equal_to<>());
271288
}
272289

273-
template <template <typename T, int Dim> typename ContainerT,
274-
typename ValueT> void test_compare_mask() {
290+
template <template <typename T, int Dim> typename ContainerT, typename ValueT>
291+
void test_compare_mask() {
275292
std::cout << __PRETTY_FUNCTION__ << std::endl;
276293
using Container = ContainerT<ValueT, 2>;
277294

278295
constexpr syclcompat::dim3 grid{1};
279296
constexpr syclcompat::dim3 threads{1};
280-
const Container op1 = {static_cast<ValueT>(1.0),
281-
static_cast<ValueT>(2.0)};
282-
const Container op2 = {static_cast<ValueT>(2.0),
283-
static_cast<ValueT>(1.0)};
284-
const Container op3 = {static_cast<ValueT>(1.0),
285-
static_cast<ValueT>(3.0)};
286-
const Container op4 = {static_cast<ValueT>(3.0),
287-
static_cast<ValueT>(2.0)};
297+
const Container op1 = {static_cast<ValueT>(1.0), static_cast<ValueT>(2.0)};
298+
const Container op2 = {static_cast<ValueT>(2.0), static_cast<ValueT>(1.0)};
299+
const Container op3 = {static_cast<ValueT>(1.0), static_cast<ValueT>(3.0)};
300+
const Container op4 = {static_cast<ValueT>(3.0), static_cast<ValueT>(2.0)};
288301
Container op5 = {sycl::nan(static_cast<unsigned int>(0)),
289302
sycl::nan(static_cast<unsigned int>(0))};
290303

@@ -319,21 +332,17 @@ void unordered_compare_mask_kernel(Container *a, Container *b, unsigned *r) {
319332
*r = syclcompat::unordered_compare_mask(*a, *b, std::equal_to<>());
320333
}
321334

322-
template <template <typename T, int Dim> typename ContainerT,
323-
typename ValueT> void test_unordered_compare_mask() {
335+
template <template <typename T, int Dim> typename ContainerT, typename ValueT>
336+
void test_unordered_compare_mask() {
324337
std::cout << __PRETTY_FUNCTION__ << std::endl;
325338
using Container = ContainerT<ValueT, 2>;
326339

327340
constexpr syclcompat::dim3 grid{1};
328341
constexpr syclcompat::dim3 threads{1};
329-
const Container op1 = {static_cast<ValueT>(1.0),
330-
static_cast<ValueT>(2.0)};
331-
const Container op2 = {static_cast<ValueT>(2.0),
332-
static_cast<ValueT>(1.0)};
333-
const Container op3 = {static_cast<ValueT>(1.0),
334-
static_cast<ValueT>(3.0)};
335-
const Container op4 = {static_cast<ValueT>(3.0),
336-
static_cast<ValueT>(2.0)};
342+
const Container op1 = {static_cast<ValueT>(1.0), static_cast<ValueT>(2.0)};
343+
const Container op2 = {static_cast<ValueT>(2.0), static_cast<ValueT>(1.0)};
344+
const Container op3 = {static_cast<ValueT>(1.0), static_cast<ValueT>(3.0)};
345+
const Container op4 = {static_cast<ValueT>(3.0), static_cast<ValueT>(2.0)};
337346
Container op5 = {sycl::nan(static_cast<unsigned int>(0)),
338347
sycl::nan(static_cast<unsigned int>(0))};
339348

@@ -368,16 +377,24 @@ int main() {
368377
INSTANTIATE_ALL_TYPES(fp_type_list, test_unordered_compare);
369378
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec, test_compare_vec);
370379
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray, test_compare_vec);
371-
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec, test_unordered_compare_vec);
372-
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray, test_unordered_compare_vec);
380+
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec,
381+
test_unordered_compare_vec);
382+
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray,
383+
test_unordered_compare_vec);
373384
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec, test_compare_both);
374-
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray, test_compare_both);
375-
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec, test_unordered_compare_both);
376-
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray, test_unordered_compare_both);
385+
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray,
386+
test_compare_both);
387+
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec,
388+
test_unordered_compare_both);
389+
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray,
390+
test_unordered_compare_both);
377391
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec, test_compare_mask);
378-
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray, test_compare_mask);
379-
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec, test_unordered_compare_mask);
380-
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray, test_unordered_compare_mask);
381-
382-
return 0;
392+
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray,
393+
test_compare_mask);
394+
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::vec,
395+
test_unordered_compare_mask);
396+
INSTANTIATE_ALL_CONTAINER_TYPES(fp_type_list, sycl::marray,
397+
test_unordered_compare_mask);
398+
399+
return 1;
383400
}

sycl/test-e2e/syclcompat/math/math_fixt.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ template <typename T, typename U> struct container_common_type<T, U> {
6868
template <typename T, typename U>
6969
using container_common_type_t = typename container_common_type<T, U>::type;
7070

71-
template <typename ...ValueT> struct should_skip {
71+
template <typename... ValueT> struct should_skip {
7272
bool operator()(const sycl::device &dev) const {
7373
if constexpr ((std::is_same_v<ValueT, double> || ...) ||
7474
(contained_is_same_v<ValueT, double> || ...)) {
@@ -173,8 +173,9 @@ class BinaryOpTestLauncher : OpTestLauncher {
173173
syclcompat::wait();
174174
syclcompat::memcpy<ResultT>(&res_h_, res_, data_size_);
175175

176-
CHECK(ResultT, res_h_, expected);
176+
// CHECK(ResultT, res_h_, expected);
177177
};
178+
178179
template <auto Kernel>
179180
void launch_test(ValueT op1, ValueU op2, ResultT expected, bool need_relu) {
180181
if (skip_)
@@ -185,7 +186,7 @@ class BinaryOpTestLauncher : OpTestLauncher {
185186
syclcompat::wait();
186187
syclcompat::memcpy<ResultT>(&res_h_, res_, data_size_);
187188

188-
CHECK(ResultT, res_h_, expected);
189+
// CHECK(ResultT, res_h_, expected);
189190
};
190191
template <auto Kernel>
191192
void launch_test(ValueT op1, ValueU op2, ResultT expected, bool expected_hi,
@@ -202,7 +203,7 @@ class BinaryOpTestLauncher : OpTestLauncher {
202203
syclcompat::memcpy<bool>(&res_hi_h_, res_hi_, 1);
203204
syclcompat::memcpy<bool>(&res_lo_h_, res_lo_, 1);
204205

205-
CHECK(ResultT, res_h_, expected);
206+
// CHECK(ResultT, res_h_, expected);
206207
assert(res_hi_h_ == expected_hi);
207208
assert(res_lo_h_ == expected_lo);
208209
};

0 commit comments

Comments
 (0)