commit | 52e10e6c3bad782380c8a931aabca2800b53a85d | [log] [tgz] |
---|---|---|
author | Arvind Sudarsanam <arvind.sudarsanam@intel.com> | Thu Apr 17 12:48:08 2025 -0400 |
committer | GitHub <noreply@github.com> | Thu Apr 17 16:48:08 2025 +0000 |
tree | 066eab7beadcc76a917e05a5fbadd0dd6329c26f | |
parent | 2ef01048624dc2a564d5925d082a72a51bb97c48 [diff] |
[SYCL] Add clang-linker-wrapper changes to call clang-sycl-linker for SYCL offloads (#135683) This PR is one of the many PRs in the SYCL upstreaming effort focusing on device code linking during the SYCL offload compilation process. RFC: https://discourse.llvm.org/t/rfc-offloading-design-for-sycl-offload-kind-and-spir-targets/74088 Approved PRs so far: 1. [Clang][SYCL] Introduce clang-sycl-linker to link SYCL offloading device code (Part 1 of many) - [Link](https://github.com/llvm/llvm-project/pull/112245) 2. [clang-sycl-linker] Replace llvm-link with API calls - [Link](https://github.com/llvm/llvm-project/pull/133797) 3. [SYCL][SPIR-V Backend][clang-sycl-linker] Add SPIR-V backend support inside clang-sycl-linker - [Link](https://github.com/llvm/llvm-project/pull/133967) This PR adds SYCL device code linking support to clang-linker-wrapper. ### Summary for this PR Device code linking happens inside clang-linker-wrapper. In the current implementation, clang-linker-wrapper does the following: 1. Extracts device code. Input_1, Input_2,..... 5. Group device code according to target devices Inputs[triple_1] = .... Inputs[triple_2] = .... 6. For each group, i.e. Inputs[triple_i], a. Gather all the offload kinds found inside those inputs in ActiveOffloadKinds b. Link all images inside Inputs[triple_i] by calling clang --target=triple_i .... c. Create a copy of that linked image for each offload kind and add it to Output[Kind] list. In SYCL compilation flow, there is a deviation in Step 3b. We call device code splitting inside the 'clang --target=triple_i ....' call and the output is now a 'packaged' file containing multiple device images. This deviation requires us to capture the OffloadKind during the linking stage and pass it along to the linking function (clang), so that clang can be called with a unique option '--sycl-link' that will help us to call 'clang-sycl-linker' under the hood (clang-sycl-linker will do SYCL specific linking). Our current objective is to implement an end-to-end SYCL offloading flow and get it working. We will eventually merge our approach with the community flow. Thanks --------- Signed-off-by: Arvind Sudarsanam <arvind.sudarsanam@intel.com>
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.