Skip to content

Check that flattened insertvalues reach the SPIR-V back end - #1075

Merged
maleadt merged 1 commit into
mainfrom
tb/spirv-insertvalue-test
Nov 3, 2026
Merged

maleadt merged 1 commit into
mainfrom
tb/spirv-insertvalue-test

Conversation

@maleadt

@maleadt maleadt commented Nov 3, 2026

Copy link
Copy Markdown
Member

flatten_nested_insertvalue! (the workaround for intel/intel-graphics-compiler#378, from #953) runs in finish_ir!, and its comment said it has to run after optimization because InstCombine folds the flattened sequences back together. prepare_execution! runs InstCombine again after finish_ir! (since #878), so if that were true the workaround would be undone before the IR reaches the back end.

It isn't undone. InstCombine only shortens or copies the index lists of existing multi-index insertvalues, it never merges single-index ones into one; the multi-index ones come from SROA splitting aggregate loads. The IR after prepare_execution! keeps the flattened form (so does default<O3> run on it), and on an Iris Xe (NEO 26.35, IGC 2.41) with oneAPI.jl 2.10 and GPUCompiler main, the reproducer from JuliaGPU/OpenCL.jl#502 and a findmin-style reduction over (Bool, value) tuples are correct, and wrong with the pass disabled.

This corrects the comment and adds a test on the SPIR-V output, since the existing one only checks code_llvm, which is taken before prepare_execution!. With the pass disabled, it fails on the Khronos translator.

The comment on `flatten_nested_insertvalue!` said it has to run after
optimization because InstCombine folds the flattened sequences back
together. InstCombine also runs after `finish_ir!`, in
`prepare_execution!`, so that would undo the Intel workaround. It
doesn't: InstCombine never merges single-index `insertvalue`s into
multi-index ones, and it is SROA, during optimization, that introduces
those. Correct the comment, and test the SPIR-V instead of only the
`finish_ir!` output, so that a pass added later between the two can't
undo the workaround unnoticed.
@maleadt
maleadt merged commit 47b9ef3 into main Nov 3, 2026
35 of 36 checks passed
@maleadt
maleadt deleted the tb/spirv-insertvalue-test branch November 3, 2026 16:46
@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.95%. Comparing base (b90c3cb) to head (6e7b942).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1075      +/-   ##
==========================================
- Coverage   92.48%   90.95%   -1.53%     
==========================================
  Files          31       31              
  Lines        7334     7333       -1     
==========================================
- Hits         6783     6670     -113     
- Misses        551      663     +112     

☔ 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.

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