Repository navigation
Conversation
Signed-off-by: jinge90 <ge.jin@intel.com>
Signed-off-by: Jin <ge.jin@intel.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved deployment, library-path, runtime-dependency, and fallback-availability regressions can leave supported configurations without required device libraries.
5 open issues
What changed in this PR
This PR integrates spirv64 LLVM libc into SYCL device compilation, deployment, and runtime compilation, replacing selected libdevice string and memory implementations.
Changes:
- Enable libc in spirv64 runtime builds and package it with the SYCL toolchain and JIT resources.
- Add libc discovery and linking to both driver models and runtime compilation.
- Disable SPIR/SPIR-V fallback implementations and update driver test expectations.
| File | Description |
|---|---|
| sycl/CMakeLists.txt | Add libc build dependencies and deployment handling. |
| sycl-jit/jit-compiler/lib/rtc/DeviceCompilation.cpp | Locate and link libc during runtime compilation. |
| sycl-jit/jit-compiler/CMakeLists.txt | Include libc in embedded JIT resources. |
| libdevice/fallback-cstring.hpp | Exclude fallback helpers for SPIR/SPIR-V. |
| libdevice/crt_wrapper.cpp | Exclude string and memory wrappers for SPIR/SPIR-V. |
| libc/cmake/modules/LLVMLibCCompileOptionRules.cmake | Enable generic default address space for SPIR-V libc. |
| clang/test/Driver/sycl-no-rdc-win.cpp | Update Windows compilation phases for libc linking. |
| clang/test/Driver/sycl-no-rdc-old-model.cpp | Update old-model compilation phases for libc linking. |
| clang/test/Driver/sycl-device-lib.cpp | Check libc linking with the new driver. |
| clang/test/Driver/sycl-device-lib-win.cpp | Check Windows device-library linking includes libc. |
| clang/test/Driver/sycl-device-lib-old-model.cpp | Check old-model libc linking, including sanitizer cases. |
| clang/test/Driver/Inputs/SYCL/lib/spirv64-unknown-unknown/libc.bc | Add a libc discovery fixture. |
| clang/lib/Driver/ToolChains/SYCL.cpp | Discover libc and recognize it as a device library. |
| clang/lib/Driver/ToolChain.cpp | Add spirv64 runtime-directory fallback lookup. |
| clang/lib/Driver/Driver.cpp | Add libc selection to the old offload driver. |
| buildbot/configure.py | Enable libc in non-Darwin spirv64 runtime builds. |
Review effort: Balanced
|
|
||
| #ifdef __LIBDEVICE_TARGET_SUPPORT | ||
|
|
||
| #if !defined(__SPIR__) && !defined(__SPIRV__) |
Contributor
Author
There was a problem hiding this comment.
We will always build libc for spirv64 and only support spir64.
Comment on lines
+6173
to
+6175
| if (std::optional<std::string> StdlibPath = TC->getStdlibPath()) { | ||
| LinkDeviceLibc = true; | ||
| LibLocCandidates.emplace_back(*StdlibPath); |
Comment on lines
+46
to
+48
| foreach(tgt IN LISTS libc_targets) | ||
| list(APPEND SYCL_JIT_RESOURCE_INSTALL_COMPONENTS libc) | ||
| endforeach() |
| jit_compiler::resource::ToolchainPrefix.Size}; | ||
| std::string ClangXXExe = (Prefix + "/bin/clang++").str(); | ||
| std::string LibclcDir = GetResourcesPath(ClangXXExe) + "/lib/"; | ||
| std::string StdlibPathBase = (Prefix + "/lib/").str(); |
…ibclc installation' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: jinge90 <ge.jin@intel.com>
Contributor
|
please ping me when this is ready for review, thanks :) |
Signed-off-by: jinge90 <ge.jin@intel.com>
Signed-off-by: jinge90 <ge.jin@intel.com>
jinge90
marked this pull request as ready for review
November 3, 2026 03:28
Contributor
Author
|
Hi, @sarnex @bader @mdtoguchi @srividya-sundaram |
| getDriver().Diag(diag::err_drv_no_sycl_device_lib) << DeviceLib.Path; | ||
| } | ||
|
|
||
| // Link deivce libc for spirv64 target. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR enables LLVM libc for spirv64 target in SYCL compiler, we also remove all string functions provided by libdevice and use the ones from libc instead.