Skip to content

Conversation

@asudarsa
Copy link
Contributor

For
clang --sycl-link --sycl-use-spirv-backend ....
We invoke clang-sycl-linker like this
clang-sycl-linker -use-spirv-backend .....

This causes the invocation of the SPIR-V backend to translate LLVM to SPIR-V (instead of the llvm-spirv translator).

Following is a list of changes in this PR:

  1. Add -sycl-use-spirv-backend to list of clang options
  2. Add -use-spirv-backend to list of clang-sycl-linker options
  3. Enable SPIR-V backend in the SYCL compiler build (add it to LLVM_TARGETS_TO_BUILD)
  4. Enable building of clang-sycl-linker in the SYCL compiler build (add it to sycl/CMakeLists.txt)
  5. Call SPIRVTranslate API call inside the clang-sycl-linker when appropriate options are specified

Please note that this is a work in progress. Options specified to the SPIR-V backend will be improved in near future.

Thanks

Signed-off-by: Arvind Sudarsanam <[email protected]>
@asudarsa asudarsa changed the title Add SPIR-V backend support inside clang-sycl-linker [New offloading model][SPIR-V backend] Add SPIR-V backend support inside clang-sycl-linker Mar 11, 2025
@bader
Copy link
Contributor

bader commented Mar 11, 2025

  1. Add -sycl-use-spirv-backend to list of clang options

Can we use -fsycl-targets=spirv64 instead?

  • Add -use-spirv-backend to list of clang-sycl-linker options
  • Call SPIRVTranslate API call inside the clang-sycl-linker when appropriate options are specified

I suggest we make clang-sycl-linker tool changes in the upstream first.
NOTE: Upstream uses SPIR-V backend by default already: llvm/llvm-project#129545, so the patch for the upstream should be smaller.

@asudarsa
Copy link
Contributor Author

asudarsa commented Mar 11, 2025

I had an offline discussion with @VyacheslavLevytskyy and we agree with @bader's comment. I will clean this PR up to remove the translator (and other unneeded options) and use SPIR-V backend by default inside clang-sycl-linker. I will mark this as draft for internal review. Once we have consensus, I will submit this upstream.

On second thoughts, I think we can close this PR, and I will put up a draft PR upstream for internal comments.

Thanks all.

@asudarsa
Copy link
Contributor Author

I will be opening an upstream PR soon. Closing this. Thanks for the feedback here.

@asudarsa asudarsa closed this Mar 12, 2025
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.

2 participants