forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathint_header_esimd.cpp
More file actions
62 lines (49 loc) · 1.57 KB
/
int_header_esimd.cpp
File metadata and controls
62 lines (49 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// RUN: %clang_cc1 -fsycl-explicit-simd -fsycl-is-device -internal-isystem %S/Inputs -fsycl-int-header=%t.h %s
// RUN: FileCheck -input-file=%t.h %s
// This test checks that
// 1) New isESIMD() member is generated into the integration header
// 2) It returns 1 for ESIMD kernels and 0 - for non-ESIMD.
#include "sycl.hpp"
using namespace cl::sycl;
// -- ESIMD Lambda kernel.
void testA() {
queue q;
q.submit([&](handler &h) {
h.single_task<class KernelA>([=]() __attribute__((sycl_explicit_simd)){});
});
}
// CHECK-LABEL: template <> struct KernelInfo<class KernelA> {
// CHECK: static constexpr bool isESIMD() { return 1; }
// -- ESIMD Functor object kernel.
struct KernelFunctor {
void operator()() const __attribute__((sycl_explicit_simd)) {}
};
void testB() {
queue q;
q.submit([&](handler &h) {
h.single_task(KernelFunctor{});
});
}
// CHECK-LABEL: template <> struct KernelInfo<::KernelFunctor> {
// CHECK: static constexpr bool isESIMD() { return 1; }
// -- Non-ESIMD Lambda kernel.
void testNA() {
queue q;
q.submit([&](handler &h) {
h.single_task<class KernelNA>([=]() {});
});
}
// CHECK-LABEL: template <> struct KernelInfo<class KernelNA> {
// CHECK: static constexpr bool isESIMD() { return 0; }
// -- Non-ESIMD Functor object kernel.
struct KernelNonESIMDFunctor {
void operator()() const {}
};
void testNB() {
queue q;
q.submit([&](handler &h) {
h.single_task(KernelNonESIMDFunctor{});
});
}
// CHECK-LABEL: template <> struct KernelInfo<::KernelNonESIMDFunctor> {
// CHECK: static constexpr bool isESIMD() { return 0; }