Skip to content

[SYCL] Use SPIR-V built-in function call for all targets and add BuiltIn to the name #19359

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

Open
wants to merge 8 commits into
base: sycl
Choose a base branch
from

Conversation

wenju-he
Copy link
Contributor

@wenju-he wenju-he commented Jul 9, 2025

Before this PR, SPIR-V built-in is represented as global variable for SPIR/SPIR-V targets and as function call for other targets in include/sycl/__spirv/spirv_vars.hpp.

According to https://github.com/llvm/llvm-project/blob/main/llvm/docs/SPIRVUsage.rst, SPIR-V built-in variable can be mapped to either function call or global variable. So function call representation should work for SPIR-V target.

Add BuiltIn to the name to align with SPIR-V friendly IR.

…ltIn` to the name

Before this PR, SPIR-V built-in is represented as global variable for
SPIR/SPIR-V targets and as function call for other targets in
include/sycl/__spirv/spirv_vars.hpp.

According to https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/docs/SPIRVRepresentationInLLVM.rst,
SPIR-V built-in variable can be mapped to either function call or global
variable. So function call representation should work for SPIR-V target.

Add `BuiltIn` to the name to align with SPIR-V friendly IR.
wenju-he added a commit to wenju-he/llvm-project that referenced this pull request Jul 14, 2025
wenju-he added a commit to llvm/llvm-project that referenced this pull request Jul 18, 2025
…#148567)

The mapping ensures the function is lowered to SPIR-V built-in variables
in SPIR-V. This can fix pre-commit CI fail in intel/llvm#19359

Also add BuiltIn to SPIR-V Builtin function name in __clang_spirv_builtins.h to align with
https://github.com/llvm/llvm-project/blob/main/llvm/docs/SPIRVUsage.rst#builtin-variables
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Jul 18, 2025
…n variables (#148567)

The mapping ensures the function is lowered to SPIR-V built-in variables
in SPIR-V. This can fix pre-commit CI fail in intel/llvm#19359

Also add BuiltIn to SPIR-V Builtin function name in __clang_spirv_builtins.h to align with
https://github.com/llvm/llvm-project/blob/main/llvm/docs/SPIRVUsage.rst#builtin-variables
wenju-he added a commit to wenju-he/llvm that referenced this pull request Jul 18, 2025
… (#148567)

The mapping ensures the function is lowered to SPIR-V built-in variables
in SPIR-V. This can fix pre-commit CI fail in intel#19359

(cherry picked from commit 64205ad)
This is a partial cherry-pick since 27c9b55 isn't in intel/llvm yet.
steffenlarsen pushed a commit that referenced this pull request Jul 18, 2025
…(#148567) (#19510)

The mapping ensures the function is lowered to SPIR-V built-in variables
in SPIR-V. This can fix pre-commit CI fail in
#19359

(cherry picked from commit 64205ad)
This is a partial cherry-pick since 27c9b55 isn't in intel/llvm
yet.
@wenju-he wenju-he marked this pull request as ready for review July 18, 2025 11:19
@wenju-he wenju-he requested review from a team as code owners July 18, 2025 11:19
@wenju-he wenju-he requested a review from a team as a code owner July 18, 2025 11:19
Copy link
Contributor

@hvdijk hvdijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Native CPU part looks good, thanks.

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