@@ -31,7 +31,6 @@ template <unsigned SIMDSize> int testAccessor(queue q) {
31
31
auto vec_3 = std::vector<int >(size);
32
32
33
33
std::iota (vec_0.begin (), vec_0.end (), 0 );
34
- std::iota (vec_1.begin (), vec_1.end (), 0 );
35
34
std::iota (vec_2.begin (), vec_2.end (), 0 );
36
35
std::iota (vec_3.begin (), vec_3.end (), 0 );
37
36
auto buf_0 = buffer{vec_0};
@@ -81,18 +80,16 @@ template <unsigned SIMDSize> int testAccessor(queue q) {
81
80
}
82
81
83
82
auto error = 0 ;
83
+ int acc = 0 ;
84
84
for (auto i = 0 ; i != size; ++i) {
85
85
if (vec_0[i] != 2 * i) {
86
86
++error;
87
87
std::cout << " Accessor Test 1 out[" << i << " ] = 0x" << std::hex
88
88
<< vec_0[i] << " vs etalon = 0x" << 2 * i << std::dec
89
89
<< std::endl;
90
90
}
91
- if (vec_1[i] > 0 ) {
92
- ++error;
93
- std::cout << " Accessor Test 2 out[" << i << " ] = 0x" << std::hex
94
- << vec_1[i] << " vs etalon = 0x" << 0 << std::dec << std::endl;
95
- }
91
+ acc += vec_1[i];
92
+
96
93
if (vec_2[i] != i) {
97
94
++error;
98
95
std::cout << " Accessor Test 3 out[" << i << " ] = 0x" << std::hex
@@ -105,6 +102,11 @@ template <unsigned SIMDSize> int testAccessor(queue q) {
105
102
<< vec_3[i] << " vs etalon = 0x" << i << std::dec << std::endl;
106
103
}
107
104
}
105
+ if (acc == 0 ) {
106
+ ++error;
107
+ std::cout << " Accessor Test 2 out = 0"
108
+ << " vs etalon non 0" << std::endl;
109
+ }
108
110
std::cout << " Accessor lsc predicate test " ;
109
111
std::cout << (error != 0 ? " FAILED" : " passed" ) << std::endl;
110
112
return error;
@@ -118,10 +120,13 @@ template <unsigned SIMDSize> int testUSM(queue q) {
118
120
auto *vec_2 = malloc_shared<int >(size, q);
119
121
auto *vec_3 = malloc_shared<int >(size, q);
120
122
std::iota (vec_0, vec_0 + size, 0 );
121
- std::iota (vec_1, vec_1 + size, 0 );
122
123
std::iota (vec_2, vec_2 + size, 0 );
123
124
std::iota (vec_3, vec_3 + size, 0 );
124
125
126
+ for (int i = 0 ; i < size; ++i) {
127
+ vec_1[i] = 0 ;
128
+ }
129
+
125
130
try {
126
131
q.submit ([&](handler &h) {
127
132
h.parallel_for (
@@ -162,17 +167,15 @@ template <unsigned SIMDSize> int testUSM(queue q) {
162
167
}
163
168
164
169
int error = 0 ;
170
+ int acc = 0 ;
165
171
for (auto i = 0 ; i != size; ++i) {
166
172
if (vec_0[i] != 2 * i) {
167
173
++error;
168
174
std::cout << " USM Test 1 out[" << i << " ] = 0x" << std::hex << vec_0[i]
169
175
<< " vs etalon = 0x" << 2 * i << std::dec << std::endl;
170
176
}
171
- if (vec_1[i] > 0 ) {
172
- ++error;
173
- std::cout << " USM Test 2 out[" << i << " ] = 0x" << std::hex << vec_1[i]
174
- << " vs etalon = 0x" << 0 << std::dec << std::endl;
175
- }
177
+ acc += vec_1[i];
178
+
176
179
if (vec_2[i] != i) {
177
180
++error;
178
181
std::cout << " USM Test 3 out[" << i << " ] = 0x" << std::hex << vec_2[i]
@@ -185,6 +188,11 @@ template <unsigned SIMDSize> int testUSM(queue q) {
185
188
<< " vs etalon = 0x" << i << std::dec << std::endl;
186
189
}
187
190
}
191
+ if (acc == 0 ) {
192
+ ++error;
193
+ std::cout << " USM Test 2 out = 0"
194
+ << " vs etalon non 0" << std::endl;
195
+ }
188
196
sycl::free (vec_0, q);
189
197
sycl::free (vec_1, q);
190
198
sycl::free (vec_2, q);
0 commit comments