Skip to content

Commit c7f6229

Browse files
authored
[SYCL] [NATIVECPU] Avoid passing -emit-only-kernels-as-entry-point on native cpu (#12191)
Similarly to NVPTX and AMD, Native CPU needs to not set ` -emit-only-kernels-as-entry-point` since kernels for this target are not identified by the calling convention.
1 parent 6465518 commit c7f6229

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10283,7 +10283,8 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
1028310283
// TODO: Try to extend this feature for non-Intel GPUs.
1028410284
if (!TCArgs.hasFlag(options::OPT_fno_sycl_remove_unused_external_funcs,
1028510285
options::OPT_fsycl_remove_unused_external_funcs, false) &&
10286-
!T.isNVPTX() && !T.isAMDGPU())
10286+
!T.isNVPTX() && !T.isAMDGPU() &&
10287+
!isSYCLNativeCPU(getToolChain(), C.getDefaultToolChain()))
1028710288
addArgs(CmdArgs, TCArgs, {"-emit-only-kernels-as-entry-points"});
1028810289

1028910290
// OPT_fsycl_device_code_split is not checked as it is an alias to

clang/test/Driver/sycl-native-cpu-fsycl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
//CHECK_INVO:{{.*}}clang{{.*}}-fsycl-is-device{{.*}}"-fsycl-is-native-cpu" "-D" "__SYCL_NATIVE_CPU__"
4141
//CHECK_INVO:{{.*}}clang{{.*}}"-x" "ir"
42+
//CHECK_INVO-NOT:{{.*}}sycl-post-link{{.*}}-emit-only-kernels-as-entry-points
4243
//CHECK_INVO:{{.*}}clang{{.*}}"-fsycl-is-host"{{.*}}
4344

4445
// checks that the device and host triple is correct in the generated actions when it is set explicitly

0 commit comments

Comments
 (0)