You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] Improve error diagnostic for invalid SYCL kernel name (#4867)
According to SYCL 2020 spec:
The kernel name must be forward declarable at namespace scope (including global namespace scope) and may not be forward declared other than at namespace scope.
The use of nested struct-case (where the name IS globally visible but just not forward-declarable) in a SYCL kernel name currently generates invalid error message:
error: '{{.*}}' should be globally visible
This patch modifies the error diagnostic message when the kernel name is declared at non-namespace scope (i.e. Inside a function or class/struct).
Signed-off-by: Soumi Manna soumi.manna@intel.com
Copy file name to clipboardExpand all lines: clang/test/SemaSYCL/unnamed-kernel.cpp
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -32,27 +32,27 @@ struct MyWrapper {
32
32
public:
33
33
voidtest() {
34
34
cl::sycl::queue q;
35
-
// expected-error@#KernelSingleTask {{'InvalidKernelName1' should be globally visible}}
35
+
// expected-error@#KernelSingleTask {{'InvalidKernelName1' is invalid; kernel name should be forward declarable at namespace scope}}
36
36
// expected-note@+3{{in instantiation of function template specialization}}
37
37
classInvalidKernelName1 {};
38
38
q.submit([&](cl::sycl::handler &h) {
39
39
h.single_task<InvalidKernelName1>([] {});
40
40
});
41
41
42
-
// expected-error@#KernelSingleTask {{'namespace1::KernelName<InvalidKernelName2>' should be globally visible}}
42
+
// expected-error@#KernelSingleTask {{'namespace1::KernelName<InvalidKernelName2>' is invalid; kernel name should be forward declarable at namespace scope}}
43
43
// expected-note@+3{{in instantiation of function template specialization}}
// expected-error@#KernelSingleTask {{'MyWrapper::InvalidKernelName0' should be globally visible}}
49
+
// expected-error@#KernelSingleTask {{'MyWrapper::InvalidKernelName0' is invalid; kernel name should be forward declarable at namespace scope}}
50
50
// expected-note@+2{{in instantiation of function template specialization}}
51
51
q.submit([&](cl::sycl::handler &h) {
52
52
h.single_task<InvalidKernelName0>([] {});
53
53
});
54
54
55
-
// expected-error@#KernelSingleTask {{'namespace1::KernelName<MyWrapper::InvalidKernelName3>' should be globally visible}}
55
+
// expected-error@#KernelSingleTask {{'namespace1::KernelName<MyWrapper::InvalidKernelName3>' is invalid; kernel name should be forward declarable at namespace scope}}
56
56
// expected-note@+2{{in instantiation of function template specialization}}
// expected-error@#KernelSingleTask {{'MyWrapper::InvalidKernelName4' should be globally visible}}
73
+
// expected-error@#KernelSingleTask {{'MyWrapper::InvalidKernelName4' is invalid; kernel name should be forward declarable at namespace scope}}
74
74
// expected-note@+2{{in instantiation of function template specialization}}
75
75
q.submit([&](cl::sycl::handler &h) {
76
76
h.single_task<InvalidAlias>([] {});
77
77
});
78
78
79
79
using InvalidAlias1 = InvalidKernelName5;
80
-
// expected-error@#KernelSingleTask {{'namespace1::KernelName<MyWrapper::InvalidKernelName5>' should be globally visible}}
80
+
// expected-error@#KernelSingleTask {{'namespace1::KernelName<MyWrapper::InvalidKernelName5>' is invalid; kernel name should be forward declarable at namespace scope}}
81
81
// expected-note@+2{{in instantiation of function template specialization}}
// expected-error@#KernelSingleTask {{'Templated_kernel_name2<Templated_kernel_name<InvalidKernelName1>>' should be globally visible}}
85
+
// expected-error@#KernelSingleTask {{'Templated_kernel_name2<Templated_kernel_name<InvalidKernelName1>>' is invalid; kernel name should be forward declarable at namespace scope}}
86
86
// expected-note@+2{{in instantiation of function template specialization}}
0 commit comments