Skip to content

Commit b9c9109

Browse files
committed
Round two of addressing code review feedback from Erich Keane.
Changes include: - Removal of an unneeded inclusion of <string>. - An update to the `sycl_kernel_entry_point` attribute documentation. - Updates to the AST test to validate next line proximity where applicable.
1 parent c2f24ed commit b9c9109

File tree

3 files changed

+47
-42
lines changed

3 files changed

+47
-42
lines changed

clang/include/clang/AST/SYCLKernelInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include "clang/AST/Decl.h"
1717
#include "clang/AST/Type.h"
18-
#include <string>
1918

2019
namespace clang {
2120

clang/include/clang/Basic/AttrDocs.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,12 @@ There are a few items worthy of note:
602602
a data member of a SYCL special type. It therefore does not need to be
603603
decomposed into its constituent members to be passed as a kernel argument.
604604

605+
#. The depiction of the ``sycl::stream`` parameter as a single self contained
606+
kernel parameter is an oversimplification. SYCL special types may require
607+
additional decomposition such that the generated function might have three
608+
or more parameters depending on how the SYCL library implementation defines
609+
these types.
610+
605611
#. The call to ``kernel_entry_point()`` has no effect other than to trigger
606612
emission of the entry point function. The statments that make up the body
607613
of the function are not executed when the function is called; they are

clang/test/ASTSYCL/ast-dump-sycl-kernel-entry-point.cpp

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,58 +31,58 @@ template<int, int=0> struct KN;
3131
__attribute__((sycl_kernel_entry_point(KN<1>)))
3232
void skep1() {
3333
}
34-
// CHECK: |-FunctionDecl {{.*}} skep1 'void ()'
35-
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN<1>
34+
// CHECK: |-FunctionDecl {{.*}} skep1 'void ()'
35+
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN<1>
3636

3737
using KN2 = KN<2>;
3838
__attribute__((sycl_kernel_entry_point(KN2)))
3939
void skep2() {
4040
}
41-
// CHECK: |-FunctionDecl {{.*}} skep2 'void ()'
42-
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN2
41+
// CHECK: |-FunctionDecl {{.*}} skep2 'void ()'
42+
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN2
4343

4444
template<int I> using KNT = KN<I>;
4545
__attribute__((sycl_kernel_entry_point(KNT<3>)))
4646
void skep3() {
4747
}
48-
// CHECK: |-FunctionDecl {{.*}} skep3 'void ()'
49-
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KNT<3>
48+
// CHECK: |-FunctionDecl {{.*}} skep3 'void ()'
49+
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KNT<3>
5050

5151
template<typename KNT, typename F>
5252
[[clang::sycl_kernel_entry_point(KNT)]]
5353
void skep4(F f) {
5454
f();
5555
}
56-
// CHECK: |-FunctionTemplateDecl {{.*}} skep4
57-
// CHECK: | |-TemplateTypeParmDecl {{.*}} KNT
58-
// CHECK: | |-TemplateTypeParmDecl {{.*}} F
59-
// CHECK: | |-FunctionDecl {{.*}} skep4 'void (F)'
60-
// CHECK: | | `-SYCLKernelEntryPointAttr {{.*}} KNT
56+
// CHECK: |-FunctionTemplateDecl {{.*}} skep4
57+
// CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} KNT
58+
// CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} F
59+
// CHECK-NEXT: | |-FunctionDecl {{.*}} skep4 'void (F)'
60+
// CHECK: | | `-SYCLKernelEntryPointAttr {{.*}} KNT
6161

6262
void test_skep4() {
6363
skep4<KNT<4>>([]{});
6464
}
65-
// CHECK: | `-FunctionDecl {{.*}} used skep4 'void ((lambda at {{.*}}))' implicit_instantiation
66-
// CHECK: | |-TemplateArgument type 'KN<4>'
67-
// CHECK: | |-TemplateArgument type '(lambda at {{.*}})'
68-
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} struct KN<4>
69-
// CHECK: |-FunctionDecl {{.*}} test_skep4 'void ()'
65+
// CHECK: | `-FunctionDecl {{.*}} used skep4 'void ((lambda at {{.*}}))' implicit_instantiation
66+
// CHECK-NEXT: | |-TemplateArgument type 'KN<4>'
67+
// CHECK: | |-TemplateArgument type '(lambda at {{.*}})'
68+
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} struct KN<4>
69+
// CHECK-NEXT: |-FunctionDecl {{.*}} test_skep4 'void ()'
7070

7171
template<typename KNT, typename T>
7272
[[clang::sycl_kernel_entry_point(KNT)]]
7373
void skep5(T) {
7474
}
75-
// CHECK: |-FunctionTemplateDecl {{.*}} skep5
76-
// CHECK: | |-TemplateTypeParmDecl {{.*}} KNT
77-
// CHECK: | |-TemplateTypeParmDecl {{.*}} T
78-
// CHECK: | |-FunctionDecl {{.*}} skep5 'void (T)'
79-
// CHECK: | | `-SYCLKernelEntryPointAttr {{.*}} KNT
75+
// CHECK: |-FunctionTemplateDecl {{.*}} skep5
76+
// CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} KNT
77+
// CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} T
78+
// CHECK-NEXT: | |-FunctionDecl {{.*}} skep5 'void (T)'
79+
// CHECK: | | `-SYCLKernelEntryPointAttr {{.*}} KNT
8080

8181
// Checks for the explicit template instantiation declaration below.
82-
// CHECK: | `-FunctionDecl {{.*}} skep5 'void (int)' explicit_instantiation_definition
83-
// CHECK: | |-TemplateArgument type 'KN<5, 4>'
84-
// CHECK: | |-TemplateArgument type 'int'
85-
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN<5, 4>
82+
// CHECK: | `-FunctionDecl {{.*}} skep5 'void (int)' explicit_instantiation_definition
83+
// CHECK-NEXT: | |-TemplateArgument type 'KN<5, 4>'
84+
// CHECK: | |-TemplateArgument type 'int'
85+
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN<5, 4>
8686

8787
// FIXME: C++23 [temp.expl.spec]p12 states:
8888
// FIXME: ... Similarly, attributes appearing in the declaration of a template
@@ -93,28 +93,28 @@ void skep5(T) {
9393
template<>
9494
void skep5<KN<5,1>>(short) {
9595
}
96-
// CHECK: |-FunctionDecl {{.*}} prev {{.*}} skep5 'void (short)' explicit_specialization
97-
// CHECK: | |-TemplateArgument type 'KN<5, 1>'
98-
// CHECK: | |-TemplateArgument type 'short'
99-
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} Inherited struct KN<5, 1>
96+
// CHECK: |-FunctionDecl {{.*}} prev {{.*}} skep5 'void (short)' explicit_specialization
97+
// CHECK-NEXT: | |-TemplateArgument type 'KN<5, 1>'
98+
// CHECK: | |-TemplateArgument type 'short'
99+
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} Inherited struct KN<5, 1>
100100

101101
template<>
102102
[[clang::sycl_kernel_entry_point(KN<5,2>)]]
103103
void skep5<KN<5,2>>(long) {
104104
}
105-
// CHECK: |-FunctionDecl {{.*}} prev {{.*}} skep5 'void (long)' explicit_specialization
106-
// CHECK: | |-TemplateArgument type 'KN<5, 2>'
107-
// CHECK: | |-TemplateArgument type 'long'
108-
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN<5, 2>
105+
// CHECK: |-FunctionDecl {{.*}} prev {{.*}} skep5 'void (long)' explicit_specialization
106+
// CHECK-NEXT: | |-TemplateArgument type 'KN<5, 2>'
107+
// CHECK: | |-TemplateArgument type 'long'
108+
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN<5, 2>
109109

110110
template<>
111111
[[clang::sycl_kernel_entry_point(KN<5,3>)]]
112112
void skep5<KN<5,-1>>(long long) {
113113
}
114-
// CHECK: |-FunctionDecl {{.*}} prev {{.*}} skep5 'void (long long)' explicit_specialization
115-
// CHECK: | |-TemplateArgument type 'KN<5, -1>'
116-
// CHECK: | |-TemplateArgument type 'long long'
117-
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN<5, 3>
114+
// CHECK: |-FunctionDecl {{.*}} prev {{.*}} skep5 'void (long long)' explicit_specialization
115+
// CHECK-NEXT: | |-TemplateArgument type 'KN<5, -1>'
116+
// CHECK: | |-TemplateArgument type 'long long'
117+
// CHECK: | `-SYCLKernelEntryPointAttr {{.*}} KN<5, 3>
118118

119119
template void skep5<KN<5,4>>(int);
120120
// Checks are located with the primary template declaration above.
@@ -127,18 +127,18 @@ void skep6() {
127127
}
128128
// CHECK: |-FunctionDecl {{.*}} skep6 'void ()'
129129
// CHECK-NEXT: | `-SYCLKernelEntryPointAttr {{.*}} KN<6>
130-
// CHECK: |-FunctionDecl {{.*}} prev {{.*}} skep6 'void ()'
131-
// CHECK: | |-CompoundStmt {{.*}}
130+
// CHECK-NEXT: |-FunctionDecl {{.*}} prev {{.*}} skep6 'void ()'
131+
// CHECK-NEXT: | |-CompoundStmt {{.*}}
132132
// CHECK-NEXT: | `-SYCLKernelEntryPointAttr {{.*}} KN<6>
133133

134134
// Ensure that matching attributes from the same declaration are ok.
135135
[[clang::sycl_kernel_entry_point(KN<7>), clang::sycl_kernel_entry_point(KN<7>)]]
136136
void skep7() {
137137
}
138138
// CHECK: |-FunctionDecl {{.*}} skep7 'void ()'
139-
// CHECK: | |-CompoundStmt {{.*}}
139+
// CHECK-NEXT: | |-CompoundStmt {{.*}}
140140
// CHECK-NEXT: | |-SYCLKernelEntryPointAttr {{.*}} KN<7>
141141
// CHECK-NEXT: | `-SYCLKernelEntryPointAttr {{.*}} KN<7>
142142

143143
void the_end() {}
144-
// CHECK: `-FunctionDecl {{.*}} the_end 'void ()'
144+
// CHECK: `-FunctionDecl {{.*}} the_end 'void ()'

0 commit comments

Comments
 (0)