Skip to content

Commit 36e6e06

Browse files
authored
[SYCL][NFC] Remove llvm-no-spir-kernel tool (#9710)
The llvm-no-spir-kernel tool is no longer in use. Remove the creation, tests and driver infrastructure to use the tool. Also remove the reference from the docs.
1 parent b3e0428 commit 36e6e06

File tree

17 files changed

+0
-259
lines changed

17 files changed

+0
-259
lines changed

clang/include/clang/Driver/Action.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class Action {
7979
OffloadPackagerJobClass,
8080
OffloadDepsJobClass,
8181
SPIRVTranslatorJobClass,
82-
SPIRCheckJobClass,
8382
SYCLPostLinkJobClass,
8483
BackendCompileJobClass,
8584
FileTableTformJobClass,
@@ -750,21 +749,6 @@ class SPIRVTranslatorJobAction : public JobAction {
750749
}
751750
};
752751

753-
// Provides a check of the given input file for the existence of SPIR kernel
754-
// code. This is currently only used for FPGA specific tool chains and can
755-
// be expanded to perform other SPIR checks if needed.
756-
// TODO: No longer being used for FPGA (or elsewhere), cleanup needed.
757-
class SPIRCheckJobAction : public JobAction {
758-
void anchor() override;
759-
760-
public:
761-
SPIRCheckJobAction(Action *Input, types::ID OutputType);
762-
763-
static bool classof(const Action *A) {
764-
return A->getKind() == SPIRCheckJobClass;
765-
}
766-
};
767-
768752
class SYCLPostLinkJobAction : public JobAction {
769753
void anchor() override;
770754

clang/include/clang/Driver/ToolChain.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ class ToolChain {
160160
mutable std::unique_ptr<Tool> OffloadPackager;
161161
mutable std::unique_ptr<Tool> OffloadDeps;
162162
mutable std::unique_ptr<Tool> SPIRVTranslator;
163-
mutable std::unique_ptr<Tool> SPIRCheck;
164163
mutable std::unique_ptr<Tool> SYCLPostLink;
165164
mutable std::unique_ptr<Tool> BackendCompiler;
166165
mutable std::unique_ptr<Tool> AppendFooter;
@@ -180,7 +179,6 @@ class ToolChain {
180179
Tool *getOffloadPackager() const;
181180
Tool *getOffloadDeps() const;
182181
Tool *getSPIRVTranslator() const;
183-
Tool *getSPIRCheck() const;
184182
Tool *getSYCLPostLink() const;
185183
Tool *getBackendCompiler() const;
186184
Tool *getAppendFooter() const;

clang/lib/Driver/Action.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ const char *Action::getClassName(ActionClass AC) {
5050
return "clang-offload-deps";
5151
case SPIRVTranslatorJobClass:
5252
return "llvm-spirv";
53-
case SPIRCheckJobClass:
54-
return "llvm-no-spir-kernel";
5553
case SYCLPostLinkJobClass:
5654
return "sycl-post-link";
5755
case BackendCompileJobClass:
@@ -508,11 +506,6 @@ SPIRVTranslatorJobAction::SPIRVTranslatorJobAction(Action *Input,
508506
types::ID Type)
509507
: JobAction(SPIRVTranslatorJobClass, Input, Type) {}
510508

511-
void SPIRCheckJobAction::anchor() {}
512-
513-
SPIRCheckJobAction::SPIRCheckJobAction(Action *Input, types::ID Type)
514-
: JobAction(SPIRCheckJobClass, Input, Type) {}
515-
516509
void SYCLPostLinkJobAction::anchor() {}
517510

518511
SYCLPostLinkJobAction::SYCLPostLinkJobAction(Action *Input,

clang/lib/Driver/ToolChain.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,6 @@ Tool *ToolChain::getSPIRVTranslator() const {
417417
return SPIRVTranslator.get();
418418
}
419419

420-
Tool *ToolChain::getSPIRCheck() const {
421-
if (!SPIRCheck)
422-
SPIRCheck.reset(new tools::SPIRCheck(*this));
423-
return SPIRCheck.get();
424-
}
425-
426420
Tool *ToolChain::getSYCLPostLink() const {
427421
if (!SYCLPostLink)
428422
SYCLPostLink.reset(new tools::SYCLPostLink(*this));
@@ -508,9 +502,6 @@ Tool *ToolChain::getTool(Action::ActionClass AC) const {
508502
case Action::SPIRVTranslatorJobClass:
509503
return getSPIRVTranslator();
510504

511-
case Action::SPIRCheckJobClass:
512-
return getSPIRCheck();
513-
514505
case Action::SYCLPostLinkJobClass:
515506
return getSYCLPostLink();
516507

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9742,45 +9742,6 @@ void SPIRVTranslator::ConstructJob(Compilation &C, const JobAction &JA,
97429742
C.addCommand(std::move(Cmd));
97439743
}
97449744

9745-
void SPIRCheck::ConstructJob(Compilation &C, const JobAction &JA,
9746-
const InputInfo &Output,
9747-
const InputInfoList &Inputs,
9748-
const llvm::opt::ArgList &TCArgs,
9749-
const char *LinkingOutput) const {
9750-
// Construct llvm-no-spir-kernel command.
9751-
assert(isa<SPIRCheckJobAction>(JA) && "Expecting SPIR Check job!");
9752-
9753-
// The spir check command looks like this:
9754-
// llvm-no-spir-kernel <file>.bc
9755-
// Upon success, we just move ahead. Error means the check failed and
9756-
// we need to exit. The expected output is the input as this is just an
9757-
// intermediate check with no functional change.
9758-
ArgStringList CheckArgs;
9759-
assert(Inputs.size() == 1 && "Unexpected number of inputs to the tool");
9760-
const InputInfo &InputFile = Inputs.front();
9761-
CheckArgs.push_back(InputFile.getFilename());
9762-
9763-
// Add output file, which is just a copy of the input to better fit in the
9764-
// toolchain flow.
9765-
CheckArgs.push_back("-o");
9766-
CheckArgs.push_back(Output.getFilename());
9767-
auto Cmd = std::make_unique<Command>(
9768-
JA, *this, ResponseFileSupport::None(),
9769-
TCArgs.MakeArgString(getToolChain().GetProgramPath(getShortName())),
9770-
CheckArgs, std::nullopt);
9771-
9772-
if (getToolChain().getTriple().getSubArch() ==
9773-
llvm::Triple::SPIRSubArch_fpga) {
9774-
const char *Msg = TCArgs.MakeArgString(
9775-
Twine("The FPGA image does not include all device kernels from ") +
9776-
Twine(InputFile.getBaseInput()) +
9777-
Twine(". Please re-generate the image"));
9778-
Cmd->addDiagForErrorCode(/*ErrorCode*/ 1, Msg);
9779-
}
9780-
9781-
C.addCommand(std::move(Cmd));
9782-
}
9783-
97849745
static void addArgs(ArgStringList &DstArgs, const llvm::opt::ArgList &Alloc,
97859746
ArrayRef<StringRef> SrcArgs) {
97869747
for (const auto Arg : SrcArgs) {

clang/lib/Driver/ToolChains/Clang.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,19 +228,6 @@ class LLVM_LIBRARY_VISIBILITY SPIRVTranslator final : public Tool {
228228
const char *LinkingOutput) const override;
229229
};
230230

231-
/// SPIR Checking tool.
232-
class LLVM_LIBRARY_VISIBILITY SPIRCheck final : public Tool {
233-
public:
234-
SPIRCheck(const ToolChain &TC)
235-
: Tool("SPIR Checker", "llvm-no-spir-kernel", TC) {}
236-
237-
bool hasIntegratedCPP() const override { return false; }
238-
void ConstructJob(Compilation &C, const JobAction &JA,
239-
const InputInfo &Output, const InputInfoList &Inputs,
240-
const llvm::opt::ArgList &TCArgs,
241-
const char *LinkingOutput) const override;
242-
};
243-
244231
/// SYCL post-link device code processing tool.
245232
class LLVM_LIBRARY_VISIBILITY SYCLPostLink final : public Tool {
246233
public:

llvm/test/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ set(LLVM_TEST_DEPENDS
109109
llvm-modextract
110110
llvm-mt
111111
llvm-nm
112-
llvm-no-spir-kernel
113112
llvm-objcopy
114113
llvm-objdump
115114
llvm-opt-fuzzer

llvm/test/tools/llvm-no-spir-kernel/error-code.ll

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

llvm/test/tools/llvm-no-spir-kernel/has-spir-kernel.ll

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

llvm/test/tools/llvm-no-spir-kernel/invalid-input.ll

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

llvm/test/tools/llvm-no-spir-kernel/no-spir-kernel.ll

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

llvm/test/tools/llvm-no-spir-kernel/no-spir-kernel2.ll

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

llvm/tools/llvm-no-spir-kernel/CMakeLists.txt

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

llvm/tools/llvm-no-spir-kernel/LLVMBuild.txt

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

llvm/tools/llvm-no-spir-kernel/llvm-no-spir-kernel.cpp

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

sycl/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ add_custom_target(sycl-compiler
303303
llc
304304
llvm-ar
305305
llvm-foreach
306-
llvm-no-spir-kernel
307306
llvm-spirv
308307
llvm-link
309308
llvm-objcopy
@@ -391,7 +390,6 @@ set( SYCL_TOOLCHAIN_DEPLOY_COMPONENTS
391390
llc
392391
llvm-ar
393392
llvm-foreach
394-
llvm-no-spir-kernel
395393
llvm-spirv
396394
llvm-link
397395
llvm-objcopy

sycl/doc/design/CompilerAndRuntimeDesign.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,6 @@ Case 1 can be identified in the device binary generation stage (step 1) by
423423
scanning the known kernels. Case 2 must be verified by the driver by checking
424424
for newly introduced kernels in the final link stage (step 3).
425425

426-
The llvm-no-spir-kernel tool was introduced to facilitate checking for case 2 in
427-
the driver. It detects if a module includes kernels and is invoked as follows:
428-
429-
```bash
430-
llvm-no-spir-kernel host.bc
431-
```
432-
433-
It returns 0 if no kernels are present and 1 otherwise.
434-
435426
#### Device code post-link step
436427

437428
At link time all the device code is linked into

0 commit comments

Comments
 (0)