Skip to content

Commit 6c8feff

Browse files
authored
[SYCL][ESIMD] Fix inline asm test (#8994)
It passes on linux ocl/l0 and windows ocl, but fails on windows l0 in postcommit. I rewrote it to use a host accessor when checking results, based on the pi trace logs, we were missing a piEnqueueMemBufferRead Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 3d6917f commit 6c8feff

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

sycl/test-e2e/ESIMD/InlineAsm/asm_glb.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ int main(void) {
2626
constexpr unsigned Size = 1024 * 128;
2727
constexpr unsigned VL = 16;
2828

29-
float *A = new float[Size];
30-
float *B = new float[Size];
31-
float *C = new float[Size];
29+
std::vector<float> A(Size);
30+
std::vector<float> B(Size);
31+
std::vector<float> C(Size);
3232

3333
for (unsigned i = 0; i < Size; ++i) {
3434
A[i] = B[i] = i;
3535
C[i] = 0.0f;
3636
}
3737

38-
try {
39-
buffer<float, 1> bufa(A, range<1>(Size));
40-
buffer<float, 1> bufb(B, range<1>(Size));
41-
buffer<float, 1> bufc(C, range<1>(Size));
38+
buffer<float, 1> bufa(A.data(), A.size());
39+
buffer<float, 1> bufb(B.data(), B.size());
40+
buffer<float, 1> bufc(C.data(), C.size());
4241

42+
try {
4343
// We need that many workgroups
4444
range<1> GlobalRange{Size / VL};
4545

@@ -77,19 +77,19 @@ int main(void) {
7777
} catch (sycl::exception const &e) {
7878
std::cout << "SYCL exception caught: " << e.what() << '\n';
7979

80-
delete[] A;
81-
delete[] B;
82-
delete[] C;
8380
return 1;
8481
}
8582

83+
sycl::host_accessor A_acc(bufa);
84+
sycl::host_accessor B_acc(bufb);
85+
sycl::host_accessor C_acc(bufc);
8686
int err_cnt = 0;
8787

8888
for (unsigned i = 0; i < Size; ++i) {
89-
if (A[i] + B[i] != C[i]) {
89+
if (A_acc[i] + B_acc[i] != C_acc[i]) {
9090
if (++err_cnt < 10) {
91-
std::cout << "failed at index " << i << ", " << C[i] << " != " << A[i]
92-
<< " + " << B[i] << "\n";
91+
std::cout << "failed at index " << i << ", " << C_acc[i]
92+
<< " != " << A_acc[i] << " + " << B_acc[i] << "\n";
9393
}
9494
}
9595
}
@@ -99,10 +99,6 @@ int main(void) {
9999
<< (Size - err_cnt) << "/" << Size << ")\n";
100100
}
101101

102-
delete[] A;
103-
delete[] B;
104-
delete[] C;
105-
106102
std::cout << (err_cnt > 0 ? "FAILED\n" : "Passed\n");
107103
return err_cnt > 0 ? 1 : 0;
108104
}

0 commit comments

Comments
 (0)