Skip to content

Commit 679436a

Browse files
committed
Renamed the tool to be called clang-sycl-linker
Signed-off-by: Arvind Sudarsanam <[email protected]>
1 parent 753edc3 commit 679436a

File tree

11 files changed

+60
-64
lines changed

11 files changed

+60
-64
lines changed

clang/docs/ClangSYCLLinkWrapper.rst renamed to clang/docs/ClangSYCLLinker.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
=======================
2-
Clang SYCL Link Wrapper
2+
Clang SYCL Linker
33
=======================
44

55
.. contents::
66
:local:
77

8-
.. _clang-sycl-link-wrapper:
8+
.. _clang-sycl-linker:
99

1010
Introduction
1111
============
1212

1313
This tool works as a wrapper around the SYCL device code linking process.
14-
The purpose of this wrapper is to provide an interface to link SYCL device
15-
bitcode in LLVM IR format, SYCL device bitcode in SPIR-V IR format, and native
16-
binary objects, and then use the SPIR-V LLVM Translator tool on fully linked
17-
device objects to produce the final output.
14+
The purpose of this tool is to provide an interface to link SYCL device bitcode
15+
in LLVM IR format, SYCL device bitcode in SPIR-V IR format, and native binary
16+
objects, and then use the SPIR-V LLVM Translator tool on fully linked device
17+
objects to produce the final output.
1818
After the linking stage, the fully linked device code in LLVM IR format may
1919
undergo several SYCL-specific finalization steps before the SPIR-V code
2020
generation step.
21-
The wrapper will also support the Ahead-Of-Time (AOT) compilation flow. AOT
21+
The tool will also support the Ahead-Of-Time (AOT) compilation flow. AOT
2222
compilation is the process of invoking the back-end at compile time to produce
2323
the final binary, as opposed to just-in-time (JIT) compilation when final code
2424
generation is deferred until application runtime.
@@ -47,7 +47,7 @@ be passed down to downstream tools like 'llvm-link', 'llvm-spirv', etc.
4747
This enables linking and code generation for SPIR-V JIT targets and AOT
4848
targets.
4949
50-
USAGE: clang-sycl-link-wrapper [options]
50+
USAGE: clang-sycl-linker [options]
5151
5252
OPTIONS:
5353
--arch <value> Specify the name of the target architecture.
@@ -77,4 +77,4 @@ generate the final executable.
7777

7878
.. code-block:: console
7979
80-
clang-sycl-link-wrapper --triple spirv64 --arch native input.bc
80+
clang-sycl-linker --triple spirv64 --arch native input.bc

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6730,7 +6730,7 @@ def fno_sycl : Flag<["-"], "fno-sycl">,
67306730
Group<sycl_Group>, HelpText<"Disables SYCL kernels compilation for device">;
67316731
def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
67326732
Visibility<[ClangOption, CLOption]>,
6733-
Group<sycl_Group>, HelpText<"Perform link through clang-sycl-link-wrapper via the target "
6733+
Group<sycl_Group>, HelpText<"Perform link through clang-sycl-linker via the target "
67346734
"offloading toolchain.">;
67356735
// OS-specific options
67366736
let Flags = [TargetSpecific] in {

clang/lib/Driver/ToolChains/SPIRV.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ void SPIRV::Linker::ConstructJob(Compilation &C, const JobAction &JA,
9595
CmdArgs.push_back("-o");
9696
CmdArgs.push_back(Output.getFilename());
9797

98-
// Use of --sycl-link will call the clang-sycl-link-wrapper instead of
98+
// Use of --sycl-link will call the clang-sycl-linker instead of
9999
// the default linker (spirv-link).
100100
if (Args.hasArg(options::OPT_sycl_link))
101-
Linker = ToolChain.GetProgramPath("clang-sycl-link-wrapper");
101+
Linker = ToolChain.GetProgramPath("clang-sycl-linker");
102102
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
103103
Args.MakeArgString(Linker), CmdArgs,
104104
Inputs, Output));

clang/test/Driver/clang-sycl-link-wrapper-test.cpp renamed to clang/test/Driver/clang-sycl-linker-test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// Tests the clang-sycl-link-wrapper tool
1+
// Tests the clang-sycl-linker tool
22
//
33
// Test a simple case without arguments
44
// RUN: %clangxx -fsycl -emit-llvm -c %s -o %t.bc
5-
// RUN: clang-sycl-link-wrapper --dry-run -triple spirv64 %t.bc --library-path=%S/Inputs -o a.spv 2>&1 \
5+
// RUN: clang-sycl-linker --dry-run -triple spirv64 %t.bc --library-path=%S/Inputs -o a.spv 2>&1 \
66
// RUN: | FileCheck %s --check-prefix=CMDS
77
// CMDS: "{{.*}}llvm-link{{.*}}" {{.*}}.bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings
88
// CMDS-NEXT: "{{.*}}llvm-link{{.*}}" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}libsycl-crt.bc {{.*}}libsycl-complex.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings

clang/test/Driver/sycl-link-spirv-target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
// RUN: touch %t.bc
55
// RUN: %clangxx --target=spirv64 --sycl-link -### %t.bc 2>&1 \
66
// RUN: | FileCheck %s -check-prefix=LINK
7-
// LINK: "{{.*}}clang-sycl-link-wrapper{{.*}}" "{{.*}}.bc" "-o" "a.out"
7+
// LINK: "{{.*}}clang-sycl-linker{{.*}}" "{{.*}}.bc" "-o" "a.out"

clang/test/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"yaml2obj",
9797
"clang-linker-wrapper",
9898
"clang-nvlink-wrapper",
99+
"clang-sycl-linker",
99100
"llvm-lto",
100101
"llvm-lto2",
101102
"llvm-profdata",

clang/tools/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_clang_subdirectory(clang-nvlink-wrapper)
1212
add_clang_subdirectory(clang-offload-packager)
1313
add_clang_subdirectory(clang-offload-bundler)
1414
add_clang_subdirectory(clang-scan-deps)
15-
add_clang_subdirectory(clang-sycl-link-wrapper)
15+
add_clang_subdirectory(clang-sycl-linker)
1616
add_clang_subdirectory(clang-installapi)
1717
if(HAVE_CLANG_REPL_SUPPORT)
1818
add_clang_subdirectory(clang-repl)

clang/tools/clang-sycl-link-wrapper/CMakeLists.txt

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
set(LLVM_LINK_COMPONENTS
2+
${LLVM_TARGETS_TO_BUILD}
3+
Option
4+
)
5+
6+
set(LLVM_TARGET_DEFINITIONS SYCLLinkOpts.td)
7+
tablegen(LLVM SYCLLinkOpts.inc -gen-opt-parser-defs)
8+
add_public_tablegen_target(SYCLLinkerOpts)
9+
10+
if(NOT CLANG_BUILT_STANDALONE)
11+
set(tablegen_deps intrinsics_gen SYCLLinkerOpts)
12+
endif()
13+
14+
add_clang_tool(clang-sycl-linker
15+
ClangSYCLLinker.cpp
16+
17+
DEPENDS
18+
${tablegen_deps}
19+
)
20+
21+
set(CLANG_SYCL_LINKER_LIB_DEPS
22+
clangBasic
23+
)
24+
25+
target_link_libraries(clang-sycl-linker
26+
PRIVATE
27+
${CLANG_SYCL_LINKER_LIB_DEPS}
28+
)

clang/tools/clang-sycl-link-wrapper/ClangSYCLLinkWrapper.cpp renamed to clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
//=-- clang-sycl-link-wrapper/ClangSYCLLinkWrapper.cpp - SYCL linker util --=//
1+
//=-------- clang-sycl-linker/ClangSYCLLinker.cpp - SYCL Linker util -------=//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===---------------------------------------------------------------------===//
88
//
9-
// This tool wraps around the sequence of steps required to link device code in
10-
// SYCL fat objects. SYCL device code linking requires a complex sequence of
11-
// steps that include linking of llvm bitcode files, linking device library
12-
// files with the fully linked source bitcode file(s), running several SYCL
13-
// specific post-link steps on the fully linked bitcode file(s), and finally
14-
// generating target-specific device code. This tool can be removed once SYCL
15-
// linking is ported to `ld.lld`.
16-
//
9+
// This tool executes a sequence of steps required to link device code in SYCL
10+
// fat objects. SYCL device code linking requires a complex sequence of steps
11+
// that include linking of llvm bitcode files, linking device library files
12+
// with the fully linked source bitcode file(s), running several SYCL specific
13+
// post-link steps on the fully linked bitcode file(s), and finally generating
14+
// target-specific device code.
1715
//===---------------------------------------------------------------------===//
1816

1917
#include "clang/Basic/Version.h"
@@ -69,7 +67,7 @@ static StringRef OutputFile;
6967
static SmallString<128> SPIRVDumpDir;
7068

7169
static void printVersion(raw_ostream &OS) {
72-
OS << clang::getClangToolFullVersion("clang-sycl-link-wrapper") << '\n';
70+
OS << clang::getClangToolFullVersion("clang-sycl-linker") << '\n';
7371
}
7472

7573
/// The value of `argv[0]` when run.
@@ -213,9 +211,8 @@ Expected<SmallVector<std::string>> getInput(const ArgList &Args) {
213211
/// Link all SYCL device input files into one before adding device library
214212
/// files. Device linking is performed using llvm-link tool.
215213
/// 'InputFiles' is the list of all LLVM IR device input files.
216-
/// 'Args' encompasses all arguments required for linking and wrapping device
217-
/// code and will be parsed to generate options required to be passed into the
218-
/// llvm-link tool.
214+
/// 'Args' encompasses all arguments required for linking device code and will
215+
/// be parsed to generate options required to be passed into llvm-link.
219216
Expected<StringRef> linkDeviceInputFiles(ArrayRef<std::string> InputFiles,
220217
const ArgList &Args) {
221218
llvm::TimeTraceScope TimeScope("SYCL LinkDeviceInputFiles");
@@ -285,9 +282,8 @@ Expected<SmallVector<std::string>> getSYCLDeviceLibFiles(const ArgList &Args) {
285282
/// Link all device library files and input file into one LLVM IR file. This
286283
/// linking is performed using llvm-link tool.
287284
/// 'InputFiles' is the list of all LLVM IR device input files.
288-
/// 'Args' encompasses all arguments required for linking and wrapping device
289-
/// code and will be parsed to generate options required to be passed into the
290-
/// llvm-link tool.
285+
/// 'Args' encompasses all arguments required for linking device code and will
286+
/// be parsed to generate options required to be passed into llvm-link tool.
291287
static Expected<StringRef> linkDeviceLibFiles(StringRef InputFile,
292288
const ArgList &Args) {
293289
llvm::TimeTraceScope TimeScope("LinkDeviceLibraryFiles");
@@ -391,9 +387,8 @@ static void getSPIRVTransOpts(const ArgList &Args,
391387

392388
/// Run LLVM to SPIR-V translation.
393389
/// Converts 'File' from LLVM bitcode to SPIR-V format using llvm-spirv tool.
394-
/// 'Args' encompasses all arguments required for linking and wrapping device
395-
/// code and will be parsed to generate options required to be passed into the
396-
/// llvm-spirv tool.
390+
/// 'Args' encompasses all arguments required for linking device code and will
391+
/// be parsed to generate options required to be passed into llvm-spirv tool.
397392
static Expected<StringRef> runLLVMToSPIRVTranslation(StringRef File,
398393
const ArgList &Args) {
399394
llvm::TimeTraceScope TimeScope("LLVMToSPIRVTranslation");
@@ -478,7 +473,7 @@ int main(int argc, char **argv) {
478473
if (Args.hasArg(OPT_help) || Args.hasArg(OPT_help_hidden)) {
479474
Tbl.printHelp(
480475
outs(),
481-
"clang-sycl-link-wrapper [options] <options to sycl link steps>",
476+
"clang-sycl-linker [options] <options to sycl link steps>",
482477
"A utility that wraps around several steps required to link SYCL "
483478
"device files.\n"
484479
"This enables LLVM IR linking, post-linking and code generation for "

0 commit comments

Comments
 (0)