forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitiation_interval.cpp
More file actions
48 lines (38 loc) · 1.44 KB
/
initiation_interval.cpp
File metadata and controls
48 lines (38 loc) · 1.44 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
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -triple spir64-unknown-unknown-sycldevice -disable-llvm-passes -sycl-std=2020 -emit-llvm -o - %s | FileCheck %s
#include "sycl.hpp"
using namespace cl::sycl;
queue q;
class Foo {
public:
[[intel::initiation_interval(1)]] void operator()() const {}
};
template <int SIZE>
class Functor {
public:
[[intel::initiation_interval(SIZE)]] void operator()() const {}
};
[[intel::initiation_interval(5)]] void foo() {}
int main() {
q.submit([&](handler &h) {
// Test attribute argument size.
Foo boo;
h.single_task<class kernel_name1>(boo);
// Test attribute is applied on lambda.
h.single_task<class kernel_name2>(
[]() [[intel::initiation_interval(42)]]{});
// Test template argument.
Functor<2> f;
h.single_task<class kernel_name3>(f);
// Test attribute is not propagated.
h.single_task<class kernel_name4>(
[]() { foo(); });
});
return 0;
}
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name1"() #0 {{.*}} !initiation_interval ![[NUM1:[0-9]+]]
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name2"() #0 {{.*}} !initiation_interval ![[NUM42:[0-9]+]]
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name3"() #0 {{.*}} !initiation_interval ![[NUM2:[0-9]+]]
// CHECK: define {{.*}}spir_kernel void @{{.*}}kernel_name4"() #0 {{.*}}
// CHECK: ![[NUM1]] = !{i32 1}
// CHECK: ![[NUM42]] = !{i32 42}
// CHECK: ![[NUM2]] = !{i32 2}