Skip to content
Open
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
13 changes: 13 additions & 0 deletions .github/workflows/sycl-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@
toolchain_artifact: sycl_linux_sprod_shared
toolchain_artifact_filename: sycl_linux_shared.tar.zst

linux_dylib_build:
if: github.repository == 'intel/llvm'
uses: ./.github/workflows/sycl-linux-build.yml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This looks to me as the common pattern in nightly, see https://github.com/intel/llvm/pull/23052/changes#diff-f8dae70b8775cf9c5fb547e9210ddc33d1e878401bfcf752b4fbdf16b1b601bbL55 . Can anyone verify that we can ignore this warning?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah let's ignore this

secrets: inherit
with:
build_cache_root: "/__w/"
build_cache_suffix: sprod_dylib
build_configure_extra_args: '--llvm-link-dylib'
build_target: all

toolchain_artifact: sycl_linux_sprod_dylib
toolchain_artifact_filename: sycl_linux_dylib.tar.zst

ubuntu2404_oneapi_build:
if: github.repository == 'intel/llvm'
uses: ./.github/workflows/sycl-linux-build.yml
Expand Down
12 changes: 12 additions & 0 deletions buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def do_configure(args, passthrough_args):
llvm_enable_sphinx = "OFF"
llvm_build_shared_libs = "OFF"
llvm_enable_lld = "OFF"
llvm_link_dylib = "OFF"
sycl_enabled_backends = ["opencl"]
sycl_preview_lib = "ON"

Expand Down Expand Up @@ -126,6 +127,9 @@ def do_configure(args, passthrough_args):
if args.use_lld:
llvm_enable_lld = "ON"

if args.llvm_link_dylib:
llvm_link_dylib = "ON"

if args.use_zstd:
llvm_enable_zstd = "FORCE_ON"

Expand Down Expand Up @@ -189,6 +193,8 @@ def do_configure(args, passthrough_args):
"-DLLVM_ENABLE_DOXYGEN={}".format(llvm_enable_doxygen),
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
"-DLLVM_LINK_LLVM_DYLIB={}".format(llvm_link_dylib),
"-DCLANG_LINK_CLANG_DYLIB={}".format(llvm_link_dylib),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this line necessary (DCLANG_LINK_CLANG_DYLIB)?

Please, check:

set(CLANG_LINK_CLANG_DYLIB ${LLVM_LINK_LLVM_DYLIB} CACHE BOOL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe what I have is more robust. If cmakelist.txt is modified (unlikely), I still want both of them to be enabled to test our build.

Do you want me to modify and skip the setting?

@YuriPlyakhin YuriPlyakhin Sep 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I want to avoid side effects.

Example (I did not verify it though):

On Windows, CAN_BUILD_LLVM_DYLIB is OFF for MSVC, so cmake_dependent_option force-sets LLVM_LINK_LLVM_DYLIB=OFF:

llvm/llvm/CMakeLists.txt

Lines 977 to 983 in c2098bb

set(CAN_BUILD_LLVM_DYLIB OFF)
if(NOT MSVC OR LLVM_BUILD_LLVM_DYLIB_VIS)
set(CAN_BUILD_LLVM_DYLIB ON)
endif()
cmake_dependent_option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" OFF
"CAN_BUILD_LLVM_DYLIB" OFF)

Explicit -DCLANG_LINK_CLANG_DYLIB=ON seems to result in error in the case, when 2 settings do not match:

llvm/clang/CMakeLists.txt

Lines 360 to 363 in bf6137c

if (NOT LLVM_LINK_LLVM_DYLIB AND CLANG_LINK_CLANG_DYLIB)
message(FATAL_ERROR "Cannot set CLANG_LINK_CLANG_DYLIB=ON when "
"LLVM_LINK_LLVM_DYLIB=OFF")
endif()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But I let @intel/dpcpp-devops-reviewers make a decision, they own this configuration file.

"-DSYCL_ENABLE_XPTI_TRACING={}".format(sycl_enable_xpti_tracing),
"-DLLVM_ENABLE_LLD={}".format(llvm_enable_lld),
"-DLLVM_SPIRV_ENABLE_LIBSPIRV_DIS={}".format(spirv_enable_dis),
Expand Down Expand Up @@ -405,6 +411,12 @@ def main():
parser.add_argument(
"--use-lld", action="store_true", help="Use LLD linker for build"
)
parser.add_argument(
"--llvm-link-dylib",
action="store_true",
help="Build/link against the shared libLLVM.so and libclang-cpp.so "
"(sets LLVM_LINK_LLVM_DYLIB=ON and CLANG_LINK_CLANG_DYLIB=ON)",
)
parser.add_argument(
"--llvm-external-projects",
help="Add external projects to build. Add as comma seperated list.",
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLLowerIR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (NOT TARGET LLVMGenXIntrinsics)
if (NOT LLVMGenXIntrinsics_FOUND)
set(LLVMGenXIntrinsics_GIT_REPO https://github.com/intel/vc-intrinsics.git)

set(LLVMGenXIntrinsics_GIT_TAG 546cf38639d042a860e44f22508d58788188f8c8)
set(LLVMGenXIntrinsics_GIT_TAG 0c3296b5fe7ab5a8392197478d0bbd35649dc924)
if(NOT FETCHCONTENT_SOURCE_DIR_VC-INTRINSICS)
message(STATUS "vc-intrinsics repo is missing. Will try to download "
"${LLVMGenXIntrinsics_GIT_TAG} from ${LLVMGenXIntrinsics_GIT_REPO}")
Expand Down
7 changes: 7 additions & 0 deletions llvm/tools/spirv-to-ir-wrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ include_directories(
add_llvm_tool(spirv-to-ir-wrapper
spirv-to-ir-wrapper.cpp
)

# LLVMSPIRVLib is not part of libLLVM.so, so in LLVM_LINK_LLVM_DYLIB builds the
# SPIRVLib component listed above resolves to the dylib (which lacks its
# symbols). Link the static library explicitly, matching llvm-spirv.
if (LLVM_LINK_LLVM_DYLIB)
target_link_libraries(spirv-to-ir-wrapper PRIVATE LLVMSPIRVLib)
endif()
10 changes: 10 additions & 0 deletions llvm/tools/sycl-post-link/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,15 @@ add_llvm_tool(sycl-post-link
intrinsics_gen
)

# sycl-post-link.cpp includes SYCLLowerIR's ESIMDUtils.h, which pulls in a
# vc-intrinsics header (GenXMetadata.h). In LLVM_LINK_LLVM_DYLIB builds this
# tool links libLLVM.so rather than the LLVMSYCLLowerIR component, so it does
# not inherit the LLVMGenXIntrinsics INTERFACE include directories. Add them
# explicitly so the header is found.
if (LLVM_LINK_LLVM_DYLIB)
target_include_directories(sycl-post-link PRIVATE
$<TARGET_PROPERTY:LLVMGenXIntrinsics,INTERFACE_INCLUDE_DIRECTORIES>)
endif()

setup_host_tool(sycl-post-link SYCL_POST_LINK
sycl-post-link_exe sycl-post-link_target)
13 changes: 13 additions & 0 deletions sycl-jit/jit-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,19 @@ target_link_libraries(sycl-jit
${CMAKE_THREAD_LIBS_INIT}
)

# In LLVM_LINK_LLVM_DYLIB builds sycl-jit links libLLVM.so rather than the LLVM
# component libraries, so it does not inherit their INTERFACE properties:
# - LLVMSPIRVLib is not part of libLLVM.so, so the SPIRVLib component listed
# above resolves to the dylib (which lacks its symbols); link it explicitly.
# - rtc/ESIMD.cpp includes a vc-intrinsics header (GenXSPIRVWriterAdaptor.h),
# so add the LLVMGenXIntrinsics INTERFACE include directories explicitly.
# The first mirrors llvm-spirv; the second mirrors sycl-post-link.
if (LLVM_LINK_LLVM_DYLIB)
target_link_libraries(sycl-jit PRIVATE LLVMSPIRVLib)
target_include_directories(sycl-jit PRIVATE
$<TARGET_PROPERTY:LLVMGenXIntrinsics,INTERFACE_INCLUDE_DIRECTORIES>)
endif()

add_dependencies(sycl-jit sycl-headers)

if("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD)
Expand Down
Loading