Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes device-link failures on amdgcn-amd-amdhsa by providing missing definitions for the SPIR-V group non-uniform shuffle builtins in the AMDGPU libspirv device library, mapping them onto the existing __spirv_SubgroupShuffle*INTEL implementations (which lower to ds_bpermute).
Changes:
- Add
libclc/libspirv/lib/amdgpu/group/group_shuffle.climplementing__spirv_GroupNonUniformShuffle{,Up,Down,Xor}for scalar types. - Register the new source file in the AMDGPU libspirv CMake sources list.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| libclc/libspirv/lib/amdgpu/group/group_shuffle.cl | Implements missing GroupNonUniform shuffle builtins via existing AMDGPU subgroup shuffle primitives. |
| libclc/libspirv/lib/amdgpu/CMakeLists.txt | Adds the new shuffle implementation file to the AMDGPU libspirv build. |
|
@zjin-lcf please fix the code formatting |
Apply the final patch from intel#22665 to provide the missing __spirv_GroupNonUniformShuffle{,Up,Down,Xor} definitions for AMDGPU. Upstream-PR: intel#22665 Upstream-Commit: af14d1d Upstream-Commit: d11a322
Apply the final patch from intel#22665 to provide the missing __spirv_GroupNonUniformShuffle{,Up,Down,Xor} definitions for AMDGPU. Upstream-PR: intel#22665 Upstream-Commit: af14d1d Upstream-Commit: d11a322
|
Hi @zjin-lcf , do you plan to continue working on your PRs? |
|
Thanks for the follow-up. Yes, I plan to continue working on this PR. The formatting issue has been fixed and the formatter check now passes. The remaining ARL CI failure is an unrelated XPASS in two bindless-image tests. I do not have permission to rerun the workflow; could a maintainer please rerun the failed job? @Maetveis @kweronsx, could you please review when convenient? |
100a29a to
865ec36
Compare
Apply the final patch from intel#22665 to provide the missing __spirv_GroupNonUniformShuffle{,Up,Down,Xor} definitions for AMDGPU. Upstream-PR: intel#22665 Upstream-Commit: af14d1d Upstream-Commit: d11a322
|
@wenju-he Thank you very much for your comments and suggestions. |
|
Hi @zjin-lcf, I see there are a few of your older PRs that require some attention. Could you please rebase them? |
The amdgcn libspirv device library declares the SPIR-V group non-uniform
shuffle builtins (__spirv_GroupNonUniformShuffle{,Up,Down,Xor}) via
libspirv/group/group_shuffle*.h but never defines them for the amdgpu
target. The SYCL headers (sycl/detail/spirv.hpp) emit these directly for
sub-group shuffle/permute/scan, and oneDPL work-group algorithms
(inclusive_scan, sort, ...) rely on them. Device linking for
amdgcn-amd-amdhsa therefore fails with e.g.
undefined symbol: __spirv_GroupNonUniformShuffleUp
Unlike SPIR-V targets there is no runtime translation of these
instructions, so the device library must provide them.
Add group/group_shuffle.cl for the amdgpu target, mapping the four
non-uniform shuffle operations onto the existing, validated
__spirv_SubgroupShuffle*INTEL primitives (misc/sub_group_shuffle.cl),
which lower to the hardware ds_bpermute wavefront shuffle. These
primitives derive the wavefront size from __spirv_BuiltInSubgroupMaxSize()
rather than hardcoding it and use only ds_bpermute, so they are correct
across all wave64 CDNA generations (CDNA1 gfx908, CDNA2 gfx90a,
CDNA3 gfx942, CDNA4 gfx950) with no arch-specific code. Only scalar
overloads are defined: the SYCL headers scalarize all vector/marray
shuffles and lower bitcast/generic shuffles onto integer scalars before
reaching the intrinsic, matching the scalar-only __spirv_GroupBroadcast
definitions in group/collectives.cl.
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Use the operation's full SPIR-V name to distinguish group non-uniform shuffles from other shuffle implementations. Co-authored-by: Cursor <[email protected]>
…oads Clang declares these builtins for every vector width, so calls with a vector Value operand must resolve for amdgcn too, even though the SYCL headers only ever emit the scalar forms. Add a lit test that fails on any overload libspirv declares but the target does not define. Co-authored-by: Cursor <[email protected]>
Follow the standard libclc gentype pattern so scalar and vector shuffle overloads share one implementation while preserving element-wise vector lowering. Co-authored-by: Cursor <[email protected]>
865ec36 to
b2e5fba
Compare
|
Rebased onto current |
The amdgcn libspirv device library declares the SPIR-V group non-uniform shuffle builtins (__spirv_GroupNonUniformShuffle{,Up,Down,Xor}) via libspirv/group/group_shuffle*.h but never defines them for the amdgpu target. The SYCL headers (sycl/detail/spirv.hpp) emit these directly for sub-group shuffle/permute/scan, and oneDPL work-group algorithms (inclusive_scan, sort, ...) rely on them. Device linking for amdgcn-amd-amdhsa therefore fails with e.g.
undefined symbol: __spirv_GroupNonUniformShuffleUp
Unlike SPIR-V targets there is no runtime translation of these instructions, so the device library must provide them.
Add group/group_shuffle.cl for the amdgpu target, mapping the four non-uniform shuffle operations onto the existing, validated __spirv_SubgroupShuffle*INTEL primitives (misc/sub_group_shuffle.cl), which lower to the hardware ds_bpermute wavefront shuffle. These primitives derive the wavefront size from __spirv_BuiltInSubgroupMaxSize() rather than hardcoding it and use only ds_bpermute, so they are correct across all wave64 CDNA generations (CDNA1 gfx908, CDNA2 gfx90a, CDNA3 gfx942, CDNA4 gfx950) with no arch-specific code. Only scalar overloads are defined: the SYCL headers scalarize all vector/marray shuffles and lower bitcast/generic shuffles onto integer scalars before reaching the intrinsic, matching the scalar-only __spirv_GroupBroadcast definitions in group/collectives.cl.