forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreqd-sub-group-size.cpp
More file actions
60 lines (47 loc) · 1.73 KB
/
reqd-sub-group-size.cpp
File metadata and controls
60 lines (47 loc) · 1.73 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
// RUN: %clang_cc1 -fsycl -fsycl-is-device -internal-isystem %S/Inputs -disable-llvm-passes -triple spir64-unknown-unknown-sycldevice -emit-llvm -o - %s | FileCheck %s
#include "sycl.hpp"
using namespace cl::sycl;
queue q;
class Functor16 {
public:
[[intel::reqd_sub_group_size(16)]] void operator()() const {}
};
[[intel::reqd_sub_group_size(8)]] void foo() {}
class Functor8 {
public:
void operator()() const {
foo();
}
};
template <int SIZE>
class Functor2 {
public:
[[intel::reqd_sub_group_size(SIZE)]] void operator()() const {}
};
template <int N>
[[intel::reqd_sub_group_size(N)]] void func() {}
int main() {
q.submit([&](handler &h) {
Functor16 f16;
h.single_task<class kernel_name1>(f16);
Functor8 f8;
h.single_task<class kernel_name2>(f8);
h.single_task<class kernel_name3>(
[]() [[intel::reqd_sub_group_size(4)]]{});
Functor2<2> f2;
h.single_task<class kernel_name4>(f2);
h.single_task<class kernel_name5>([]() {
func<2>();
});
});
return 0;
}
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name1"() #0 {{.*}} !intel_reqd_sub_group_size ![[SGSIZE16:[0-9]+]]
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name2"() #0 {{.*}} !intel_reqd_sub_group_size ![[SGSIZE8:[0-9]+]]
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name3"() #0 {{.*}} !intel_reqd_sub_group_size ![[SGSIZE4:[0-9]+]]
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name4"() #0 {{.*}} !intel_reqd_sub_group_size ![[SGSIZE2:[0-9]+]]
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name5"() #0 {{.*}} !intel_reqd_sub_group_size ![[SGSIZE2]]
// CHECK: ![[SGSIZE16]] = !{i32 16}
// CHECK: ![[SGSIZE8]] = !{i32 8}
// CHECK: ![[SGSIZE4]] = !{i32 4}
// CHECK: ![[SGSIZE2]] = !{i32 2}