Skip to content

[SYCL][NewOffload][NFC] Add SYCLPostLink library component. #17454

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 6 commits into from
Mar 20, 2025
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
1 change: 1 addition & 0 deletions clang/tools/clang-linker-wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set(LLVM_LINK_COMPONENTS
LTO
FrontendOffloading
SYCLLowerIR
SYCLPostLink
)

set(LLVM_TARGET_DEFINITIONS LinkerWrapperOpts.td)
Expand Down
2 changes: 1 addition & 1 deletion clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "llvm/Option/Option.h"
#include "llvm/Passes/PassPlugin.h"
#include "llvm/Remarks/HotnessThresholdParser.h"
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
#include "llvm/SYCLPostLink/ModuleSplitter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileOutputBuffer.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#pragma once

#include "llvm/ADT/SetVector.h"
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
#include "llvm/SYCLLowerIR/SYCLDeviceLibReqMask.h"
#include "llvm/Support/PropertySetIO.h"
#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
#ifndef LLVM_SYCLLOWERIR_MODULE_SPLITTER_H
#define LLVM_SYCLLOWERIR_MODULE_SPLITTER_H

#include "SYCLDeviceRequirements.h"

#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Function.h"
#include "llvm/SYCLLowerIR/SYCLDeviceRequirements.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/PropertySetIO.h"

Expand Down
1 change: 1 addition & 0 deletions llvm/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ add_subdirectory(ProfileData)
add_subdirectory(Passes)
add_subdirectory(SYCLLowerIR)
add_subdirectory(SYCLNativeCPUUtils)
add_subdirectory(SYCLPostLink)
add_subdirectory(TargetParser)
add_subdirectory(TextAPI)
add_subdirectory(Telemetry)
Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/SYCLLowerIR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ add_llvm_component_library(LLVMSYCLLowerIR
RecordSYCLAspectNames.cpp
CleanupSYCLMetadata.cpp
CompileTimePropertiesPass.cpp
ComputeModuleRuntimeInfo.cpp
DeviceGlobals.cpp
ESIMD/LowerESIMDVLoadVStore.cpp
ESIMD/LowerESIMDSlmReservation.cpp
HostPipes.cpp
LowerInvokeSimd.cpp
LowerWGLocalMemory.cpp
LowerWGScope.cpp
ModuleSplitter.cpp
MutatePrintfAddrspace.cpp
SpecConstants.cpp
SYCLAddOptLevelAttribute.cpp
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/SYCLLowerIR/SYCLDeviceRequirements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Module.h"
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
#include "llvm/Support/PropertySetIO.h"

#include <set>
Expand Down
27 changes: 27 additions & 0 deletions llvm/lib/SYCLPostLink/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
add_llvm_component_library(LLVMSYCLPostLink
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

about the name, to me syclpostlink is a tool, so i would expect files to be in clang/tools, so maybe we could rename it to something else, but i don't have any great ideas, SYCLLowering, SYCLFinalization, idk

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sycl-post-link's help text reads:

This is a collection of utilities run on device code's LLVM IR before handing off to back-end for further compilation or emitting SPIRV.

... so I think the verb "finalize" would capture that well. SYCLFinalizeIR in analogy to SYCLLowerIR maybe?

I also wouldn't mind keeping the "post-link" moniker. SYCLPostLinkUtils or so would make it clear that this is not a tool.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sycl-post-link tool is going to disappear after migration to New Offload Model.
clang/tools is not appropriate since sycl-jit and intel's fortran compiler depend on this functionality.

ComputeModuleRuntimeInfo.cpp
ModuleSplitter.cpp

ADDITIONAL_HEADER_DIRS
${LLVM_MAIN_INCLUDE_DIR}/llvm/SYCLPostLink

DEPENDS
intrinsics_gen
LLVMDemangle
LLVMTransformUtils

LINK_LIBS
LLVMDemangle
LLVMTargetParser
LLVMTransformUtils

LINK_COMPONENTS
Analysis
BitWriter
Core
Demangle
IRPrinter
Passes
Support
ipo
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// See comments in the header.
//===----------------------------------------------------------------------===//
#include "llvm/SYCLLowerIR/ComputeModuleRuntimeInfo.h"
#include "llvm/SYCLPostLink/ComputeModuleRuntimeInfo.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSet.h"
Expand All @@ -17,11 +17,11 @@
#include "llvm/SYCLLowerIR/DeviceGlobals.h"
#include "llvm/SYCLLowerIR/HostPipes.h"
#include "llvm/SYCLLowerIR/LowerWGLocalMemory.h"
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
#include "llvm/SYCLLowerIR/SYCLDeviceLibReqMask.h"
#include "llvm/SYCLLowerIR/SYCLKernelParamOptInfo.h"
#include "llvm/SYCLLowerIR/SYCLUtils.h"
#include "llvm/SYCLLowerIR/SpecConstants.h"
#include "llvm/SYCLPostLink/ModuleSplitter.h"
#include <queue>
#include <unordered_set>
#ifndef NDEBUG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// See comments in the header.
//===----------------------------------------------------------------------===//

#include "llvm/SYCLLowerIR/ModuleSplitter.h"
#include "llvm/SYCLPostLink/ModuleSplitter.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringExtras.h"
Expand All @@ -24,7 +24,6 @@
#include "llvm/IR/PassManagerImpl.h"
#include "llvm/IRPrinter/IRPrintingPasses.h"
#include "llvm/SYCLLowerIR/CleanupSYCLMetadata.h"
#include "llvm/SYCLLowerIR/ComputeModuleRuntimeInfo.h"
#include "llvm/SYCLLowerIR/DeviceGlobals.h"
#include "llvm/SYCLLowerIR/ESIMD/LowerESIMD.h"
#include "llvm/SYCLLowerIR/LowerInvokeSimd.h"
Expand All @@ -33,6 +32,7 @@
#include "llvm/SYCLLowerIR/SYCLUtils.h"
#include "llvm/SYCLLowerIR/SanitizerKernelMetadata.h"
#include "llvm/SYCLLowerIR/SpecConstants.h"
#include "llvm/SYCLPostLink/ComputeModuleRuntimeInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/sycl-module-split/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(LLVM_LINK_COMPONENTS
Core
IRReader
Support
SYCLLowerIR
SYCLPostLink
)

add_llvm_tool(sycl-module-split
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/sycl-module-split/sycl-module-split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
#include "llvm/SYCLPostLink/ModuleSplitter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/PropertySetIO.h"
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/sycl-post-link/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(LLVM_LINK_COMPONENTS
TargetParser
TransformUtils
SYCLLowerIR
SYCLPostLink
InstCombine
ScalarOpts
Linker
Expand Down
5 changes: 3 additions & 2 deletions llvm/tools/sycl-post-link/sycl-post-link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
#include "llvm/Linker/Linker.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/SYCLLowerIR/CompileTimePropertiesPass.h"
#include "llvm/SYCLLowerIR/ComputeModuleRuntimeInfo.h"
#include "llvm/SYCLLowerIR/DeviceConfigFile.hpp"
#include "llvm/SYCLLowerIR/ESIMD/ESIMDUtils.h"
#include "llvm/SYCLLowerIR/ESIMD/LowerESIMD.h"
#include "llvm/SYCLLowerIR/HostPipes.h"
#include "llvm/SYCLLowerIR/LowerInvokeSimd.h"
#include "llvm/SYCLLowerIR/ModuleSplitter.h"
#include "llvm/SYCLLowerIR/SYCLJointMatrixTransform.h"
#include "llvm/SYCLLowerIR/SYCLUtils.h"
#include "llvm/SYCLLowerIR/SpecConstants.h"
#include "llvm/SYCLLowerIR/Support.h"
#include "llvm/SYCLPostLink/ComputeModuleRuntimeInfo.h"
#include "llvm/SYCLPostLink/ModuleSplitter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/InitLLVM.h"
Expand Down
1 change: 1 addition & 0 deletions sycl-jit/jit-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ add_llvm_library(sycl-jit
TargetParser
MC
SYCLLowerIR
SYCLPostLink
GenXIntrinsics
${LLVM_TARGETS_TO_BUILD}

Expand Down
4 changes: 2 additions & 2 deletions sycl-jit/jit-compiler/lib/rtc/DeviceCompilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#include <llvm/IR/PassManager.h>
#include <llvm/IRReader/IRReader.h>
#include <llvm/Linker/Linker.h>
#include <llvm/SYCLLowerIR/ComputeModuleRuntimeInfo.h>
#include <llvm/SYCLLowerIR/ESIMD/LowerESIMD.h>
#include <llvm/SYCLLowerIR/LowerInvokeSimd.h>
#include <llvm/SYCLLowerIR/ModuleSplitter.h>
#include <llvm/SYCLLowerIR/SYCLJointMatrixTransform.h>
#include <llvm/SYCLPostLink/ComputeModuleRuntimeInfo.h>
#include <llvm/SYCLPostLink/ModuleSplitter.h>
#include <llvm/Support/BLAKE3.h>
#include <llvm/Support/Base64.h>
#include <llvm/Support/PropertySetIO.h>
Expand Down
2 changes: 1 addition & 1 deletion sycl-jit/jit-compiler/lib/rtc/ESIMD.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef SYCL_JIT_COMPILER_RTC_ESIMD_H
#define SYCL_JIT_COMPILER_RTC_ESIMD_H

#include "llvm/SYCLLowerIR/ModuleSplitter.h"
#include "llvm/SYCLPostLink/ModuleSplitter.h"

namespace jit_compiler {

Expand Down