POCL: avoid Int128 in bounds checks of a StepRange - #835
Merged
Merged
Conversation
Julia 1.12 checks the bounds of a `StepRange` with `widemul`, i.e. in
128-bit integers, which the SPIR-V back-end cannot lower:
LLVM ERROR: OpTypeInt type with a width other than 8, 16, 32 or 64
bits requires the following SPIR-V extension:
SPV_ALTERA_arbitrary_precision_integers
This is reached e.g. by indexing a strided view with
`--check-bounds=yes`. Override it as Metal.jl, OpenCL.jl and oneAPI.jl
do, but for all the types Base's method covers: a range of `Int32`
indexed with an `Int64` widens to `Int128` as well.
Assisted-by: Claude Code (Opus 5.5)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #835 +/- ##
==========================================
- Coverage 79.06% 79.05% -0.02%
==========================================
Files 24 24
Lines 2040 2043 +3
==========================================
+ Hits 1613 1615 +2
- Misses 427 428 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Benchmark ResultsShow table
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Julia 1.12 checks the bounds of a
StepRangewithwidemul(JuliaLang/julia#56750), i.e. in 128-bit integers, which the SPIR-V back-end cannot lower:This is reached e.g. by indexing a strided view (
view(A, 1:2:8, 2:2:10)) with--check-bounds=yes, which is what makes theforeach_indextests of #827 fail on Julia 1.12 and 1.13.This adds the device override that Metal.jl, OpenCL.jl and oneAPI.jl have, which checks against the length instead. Unlike theirs, it covers all the types Base's method does rather than only
Int64/UInt64: a range ofInt32indexed with anInt64(as in a kernel) widens toInt128too.The new test calls
checkboundson aStepRangein a kernel, so it does not depend on--check-bounds=yes. Without the override, all four range cases fail to compile; with it, the test passes with and without--check-bounds=yes(locally, Julia 1.12.7).🤖 Generated with Claude Code