Skip to content

[libspirv] Use clc functions for __spirv_All/Any#22105

Merged
KornevNikita merged 1 commit into
intel:syclfrom
wenju-he:refine-libspirv-all-any
May 26, 2026
Merged

[libspirv] Use clc functions for __spirv_All/Any#22105
KornevNikita merged 1 commit into
intel:syclfrom
wenju-he:refine-libspirv-all-any

Conversation

@wenju-he

Copy link
Copy Markdown
Contributor

They are now implemented with @llvm.vector.reduce.and/or, which can map to native hardware instruction. Example llvm-diff changes (> is reference): in function _Z11__spirv_AllDv2_c:
> %2 = extractelement <2 x i8> %0, i64 0
> %3 = extractelement <2 x i8> %0, i64 1
> %4 = and i8 %2, %3
< %2 = tail call i8 @llvm.vector.reduce.and.v2i8(<2 x i8> %0)
in function _Z11__spirv_AnyDv2_c:
> %2 = extractelement <2 x i8> %0, i64 0
> %3 = extractelement <2 x i8> %0, i64 1
> %4 = or i8 %2, %3
< %2 = tail call i8 @llvm.vector.reduce.or.v2i8(<2 x i8> %0)

They are now implemented with @llvm.vector.reduce.and/or, which can map
to native hardware instruction. Example llvm-diff changes (> is reference):
in function _Z11__spirv_AllDv2_c:
    >   %2 = extractelement <2 x i8> %0, i64 0
    >   %3 = extractelement <2 x i8> %0, i64 1
    >   %4 = and i8 %2, %3
    <   %2 = tail call i8 @llvm.vector.reduce.and.v2i8(<2 x i8> %0)
in function _Z11__spirv_AnyDv2_c:
    >   %2 = extractelement <2 x i8> %0, i64 0
    >   %3 = extractelement <2 x i8> %0, i64 1
    >   %4 = or i8 %2, %3
    <   %2 = tail call i8 @llvm.vector.reduce.or.v2i8(<2 x i8> %0)
@wenju-he wenju-he requested review from a team and Maetveis as code owners May 25, 2026 01:51
@wenju-he wenju-he requested a review from kweronsx May 25, 2026 01:51

@Maetveis Maetveis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, great cleanup, thanks!

@sys-ce-bb

Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

@KornevNikita KornevNikita merged commit fef8e42 into intel:sycl May 26, 2026
50 of 52 checks passed
@wenju-he wenju-he deleted the refine-libspirv-all-any branch May 26, 2026 10:56
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.

4 participants