Skip to content

Commit 566fc15

Browse files
authored
[SYCL][NativeCPU] Remove -fsycl-is-native-cpu. (#19446)
Now that we are able to check whether the triple is native_cpu, we no longer need this additional compiler option.
1 parent ede5e44 commit 566fc15

File tree

18 files changed

+22
-81
lines changed

18 files changed

+22
-81
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9032,10 +9032,6 @@ def fenable_sycl_dae : Flag<["-"], "fenable-sycl-dae">,
90329032
def fsycl_enable_int_header_diags: Flag<["-"], "fsycl-enable-int-header-diags">,
90339033
HelpText<"Enable diagnostics that require the SYCL integration header.">,
90349034
MarshallingInfoFlag<LangOpts<"SYCLEnableIntHeaderDiags">>;
9035-
def fsycl_is_native_cpu : Flag<["-"], "fsycl-is-native-cpu">,
9036-
HelpText<"Perform device compilation for Native CPU.">,
9037-
Visibility<[CC1Option]>,
9038-
MarshallingInfoFlag<LangOpts<"SYCLIsNativeCPU">>;
90399035
// TODO: This option can be removed once a fix goes in that can
90409036
// work with the community changes for using the alloca address space.
90419037
defm offload_use_alloca_addrspace_for_srets : BoolFOption<"offload-use-alloca-addrspace-for-srets",

clang/lib/AST/MicrosoftMangle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,12 +3219,12 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(CallingConv CC,
32193219
Out << "w";
32203220
return;
32213221
case CC_OpenCLKernel:
3222-
// This can occur on the SYCl NativeCPU device
3222+
// This can occur on the SYCL NativeCPU device
32233223
// where device code is compiled with the same
32243224
// target triple (eg for Windows) as host code.
32253225
// FIXME: 1.) provide mangling if needed
32263226
// 2.) check if other conventions need to be handled.
3227-
if (!getASTContext().getLangOpts().SYCLIsNativeCPU)
3227+
if (!getASTContext().getTargetInfo().getTriple().isNativeCPU())
32283228
// Currently we only allow this convention in
32293229
// SYCLNativeCPU and raise the usual error otherwise.
32303230
llvm_unreachable("Unsupported CC for mangling");

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,8 +1396,6 @@ void CodeGenModule::Release() {
13961396

13971397
if (LangOpts.SYCLIsDevice) {
13981398
getModule().addModuleFlag(llvm::Module::Error, "sycl-device", 1);
1399-
if (LangOpts.SYCLIsNativeCPU)
1400-
getModule().addModuleFlag(llvm::Module::Error, "is-native-cpu", 1);
14011399
}
14021400

14031401
if (LangOpts.EHAsynch)
@@ -6955,8 +6953,7 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD,
69556953
if (GD.getKernelReferenceKind() == KernelReferenceKind::Stub &&
69566954
!D->hasAttr<NoInlineAttr>() &&
69576955
!Fn->hasFnAttribute(llvm::Attribute::NoInline) &&
6958-
!D->hasAttr<OptimizeNoneAttr>() && !LangOpts.SYCLIsNativeCPU &&
6959-
!LangOpts.SYCLIsDevice &&
6956+
!D->hasAttr<OptimizeNoneAttr>() && !LangOpts.SYCLIsDevice &&
69606957
!Fn->hasFnAttribute(llvm::Attribute::OptimizeNone) &&
69616958
!ShouldAddOptNone) {
69626959
Fn->addFnAttr(llvm::Attribute::AlwaysInline);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5696,7 +5696,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
56965696
CmdArgs.push_back("-sycl-opt");
56975697
}
56985698
if (RawTriple.isNativeCPU()) {
5699-
CmdArgs.push_back("-fsycl-is-native-cpu");
57005699
CmdArgs.push_back("-D");
57015700
CmdArgs.push_back("__SYCL_NATIVE_CPU__");
57025701
CmdArgs.push_back("-fno-autolink");

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
15491549
const llvm::Triple::SubArchType SubArch = Triple.getSubArch();
15501550
if (Triple.isNVPTX() || Triple.isAMDGPU() ||
15511551
(Triple.isSPIR() && SubArch != llvm::Triple::SPIRSubArch_fpga) ||
1552-
LangOpts.SYCLIsNativeCPU)
1552+
Triple.isNativeCPU())
15531553
Builder.defineMacro("SYCL_USE_NATIVE_FP_ATOMICS");
15541554
// Enable generation of USM address spaces for FPGA.
15551555
if (SubArch == llvm::Triple::SPIRSubArch_fpga) {

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ constructKernelName(SemaSYCL &S, const FunctionDecl *KernelCallerFunc,
13031303
// instead to always compile the NativeCPU device code in GNU mode which
13041304
// may cause issues when compiling headers with non-standard extensions
13051305
// written for compilers with different C++ ABIs (like MS VS).
1306-
if (S.getLangOpts().SYCLIsNativeCPU) {
1306+
if (S.getASTContext().getTargetInfo().getTriple().isNativeCPU()) {
13071307
MangledName = StableName;
13081308
}
13091309

clang/test/CodeGenSYCL/native_cpu_as.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// This test is temporarily disabled for SYCL Native CPU on Windows
22
// UNSUPPORTED: system-windows
3-
// Checks that name mangling matches between SYCL Native CPU and OpenCL when -fsycl-is-native-cpu is set
4-
// RUN: %clang_cc1 -triple=native_cpu -DCPP -fsycl-is-device -emit-llvm -internal-isystem %S/Inputs -fsycl-is-native-cpu -o %t_sycl.ll %s
3+
// Checks that name mangling matches between SYCL Native CPU and OpenCL
4+
// RUN: %clang_cc1 -triple=native_cpu -DCPP -fsycl-is-device -emit-llvm -internal-isystem %S/Inputs -o %t_sycl.ll %s
55
// RUN: FileCheck -input-file=%t_sycl.ll %s
66

7-
// RUN: %clang_cc1 -triple=native_cpu -x cl -DOCL -emit-llvm -internal-isystem %S/Inputs -fsycl-is-native-cpu -o %t_ocl.ll %s
7+
// RUN: %clang_cc1 -triple=native_cpu -x cl -DOCL -emit-llvm -internal-isystem %S/Inputs -o %t_ocl.ll %s
88
// RUN: FileCheck -input-file=%t_ocl.ll %s
99

1010
#ifdef CPP

clang/test/CodeGenSYCL/native_cpu_basic.cpp

Lines changed: 0 additions & 38 deletions
This file was deleted.

clang/test/CodeGenSYCL/native_cpu_mangling.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// This test ensures the native-cpu device generates the expected kernel names,
22
// and that the MS mangler doesn't assert on the code below.
33

4-
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -aux-triple x86_64-pc-windows-msvc -I %S/Inputs -fsycl-is-device -fsycl-is-native-cpu -emit-llvm -o - -x c++ %s | FileCheck %s
5-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -aux-triple x86_64-unknown-linux-gnu -I %S/Inputs -fsycl-is-device -fsycl-is-native-cpu -emit-llvm -o - -x c++ %s | FileCheck %s
6-
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -aux-triple x86_64-pc-windows-msvc -I %S/Inputs -fsycl-is-device -fsycl-is-native-cpu -emit-llvm -o - -x c++ %s | FileCheck %s
7-
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -aux-triple x86_64-unknown-linux-gnu -I %S/Inputs -fsycl-is-device -fsycl-is-native-cpu -emit-llvm -o - -x c++ %s | FileCheck %s
4+
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-pc-windows-msvc -I %S/Inputs -fsycl-is-device -emit-llvm -o - -x c++ %s | FileCheck %s
5+
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -I %S/Inputs -fsycl-is-device -emit-llvm -o - -x c++ %s | FileCheck %s
6+
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-pc-windows-msvc -I %S/Inputs -fsycl-is-device -emit-llvm -o - -x c++ %s | FileCheck %s
7+
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -I %S/Inputs -fsycl-is-device -emit-llvm -o - -x c++ %s | FileCheck %s
88
// Todo: check other cpus
99

1010
#include "sycl.hpp"

clang/test/CodeGenSYCL/native_cpu_target_features.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -fsycl-is-device -emit-llvm -fsycl-is-native-cpu -o - %s | FileCheck %s --check-prefixes=CHECK,NOAVX
2-
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -aux-target-cpu skylake -fsycl-is-device -emit-llvm -fsycl-is-native-cpu -o - %s | FileCheck %s --check-prefixes=CHECK,AVX
3-
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -aux-target-feature +avx -fsycl-is-device -emit-llvm -fsycl-is-native-cpu -o - %s | FileCheck %s --check-prefixes=CHECK,AVX
1+
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -fsycl-is-device -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,NOAVX
2+
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -aux-target-cpu skylake -fsycl-is-device -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,AVX
3+
// RUN: %clang_cc1 -triple native_cpu -aux-triple x86_64-unknown-linux-gnu -aux-target-feature +avx -fsycl-is-device -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,AVX
44
//
55
// This is not sensible but check that we do not crash.
6-
// RUN: %clang_cc1 -triple native_cpu -aux-triple native_cpu -fsycl-is-device -emit-llvm -fsycl-is-native-cpu -o - %s | FileCheck %s --check-prefixes=CHECK,NOAVX
6+
// RUN: %clang_cc1 -triple native_cpu -aux-triple native_cpu -fsycl-is-device -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,NOAVX
77

88
#include "Inputs/sycl.hpp"
99
using namespace sycl;

0 commit comments

Comments
 (0)