https://github.com/sergey-semenov updated https://github.com/llvm/llvm-project/pull/188770
>From e484402a777e7b66d355034e387939cd28089f74 Mon Sep 17 00:00:00 2001 From: Sergey Semenov <[email protected]> Date: Thu, 26 Mar 2026 05:35:19 -0700 Subject: [PATCH 1/4] [libsycl] Move and rename the shared library Align the shared library with other runtime libraries: - Rename from libsycl.so to libLLVMSYCL.so - Make build dir independent from LLVM_ENABLE_PER_TARGET_RUNTIME_DIR and install dir dependent on it. --- libsycl/CMakeLists.txt | 15 ++++++++------- libsycl/src/CMakeLists.txt | 4 ++-- libsycl/tools/sycl-ls/CMakeLists.txt | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libsycl/CMakeLists.txt b/libsycl/CMakeLists.txt index f75216978f69a..8a414b1730c6a 100644 --- a/libsycl/CMakeLists.txt +++ b/libsycl/CMakeLists.txt @@ -37,22 +37,23 @@ option(LIBSYCL_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF) set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +if(LLVM_LIBRARY_OUTPUT_INTDIR) + set(LIBSYCL_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) +else() + set(LIBSYCL_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBSYCL_LIBDIR_SUFFIX}) +endif() + if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBSYCL_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBSYCL_LIBDIR_SUBDIR) string(APPEND LIBSYCL_TARGET_SUBDIR /${LIBSYCL_LIBDIR_SUBDIR}) endif() cmake_path(NORMAL_PATH LIBSYCL_TARGET_SUBDIR) - set(LIBSYCL_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBSYCL_TARGET_SUBDIR}) set(LIBSYCL_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBSYCL_TARGET_SUBDIR} CACHE STRING "Path where built libsycl libraries should be installed.") unset(LIBSYCL_TARGET_SUBDIR) else() - if(LLVM_LIBRARY_OUTPUT_INTDIR) - set(LIBSYCL_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) - else() - set(LIBSYCL_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBSYCL_LIBDIR_SUFFIX}) - endif() set(LIBSYCL_INSTALL_LIBRARY_DIR lib${LIBSYCL_LIBDIR_SUFFIX} CACHE STRING "Path where built libsycl libraries should be installed.") endif() @@ -115,7 +116,7 @@ add_custom_command( install(DIRECTORY "${LIBSYCL_SOURCE_INCLUDE_DIR}/sycl" DESTINATION ${LIBSYCL_INCLUDE_DIR} COMPONENT sycl-headers) install(DIRECTORY "${LIBSYCL_SOURCE_INCLUDE_DIR}/CL" DESTINATION ${LIBSYCL_INCLUDE_DIR} COMPONENT sycl-headers) -set(LIBSYCL_LIB_NAME "sycl") +set(LIBSYCL_LIB_NAME "LLVMSYCL") set(LIBSYCL_SHARED_OUTPUT_NAME "${LIBSYCL_LIB_NAME}") if (CMAKE_SYSTEM_NAME STREQUAL Windows) if (CMAKE_MSVC_RUNTIME_LIBRARY AND (NOT CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DLL$")) diff --git a/libsycl/src/CMakeLists.txt b/libsycl/src/CMakeLists.txt index 67ba7d28968de..c7d078d2322ae 100644 --- a/libsycl/src/CMakeLists.txt +++ b/libsycl/src/CMakeLists.txt @@ -105,6 +105,6 @@ add_sycl_rt_library(${LIBSYCL_LIB_NAME} ${LIBSYCL_SOURCES}) install(TARGETS ${LIBSYCL_RT_LIBS} - ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT libsycl - LIBRARY DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT libsycl + ARCHIVE DESTINATION ${LIBSYCL_INSTALL_LIBRARY_DIR} COMPONENT libsycl + LIBRARY DESTINATION ${LIBSYCL_INSTALL_LIBRARY_DIR} COMPONENT libsycl RUNTIME DESTINATION "bin" COMPONENT libsycl) diff --git a/libsycl/tools/sycl-ls/CMakeLists.txt b/libsycl/tools/sycl-ls/CMakeLists.txt index 82eb3e644e5b1..e34ba77c88c37 100644 --- a/libsycl/tools/sycl-ls/CMakeLists.txt +++ b/libsycl/tools/sycl-ls/CMakeLists.txt @@ -3,7 +3,7 @@ add_executable(sycl-ls sycl-ls.cpp) target_include_directories(sycl-ls SYSTEM PRIVATE ${LLVM_MAIN_INCLUDE_DIR}) target_link_libraries(sycl-ls PRIVATE LLVMSupport LLVMObject) -add_dependencies(sycl-ls sycl) +add_dependencies(sycl-ls ${LIBSYCL_LIB_NAME}) target_include_directories(sycl-ls PRIVATE ${LIBSYCL_BUILD_INCLUDE_DIR}) target_link_libraries(sycl-ls >From 38c27457c68fc0bbc4bbafdd0adc3ff1bc673939 Mon Sep 17 00:00:00 2001 From: Sergey Semenov <[email protected]> Date: Fri, 27 Mar 2026 07:47:11 -0700 Subject: [PATCH 2/4] Update lit.cfg.py --- libsycl/test/lit.cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsycl/test/lit.cfg.py b/libsycl/test/lit.cfg.py index 67ab5d2e83294..377be90791ef0 100644 --- a/libsycl/test/lit.cfg.py +++ b/libsycl/test/lit.cfg.py @@ -117,7 +117,7 @@ def __exit__(self, exc_type, exc_value, exc_traceback): config.substitutions.append( ( "%sycl_options", - " -lsycl" + " -lLLVMSYCL" + " -isystem " + config.libsycl_include + " -isystem " >From 3bd99fbd9da547c7ad85ed07fc0cf0b0f9335fd2 Mon Sep 17 00:00:00 2001 From: Sergey Semenov <[email protected]> Date: Fri, 27 Mar 2026 09:39:11 -0700 Subject: [PATCH 3/4] Revert build dir change --- libsycl/CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libsycl/CMakeLists.txt b/libsycl/CMakeLists.txt index 8a414b1730c6a..6f55838c7b2e3 100644 --- a/libsycl/CMakeLists.txt +++ b/libsycl/CMakeLists.txt @@ -37,23 +37,22 @@ option(LIBSYCL_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF) set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -if(LLVM_LIBRARY_OUTPUT_INTDIR) - set(LIBSYCL_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) -else() - set(LIBSYCL_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBSYCL_LIBDIR_SUFFIX}) -endif() - if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBSYCL_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) if(LIBSYCL_LIBDIR_SUBDIR) string(APPEND LIBSYCL_TARGET_SUBDIR /${LIBSYCL_LIBDIR_SUBDIR}) endif() cmake_path(NORMAL_PATH LIBSYCL_TARGET_SUBDIR) + set(LIBSYCL_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBSYCL_TARGET_SUBDIR}) set(LIBSYCL_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBSYCL_TARGET_SUBDIR} CACHE STRING "Path where built libsycl libraries should be installed.") unset(LIBSYCL_TARGET_SUBDIR) else() + if(LLVM_LIBRARY_OUTPUT_INTDIR) + set(LIBSYCL_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) + else() + set(LIBSYCL_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBSYCL_LIBDIR_SUFFIX}) + endif() set(LIBSYCL_INSTALL_LIBRARY_DIR lib${LIBSYCL_LIBDIR_SUFFIX} CACHE STRING "Path where built libsycl libraries should be installed.") endif() >From 4209b1b826c9d392193c6728ba9f33341ab388c9 Mon Sep 17 00:00:00 2001 From: Srividya Sundaram <[email protected]> Date: Tue, 31 Mar 2026 11:43:07 -0700 Subject: [PATCH 4/4] [Driver] Update SYCL runtime library name and path for target-specific directories (#189053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch updates the Clang driver to support the renamed SYCL runtime library (libsycl.so → libLLVMSYCL.so) and its new location in target-specific directories. These changes align with PR #[188770](https://github.com/llvm/llvm-project/pull/188770), which standardizes the SYCL runtime library naming and directory structure to match other LLVM runtime libraries. **Changes** **Library Naming** - **Old**: libsycl.so - **New**: libLLVMSYCL.so **Directory Structure** Both build and install directories now use target-specific subdirectories: - **Old:** lib/libsycl.so - **New:** lib/target-triple/libLLVMSYCL.so For example, on x86_64-unknown-linux-gnu: - **Old**: build/lib/libsycl.so → install/lib/libsycl.so - **New**: build/lib/x86_64-unknown-linux-gnu/libLLVMSYCL.so → install/lib/x86_64-unknown-linux-gnu/libLLVMSYCL.so --- clang/include/clang/Driver/SyclInstallationDetector.h | 4 ++-- clang/lib/Driver/ToolChains/Linux.cpp | 3 ++- clang/lib/Driver/ToolChains/SYCL.cpp | 10 ++++++---- .../Driver/Inputs/SYCL/{libsycl.ll => libLLVMSYCL.ll} | 0 clang/test/Driver/link-device-code.test | 4 ++-- clang/test/Driver/sycl-offload-jit.cpp | 4 ++-- 6 files changed, 14 insertions(+), 11 deletions(-) rename clang/test/Driver/Inputs/SYCL/{libsycl.ll => libLLVMSYCL.ll} (100%) diff --git a/clang/include/clang/Driver/SyclInstallationDetector.h b/clang/include/clang/Driver/SyclInstallationDetector.h index f92228817f045..5f40294c026d7 100644 --- a/clang/include/clang/Driver/SyclInstallationDetector.h +++ b/clang/include/clang/Driver/SyclInstallationDetector.h @@ -22,8 +22,8 @@ class SYCLInstallationDetector { void addSYCLIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const; - // Return the filesystem path to the SYCL runtime library (libsycl.so), that - // was detected. + // Return the filesystem path to the SYCL runtime library (libLLVMSYCL.so), + // that was detected. StringRef getSYCLRTLibPath() const { return SYCLRTLibPath; } private: diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp index bde99a3dac860..cf67f984ccdd2 100644 --- a/clang/lib/Driver/ToolChains/Linux.cpp +++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -865,7 +865,8 @@ void Linux::addOffloadRTLibs(unsigned ActiveKinds, const ArgList &Args, if (ActiveKinds & Action::OFK_HIP) Libraries.emplace_back(RocmInstallation->getLibPath(), "libamdhip64.so"); else if (ActiveKinds & Action::OFK_SYCL) - Libraries.emplace_back(SYCLInstallation->getSYCLRTLibPath(), "libsycl.so"); + Libraries.emplace_back(SYCLInstallation->getSYCLRTLibPath(), + "libLLVMSYCL.so"); for (auto [Path, Library] : Libraries) { if (Args.hasFlag(options::OPT_frtlib_add_rpath, diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp b/clang/lib/Driver/ToolChains/SYCL.cpp index 033fd98183737..53bfdfe4316ae 100644 --- a/clang/lib/Driver/ToolChains/SYCL.cpp +++ b/clang/lib/Driver/ToolChains/SYCL.cpp @@ -19,15 +19,17 @@ SYCLInstallationDetector::SYCLInstallationDetector( const Driver &D, const llvm::Triple &HostTriple, const llvm::opt::ArgList &Args) : D(D) { - // Detect the presence of the SYCL runtime library (libsycl.so) in the + // Detect the presence of the SYCL runtime library (libLLVMSYCL.so) in the // filesystem. This is used to determine whether a usable SYCL installation // is available for the current driver invocation. StringRef SysRoot = D.SysRoot; SmallString<128> DriverDir(D.Dir); + SmallString<128> LibPath(DriverDir); + llvm::sys::path::append(LibPath, "..", "lib", HostTriple.str(), + "libLLVMSYCL.so"); if (DriverDir.starts_with(SysRoot) && - (Args.hasArg(options::OPT_fsycl) || - D.getVFS().exists(DriverDir + "/../lib/libsycl.so"))) { - llvm::sys::path::append(DriverDir, "..", "lib"); + (Args.hasArg(options::OPT_fsycl) || D.getVFS().exists(LibPath))) { + llvm::sys::path::append(DriverDir, "..", "lib", HostTriple.str()); SYCLRTLibPath = DriverDir; } } diff --git a/clang/test/Driver/Inputs/SYCL/libsycl.ll b/clang/test/Driver/Inputs/SYCL/libLLVMSYCL.ll similarity index 100% rename from clang/test/Driver/Inputs/SYCL/libsycl.ll rename to clang/test/Driver/Inputs/SYCL/libLLVMSYCL.ll diff --git a/clang/test/Driver/link-device-code.test b/clang/test/Driver/link-device-code.test index 231f02b6560e0..eb75eaf1fe5c2 100644 --- a/clang/test/Driver/link-device-code.test +++ b/clang/test/Driver/link-device-code.test @@ -3,12 +3,12 @@ # RUN: llvm-as %S/Inputs/SYCL/foo.ll -o %t.foo.bc # RUN: llvm-as %S/Inputs/SYCL/bar.ll -o %t.bar.bc # RUN: llvm-as %S/Inputs/SYCL/baz.ll -o %t.baz.bc -# RUN: llvm-as %S/Inputs/SYCL/libsycl.ll -o %t.libsycl.bc +# RUN: llvm-as %S/Inputs/SYCL/libLLVMSYCL.ll -o %t.libLLVMSYCL.bc # RUN: clang-sycl-linker %t.foo.bc %t.bar.bc -triple=spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-SIMPLE # RUN: not clang-sycl-linker %t.bar.bc %t.baz.bc -triple=spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-MULTIPLE-DEFS -# RUN: clang-sycl-linker %t.foo.bc %t.bar.bc -device-libs=%t.libsycl.bc -library-path= -triple=spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-DEVICE-LIB +# RUN: clang-sycl-linker %t.foo.bc %t.bar.bc -device-libs=%t.libLLVMSYCL.bc -library-path= -triple=spirv64 --dry-run -o a.spv --print-linked-module 2>&1 | FileCheck %s --check-prefix=CHECK-DEVICE-LIB ; CHECK-SIMPLE: define {{.*}}foo_func1{{.*}} ; CHECK-SIMPLE: define {{.*}}foo_func2{{.*}} diff --git a/clang/test/Driver/sycl-offload-jit.cpp b/clang/test/Driver/sycl-offload-jit.cpp index 5bdb56d935a98..e9b821597f804 100644 --- a/clang/test/Driver/sycl-offload-jit.cpp +++ b/clang/test/Driver/sycl-offload-jit.cpp @@ -29,13 +29,13 @@ // CHK-DEVICE-TRIPLE-SAME: "-O2" // CHK-DEVICE-TRIPLE: llvm-offload-binary{{.*}} "--image=file={{.*}}.bc,triple=spirv64-unknown-unknown,arch=generic,kind=sycl" -// Check if path to libsycl.so is passed to clang-linker-wrapper tool by default for SYCL compilation. +// Check if path to libLLVMSYCL.so is passed to clang-linker-wrapper tool by default for SYCL compilation. // The test also checks if SYCL header include paths are added to the SYCL host and device compilation. // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK-LSYCL,CHECK-SYCL-HEADERS-HOST,CHECK-SYCL-HEADERS-DEVICE %s // CHECK-SYCL-HEADERS-DEVICE: "-fsycl-is-device"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include" // CHECK-SYCL-HEADERS-HOST: "-fsycl-is-host"{{.*}} "-internal-isystem" "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}include" -// CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}libsycl.so" +// CHECK-LSYCL: clang-linker-wrapper{{.*}} "{{.*}}bin{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}x86_64-unknown-linux-gnu{{[/\\]+}}libLLVMSYCL.so" /// Check -fsycl-is-device is passed when compiling for the device. /// Check -fsycl-is-host is passed when compiling for host. _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
