Skip to content

Commit 60b9108

Browse files
committed
Further verbosity added
Signed-off-by: Alberto Cabrera <[email protected]>
1 parent 8a2b72e commit 60b9108

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,42 @@ template <typename... ValueT> struct should_skip {
9090
}
9191
};
9292

93+
#define CHECK_PRINT(ResultT, RESULT, EXPECTED) \
94+
if constexpr (std::is_integral_v<ResultT>) { \
95+
std::cerr << "RESULT == EXPECTED" << std::endl; \
96+
std::cerr << RESULT << " == " << EXPECTED << std::endl; \
97+
} else if constexpr (contained_is_integral_v<ResultT>) { \
98+
for (size_t i = 0; i < RESULT.size(); i++) { \
99+
std::cerr << i << " RESULT[i] == EXPECTED[i]" << std::endl; \
100+
std::cerr << i << " " << RESULT[i] << " == " << EXPECTED[i] \
101+
<< std::endl; \
102+
} \
103+
} else if constexpr (syclcompat::is_floating_point_v<ResultT>) { \
104+
if (syclcompat::detail::isnan(RESULT)) { \
105+
std::cerr << "syclcompat::detail::isnan(EXPECTED)" << std::endl; \
106+
std::cerr << syclcompat::detail::isnan(EXPECTED) << std::endl; \
107+
} else { \
108+
std::cerr << "fabs(RESULT - EXPECTED) < ERROR_TOLERANCE" << std::endl; \
109+
std::cerr << fabs(RESULT - EXPECTED) << " < " << ERROR_TOLERANCE \
110+
<< std::endl; \
111+
} \
112+
} else if constexpr (contained_is_floating_point_v<ResultT>) { \
113+
for (size_t i = 0; i < RESULT.size(); i++) { \
114+
if (syclcompat::detail::isnan(RESULT[i])) { \
115+
std::cerr << i << " syclcompat::detail::isnan(EXPECTED[i])" \
116+
<< std::endl; \
117+
std::cerr << syclcompat::detail::isnan(EXPECTED[i]) << std::endl; \
118+
} else { \
119+
std::cerr << i << " fabs(RESULT[i] - EXPECTED[i]) < ERROR_TOLERANCE" \
120+
<< std::endl; \
121+
std::cerr << i << " " << fabs(RESULT[i] - EXPECTED[i]) << " < " \
122+
<< ERROR_TOLERANCE << std::endl; \
123+
} \
124+
} \
125+
} else { \
126+
static_assert(0, "math_fixt.hpp should not have arrived here."); \
127+
}
128+
93129
#define CHECK(ResultT, RESULT, EXPECTED) \
94130
if constexpr (std::is_integral_v<ResultT>) { \
95131
assert(RESULT == EXPECTED); \
@@ -174,6 +210,7 @@ class BinaryOpTestLauncher : OpTestLauncher {
174210
syclcompat::memcpy<ResultT>(&res_h_, res_, data_size_);
175211

176212
// CHECK(ResultT, res_h_, expected);
213+
CHECK_PRINT(ResultT, res_h_, expected);
177214
};
178215

179216
template <auto Kernel>
@@ -187,6 +224,7 @@ class BinaryOpTestLauncher : OpTestLauncher {
187224
syclcompat::memcpy<ResultT>(&res_h_, res_, data_size_);
188225

189226
// CHECK(ResultT, res_h_, expected);
227+
CHECK_PRINT(ResultT, res_h_, expected);
190228
};
191229
template <auto Kernel>
192230
void launch_test(ValueT op1, ValueU op2, ResultT expected, bool expected_hi,
@@ -204,6 +242,7 @@ class BinaryOpTestLauncher : OpTestLauncher {
204242
syclcompat::memcpy<bool>(&res_lo_h_, res_lo_, 1);
205243

206244
// CHECK(ResultT, res_h_, expected);
245+
CHECK_PRINT(ResultT, res_h_, expected);
207246
assert(res_hi_h_ == expected_hi);
208247
assert(res_lo_h_ == expected_lo);
209248
};

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,21 @@ void test_container_syclcompat_fmax_nan() {
188188
<< std::bitset<8 * sizeof(ValueTU)>(op5[1]) << std::endl;
189189
std::cerr << "ResBitset: " << std::bitset<8 * sizeof(ValueTU)>(res2[0]) << " "
190190
<< std::bitset<8 * sizeof(ValueTU)>(res2[1]) << std::endl;
191+
191192
BinaryOpTestLauncher<ContT, ContU>(grid, threads)
192193
.template launch_test<fmax_nan_kernel<ContT, ContU>>(op4, op5, res2);
193194

194195
std::cerr << "Second container test: " << std::endl;
196+
std::cerr << "Op4: " << op4[0] << " " << op4[1] << std::endl;
197+
std::cerr << "Op6: " << op6[0] << " " << op6[1] << std::endl;
198+
std::cerr << "Res: " << op6_res[0] << " " << op6_res[1] << std::endl;
195199
std::cerr << "Op4: " << std::bitset<8 * sizeof(ValueTU)>(op4[0]) << " "
196200
<< std::bitset<8 * sizeof(ValueTU)>(op4[1]) << std::endl;
197201
std::cerr << "Op6: " << std::bitset<8 * sizeof(ValueTU)>(op6[0]) << " "
198202
<< std::bitset<8 * sizeof(ValueTU)>(op6[1]) << std::endl;
199203
std::cerr << "Res: " << std::bitset<8 * sizeof(ValueTU)>(op6_res[0]) << " "
200204
<< std::bitset<8 * sizeof(ValueTU)>(op6_res[1]) << std::endl;
205+
201206
BinaryOpTestLauncher<ContT, ContU>(grid, threads)
202207
.template launch_test<fmax_nan_kernel<ContT, ContU>>(op4, op6, op6_res);
203208
}

0 commit comments

Comments
 (0)