Skip to content

Commit e4a826b

Browse files
authored
[SYCL][NewOffload][NFC] Add SYCLPostLink library component. (#17454)
This change adds a component that should contain all post-link processing (e.g., ESIMD, specialization constants). It is not appropriate to put all this functionality into SYCLLowerIR because there is a dependency in LLVMPasses on SYCLLowerIR. Post-link processing requires capabilities such as linking and pipeline building, which being added to SYCLLowerIR will create a dependancy cycle. After this change, the dependency diagram will look like the following: ``` SYCLLowerIR -> Passes -> clang -------> opt | V SYCLPostLink -> clang-linker-wrapper |-------------> sycl-post-link --------------> sycl-jit. ```
1 parent 02593fa commit e4a826b

File tree

17 files changed

+45
-18
lines changed

17 files changed

+45
-18
lines changed

clang/tools/clang-linker-wrapper/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ set(LLVM_LINK_COMPONENTS
1717
LTO
1818
FrontendOffloading
1919
SYCLLowerIR
20+
SYCLPostLink
2021
)
2122

2223
set(LLVM_TARGET_DEFINITIONS LinkerWrapperOpts.td)

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include "llvm/Option/Option.h"
4343
#include "llvm/Passes/PassPlugin.h"
4444
#include "llvm/Remarks/HotnessThresholdParser.h"
45-
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
45+
#include "llvm/SYCLPostLink/ModuleSplitter.h"
4646
#include "llvm/Support/CommandLine.h"
4747
#include "llvm/Support/Errc.h"
4848
#include "llvm/Support/FileOutputBuffer.h"

llvm/include/llvm/SYCLLowerIR/ComputeModuleRuntimeInfo.h renamed to llvm/include/llvm/SYCLPostLink/ComputeModuleRuntimeInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#pragma once
1212

1313
#include "llvm/ADT/SetVector.h"
14-
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
1514
#include "llvm/SYCLLowerIR/SYCLDeviceLibReqMask.h"
1615
#include "llvm/Support/PropertySetIO.h"
1716
#include <string>

llvm/include/llvm/SYCLLowerIR/ModuleSplitter.h renamed to llvm/include/llvm/SYCLPostLink/ModuleSplitter.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
#ifndef LLVM_SYCLLOWERIR_MODULE_SPLITTER_H
1414
#define LLVM_SYCLLOWERIR_MODULE_SPLITTER_H
1515

16-
#include "SYCLDeviceRequirements.h"
17-
1816
#include "llvm/ADT/SetVector.h"
1917
#include "llvm/ADT/StringRef.h"
2018
#include "llvm/IR/Function.h"
19+
#include "llvm/SYCLLowerIR/SYCLDeviceRequirements.h"
2120
#include "llvm/Support/Error.h"
2221
#include "llvm/Support/PropertySetIO.h"
2322

llvm/lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ add_subdirectory(ProfileData)
4141
add_subdirectory(Passes)
4242
add_subdirectory(SYCLLowerIR)
4343
add_subdirectory(SYCLNativeCPUUtils)
44+
add_subdirectory(SYCLPostLink)
4445
add_subdirectory(TargetParser)
4546
add_subdirectory(TextAPI)
4647
add_subdirectory(Telemetry)

llvm/lib/SYCLLowerIR/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,13 @@ add_llvm_component_library(LLVMSYCLLowerIR
4747
RecordSYCLAspectNames.cpp
4848
CleanupSYCLMetadata.cpp
4949
CompileTimePropertiesPass.cpp
50-
ComputeModuleRuntimeInfo.cpp
5150
DeviceGlobals.cpp
5251
ESIMD/LowerESIMDVLoadVStore.cpp
5352
ESIMD/LowerESIMDSlmReservation.cpp
5453
HostPipes.cpp
5554
LowerInvokeSimd.cpp
5655
LowerWGLocalMemory.cpp
5756
LowerWGScope.cpp
58-
ModuleSplitter.cpp
5957
MutatePrintfAddrspace.cpp
6058
SpecConstants.cpp
6159
SYCLAddOptLevelAttribute.cpp

llvm/lib/SYCLLowerIR/SYCLDeviceRequirements.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "llvm/ADT/StringRef.h"
1313
#include "llvm/IR/Constants.h"
1414
#include "llvm/IR/Module.h"
15-
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
1615
#include "llvm/Support/PropertySetIO.h"
1716

1817
#include <set>

llvm/lib/SYCLPostLink/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
add_llvm_component_library(LLVMSYCLPostLink
2+
ComputeModuleRuntimeInfo.cpp
3+
ModuleSplitter.cpp
4+
5+
ADDITIONAL_HEADER_DIRS
6+
${LLVM_MAIN_INCLUDE_DIR}/llvm/SYCLPostLink
7+
8+
DEPENDS
9+
intrinsics_gen
10+
LLVMDemangle
11+
LLVMTransformUtils
12+
13+
LINK_LIBS
14+
LLVMDemangle
15+
LLVMTargetParser
16+
LLVMTransformUtils
17+
18+
LINK_COMPONENTS
19+
Analysis
20+
BitWriter
21+
Core
22+
Demangle
23+
IRPrinter
24+
Passes
25+
Support
26+
ipo
27+
)

llvm/lib/SYCLLowerIR/ComputeModuleRuntimeInfo.cpp renamed to llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88
// See comments in the header.
99
//===----------------------------------------------------------------------===//
10-
#include "llvm/SYCLLowerIR/ComputeModuleRuntimeInfo.h"
10+
#include "llvm/SYCLPostLink/ComputeModuleRuntimeInfo.h"
1111
#include "llvm/ADT/SmallString.h"
1212
#include "llvm/ADT/SmallVector.h"
1313
#include "llvm/ADT/StringSet.h"
@@ -17,11 +17,11 @@
1717
#include "llvm/SYCLLowerIR/DeviceGlobals.h"
1818
#include "llvm/SYCLLowerIR/HostPipes.h"
1919
#include "llvm/SYCLLowerIR/LowerWGLocalMemory.h"
20-
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
2120
#include "llvm/SYCLLowerIR/SYCLDeviceLibReqMask.h"
2221
#include "llvm/SYCLLowerIR/SYCLKernelParamOptInfo.h"
2322
#include "llvm/SYCLLowerIR/SYCLUtils.h"
2423
#include "llvm/SYCLLowerIR/SpecConstants.h"
24+
#include "llvm/SYCLPostLink/ModuleSplitter.h"
2525
#include <queue>
2626
#include <unordered_set>
2727
#ifndef NDEBUG

llvm/lib/SYCLLowerIR/ModuleSplitter.cpp renamed to llvm/lib/SYCLPostLink/ModuleSplitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// See comments in the header.
99
//===----------------------------------------------------------------------===//
1010

11-
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
11+
#include "llvm/SYCLPostLink/ModuleSplitter.h"
1212
#include "llvm/ADT/SetVector.h"
1313
#include "llvm/ADT/SmallPtrSet.h"
1414
#include "llvm/ADT/StringExtras.h"
@@ -24,7 +24,6 @@
2424
#include "llvm/IR/PassManagerImpl.h"
2525
#include "llvm/IRPrinter/IRPrintingPasses.h"
2626
#include "llvm/SYCLLowerIR/CleanupSYCLMetadata.h"
27-
#include "llvm/SYCLLowerIR/ComputeModuleRuntimeInfo.h"
2827
#include "llvm/SYCLLowerIR/DeviceGlobals.h"
2928
#include "llvm/SYCLLowerIR/ESIMD/LowerESIMD.h"
3029
#include "llvm/SYCLLowerIR/LowerInvokeSimd.h"
@@ -33,6 +32,7 @@
3332
#include "llvm/SYCLLowerIR/SYCLUtils.h"
3433
#include "llvm/SYCLLowerIR/SanitizerKernelMetadata.h"
3534
#include "llvm/SYCLLowerIR/SpecConstants.h"
35+
#include "llvm/SYCLPostLink/ComputeModuleRuntimeInfo.h"
3636
#include "llvm/Support/CommandLine.h"
3737
#include "llvm/Support/Error.h"
3838
#include "llvm/Support/FileSystem.h"

0 commit comments

Comments
 (0)