-
Notifications
You must be signed in to change notification settings - Fork 844
[SYCL] Differentiate install targets for clang* binaries
#21598
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
dm-vodopyanov
merged 55 commits into
intel:sycl
from
dm-vodopyanov:rename_clang_to_dpclang
Jul 10, 2026
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
e6cb663
[SYCL] Rename clang binaries to dpclang
dm-vodopyanov d8939da
Revert "[SYCL] Rename clang binaries to dpclang"
dm-vodopyanov 0e2ecdb
Merge remote-tracking branch 'origin/sycl' into rename_clang_to_dpclang
dm-vodopyanov 6b896ba
Apply CR comments
dm-vodopyanov a678dba
Move sycl-ls back to install/bin folder
dm-vodopyanov 814058d
Make it only for Linux`
dm-vodopyanov e0be600
Fix regressions + add a test
dm-vodopyanov 4d91d11
Small fix
dm-vodopyanov 56207c8
Fix formatting
dm-vodopyanov 8110571
Fix formatting
dm-vodopyanov 1b19d13
Update CI
dm-vodopyanov 1139beb
Try to fix CI for Linux
dm-vodopyanov fc08eb4
Fix CI on Linux
dm-vodopyanov 417df3d
Fix CI
dm-vodopyanov 8b44d37
Fix merge conflict`
dm-vodopyanov e7ab6ae
Merge branch 'sycl' into rename_clang_to_dpclang
dm-vodopyanov 44c1954
Try to fix CI
dm-vodopyanov 9887a91
Try to fix CI
dm-vodopyanov 079ce50
Fix CI
dm-vodopyanov 984b2e4
Fix CI
dm-vodopyanov 42408f3
Update CI config
dm-vodopyanov 0623bae
Try to fix failures on Windows
dm-vodopyanov a832242
Fix clang-format
dm-vodopyanov fea0eaf
Some improvements
dm-vodopyanov eeb5025
Fix Windows
dm-vodopyanov 8b4c27e
Add missing binary
dm-vodopyanov 8d0835a
Merge branch 'sycl' into rename_clang_to_dpclang
dm-vodopyanov 46b01d7
Merge remote-tracking branch 'origin/sycl' into rename_clang_to_dpclang
0f44a04
Apply CR comments
dm-vodopyanov a232458
Merge branch 'rename_clang_to_dpclang' of https://github.com/dm-vodop…
dm-vodopyanov b0802b7
Fix CI
dm-vodopyanov 3578f68
Fix CI
dm-vodopyanov 9fb8f49
Fix CI
dm-vodopyanov de25fd1
Fix CI
dm-vodopyanov 348ab49
Merge branch 'intel:sycl' into rename_clang_to_dpclang
dm-vodopyanov 8f13cab
Fix CI
dm-vodopyanov 1f78e64
Merge branch 'rename_clang_to_dpclang' of https://github.com/dm-vodop…
dm-vodopyanov 761cc89
Fix Windows
dm-vodopyanov b0c0c73
Fix Windows
dm-vodopyanov 42c7929
Fix for SYCL RTC
dm-vodopyanov d887130
Fix E2E
dm-vodopyanov 75cfdcd
Try to fix CI on Windows
dm-vodopyanov fa3a81b
Fix CI
dm-vodopyanov 02c10da
Fix E2E test
dm-vodopyanov 3c066a5
Fix some paths
dm-vodopyanov bae507e
Apply CR comment
dm-vodopyanov 7291c6b
Apply CR comment
dm-vodopyanov 4efea35
Revert changing location of devicelib files
dm-vodopyanov b7171a2
Apply CR comments
dm-vodopyanov 05e80f6
Apply CR comments
dm-vodopyanov 7f5938b
Apply CR comments
dm-vodopyanov 26b9b59
Fix clang-format
dm-vodopyanov d0d0167
Fix for Windows
dm-vodopyanov 8da7edf
Fix for Windows in-tree tests
dm-vodopyanov 45c68d1
Fix clang-format
dm-vodopyanov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| set(LLVM_LINK_COMPONENTS | ||
| Support | ||
| ) | ||
|
|
||
| # dpllvm is the entry-point shim for the DPC++ toolchain. It is installed into | ||
| # bin/ next to the real tools; the public "dp"-prefixed names are symlinks | ||
| # (copies on Windows, which lacks first-class symlinks) to it. At runtime | ||
| # dpllvm strips the "dp" prefix from argv[0] and execs the sibling real binary | ||
| # (dpclang -> clang, dpclang++ -> clang++, dpsycl-ls -> sycl-ls, ...). | ||
| # | ||
| # These names must not collide with a system LLVM/Clang on PATH, hence the | ||
| # prefix; the real binaries keep their original names because the clang driver | ||
| # re-invokes itself by name and expects to find "clang"/"clang++". | ||
| add_clang_tool(dpllvm | ||
| dpllvm.cpp | ||
| ) | ||
|
|
||
| # The public entry-points. Each is a symlink/copy to dpllvm; the stripped name | ||
| # (after removing "dp") must match a real binary installed next to dpllvm. | ||
| # dpclang* -> clang, clang++, clang-cl, clang-cpp (this project) | ||
| # dpsycl-ls -> sycl-ls (sycl/tools/sycl-ls) | ||
| # dpsyclbin-dump -> syclbin-dump (sycl/tools/syclbin-dump) | ||
| # dpsycl-prof -> sycl-prof (sycl/tools/sycl-prof, UNIX + XPTI only) | ||
| # dpsycl-sanitize -> sycl-sanitize (sycl/tools/sycl-sanitize, UNIX + XPTI) | ||
| # dpsycl-trace -> sycl-trace (sycl/tools/sycl-trace, UNIX + XPTI) | ||
| # | ||
| # add_clang_symlink creates both the build-tree link (POST_BUILD of dpllvm, so | ||
| # it lands in the same build bin/ as every real tool) and the install rule | ||
| # (component "dpllvm"). The sycl-* entry-points are created here rather than in | ||
| # their own tool directories so that all symlink creation lives in one place and | ||
| # ships as a single component that deploy-sycl-toolchain pulls in; a symlink | ||
| # whose target tool is not built on a given platform simply errors at runtime, | ||
| # which is the same behavior as a missing tool. | ||
| set(DPCPP_ENTRY_POINTS | ||
| dpclang | ||
| dpclang++ | ||
| dpclang-cl | ||
| dpclang-cpp | ||
| dpsycl-ls | ||
| dpsyclbin-dump | ||
| dpsycl-prof | ||
| dpsycl-sanitize | ||
| dpsycl-trace | ||
| ) | ||
|
|
||
| foreach(link ${DPCPP_ENTRY_POINTS}) | ||
| add_clang_symlink(${link} dpllvm) | ||
| endforeach() |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| //===-- dpllvm.cpp - DPC++ tool entry-point shim --------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // The DPC++ toolchain ships public entry-points whose names are prefixed with | ||
| // "dp" (dpclang, dpclang++, dpclang-cl, dpclang-cpp, dpsycl-ls, ...) so they | ||
| // don't collide with the identically-named tools of a system LLVM/Clang | ||
| // installation that may be on PATH. Those entry-points are symlinks (real | ||
| // copies on Windows, which has no first-class symlinks) that resolve to this | ||
| // tool. | ||
| // | ||
| // dpllvm looks at how it was invoked (argv[0]), strips the leading "dp", and | ||
| // re-executes the correspondingly-named real binary that lives next to it in | ||
| // the same directory -- e.g. invoking "dpclang++" runs "clang++". The real | ||
| // binary keeps its original name ("clang++", not "dpclang++") because the | ||
| // clang driver re-invokes itself by name (for -cc1, offloading sub-jobs, etc.) | ||
| // and must find a binary called "clang"/"clang++". | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "llvm/Support/Error.h" | ||
| #include "llvm/Support/Path.h" | ||
| #include "llvm/Support/Program.h" | ||
|
|
||
| int main(int argc, char *argv[]) { | ||
| using namespace llvm; | ||
| using namespace llvm::sys; | ||
|
|
||
| StringRef Executable = argv[0]; | ||
| StringRef Alias = path::filename(Executable); | ||
|
|
||
| ExitOnError Exit((Alias + ": ").str()); | ||
|
|
||
| // Derive the real tool's base name by dropping any executable extension and | ||
| // stripping the "dp" prefix (e.g. "dpclang++" / "dpclang++.exe" -> | ||
| // "clang++"). The extension is intentionally not carried over: how it appears | ||
| // in argv[0] is inconsistent across platforms (a Windows invocation may or | ||
| // may not include ".exe"), so it is left to findProgramByName below to append | ||
| // the right suffix when locating the real binary. | ||
| StringRef RealName = path::stem(Alias); | ||
| if (!RealName.consume_front("dp")) | ||
| Exit(createStringError("binary '" + Alias + "' not prefixed by 'dp'.")); | ||
|
|
||
| // Locate the directory this tool was installed into so we can find the real | ||
| // binary sitting next to it, regardless of the current working directory or | ||
| // how the tool was found on PATH. | ||
| void *MainAddr = reinterpret_cast<void *>(main); | ||
| std::string DpllvmPath = fs::getMainExecutable(argv[0], MainAddr); | ||
| if (DpllvmPath.empty()) | ||
| Exit(createStringError( | ||
| "couldn't determine the path to the DPC++ bin/ directory.")); | ||
|
|
||
| StringRef BinaryDir = path::parent_path(DpllvmPath); | ||
|
|
||
| // findProgramByName searches the given directory and appends the platform | ||
| // executable suffix (".exe" on Windows), so this resolves the sibling real | ||
| // binary whether or not the invoking name carried an extension. | ||
| ErrorOr<std::string> BinaryPathOrErr = | ||
| findProgramByName(RealName, {BinaryDir}); | ||
| if (!BinaryPathOrErr) | ||
| Exit(createStringError("binary '" + RealName + "' not found next to '" + | ||
| DpllvmPath + "'.")); | ||
| StringRef BinaryPath = *BinaryPathOrErr; | ||
|
|
||
| SmallVector<StringRef, 128> Args = {BinaryPath}; | ||
| Args.append(argv + 1, argv + argc); | ||
|
|
||
| std::string ErrMsg; | ||
| int Result = ExecuteAndWait(BinaryPath, Args, /*Env=*/std::nullopt, | ||
| /*Redirects=*/{}, /*SecondsToWait=*/0, | ||
| /*MemoryLimit=*/0, &ErrMsg); | ||
| if (!ErrMsg.empty()) | ||
| Exit( | ||
| createStringError("failed to execute '" + BinaryPath + "': " + ErrMsg)); | ||
| return Result; | ||
| } |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.