Skip to content

[SYCL][ESIMD] Fix inline asm test #8994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions sycl/test-e2e/ESIMD/InlineAsm/asm_glb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ int main(void) {
constexpr unsigned Size = 1024 * 128;
constexpr unsigned VL = 16;

float *A = new float[Size];
float *B = new float[Size];
float *C = new float[Size];
std::vector<float> A(Size);
std::vector<float> B(Size);
std::vector<float> C(Size);

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

try {
buffer<float, 1> bufa(A, range<1>(Size));
buffer<float, 1> bufb(B, range<1>(Size));
buffer<float, 1> bufc(C, range<1>(Size));
buffer<float, 1> bufa(A.data(), A.size());
buffer<float, 1> bufb(B.data(), B.size());
buffer<float, 1> bufc(C.data(), C.size());

try {
// We need that many workgroups
range<1> GlobalRange{Size / VL};

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

delete[] A;
delete[] B;
delete[] C;
return 1;
}

sycl::host_accessor A_acc(bufa);
sycl::host_accessor B_acc(bufb);
sycl::host_accessor C_acc(bufc);
int err_cnt = 0;

for (unsigned i = 0; i < Size; ++i) {
if (A[i] + B[i] != C[i]) {
if (A_acc[i] + B_acc[i] != C_acc[i]) {
if (++err_cnt < 10) {
std::cout << "failed at index " << i << ", " << C[i] << " != " << A[i]
<< " + " << B[i] << "\n";
std::cout << "failed at index " << i << ", " << C_acc[i]
<< " != " << A_acc[i] << " + " << B_acc[i] << "\n";
}
}
}
Expand All @@ -99,10 +99,6 @@ int main(void) {
<< (Size - err_cnt) << "/" << Size << ")\n";
}

delete[] A;
delete[] B;
delete[] C;

std::cout << (err_cnt > 0 ? "FAILED\n" : "Passed\n");
return err_cnt > 0 ? 1 : 0;
}