Skip to content

[SYCL][NFC] Remove llvm-no-spir-kernel tool #9710

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2023
Merged
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
16 changes: 0 additions & 16 deletions clang/include/clang/Driver/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class Action {
OffloadPackagerJobClass,
OffloadDepsJobClass,
SPIRVTranslatorJobClass,
SPIRCheckJobClass,
SYCLPostLinkJobClass,
BackendCompileJobClass,
FileTableTformJobClass,
Expand Down Expand Up @@ -750,21 +749,6 @@ class SPIRVTranslatorJobAction : public JobAction {
}
};

// Provides a check of the given input file for the existence of SPIR kernel
// code. This is currently only used for FPGA specific tool chains and can
// be expanded to perform other SPIR checks if needed.
// TODO: No longer being used for FPGA (or elsewhere), cleanup needed.
class SPIRCheckJobAction : public JobAction {
void anchor() override;

public:
SPIRCheckJobAction(Action *Input, types::ID OutputType);

static bool classof(const Action *A) {
return A->getKind() == SPIRCheckJobClass;
}
};

class SYCLPostLinkJobAction : public JobAction {
void anchor() override;

Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Driver/ToolChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class ToolChain {
mutable std::unique_ptr<Tool> OffloadPackager;
mutable std::unique_ptr<Tool> OffloadDeps;
mutable std::unique_ptr<Tool> SPIRVTranslator;
mutable std::unique_ptr<Tool> SPIRCheck;
mutable std::unique_ptr<Tool> SYCLPostLink;
mutable std::unique_ptr<Tool> BackendCompiler;
mutable std::unique_ptr<Tool> AppendFooter;
Expand All @@ -180,7 +179,6 @@ class ToolChain {
Tool *getOffloadPackager() const;
Tool *getOffloadDeps() const;
Tool *getSPIRVTranslator() const;
Tool *getSPIRCheck() const;
Tool *getSYCLPostLink() const;
Tool *getBackendCompiler() const;
Tool *getAppendFooter() const;
Expand Down
7 changes: 0 additions & 7 deletions clang/lib/Driver/Action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ const char *Action::getClassName(ActionClass AC) {
return "clang-offload-deps";
case SPIRVTranslatorJobClass:
return "llvm-spirv";
case SPIRCheckJobClass:
return "llvm-no-spir-kernel";
case SYCLPostLinkJobClass:
return "sycl-post-link";
case BackendCompileJobClass:
Expand Down Expand Up @@ -508,11 +506,6 @@ SPIRVTranslatorJobAction::SPIRVTranslatorJobAction(Action *Input,
types::ID Type)
: JobAction(SPIRVTranslatorJobClass, Input, Type) {}

void SPIRCheckJobAction::anchor() {}

SPIRCheckJobAction::SPIRCheckJobAction(Action *Input, types::ID Type)
: JobAction(SPIRCheckJobClass, Input, Type) {}

void SYCLPostLinkJobAction::anchor() {}

SYCLPostLinkJobAction::SYCLPostLinkJobAction(Action *Input,
Expand Down
9 changes: 0 additions & 9 deletions clang/lib/Driver/ToolChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,6 @@ Tool *ToolChain::getSPIRVTranslator() const {
return SPIRVTranslator.get();
}

Tool *ToolChain::getSPIRCheck() const {
if (!SPIRCheck)
SPIRCheck.reset(new tools::SPIRCheck(*this));
return SPIRCheck.get();
}

Tool *ToolChain::getSYCLPostLink() const {
if (!SYCLPostLink)
SYCLPostLink.reset(new tools::SYCLPostLink(*this));
Expand Down Expand Up @@ -508,9 +502,6 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const {
case Action::SPIRVTranslatorJobClass:
return getSPIRVTranslator();

case Action::SPIRCheckJobClass:
return getSPIRCheck();

case Action::SYCLPostLinkJobClass:
return getSYCLPostLink();

Expand Down
39 changes: 0 additions & 39 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9754,45 +9754,6 @@ void SPIRVTranslator::ConstructJob(Compilation &C, const JobAction &JA,
C.addCommand(std::move(Cmd));
}

void SPIRCheck::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const {
// Construct llvm-no-spir-kernel command.
assert(isa<SPIRCheckJobAction>(JA) && "Expecting SPIR Check job!");

// The spir check command looks like this:
// llvm-no-spir-kernel <file>.bc
// Upon success, we just move ahead. Error means the check failed and
// we need to exit. The expected output is the input as this is just an
// intermediate check with no functional change.
ArgStringList CheckArgs;
assert(Inputs.size() == 1 && "Unexpected number of inputs to the tool");
const InputInfo &InputFile = Inputs.front();
CheckArgs.push_back(InputFile.getFilename());

// Add output file, which is just a copy of the input to better fit in the
// toolchain flow.
CheckArgs.push_back("-o");
CheckArgs.push_back(Output.getFilename());
auto Cmd = std::make_unique<Command>(
JA, *this, ResponseFileSupport::None(),
TCArgs.MakeArgString(getToolChain().GetProgramPath(getShortName())),
CheckArgs, std::nullopt);

if (getToolChain().getTriple().getSubArch() ==
llvm::Triple::SPIRSubArch_fpga) {
const char *Msg = TCArgs.MakeArgString(
Twine("The FPGA image does not include all device kernels from ") +
Twine(InputFile.getBaseInput()) +
Twine(". Please re-generate the image"));
Cmd->addDiagForErrorCode(/*ErrorCode*/ 1, Msg);
}

C.addCommand(std::move(Cmd));
}

static void addArgs(ArgStringList &DstArgs, const llvm::opt::ArgList &Alloc,
ArrayRef<StringRef> SrcArgs) {
for (const auto Arg : SrcArgs) {
Expand Down
13 changes: 0 additions & 13 deletions clang/lib/Driver/ToolChains/Clang.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,6 @@ class LLVM_LIBRARY_VISIBILITY SPIRVTranslator final : public Tool {
const char *LinkingOutput) const override;
};

/// SPIR Checking tool.
class LLVM_LIBRARY_VISIBILITY SPIRCheck final : public Tool {
public:
SPIRCheck(const ToolChain &TC)
: Tool("SPIR Checker", "llvm-no-spir-kernel", TC) {}

bool hasIntegratedCPP() const override { return false; }
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};

/// SYCL post-link device code processing tool.
class LLVM_LIBRARY_VISIBILITY SYCLPostLink final : public Tool {
public:
Expand Down
1 change: 0 additions & 1 deletion llvm/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ set(LLVM_TEST_DEPENDS
llvm-modextract
llvm-mt
llvm-nm
llvm-no-spir-kernel
llvm-objcopy
llvm-objdump
llvm-opt-fuzzer
Expand Down
11 changes: 0 additions & 11 deletions llvm/test/tools/llvm-no-spir-kernel/error-code.ll

This file was deleted.

15 changes: 0 additions & 15 deletions llvm/test/tools/llvm-no-spir-kernel/has-spir-kernel.ll

This file was deleted.

2 changes: 0 additions & 2 deletions llvm/test/tools/llvm-no-spir-kernel/invalid-input.ll

This file was deleted.

8 changes: 0 additions & 8 deletions llvm/test/tools/llvm-no-spir-kernel/no-spir-kernel.ll

This file was deleted.

12 changes: 0 additions & 12 deletions llvm/test/tools/llvm-no-spir-kernel/no-spir-kernel2.ll

This file was deleted.

13 changes: 0 additions & 13 deletions llvm/tools/llvm-no-spir-kernel/CMakeLists.txt

This file was deleted.

21 changes: 0 additions & 21 deletions llvm/tools/llvm-no-spir-kernel/LLVMBuild.txt

This file was deleted.

79 changes: 0 additions & 79 deletions llvm/tools/llvm-no-spir-kernel/llvm-no-spir-kernel.cpp

This file was deleted.

2 changes: 0 additions & 2 deletions sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ add_custom_target(sycl-compiler
llc
llvm-ar
llvm-foreach
llvm-no-spir-kernel
llvm-spirv
llvm-link
llvm-objcopy
Expand Down Expand Up @@ -391,7 +390,6 @@ set( SYCL_TOOLCHAIN_DEPLOY_COMPONENTS
llc
llvm-ar
llvm-foreach
llvm-no-spir-kernel
llvm-spirv
llvm-link
llvm-objcopy
Expand Down
9 changes: 0 additions & 9 deletions sycl/doc/design/CompilerAndRuntimeDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,6 @@ Case 1 can be identified in the device binary generation stage (step 1) by
scanning the known kernels. Case 2 must be verified by the driver by checking
for newly introduced kernels in the final link stage (step 3).

The llvm-no-spir-kernel tool was introduced to facilitate checking for case 2 in
the driver. It detects if a module includes kernels and is invoked as follows:

```bash
llvm-no-spir-kernel host.bc
```

It returns 0 if no kernels are present and 1 otherwise.

#### Device code post-link step

At link time all the device code is linked into
Expand Down