Skip to content

Commit 16f1a5c

Browse files
AaronBallmanAdamGlass
authored andcommitted
Revert "[Driver][SYCL] Add initial SYCL offload compilation support" (llvm#116381)
Reverts llvm#107493 Failing bots include: https://lab.llvm.org/buildbot/#/builders/190/builds/9546 https://lab.llvm.org/buildbot/#/builders/46/builds/7938
1 parent 545c3f1 commit 16f1a5c

File tree

20 files changed

+26
-532
lines changed

20 files changed

+26
-532
lines changed

clang/include/clang/Driver/Action.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ class Action {
9494
OFK_Cuda = 0x02,
9595
OFK_OpenMP = 0x04,
9696
OFK_HIP = 0x08,
97-
OFK_SYCL = 0x10,
9897
};
9998

10099
static const char *getClassName(ActionClass AC);

clang/include/clang/Driver/Driver.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,6 @@ class Driver {
582582
/// @name Helper Methods
583583
/// @{
584584

585-
/// getSYCLDeviceTriple - Returns the SYCL device triple for the
586-
/// specified ArchType.
587-
llvm::Triple getSYCLDeviceTriple(StringRef TargetArch = "spir64") const;
588-
589585
/// PrintActions - Print the list of actions.
590586
void PrintActions(const Compilation &C) const;
591587

clang/include/clang/Driver/Options.td

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ def opencl_Group : OptionGroup<"<opencl group>">, Group<f_Group>,
182182
DocName<"OpenCL options">;
183183

184184
def sycl_Group : OptionGroup<"<SYCL group>">, Group<f_Group>,
185-
DocName<"SYCL options">,
186-
Visibility<[ClangOption, CLOption]>;
185+
DocName<"SYCL options">;
187186

188187
def cuda_Group : OptionGroup<"<CUDA group>">, Group<f_Group>,
189188
DocName<"CUDA options">,
@@ -6809,20 +6808,16 @@ defm : FlangIgnoredDiagOpt<"frontend-loop-interchange">;
68096808
defm : FlangIgnoredDiagOpt<"target-lifetime">;
68106809

68116810
// C++ SYCL options
6812-
let Group = sycl_Group in {
68136811
def fsycl : Flag<["-"], "fsycl">,
6814-
HelpText<"Enables SYCL kernels compilation for device">;
6812+
Visibility<[ClangOption, CLOption]>,
6813+
Group<sycl_Group>, HelpText<"Enables SYCL kernels compilation for device">;
68156814
def fno_sycl : Flag<["-"], "fno-sycl">,
6816-
HelpText<"Disables SYCL kernels compilation for device">;
6817-
def fsycl_device_only : Flag<["-"], "fsycl-device-only">,
6818-
Alias<offload_device_only>, HelpText<"Compile SYCL kernels for device only">;
6819-
def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
6820-
Alias<offload_host_only>, HelpText<"Compile SYCL kernels for host only">;
6815+
Visibility<[ClangOption, CLOption]>,
6816+
Group<sycl_Group>, HelpText<"Disables SYCL kernels compilation for device">;
68216817
def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
6822-
HelpText<"Perform link through clang-sycl-linker via the target "
6818+
Visibility<[ClangOption, CLOption]>,
6819+
Group<sycl_Group>, HelpText<"Perform link through clang-sycl-linker via the target "
68236820
"offloading toolchain.">;
6824-
} // let Group = sycl_Group
6825-
68266821
// OS-specific options
68276822
let Flags = [TargetSpecific] in {
68286823
defm android_pad_segment : BooleanFFlag<"android-pad-segment">, Group<f_Group>;

clang/include/clang/Driver/ToolChain.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,10 +762,6 @@ class ToolChain {
762762
virtual void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
763763
llvm::opt::ArgStringList &CC1Args) const;
764764

765-
/// Add arguments to use system-specific SYCL includes.
766-
virtual void AddSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs,
767-
llvm::opt::ArgStringList &CC1Args) const;
768-
769765
/// Add arguments to use MCU GCC toolchain includes.
770766
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
771767
llvm::opt::ArgStringList &CC1Args) const;

clang/lib/Driver/Action.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ std::string Action::getOffloadingKindPrefix() const {
111111
return "device-openmp";
112112
case OFK_HIP:
113113
return "device-hip";
114-
case OFK_SYCL:
115-
return "device-sycl";
116114

117115
// TODO: Add other programming models here.
118116
}
@@ -130,8 +128,6 @@ std::string Action::getOffloadingKindPrefix() const {
130128
Res += "-hip";
131129
if (ActiveOffloadKindMask & OFK_OpenMP)
132130
Res += "-openmp";
133-
if (ActiveOffloadKindMask & OFK_SYCL)
134-
Res += "-sycl";
135131

136132
// TODO: Add other programming models here.
137133

@@ -168,8 +164,6 @@ StringRef Action::GetOffloadKindName(OffloadKind Kind) {
168164
return "openmp";
169165
case OFK_HIP:
170166
return "hip";
171-
case OFK_SYCL:
172-
return "sycl";
173167

174168
// TODO: Add other programming models here.
175169
}
@@ -326,7 +320,7 @@ void OffloadAction::DeviceDependences::add(Action &A, const ToolChain &TC,
326320
DeviceBoundArchs.push_back(BoundArch);
327321

328322
// Add each active offloading kind from a mask.
329-
for (OffloadKind OKind : {OFK_OpenMP, OFK_Cuda, OFK_HIP, OFK_SYCL})
323+
for (OffloadKind OKind : {OFK_OpenMP, OFK_Cuda, OFK_HIP})
330324
if (OKind & OffloadKindMask)
331325
DeviceOffloadKinds.push_back(OKind);
332326
}

clang/lib/Driver/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ add_clang_library(clangDriver
7777
ToolChains/RISCVToolchain.cpp
7878
ToolChains/Solaris.cpp
7979
ToolChains/SPIRV.cpp
80-
ToolChains/SYCL.cpp
8180
ToolChains/TCE.cpp
8281
ToolChains/UEFI.cpp
8382
ToolChains/VAXToolchain.cpp

clang/lib/Driver/Compilation.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,10 @@ static bool ActionFailed(const Action *A,
214214
if (FailingCommands.empty())
215215
return false;
216216

217-
// CUDA/HIP/SYCL can have the same input source code compiled multiple times
218-
// so do not compile again if there are already failures. It is OK to abort
219-
// the CUDA/HIP/SYCL pipeline on errors.
220-
if (A->isOffloading(Action::OFK_Cuda) || A->isOffloading(Action::OFK_HIP) ||
221-
A->isOffloading(Action::OFK_SYCL))
217+
// CUDA/HIP can have the same input source code compiled multiple times so do
218+
// not compiled again if there are already failures. It is OK to abort the
219+
// CUDA pipeline on errors.
220+
if (A->isOffloading(Action::OFK_Cuda) || A->isOffloading(Action::OFK_HIP))
222221
return true;
223222

224223
for (const auto &CI : FailingCommands)

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "ToolChains/PS4CPU.h"
4444
#include "ToolChains/RISCVToolchain.h"
4545
#include "ToolChains/SPIRV.h"
46-
#include "ToolChains/SYCL.h"
4746
#include "ToolChains/Solaris.h"
4847
#include "ToolChains/TCE.h"
4948
#include "ToolChains/UEFI.h"
@@ -782,27 +781,6 @@ Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const ArgList &Args) const {
782781
return RT;
783782
}
784783

785-
static const char *getDefaultSYCLArch(Compilation &C) {
786-
// If -fsycl is supplied we will assume SPIR-V
787-
if (C.getDefaultToolChain().getTriple().isArch32Bit())
788-
return "spirv32";
789-
return "spirv64";
790-
}
791-
792-
static bool addSYCLDefaultTriple(Compilation &C,
793-
SmallVectorImpl<llvm::Triple> &SYCLTriples) {
794-
for (const auto &SYCLTriple : SYCLTriples) {
795-
if (SYCLTriple.getSubArch() == llvm::Triple::NoSubArch &&
796-
SYCLTriple.isSPIROrSPIRV())
797-
return false;
798-
}
799-
// Add the default triple as it was not found.
800-
llvm::Triple DefaultTriple =
801-
C.getDriver().getSYCLDeviceTriple(getDefaultSYCLArch(C));
802-
SYCLTriples.insert(SYCLTriples.begin(), DefaultTriple);
803-
return true;
804-
}
805-
806784
void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
807785
InputList &Inputs) {
808786

@@ -1016,41 +994,6 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
1016994
return;
1017995
}
1018996

1019-
//
1020-
// SYCL
1021-
//
1022-
// We need to generate a SYCL toolchain if the user specified -fsycl.
1023-
bool IsSYCL = C.getInputArgs().hasFlag(options::OPT_fsycl,
1024-
options::OPT_fno_sycl, false);
1025-
1026-
auto argSYCLIncompatible = [&](OptSpecifier OptId) {
1027-
if (!IsSYCL)
1028-
return;
1029-
if (Arg *IncompatArg = C.getInputArgs().getLastArg(OptId))
1030-
Diag(clang::diag::err_drv_argument_not_allowed_with)
1031-
<< IncompatArg->getSpelling() << "-fsycl";
1032-
};
1033-
// -static-libstdc++ is not compatible with -fsycl.
1034-
argSYCLIncompatible(options::OPT_static_libstdcxx);
1035-
// -ffreestanding cannot be used with -fsycl
1036-
argSYCLIncompatible(options::OPT_ffreestanding);
1037-
1038-
llvm::SmallVector<llvm::Triple, 4> UniqueSYCLTriplesVec;
1039-
1040-
if (IsSYCL) {
1041-
addSYCLDefaultTriple(C, UniqueSYCLTriplesVec);
1042-
1043-
// We'll need to use the SYCL and host triples as the key into
1044-
// getOffloadingDeviceToolChain, because the device toolchains we're
1045-
// going to create will depend on both.
1046-
const ToolChain *HostTC = C.getSingleOffloadToolChain<Action::OFK_Host>();
1047-
for (const auto &TT : UniqueSYCLTriplesVec) {
1048-
auto SYCLTC = &getOffloadingDeviceToolChain(C.getInputArgs(), TT, *HostTC,
1049-
Action::OFK_SYCL);
1050-
C.addOffloadDeviceToolChain(SYCLTC, Action::OFK_SYCL);
1051-
}
1052-
}
1053-
1054997
//
1055998
// TODO: Add support for other offloading programming models here.
1056999
//
@@ -2072,20 +2015,6 @@ void Driver::PrintHelp(bool ShowHidden) const {
20722015
VisibilityMask);
20732016
}
20742017

2075-
llvm::Triple Driver::getSYCLDeviceTriple(StringRef TargetArch) const {
2076-
SmallVector<StringRef, 5> SYCLAlias = {"spir", "spir64", "spirv32",
2077-
"spirv64"};
2078-
if (std::find(SYCLAlias.begin(), SYCLAlias.end(), TargetArch) !=
2079-
SYCLAlias.end()) {
2080-
llvm::Triple TT;
2081-
TT.setArchName(TargetArch);
2082-
TT.setVendor(llvm::Triple::UnknownVendor);
2083-
TT.setOS(llvm::Triple::UnknownOS);
2084-
return TT;
2085-
}
2086-
return llvm::Triple(TargetArch);
2087-
}
2088-
20892018
void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const {
20902019
if (IsFlangMode()) {
20912020
OS << getClangToolFullVersion("flang") << '\n';
@@ -4242,7 +4171,6 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
42424171

42434172
bool UseNewOffloadingDriver =
42444173
C.isOffloadingHostKind(Action::OFK_OpenMP) ||
4245-
C.isOffloadingHostKind(Action::OFK_SYCL) ||
42464174
Args.hasFlag(options::OPT_foffload_via_llvm,
42474175
options::OPT_fno_offload_via_llvm, false) ||
42484176
Args.hasFlag(options::OPT_offload_new_driver,
@@ -4654,8 +4582,6 @@ Driver::getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args,
46544582
Archs.insert(OffloadArchToString(OffloadArch::HIPDefault));
46554583
else if (Kind == Action::OFK_OpenMP)
46564584
Archs.insert(StringRef());
4657-
else if (Kind == Action::OFK_SYCL)
4658-
Archs.insert(StringRef());
46594585
} else {
46604586
Args.ClaimAllArgs(options::OPT_offload_arch_EQ);
46614587
Args.ClaimAllArgs(options::OPT_no_offload_arch_EQ);
@@ -4680,7 +4606,7 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
46804606
OffloadAction::DeviceDependences DDeps;
46814607

46824608
const Action::OffloadKind OffloadKinds[] = {
4683-
Action::OFK_OpenMP, Action::OFK_Cuda, Action::OFK_HIP, Action::OFK_SYCL};
4609+
Action::OFK_OpenMP, Action::OFK_Cuda, Action::OFK_HIP};
46844610

46854611
for (Action::OffloadKind Kind : OffloadKinds) {
46864612
SmallVector<const ToolChain *, 2> ToolChains;
@@ -4725,11 +4651,6 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
47254651
break;
47264652
}
47274653

4728-
// Assemble actions are not used for the SYCL device side. Both compile
4729-
// and backend actions are used to generate IR and textual IR if needed.
4730-
if (Kind == Action::OFK_SYCL && Phase == phases::Assemble)
4731-
continue;
4732-
47334654
auto TCAndArch = TCAndArchs.begin();
47344655
for (Action *&A : DeviceActions) {
47354656
if (A->getType() == types::TY_Nothing)
@@ -4968,7 +4889,6 @@ Action *Driver::ConstructPhaseAction(
49684889
return C.MakeAction<BackendJobAction>(Input, Output);
49694890
}
49704891
if (Args.hasArg(options::OPT_emit_llvm) ||
4971-
TargetDeviceOffloadKind == Action::OFK_SYCL ||
49724892
(((Input->getOffloadingToolChain() &&
49734893
Input->getOffloadingToolChain()->getTriple().isAMDGPU()) ||
49744894
TargetDeviceOffloadKind == Action::OFK_HIP) &&
@@ -6663,19 +6583,6 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
66636583
HostTC, Args);
66646584
break;
66656585
}
6666-
case Action::OFK_SYCL:
6667-
switch (Target.getArch()) {
6668-
case llvm::Triple::spir:
6669-
case llvm::Triple::spir64:
6670-
case llvm::Triple::spirv32:
6671-
case llvm::Triple::spirv64:
6672-
TC = std::make_unique<toolchains::SYCLToolChain>(*this, Target, HostTC,
6673-
Args);
6674-
break;
6675-
default:
6676-
break;
6677-
}
6678-
break;
66796586
default:
66806587
break;
66816588
}

clang/lib/Driver/ToolChain.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,9 +1485,6 @@ void ToolChain::AddCudaIncludeArgs(const ArgList &DriverArgs,
14851485
void ToolChain::AddHIPIncludeArgs(const ArgList &DriverArgs,
14861486
ArgStringList &CC1Args) const {}
14871487

1488-
void ToolChain::AddSYCLIncludeArgs(const ArgList &DriverArgs,
1489-
ArgStringList &CC1Args) const {}
1490-
14911488
llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12>
14921489
ToolChain::getDeviceLibs(const ArgList &DriverArgs) const {
14931490
return {};

0 commit comments

Comments
 (0)