Skip to content

Test that SPIR-V merge instructions precede their branch - #1145

Merged
maleadt merged 1 commit into
mainfrom
tb/spirv-merge-before-branch
Dec 3, 2026
Merged

maleadt merged 1 commit into
mainfrom
tb/spirv-merge-before-branch

Conversation

@maleadt

@maleadt maleadt commented Dec 2, 2026

Copy link
Copy Markdown
Member

MachineCSE could separate OpLoopMerge from its branch in bounds-checked JLArray statistics kernels, causing SPIR-V validation to fail (JuliaGPU/GPUArrays.jl#871, llvm/llvm-project#245799).

The merge instructions testset in test/spirv.jl compiles and validates a reduced loop with both SPIR-V backends. For the LLVM backend, it also checks that OpBranchConditional immediately follows OpLoopMerge. The Khronos translator emits no merge for this loop.

The LLVM backend test fails with SPIRV_LLVM_Backend_jll 23.1.4+6 and passes with 23.1.4+7, which carries JuliaPackaging/Yggdrasil#15910.

MachineCSE used to hoist instructions between an OpLoopMerge and its
branch, which spirv-val rejects (llvm/llvm-project#245799). Julia's
bounds-checked loops hit this since LLVM 23, which gives OpenCL loops
with unroll hints an OpLoopMerge (JuliaGPU/GPUArrays.jl#871).
SPIRV_LLVM_Backend_jll 23.1.4+7 carries the fix.
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.52%. Comparing base (51de390) to head (4938bad).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1145      +/-   ##
==========================================
- Coverage   92.99%   91.52%   -1.47%     
==========================================
  Files          32       32              
  Lines        8574     8574              
==========================================
- Hits         7973     7847     -126     
- Misses        601      727     +126     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maleadt
maleadt merged commit 4ae11c3 into main Dec 3, 2026
40 checks passed
@maleadt
maleadt deleted the tb/spirv-merge-before-branch branch December 3, 2026 05:32
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