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

Commit dc06d2d

Browse files
committed
Apply comments
1 parent 3f29110 commit dc06d2d

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

SYCL/ESIMD/regression/Inputs/complex-lib-esimd.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
static constexpr const int VL = 4;
55

6-
sycl::event add(size_t n, sycl::buffer<double, 1> &buf_a,
7-
sycl::buffer<double, 1> &buf_b, sycl::buffer<double, 1> &buf_c,
6+
sycl::event add(size_t n, sycl::buffer<int, 1> &buf_a,
7+
sycl::buffer<int, 1> &buf_b, sycl::buffer<int, 1> &buf_c,
88
sycl::queue &Q) {
99
auto E = Q.submit([&](sycl::handler &H) {
1010
sycl::accessor acc_a{buf_a, H, sycl::read_only};
@@ -13,12 +13,12 @@ sycl::event add(size_t n, sycl::buffer<double, 1> &buf_a,
1313

1414
H.parallel_for(n, [=](sycl::id<1> i) SYCL_ESIMD_KERNEL {
1515
using namespace sycl::ext::intel::experimental::esimd;
16-
unsigned int offset = i * VL * sizeof(float);
17-
simd<float, VL> va;
16+
unsigned int offset = i * VL * sizeof(int);
17+
simd<int, VL> va;
1818
va.copy_from(acc_a, offset);
19-
simd<float, VL> vb;
19+
simd<int, VL> vb;
2020
vb.copy_from(acc_b, offset);
21-
simd<float, VL> vc = va + vb;
21+
simd<int, VL> vc = va + vb;
2222
vc.copy_to(acc_c, offset);
2323
});
2424
});

SYCL/ESIMD/regression/Inputs/complex-lib-sycl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sycl::event iota(size_t n, sycl::buffer<int, 1> &buf, sycl::queue &Q) {
66
auto K = [=](sycl::id<1> id) {
77
int *y = acc_y.get_pointer();
88
size_t i = id.get(0);
9-
y[i] = i;
9+
y[i] = static_cast<int>(i);
1010
};
1111
H.parallel_for(n, K);
1212
};

SYCL/ESIMD/regression/Inputs/complex-lib-test.cpp

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,43 @@
22
#include <cstdio>
33

44
sycl::event iota(size_t n, sycl::buffer<int, 1> &d, sycl::queue &Q);
5-
6-
const char *name = "with eSIMD";
5+
sycl::event add(size_t n, sycl::buffer<int, 1> &buf_a,
6+
sycl::buffer<int, 1> &buf_b, sycl::buffer<int, 1> &buf_c,
7+
sycl::queue &Q);
78

89
int main(int argc, char *argv[]) {
910
try {
1011
size_t i;
1112
size_t N = 1024;
1213
sycl::device D(sycl::default_selector{});
13-
sycl::context C(D);
14-
sycl::queue Q(C, D);
14+
sycl::context Ctx(D);
15+
sycl::queue Q(Ctx, D);
1516

16-
int *y = new int[N];
17+
std::vector<int> A(N), B(N), C(N);
1718
{
18-
sycl::buffer<int, 1> buf_y(y, N);
19-
iota(N, buf_y, Q);
19+
sycl::buffer<int, 1> buf_A(A.data(), N);
20+
sycl::buffer<int, 1> buf_B(B.data(), N);
21+
iota(N, buf_A, Q);
22+
iota(N, buf_B, Q);
2023
}
24+
2125
bool pass = true;
2226
for (i = 0; i < 10; ++i) {
23-
pass = pass && (y[i] == i);
27+
pass = pass && (A[i] == i);
28+
pass = pass && (B[i] == i);
29+
}
30+
31+
{
32+
sycl::buffer<int, 1> buf_A(A.data(), N);
33+
sycl::buffer<int, 1> buf_B(B.data(), N);
34+
sycl::buffer<int, 1> buf_C(C.data(), N);
35+
add(N, buf_A, buf_B, buf_C, Q);
2436
}
25-
delete[] y;
37+
38+
for (i = 0; i < 10; ++i) {
39+
pass = pass && (A[i] + B[i] == C[i]);
40+
}
41+
2642
fprintf(stdout, "%s: %s\n", argv[0], pass ? "PASS" : "FAIL");
2743
} catch (sycl::exception const &se) {
2844
fprintf(stderr, "%s failed with %s (%d)\n", argv[0], se.what(),

SYCL/ESIMD/regression/complex-lib-lin.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// device images, but at the same time it stated that they contain some kernels.
66
// More details can be found in intel/llvm#4927.
77
//
8-
// REQUIRES: linux && (cpu || gpu)
8+
// REQUIRES: linux,gpu
99
// UNSUPPORTED: cuda || hip
1010
//
1111
// RUN: %clangxx -fsycl -fPIC -O3 %S/Inputs/complex-lib-sycl.cpp -c -o %t-lib-sycl.o
@@ -30,7 +30,5 @@
3030
// RUN: %clangxx -fsycl %t-test.o %t-lib-o.so -o %t-o.run
3131
//
3232
// FIXME: is there better way to handle libraries loading than LD_PRELOAD?
33-
// RUN: %CPU_RUN_PLACEHOLDER LD_PRELOAD=%t-lib-a.so %t-a.run
34-
// RUN: %CPU_RUN_PLACEHOLDER LD_PRELOAD=%t-lib-o.so %t-o.run
3533
// RUN: %GPU_RUN_PLACEHOLDER LD_PRELOAD=%t-lib-a.so %t-a.run
3634
// RUN: %GPU_RUN_PLACEHOLDER LD_PRELOAD=%t-lib-o.so %t-o.run

0 commit comments

Comments
 (0)