Repository navigation
[libclc] Remove __attribute__((always_inline)) - #158791
Merged
Merged
Conversation
Some built-ins miss alwaysinline attribute due to the typo.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a widespread typo where _CLC_DECL is incorrectly used instead of _CLC_DEF for function definitions in libclc, causing some built-ins to miss the alwaysinline attribute.
- Replaces
_CLC_DECLwith_CLC_DEFin function definitions across multiple files - Ensures proper inline attributes are applied to OpenCL C library functions
- Affects math helpers, atomic operations, and shuffle functions
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| libclc/clc/lib/generic/math/clc_sincos_helpers.inc | Fixed macro for tangent helper function definition |
| libclc/clc/lib/generic/atomic/clc_atomic_def.inc | Fixed macros for atomic operation function definitions |
| libclc/clc/lib/generic/atomic/clc_atomic_compare_exchange.inc | Fixed macros for atomic compare exchange function definitions |
| libclc/clc/include/clc/misc/shuffle_def.inc | Fixed macros for shuffle function definitions |
| libclc/clc/include/clc/misc/shuffle2_def.inc | Fixed macros for shuffle2 function definitions |
arsenm
reviewed
Sep 16, 2025
arsenm
left a comment
Contributor
There was a problem hiding this comment.
I think all the always_inline attributes should be removed, That's a good bug
arsenm
approved these changes
Sep 16, 2025
Contributor
Author
done, thanks.
|
frasercrmck
approved these changes
Sep 17, 2025
Member
|
This is causing test failures for me: |
Contributor
Author
Eric-Guo-NXP
added a commit
to Eric-Guo-NXP/llvm-project
that referenced
this pull request
Jun 16, 2026
PR llvm#158791 removed always_inline from _CLC_INLINE/_CLC_DEF. SPIR-V targets built at -O0 and never run 'opt', so helpers were marked optnone/noinline and survived as real calls, causing NIR validation failures in rusticl (e.g. OpenCL CTS math_brute_force -w cos). Build with '-Xclang -disable-llvm-passes' instead: SPIRV is generic target and doesn't have TTI interface, which can cause optimizations pass to make suboptimal decisions. An alternative approach is to selectively disable some passes , but this is not trivial. Co-authored-by: Wenju He <[email protected]>
karolherbst
added a commit
to karolherbst/llvm-project
that referenced
this pull request
Jul 2, 2026
The compiled SPIR-V libclc binaries ended up with an empty definition for __clc_flush_denormal_if_not_supported. b8a5888 ("[libclc] Fix memory fence scope mapping for OpenCL (llvm#170542)") also added the static keyword probably due to the same issue. Fixes: 7f36611 ("[libclc] Remove __attribute__((always_inline)) (llvm#158791)")
karolherbst
added a commit
to karolherbst/llvm-project
that referenced
this pull request
Jul 2, 2026
The compiled SPIR-V libclc binaries ended up with an empty definition for __clc_flush_denormal_if_not_supported. b8a5888 ("[libclc] Fix memory fence scope mapping for OpenCL (llvm#170542)") also added the static keyword probably due to the same issue. Fixes: 7f36611 ("[libclc] Remove __attribute__((always_inline)) (llvm#158791)")
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.
always_inline doesn't guarantee performance improvement.
Target-specific optimizations decide whether inlining is profitable.
Changes to amdgcn--amdhsa.bc:
Also replace typo _CLC_DECL with _CLC_DEF for function definition.