@@ -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 };
0 commit comments