Skip to content

[Driver][NFC][FPGA] Remove remaining FPGA offload support in driver #18087

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: sycl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -7145,10 +7145,13 @@ defm sycl_force_inline_kernel_lambda
NegFlag<SetFalse, [], [ClangOption, CLOption], "Disallow">,
BothFlags<[], [ClangOption, CLOption, CC1Option], " force inline "
"SYCL kernels lambda in entry point">>;
def fsycl_help_EQ : Joined<["-"], "fsycl-help=">, Flags<[NoXarchOption]>,
HelpText<"Emit help information from the related offline compilation tool. "
"Valid values: all, fpga, gen, x86_64.">,
Values<"all,fpga,gen,x86_64">;
def fsycl_help_EQ
: Joined<["-"], "fsycl-help=">,
Flags<[NoXarchOption]>,
HelpText<
"Emit help information from the related offline compilation tool. "
"Valid values: all, gen, x86_64.">,
Values<"all,gen,x86_64">;
def fsycl_help : Flag<["-"], "fsycl-help">, Alias<fsycl_help_EQ>,
Flags<[NoXarchOption]>, AliasArgs<["all"]>,
HelpText<"Emit help information from all of the offline compilation tools">;
Expand Down
1 change: 0 additions & 1 deletion clang/include/clang/Driver/Types.def
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ TYPE("tempfiletable", Tempfiletable,INVALID, "table", phases
TYPE("tempAOCOfilelist", TempAOCOfilelist, INVALID, "txt", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("archive", Archive, INVALID, "a", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("wholearchive", WholeArchive, INVALID, "a", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("fpga_dep", FPGA_Dependencies, INVALID, "d", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("host_dep_image", Host_Dependencies_Image, INVALID, "out", phases::Compile, phases::Backend, phases::Assemble, phases::Link)
TYPE("api-information", API_INFO, INVALID, "json", phases::Precompile)
TYPE("dx-container", DX_CONTAINER, INVALID, "dxo", phases::Compile, phases::Backend)
Expand Down
242 changes: 33 additions & 209 deletions clang/lib/Driver/Driver.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions clang/lib/Driver/OffloadBundler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ bool OffloadTargetInfo::hasHostKind() const {

bool OffloadTargetInfo::isOffloadKindValid() const {
return OffloadKind == "host" || OffloadKind == "openmp" ||
OffloadKind == "sycl" || OffloadKind == "fpga" ||
OffloadKind == "hip" || OffloadKind == "hipv4";
OffloadKind == "sycl" || OffloadKind == "hip" ||
OffloadKind == "hipv4";
}

bool OffloadTargetInfo::isOffloadKindCompatible(
Expand Down
240 changes: 32 additions & 208 deletions clang/lib/Driver/ToolChains/Clang.cpp

Large diffs are not rendered by default.

46 changes: 0 additions & 46 deletions clang/lib/Driver/ToolChains/Gnu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,42 +308,6 @@ static bool getStatic(const ArgList &Args) {
!Args.hasArg(options::OPT_static_pie);
}

// Create an archive with llvm-ar. This is used to create an archive that
// contains host objects and the wrapped FPGA device binary
void tools::gnutools::Linker::constructLLVMARCommand(
Compilation &C, const JobAction &JA, const InputInfo &Output,
const InputInfoList &Input, const ArgList &Args) const {
ArgStringList CmdArgs;
// Use 'cqL' to create the archive. This allows for any fat archives that
// are passed on the command line to be added via contents instead of the
// full archive. Any usage of the generated archive will then have full
// access to resolve any dependencies.
CmdArgs.push_back("cqL");
const char *OutputFilename = Output.getFilename();
if (llvm::sys::fs::exists(OutputFilename)) {
C.getDriver().Diag(clang::diag::warn_drv_existing_archive_append)
<< OutputFilename;
}
CmdArgs.push_back(OutputFilename);
for (const auto &II : Input) {
if (II.getType() == types::TY_Tempfilelist) {
// Take the list file and pass it in with '@'.
std::string FileName(II.getFilename());
const char *ArgFile = Args.MakeArgString("@" + FileName);
CmdArgs.push_back(ArgFile);
continue;
}
if (II.isFilename())
CmdArgs.push_back(II.getFilename());
}

SmallString<128> LLVMARPath(C.getDriver().Dir);
llvm::sys::path::append(LLVMARPath, "llvm-ar");
const char *Exec = C.getArgs().MakeArgString(LLVMARPath);
C.addCommand(std::make_unique<Command>(
JA, *this, ResponseFileSupport::None(), Exec, CmdArgs, std::nullopt));
}

void tools::gnutools::StaticLibTool::ConstructJob(
Compilation &C, const JobAction &JA, const InputInfo &Output,
const InputInfoList &Inputs, const ArgList &Args,
Expand Down Expand Up @@ -413,12 +377,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
ToolChain.getTriple().hasEnvironment() ||
(ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);

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

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

// LLVM support for atomics on 32-bit SPARC V8+ is incomplete, so
Expand Down
6 changes: 0 additions & 6 deletions clang/lib/Driver/ToolChains/Gnu.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
const InputInfo &Output, const InputInfoList &Inputs,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;

private:
void constructLLVMARCommand(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &InputFiles,
const llvm::opt::ArgList &Args) const;
};

class LLVM_LIBRARY_VISIBILITY StaticLibTool : public Tool {
Expand Down
42 changes: 0 additions & 42 deletions clang/lib/Driver/ToolChains/MSVC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,55 +65,13 @@ static std::string FindVisualStudioExecutable(const ToolChain &TC,
return std::string(canExecute(TC.getVFS(), FilePath) ? FilePath.str() : Exe);
}

// Add a call to lib.exe to create an archive. This is used to embed host
// objects into the bundled fat FPGA device binary.
void visualstudio::Linker::constructMSVCLibCommand(Compilation &C,
const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Input,
const ArgList &Args) const {
ArgStringList CmdArgs;
for (const auto &II : Input) {
if (II.getType() == types::TY_Tempfilelist) {
// Take the list file and pass it in with '@'.
std::string FileName(II.getFilename());
const char *ArgFile = Args.MakeArgString("@" + FileName);
CmdArgs.push_back(ArgFile);
continue;
}
CmdArgs.push_back(II.getFilename());
}
if (Args.hasArg(options::OPT_fsycl_link_EQ) &&
Args.hasArg(options::OPT_fintelfpga))
CmdArgs.push_back("/IGNORE:4221");

// Suppress multiple section warning LNK4078
if (Args.hasFlag(options::OPT_fsycl, options::OPT_fno_sycl, false))
CmdArgs.push_back("/IGNORE:4078");

CmdArgs.push_back(
C.getArgs().MakeArgString(Twine("-OUT:") + Output.getFilename()));

SmallString<128> ExecPath(getToolChain().GetProgramPath("lib.exe"));
const char *Exec = C.getArgs().MakeArgString(ExecPath);
C.addCommand(std::make_unique<Command>(
JA, *this, ResponseFileSupport::AtFileUTF16(), Exec, CmdArgs, std::nullopt));
}

void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;

// Create a library with -fsycl-link
if (Args.hasArg(options::OPT_fsycl_link_EQ) &&
JA.getType() == types::TY_Archive) {
constructMSVCLibCommand(C, JA, Output, Inputs, Args);
return;
}

auto &TC = static_cast<const toolchains::MSVCToolChain &>(getToolChain());

assert((Output.isFilename() || Output.isNothing()) && "invalid output");
Expand Down
6 changes: 0 additions & 6 deletions clang/lib/Driver/ToolChains/MSVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
const InputInfo &Output, const InputInfoList &Inputs,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;

private:
void constructMSVCLibCommand(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &InputFiles,
const llvm::opt::ArgList &Args) const;
};
} // end namespace visualstudio

Expand Down
Loading