Skip to content

Commit 5da1a25

Browse files
[SYCL][Clang] Add sentinel value to kernel_args_sizes (#20540)
Add sentinel value to compiler generated array kernel_args_sizes in integration header to avoid warnings about empty arrays. This array is used to hold the number of elements in each kernel. This PR changes the type to int to add a sentinel value of std::numeric_limits<uint32_t>::max().
1 parent faa6180 commit 5da1a25

File tree

8 files changed

+11
-7
lines changed

8 files changed

+11
-7
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7056,7 +7056,11 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
70567056
for (unsigned I = 0; I < KernelDescs.size(); I++) {
70577057
O << KernelDescs[I].Params.size() << ", ";
70587058
}
7059+
// Add a sentinel to avoid warning if the collection is empty
7060+
// (similar to what we do for kernel_signatures below).
7061+
O << std::numeric_limits<uint32_t>::max() << ", \n";
70597062
O << "};\n\n";
7063+
70607064
O << "// array representing signatures of all kernels defined in the\n";
70617065
O << "// corresponding source\n";
70627066
O << "static constexpr\n";

clang/test/CodeGenSYCL/int-header-empty-signatures.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// CHECK-NEXT: ""
1111
// CHECK-NEXT: };
1212

13-
// CHECK: static constexpr unsigned kernel_args_sizes[] = {
13+
// CHECK: static constexpr unsigned kernel_args_sizes[] = {0, 4294967295
1414

1515
// CHECK: static constexpr
1616
// CHECK-NEXT: const kernel_param_desc_t kernel_signatures[] = {

clang/test/CodeGenSYCL/integration_header.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// CHECK-NEXT: ""
2626
// CHECK-NEXT: };
2727
//
28-
// CHECK: static constexpr unsigned kernel_args_sizes[] = {
28+
// CHECK: static constexpr unsigned kernel_args_sizes[] = {5, 3, 2, 8, 3, 0, 4294967295,
2929
//
3030
// CHECK: static constexpr
3131
// CHECK-NEXT: const kernel_param_desc_t kernel_signatures[] = {

clang/test/CodeGenSYCL/kernel-param-acc-array-ih.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// CHECK-NEXT: ""
1919
// CHECK-NEXT: };
2020

21-
// CHECK: static constexpr unsigned kernel_args_sizes[] = {
21+
// CHECK: static constexpr unsigned kernel_args_sizes[] = {2, 4294967295,
2222

2323
// CHECK: static constexpr
2424
// CHECK-NEXT: const kernel_param_desc_t kernel_signatures[] = {

clang/test/CodeGenSYCL/kernel-param-member-acc-array-ih.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// CHECK-NEXT: ""
1919
// CHECK-NEXT: };
2020

21-
// CHECK: static constexpr unsigned kernel_args_sizes[] = {
21+
// CHECK: static constexpr unsigned kernel_args_sizes[] = {2, 4294967295,
2222

2323
// CHECK: static constexpr
2424
// CHECK-NEXT: const kernel_param_desc_t kernel_signatures[] = {

clang/test/CodeGenSYCL/kernel-param-pod-array-ih.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// CHECK-NEXT: ""
2020
// CHECK-NEXT: };
2121

22-
// CHECK: static constexpr unsigned kernel_args_sizes[] = {
22+
// CHECK: static constexpr unsigned kernel_args_sizes[] = {1, 1, 1, 4294967295,
2323

2424
// CHECK: static constexpr
2525
// CHECK-NEXT: const kernel_param_desc_t kernel_signatures[] = {

clang/test/CodeGenSYCL/union-kernel-param-ih.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// CHECK-NEXT: ""
1919
// CHECK-NEXT: };
2020

21-
// CHECK: static constexpr unsigned kernel_args_sizes[] = {
21+
// CHECK: static constexpr unsigned kernel_args_sizes[] = {1, 4294967295,
2222

2323
// CHECK: static constexpr
2424
// CHECK-NEXT: const kernel_param_desc_t kernel_signatures[] = {

clang/test/CodeGenSYCL/wrapped-accessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// CHECK-NEXT: ""
1616
// CHECK-NEXT: };
1717

18-
// CHECK: static constexpr unsigned kernel_args_sizes[] = {
18+
// CHECK: static constexpr unsigned kernel_args_sizes[] = {1, 4294967295,
1919

2020
// CHECK: static constexpr
2121
// CHECK-NEXT: const kernel_param_desc_t kernel_signatures[] = {

0 commit comments

Comments
 (0)