Skip to content

[SYCL][CMake] Enable LLVM_LINK_LLVM_DYLIB builds of the SYCL toolchain - #23052

Open
koparasy wants to merge 2 commits into
intel:syclfrom
koparasy:update-vc-intrinsics
Open

[SYCL][CMake] Enable LLVM_LINK_LLVM_DYLIB builds of the SYCL toolchain#23052
koparasy wants to merge 2 commits into
intel:syclfrom
koparasy:update-vc-intrinsics

Conversation

@koparasy

@koparasy koparasy commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Enable building the SYCL toolchain with -DLLVM_LINK_LLVM_DYLIB=ON
(-DCLANG_LINK_CLANG_DYLIB=ON), previously unsupported.

This is a needed change to allow clang plugins to be loaded during compilation
of sycl code.

Under dylib, tools link libLLVM.so instead of the LLVM component
libraries and so don't inherit their INTERFACE properties. Fixes:

  • Bump the vc-intrinsics pin to 0c3296b, which drops a spurious LLVMGenXIntrinsics
    dependency on LLVMSPIRVLib that formed an illegal cross-dylib cycle
    (LLVM -> SYCLLowerIR -> GenXIntrinsics -> SPIRVLib
    -> LLVM) and broke CMake configuration.
  • LLVMSPIRVLib is not part of libLLVM.so: link it explicitly in
    spirv-to-ir-wrapper and sycl-jit (matching llvm-spirv).
  • sycl-post-link and sycl-jit include vc-intrinsics headers; add the
    LLVMGenXIntrinsics INTERFACE include directories explicitly.

All changes are guarded by LLVM_LINK_LLVM_DYLIB; static builds are
unchanged.

@koparasy
koparasy requested review from a team and cperkinsintel as code owners August 28, 2026 16:43
@koparasy

Copy link
Copy Markdown
Contributor Author

@vmustya for your verifier.

@koparasy

koparasy commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@intel/llvm-reviewers-runtime @intel/dpcpp-tools-reviewers @intel/dpcpp-esimd-reviewers can you please review?

@YuriPlyakhin YuriPlyakhin left a comment

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 there a CI coverage for the configuration this PR enables?

I have not found LLVM_LINK_LLVM_DYLIB=ON under .github/workflows/ or in buildbot/configure.py.

Could you please add a --llvm-link-dylib-style switch to buildbot/configure.py and a nightly job (or even less frequent would be fine)?

@YuriPlyakhin

Copy link
Copy Markdown
Contributor
  • drops a spurious
    LLVMSPIRVLib dependency on LLVMGenXIntrinsics

did you mean:
drops a spurious LLVMGenXIntrinsics dependency on LLVMSPIRVLib
?

Comment thread sycl-jit/jit-compiler/CMakeLists.txt Outdated
@koparasy
koparasy requested a review from a team as a code owner September 2, 2026 13:44
@koparasy

koparasy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Is there a CI coverage for the configuration this PR enables?

I have not found LLVM_LINK_LLVM_DYLIB=ON under .github/workflows/ or in buildbot/configure.py.

Could you please add a --llvm-link-dylib-style switch to buildbot/configure.py and a nightly job (or even less frequent would be fine)?

Done in 0de19b2


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

@KornevNikita KornevNikita left a comment

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.

nightly changes lgtm

@koparasy

koparasy commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@intel/dpcpp-esimd-reviewers can you please review this. Thank you!

Comment thread buildbot/configure.py
"-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.

@YuriPlyakhin YuriPlyakhin left a comment

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.

changes in llvm LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants