Skip to content

Commit 376d388

Browse files
authored
[Driver][NFC][FPGA] Remove remaining FPGA offload support in driver (#18087)
Following 491915b, remove the remaining items in the driver that support FPGA. Small exceptions to this include any specific diagnostic behaviors that inform the user of option usage that is not supported due to the removal of FPGA. Cleanup of those items can occur following a later major release. The extension enabling options for the `sycl-post-link` tool specific for fpga also remain for now.
1 parent cec6c48 commit 376d388

File tree

12 files changed

+79
-794
lines changed

12 files changed

+79
-794
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7145,10 +7145,13 @@ defm sycl_force_inline_kernel_lambda
71457145
NegFlag<SetFalse, [], [ClangOption, CLOption], "Disallow">,
71467146
BothFlags<[], [ClangOption, CLOption, CC1Option], " force inline "
71477147
"SYCL kernels lambda in entry point">>;
7148-
def fsycl_help_EQ : Joined<["-"], "fsycl-help=">, Flags<[NoXarchOption]>,
7149-
HelpText<"Emit help information from the related offline compilation tool. "
7150-
"Valid values: all, fpga, gen, x86_64.">,
7151-
Values<"all,fpga,gen,x86_64">;
7148+
def fsycl_help_EQ
7149+
: Joined<["-"], "fsycl-help=">,
7150+
Flags<[NoXarchOption]>,
7151+
HelpText<
7152+
"Emit help information from the related offline compilation tool. "
7153+
"Valid values: all, gen, x86_64.">,
7154+
Values<"all,gen,x86_64">;
71527155
def fsycl_help : Flag<["-"], "fsycl-help">, Alias<fsycl_help_EQ>,
71537156
Flags<[NoXarchOption]>, AliasArgs<["all"]>,
71547157
HelpText<"Emit help information from all of the offline compilation tools">;

clang/include/clang/Driver/Types.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ TYPE("tempfiletable", Tempfiletable,INVALID, "table", phases
125125
TYPE("tempAOCOfilelist", TempAOCOfilelist, INVALID, "txt", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
126126
TYPE("archive", Archive, INVALID, "a", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
127127
TYPE("wholearchive", WholeArchive, INVALID, "a", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
128-
TYPE("fpga_dep", FPGA_Dependencies, INVALID, "d", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
129128
TYPE("host_dep_image", Host_Dependencies_Image, INVALID, "out", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
130129
TYPE("api-information", API_INFO, INVALID, "json", phases::Precompile)
131130
TYPE("dx-container", DX_CONTAINER, INVALID, "dxo", phases::Compile, phases::Backend)

clang/lib/Driver/Driver.cpp

Lines changed: 33 additions & 209 deletions
Large diffs are not rendered by default.

clang/lib/Driver/OffloadBundler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ bool OffloadTargetInfo::hasHostKind() const {
154154

155155
bool OffloadTargetInfo::isOffloadKindValid() const {
156156
return OffloadKind == "host" || OffloadKind == "openmp" ||
157-
OffloadKind == "sycl" || OffloadKind == "fpga" ||
158-
OffloadKind == "hip" || OffloadKind == "hipv4";
157+
OffloadKind == "sycl" || OffloadKind == "hip" ||
158+
OffloadKind == "hipv4";
159159
}
160160

161161
bool OffloadTargetInfo::isOffloadKindCompatible(

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 32 additions & 208 deletions
Large diffs are not rendered by default.

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -308,42 +308,6 @@ static bool getStatic(const ArgList &Args) {
308308
!Args.hasArg(options::OPT_static_pie);
309309
}
310310

311-
// Create an archive with llvm-ar. This is used to create an archive that
312-
// contains host objects and the wrapped FPGA device binary
313-
void tools::gnutools::Linker::constructLLVMARCommand(
314-
Compilation &C, const JobAction &JA, const InputInfo &Output,
315-
const InputInfoList &Input, const ArgList &Args) const {
316-
ArgStringList CmdArgs;
317-
// Use 'cqL' to create the archive. This allows for any fat archives that
318-
// are passed on the command line to be added via contents instead of the
319-
// full archive. Any usage of the generated archive will then have full
320-
// access to resolve any dependencies.
321-
CmdArgs.push_back("cqL");
322-
const char *OutputFilename = Output.getFilename();
323-
if (llvm::sys::fs::exists(OutputFilename)) {
324-
C.getDriver().Diag(clang::diag::warn_drv_existing_archive_append)
325-
<< OutputFilename;
326-
}
327-
CmdArgs.push_back(OutputFilename);
328-
for (const auto &II : Input) {
329-
if (II.getType() == types::TY_Tempfilelist) {
330-
// Take the list file and pass it in with '@'.
331-
std::string FileName(II.getFilename());
332-
const char *ArgFile = Args.MakeArgString("@" + FileName);
333-
CmdArgs.push_back(ArgFile);
334-
continue;
335-
}
336-
if (II.isFilename())
337-
CmdArgs.push_back(II.getFilename());
338-
}
339-
340-
SmallString<128> LLVMARPath(C.getDriver().Dir);
341-
llvm::sys::path::append(LLVMARPath, "llvm-ar");
342-
const char *Exec = C.getArgs().MakeArgString(LLVMARPath);
343-
C.addCommand(std::make_unique<Command>(
344-
JA, *this, ResponseFileSupport::None(), Exec, CmdArgs, std::nullopt));
345-
}
346-
347311
void tools::gnutools::StaticLibTool::ConstructJob(
348312
Compilation &C, const JobAction &JA, const InputInfo &Output,
349313
const InputInfoList &Inputs, const ArgList &Args,
@@ -413,12 +377,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
413377
ToolChain.getTriple().hasEnvironment() ||
414378
(ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);
415379

416-
// Use of -fsycl-link creates an archive.
417-
if (Args.hasArg(options::OPT_fsycl_link_EQ) &&
418-
JA.getType() == types::TY_Archive) {
419-
constructLLVMARCommand(C, JA, Output, Inputs, Args);
420-
return;
421-
}
422380
ArgStringList CmdArgs;
423381

424382
// Silence warning for "clang -g foo.o -o foo"
@@ -739,10 +697,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
739697
else
740698
CmdArgs.push_back("-lsycl");
741699
CmdArgs.push_back("-lsycl-devicelib-host");
742-
// Use of -fintelfpga implies -lOpenCL.
743-
// FIXME: Adjust to use plugin interface when available.
744-
if (Args.hasArg(options::OPT_fintelfpga))
745-
CmdArgs.push_back("-lOpenCL");
746700
}
747701

748702
// LLVM support for atomics on 32-bit SPARC V8+ is incomplete, so

clang/lib/Driver/ToolChains/Gnu.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,6 @@ class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
6363
const InputInfo &Output, const InputInfoList &Inputs,
6464
const llvm::opt::ArgList &TCArgs,
6565
const char *LinkingOutput) const override;
66-
67-
private:
68-
void constructLLVMARCommand(Compilation &C, const JobAction &JA,
69-
const InputInfo &Output,
70-
const InputInfoList &InputFiles,
71-
const llvm::opt::ArgList &Args) const;
7266
};
7367

7468
class LLVM_LIBRARY_VISIBILITY StaticLibTool : public Tool {

clang/lib/Driver/ToolChains/MSVC.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -65,55 +65,13 @@ static std::string FindVisualStudioExecutable(const ToolChain &TC,
6565
return std::string(canExecute(TC.getVFS(), FilePath) ? FilePath.str() : Exe);
6666
}
6767

68-
// Add a call to lib.exe to create an archive. This is used to embed host
69-
// objects into the bundled fat FPGA device binary.
70-
void visualstudio::Linker::constructMSVCLibCommand(Compilation &C,
71-
const JobAction &JA,
72-
const InputInfo &Output,
73-
const InputInfoList &Input,
74-
const ArgList &Args) const {
75-
ArgStringList CmdArgs;
76-
for (const auto &II : Input) {
77-
if (II.getType() == types::TY_Tempfilelist) {
78-
// Take the list file and pass it in with '@'.
79-
std::string FileName(II.getFilename());
80-
const char *ArgFile = Args.MakeArgString("@" + FileName);
81-
CmdArgs.push_back(ArgFile);
82-
continue;
83-
}
84-
CmdArgs.push_back(II.getFilename());
85-
}
86-
if (Args.hasArg(options::OPT_fsycl_link_EQ) &&
87-
Args.hasArg(options::OPT_fintelfpga))
88-
CmdArgs.push_back("/IGNORE:4221");
89-
90-
// Suppress multiple section warning LNK4078
91-
if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
92-
CmdArgs.push_back("/IGNORE:4078");
93-
94-
CmdArgs.push_back(
95-
C.getArgs().MakeArgString(Twine("-OUT:") + Output.getFilename()));
96-
97-
SmallString<128> ExecPath(getToolChain().GetProgramPath("lib.exe"));
98-
const char *Exec = C.getArgs().MakeArgString(ExecPath);
99-
C.addCommand(std::make_unique<Command>(
100-
JA, *this, ResponseFileSupport::AtFileUTF16(), Exec, CmdArgs, std::nullopt));
101-
}
102-
10368
void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
10469
const InputInfo &Output,
10570
const InputInfoList &Inputs,
10671
const ArgList &Args,
10772
const char *LinkingOutput) const {
10873
ArgStringList CmdArgs;
10974

110-
// Create a library with -fsycl-link
111-
if (Args.hasArg(options::OPT_fsycl_link_EQ) &&
112-
JA.getType() == types::TY_Archive) {
113-
constructMSVCLibCommand(C, JA, Output, Inputs, Args);
114-
return;
115-
}
116-
11775
auto &TC = static_cast<const toolchains::MSVCToolChain &>(getToolChain());
11876

11977
assert((Output.isFilename() || Output.isNothing()) && "invalid output");

clang/lib/Driver/ToolChains/MSVC.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
3636
const InputInfo &Output, const InputInfoList &Inputs,
3737
const llvm::opt::ArgList &TCArgs,
3838
const char *LinkingOutput) const override;
39-
40-
private:
41-
void constructMSVCLibCommand(Compilation &C, const JobAction &JA,
42-
const InputInfo &Output,
43-
const InputInfoList &InputFiles,
44-
const llvm::opt::ArgList &Args) const;
4539
};
4640
} // end namespace visualstudio
4741

0 commit comments

Comments
 (0)