Skip to content

Translate OpenCL group and sub-group operations - #26

Merged
maleadt merged 1 commit into
mainfrom
fix-spirv2clc-subgroups-1c5722d8
Oct 10, 2026
Merged

maleadt merged 1 commit into
mainfrom
fix-spirv2clc-subgroups-1c5722d8

Conversation

@maleadt

@maleadt maleadt commented Oct 10, 2026

Copy link
Copy Markdown
Member

OpenCL.jl's poclc target and the arm64 “PoCL next” job fail on KernelInterface sub-group kernels with UNIMPLEMENTED instruction 262/264 and UNIMPLEMENTED capability 64. These are OpGroupAny, OpGroupIAdd, and GroupNonUniformBallot.

Translate the OpenCL group operations using the builtin mappings from Khronos SPIRV-LLVM-Translator. Coverage includes uniform votes/broadcasts/reductions/scans, non-uniform votes and ballots, arithmetic/bitwise/logical collectives and clustered reductions, shuffles and relative shuffles, rotations, ballot masks, and sub-group queries/barriers.

Preserve execution scope, signed min/max overloads and scan identities, boolean conversion, and broadcast coordinates. Enable the appropriate OpenCL extensions, including the missing shuffle pragma; work-group-only collectives no longer enable cl_khr_subgroups. Reject scopes and operand types with no matching OpenCL builtin. Shader quad and vendor-specific instructions remain unsupported.

Validation:

  • All 147 lit regressions pass, including OpenCL C 2.0/3.0 compilation, 1.2 rejection, operation/mode coverage, signed/narrow/half/double types, boolean values, mask extraction, and unsupported scopes/types. Formatting and whitespace checks pass.
  • All 20 SPIR-V dumps from the failing OpenCL.jl CI run translate and compile with Clang. The released translator fails on every dump with the reported diagnostics. The arm64 dumps were compiled locally on x64; arm64 execution was not tested.
  • OpenCL.jl #554 at b06173c: all 5,933 KernelInterface checks pass on PoCL 7.2.2 with Julia 1.13.1, sub-groups enabled, and the OpenCL C backend forced, using this translator.

OpenCL.jl will need a rebuilt spirv2clc_jll to use the fix.

@maleadt
maleadt merged commit 16a9b34 into main Oct 10, 2026
5 checks passed
@maleadt
maleadt deleted the fix-spirv2clc-subgroups-1c5722d8 branch October 10, 2026 19: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.

1 participant