Skip to content

Commit fcf2965

Browse files
jsjitahonermann
andcommitted
[SYCL] Require emit of sycl_kernel_entry_point attributed functions. #18100 (#29084)
- [SYCL] Require emit of sycl_kernel_entry_point attributed functions. - Remove run configuration lines rather than disabling them. --------- Co-authored-by: Tom Honermann <tom.honermann@intel.com>
1 parent 4110f4e commit fcf2965

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12864,7 +12864,7 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
1286412864
return false;
1286512865

1286612866
if (LangOpts.SYCLIsDevice && !D->hasAttr<OpenCLKernelAttr>() &&
12867-
!D->hasAttr<SYCLDeviceAttr>())
12867+
!D->hasAttr<SYCLDeviceAttr>() && !D->hasAttr<SYCLKernelEntryPointAttr>())
1286812868
return false;
1286912869

1287012870
// Aliases and used decls are required.

clang/test/CodeGenSYCL/kernel-caller-entry-point.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -aux-triple x86_64-pc-windows-msvc -triple amdgcn-amd-amdhsa -std=c++17 %s -o - | FileCheck --check-prefixes=CHECK-DEVICE,CHECK-AMDGCN %s
1111
// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -aux-triple x86_64-pc-windows-msvc -triple nvptx-nvidia-cuda -std=c++17 %s -o - | FileCheck --check-prefixes=CHECK-DEVICE,CHECK-NVPTX %s
1212
// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -aux-triple x86_64-pc-windows-msvc -triple nvptx64-nvidia-cuda -std=c++17 %s -o - | FileCheck --check-prefixes=CHECK-DEVICE,CHECK-NVPTX %s
13-
// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -aux-triple x86_64-pc-windows-msvc -triple spir-unknown-unknown -std=c++17 %s -o - | FileCheck --check-prefixes=CHECK-DEVICE,CHECK-SPIR %s
1413
// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -aux-triple x86_64-pc-windows-msvc -triple spir64-unknown-unknown -std=c++17 %s -o - | FileCheck --check-prefixes=CHECK-DEVICE,CHECK-SPIR %s
15-
// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -aux-triple x86_64-pc-windows-msvc -triple spirv32-unknown-unknown -std=c++17 %s -o - | FileCheck --check-prefixes=CHECK-DEVICE,CHECK-SPIR %s
1614
// RUN: %clang_cc1 -fsycl-is-device -emit-llvm -aux-triple x86_64-pc-windows-msvc -triple spirv64-unknown-unknown -std=c++17 %s -o - | FileCheck --check-prefixes=CHECK-DEVICE,CHECK-SPIR %s
1715

1816
// Test the generation of SYCL kernel caller functions. These functions are
@@ -91,12 +89,6 @@ int main() {
9189
// CHECK-HOST-WINDOWS-NEXT: }
9290

9391
// Verify that SYCL kernel caller functions are emitted for each device target.
94-
//
95-
// FIXME: The following set of matches are used to skip over the declaration of
96-
// main(). main() shouldn't be emitted in device code, but that pruning isn't
97-
// performed yet.
98-
// CHECK-DEVICE: Function Attrs: convergent mustprogress noinline norecurse nounwind optnone
99-
// CHECK-DEVICE-NEXT: define {{[a-z_ ]*}}noundef i32 @main() #0
10092

10193
// IR for the SYCL kernel caller function generated for
10294
// single_purpose_kernel_task with single_purpose_kernel_name as the SYCL kernel
@@ -174,11 +166,11 @@ int main() {
174166
// CHECK-SPIR-NEXT: }
175167
// CHECK-SPIR: define internal spir_func void @_ZZ4mainENKUlT_E_clIiEEDaS_
176168

177-
// CHECK-AMDGCN: #[[AMDGCN_ATTR0]] = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
169+
// CHECK-AMDGCN: #[[AMDGCN_ATTR0]] = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-optlevel"="0" }
178170
// CHECK-AMDGCN: #[[AMDGCN_ATTR1]] = { convergent nounwind }
179171
//
180-
// CHECK-NVPTX: #[[NVPTX_ATTR0]] = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+ptx32" }
172+
// CHECK-NVPTX: #[[NVPTX_ATTR0]] = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-optlevel"="0" "target-features"="+ptx32" }
181173
// CHECK-NVPTX: #[[NVPTX_ATTR1]] = { convergent nounwind }
182174
//
183-
// CHECK-SPIR: #[[SPIR_ATTR0]] = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
175+
// CHECK-SPIR: #[[SPIR_ATTR0]] = { convergent mustprogress noinline norecurse nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-optlevel"="0" }
184176
// CHECK-SPIR: #[[SPIR_ATTR1]] = { convergent nounwind }

0 commit comments

Comments
 (0)