Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 12c9500

Browse files
committed
Add more debugging information to the test
1 parent e440ea2 commit 12c9500

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

SYCL/ESIMD/lsc/lsc_predicate.cpp

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,28 @@ template <unsigned SIMDSize> int testAccessor(queue q) {
8989

9090
auto error = 0;
9191
for (auto i = 0; i != size; ++i) {
92-
error += vec_0[i] != 2 * i;
93-
error += vec_1[i] > 0;
94-
error += vec_2[i] != i;
95-
error += vec_3[i] != i;
92+
if (vec_0[i] != 2 * i) {
93+
++error;
94+
std::cout << " Accessor Test 1 out[" << i << "] = 0x" << std::hex
95+
<< vec_0[i] << " vs etalon = 0x" << 2 * i << std::dec
96+
<< std::endl;
97+
}
98+
if (vec_1[i] > 0) {
99+
++error;
100+
std::cout << " Accessor Test 2 out[" << i << "] = 0x" << std::hex
101+
<< vec_1[i] << " vs etalon = 0x" << 0 << std::dec << std::endl;
102+
}
103+
if (vec_2[i] != i) {
104+
++error;
105+
std::cout << " Accessor Test 3 out[" << i << "] = 0x" << std::hex
106+
<< vec_2[i] << " vs etalon = 0x" << i << std::dec << std::endl;
107+
}
108+
109+
if (vec_3[i] != i) {
110+
++error;
111+
std::cout << " Accessor Test 4 out[" << i << "] = 0x" << std::hex
112+
<< vec_3[i] << " vs etalon = 0x" << i << std::dec << std::endl;
113+
}
96114
}
97115
std::cout << "Accessor lsc predicate test ";
98116
std::cout << (error != 0 ? "FAILED" : "passed") << std::endl;
@@ -153,10 +171,27 @@ template <unsigned SIMDSize> int testUSM(queue q) {
153171

154172
int error = 0;
155173
for (auto i = 0; i != size; ++i) {
156-
error += vec_0[i] != 2 * i;
157-
error += vec_1[i] > 0;
158-
error += vec_2[i] != i;
159-
error += vec_3[i] != i;
174+
if (vec_0[i] != 2 * i) {
175+
++error;
176+
std::cout << " USM Test 1 out[" << i << "] = 0x" << std::hex << vec_0[i]
177+
<< " vs etalon = 0x" << 2 * i << std::dec << std::endl;
178+
}
179+
if (vec_1[i] > 0) {
180+
++error;
181+
std::cout << " USM Test 2 out[" << i << "] = 0x" << std::hex << vec_1[i]
182+
<< " vs etalon = 0x" << 0 << std::dec << std::endl;
183+
}
184+
if (vec_2[i] != i) {
185+
++error;
186+
std::cout << " USM Test 3 out[" << i << "] = 0x" << std::hex << vec_2[i]
187+
<< " vs etalon = 0x" << i << std::dec << std::endl;
188+
}
189+
190+
if (vec_3[i] != i) {
191+
++error;
192+
std::cout << " USM Test 4 out[" << i << "] = 0x" << std::hex << vec_3[i]
193+
<< " vs etalon = 0x" << i << std::dec << std::endl;
194+
}
160195
}
161196
sycl::free(vec_0, q);
162197
sycl::free(vec_1, q);
@@ -169,15 +204,14 @@ template <unsigned SIMDSize> int testUSM(queue q) {
169204

170205
int main() {
171206

172-
auto q =
173-
queue{esimd_test::ESIMDSelector, esimd_test::createExceptionHandler()};
207+
queue q(esimd_test::ESIMDSelector, esimd_test::createExceptionHandler());
174208
auto device = q.get_device();
175209
std::cout << "Device name: " << device.get_info<info::device::name>()
176210
<< std::endl;
177211

178212
int error = testUSM<8>(q);
179-
error = testUSM<16>(q);
180-
error = testUSM<32>(q);
213+
error += testUSM<16>(q);
214+
error += testUSM<32>(q);
181215

182216
error += testAccessor<8>(q);
183217
error += testAccessor<16>(q);

0 commit comments

Comments
 (0)