2
2
3
3
// Tests for IR of Intel FPGA [[intel::use_stall_enable_clusters]] function attribute on Device.
4
4
// The metadata to be attached to the functionDecl that the attribute is applied to.
5
- // The attributes do not get propagated to kernel metadata i.e. spir_kernel.
5
+ // The attributes get propagated to the kernel metadata i.e. spir_kernel if directly applied
6
+ // through functors/lambda function.
6
7
7
8
#include " sycl.hpp"
8
9
9
10
using namespace cl ::sycl;
10
11
queue q;
11
12
12
- [[intel::use_stall_enable_clusters]] void test () {}
13
+ [[intel::use_stall_enable_clusters]] void func () {}
13
14
14
15
struct FuncObj {
15
16
[[intel::use_stall_enable_clusters]] void operator ()() const {}
16
17
};
17
18
18
- void test1 () {
19
+ void func1 () {
19
20
auto lambda = []() [[intel::use_stall_enable_clusters]]{};
20
21
lambda ();
21
22
}
@@ -25,30 +26,49 @@ class Foo {
25
26
[[intel::use_stall_enable_clusters]] void operator ()() const {}
26
27
};
27
28
29
+ class Functor {
30
+ public:
31
+ [[intel::use_stall_enable_clusters]] void operator ()() const {}
32
+ };
33
+
28
34
int main () {
29
35
q.submit ([&](handler &h) {
30
- // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel1() #0 !kernel_arg_buffer_location ![[NUM4:[0-9]+]]
31
- // CHECK: define {{.*}}spir_func void @{{.*}}FuncObjclEv(%struct.{{.*}}FuncObj addrspace(4)* align 1 dereferenceable_or_null(1) %this) #3 comdat align 2 !stall_enable ![[NUM5:[0-9]+ ]]
36
+ // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel1() {{.*}} !stall_enable ![[NUM4:[0-9]+]]
37
+ // CHECK: define {{.*}}spir_func void @{{.*}}FuncObjclEv(%struct.{{.*}}FuncObj addrspace(4)* align 1 dereferenceable_or_null(1) %this) #3 comdat align 2 !stall_enable ![[NUM4 ]]
32
38
h.single_task <class test_kernel1 >(
33
39
FuncObj ());
34
40
35
- // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel2() #0 !kernel_arg_buffer_location ![[NUM4]]
36
- // CHECK define {{.*}}spir_func void @{{.*}}FooclEv(%class._ZTS3Foo.Foo addrspace(4)* align 1 dereferenceable_or_null(1) %this) #3 comdat align 2 !stall_enable ![[NUM5 ]]
41
+ // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel2() {{.*}} !stall_enable ![[NUM4]]
42
+ // CHECK define {{.*}}spir_func void @{{.*}}FooclEv(%class._ZTS3Foo.Foo addrspace(4)* align 1 dereferenceable_or_null(1) %this) #3 comdat align 2 !stall_enable ![[NUM4 ]]
37
43
Foo f;
38
44
h.single_task <class test_kernel2 >(f);
39
45
40
- // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel3() #0 !kernel_arg_buffer_location ![[NUM4]]
41
- // CHECK: define {{.*}}spir_func void @_Z4testv() #3 !stall_enable ![[NUM5]]
46
+ // Test attribute is not propagated to the kernel metadata i.e. spir_kernel.
47
+ // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel3()
48
+ // CHECK-NOT: !stall_enable
49
+ // CHECK-SAME: {
50
+ // CHECK: define {{.*}}spir_func void @{{.*}}func{{.*}} !stall_enable ![[NUM4]]
42
51
h.single_task <class test_kernel3 >(
43
- []() { test (); });
52
+ []() { func (); });
44
53
45
- // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel4() #0 !kernel_arg_buffer_location ![[NUM4]]
46
- // CHECK: define {{.*}}spir_func void @{{.*}}test1vENKUlvE_clEv(%class.{{.*}}test1{{.*}}.anon addrspace(4)* align 1 dereferenceable_or_null(1) %this) #4 align 2 !stall_enable ![[NUM5]]
54
+ // Test attribute is not propagated to the kernel metadata i.e. spir_kernel.
55
+ // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel4()
56
+ // CHECK-NOT: !stall_enable
57
+ // CHECK-SAME: {
58
+ // CHECK: define {{.*}}spir_func void @{{.*}}func1{{.*}}(%class.{{.*}}func1{{.*}}.anon addrspace(4)* align 1 dereferenceable_or_null(1) %this) #4 align 2 !stall_enable ![[NUM4]]
47
59
h.single_task <class test_kernel4 >(
48
- []() { test1 (); });
60
+ []() { func1 (); });
61
+
62
+ // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel5() {{.*}} !stall_enable ![[NUM4]]
63
+ h.single_task <class test_kernel5 >(
64
+ []() [[intel::use_stall_enable_clusters]]{});
65
+
66
+ // CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel6() {{.*}} !stall_enable ![[NUM4]]
67
+ // CHECK: define {{.*}}spir_func void @{{.*}}Functor{{.*}}(%class._ZTS7Functor.Functor addrspace(4)* align 1 dereferenceable_or_null(1) %this) #3 comdat align 2 !stall_enable ![[NUM4]]
68
+ Functor f1;
69
+ h.single_task <class test_kernel6 >(f1);
49
70
});
50
71
return 0 ;
51
72
}
52
73
53
- // CHECK: ![[NUM4]] = !{}
54
- // CHECK: ![[NUM5]] = !{i32 1}
74
+ // CHECK: ![[NUM4]] = !{i32 1}
0 commit comments