Skip to content

Commit 6c3fdcc

Browse files
authored
[ESIMD] Split the test esimd::wait() to e2e and compile-only (#8821)
Signed-off-by: Vyacheslav N Klochkov <[email protected]>
1 parent 4e39e3e commit 6c3fdcc

File tree

2 files changed

+51
-13
lines changed

2 files changed

+51
-13
lines changed

sycl/test-e2e/ESIMD/wait.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
// REQUIRES: gpu
99
// UNSUPPORTED: cuda || hip
1010

11-
// RUN: %clangxx -fsycl -fsycl-device-only -Xclang -emit-llvm -o %t.comp.ll %s
12-
// RUN: sycl-post-link -ir-output-only -lower-esimd -S %t.comp.ll -o %t.out.ll
13-
// RUN: FileCheck --input-file=%t.out.ll %s
14-
1511
// RUN: %clangxx -fsycl %s -o %t.out
1612
// RUN: %GPU_RUN_PLACEHOLDER %t.out
1713

@@ -37,8 +33,6 @@ bool test(sycl::queue Q, int IArg = 128) {
3733
simd<int, 16> A = IArg;
3834
simd<int, 16> B = A * A;
3935
iesimd::wait(B);
40-
// CHECK: mul <16 x i32>
41-
// CHECK: llvm.genx.dummy.mov
4236
}).wait();
4337

4438
// Test case 2: check wait() with esimd::simd_view argument.
@@ -48,9 +42,6 @@ bool test(sycl::queue Q, int IArg = 128) {
4842
auto BView = B.select<8, 2>(0);
4943
BView += 2;
5044
iesimd::wait(BView);
51-
// CHECK: mul <16 x i32>
52-
// CHECK: add <8 x i32>
53-
// CHECK: llvm.genx.dummy.mov
5445
}).wait();
5546

5647
// Test case 3: check wait() that prevesrves one simd and lets
@@ -60,10 +51,6 @@ bool test(sycl::queue Q, int IArg = 128) {
6051
auto B = A * 17;
6152
iesimd::wait(B);
6253
auto C = B * 17;
63-
// CHECK: mul <8 x i64>
64-
// CHECK-NOT: add <8 x i64>
65-
// CHECK: llvm.genx.dummy.mov
66-
// CHECK-NEXT: ret void
6754
}).wait();
6855
} catch (sycl::exception const &e) {
6956
std::cout << "SYCL exception caught: " << e.what() << '\n';

sycl/test/esimd/wait.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// RUN: %clangxx -fsycl -fsycl-device-only -Xclang -emit-llvm -o %t.comp.ll %s
2+
// RUN: sycl-post-link -ir-output-only -lower-esimd -S %t.comp.ll -o %t.out.ll
3+
// RUN: FileCheck --input-file=%t.out.ll %s
4+
5+
// This test verifies that calls of ext::intel::experimental::esimd::wait()
6+
// are lowered properly, not deleted as unused and they do not let delete
7+
// the argument of wait() function.
8+
9+
#include <iostream>
10+
#include <sycl/ext/intel/esimd.hpp>
11+
#include <sycl/sycl.hpp>
12+
13+
using namespace sycl;
14+
using namespace sycl::ext::intel::esimd;
15+
namespace iesimd = sycl::ext::intel::experimental::esimd;
16+
17+
SYCL_ESIMD_FUNCTION SYCL_EXTERNAL void func(int IArg) {
18+
// Test case 1: check wait() with esimd::simd argument.
19+
{
20+
simd<int, 16> A = IArg;
21+
simd<int, 16> B = A * A;
22+
iesimd::wait(B);
23+
// CHECK: mul <16 x i32>
24+
// CHECK: llvm.genx.dummy.mov
25+
}
26+
27+
// Test case 2: check wait() with esimd::simd_view argument.
28+
{
29+
simd<int, 16> A = IArg;
30+
simd<int, 16> B = A * 17;
31+
auto BView = B.select<8, 2>(0);
32+
BView += 2;
33+
iesimd::wait(BView);
34+
// CHECK: mul <16 x i32>
35+
// CHECK: add <8 x i32>
36+
// CHECK: llvm.genx.dummy.mov
37+
}
38+
39+
// Test case 3: check wait() that prevesrves one simd and lets
40+
// optimize away the other/unused one.
41+
{
42+
simd<uint64_t, 8> A = IArg;
43+
auto B = A * 17;
44+
iesimd::wait(B);
45+
auto C = B * 17;
46+
// CHECK: mul <8 x i64>
47+
// CHECK-NOT: add <8 x i64>
48+
// CHECK: llvm.genx.dummy.mov
49+
// CHECK-NEXT: ret void
50+
}
51+
}

0 commit comments

Comments
 (0)