Skip to content

Fixes for 12.0.2 - #808

Merged
maleadt merged 2 commits into
mainfrom
tb/gpuarrays-12.0.2
Oct 7, 2026
Merged

maleadt merged 2 commits into
mainfrom
tb/gpuarrays-12.0.2

Conversation

@maleadt

@maleadt maleadt commented Oct 7, 2026

Copy link
Copy Markdown
Member

Found by Metal.jl's CI on Julia 1.10 (JuliaGPU/Metal.jl#1013), for 12.0.2:

On Julia 1.10, indexing a multidimensional GPU array with a single logical mask of a different shape didn't throw a BoundsError when every true entry of the mask fell within the array; it returned those elements instead. Base 1.10 hands a single index to the three-argument to_indices with one linear range as the indices, so the shape check, which only ran when there was one index per dimension, never ran. The two-argument method that 1.11 and later already used is now defined on every version, and the three-argument override remains only for the trailing host mask that 1.10 would otherwise turn into a LogicalIndex.

The testsuite caught this only in about a quarter of runs (any back-end, JLArrays included), because the mask was random; it now uses masks that select only in-bounds elements. Without the fix, indexing logical fails on 1.10 every time; with it, it passes on 1.10 and 1.13 with JLArrays, and Metal's logical indexing and findall tests pass on 1.10.

On 1.10, Base passes a single index to the three-argument to_indices
with one linear range as the indices, so _check_mask never checked a
mask against a multidimensional array. A mask of the wrong shape whose
true entries all fell within the array then returned values instead
of throwing a BoundsError. Define the two-argument method on every
version, as 1.11 already did, and keep the three-argument override
only for the trailing host mask that 1.10 would make a LogicalIndex.

The test now uses masks that select only in-bounds elements, so it
fails deterministically instead of in about a quarter of the runs.
@maleadt
maleadt merged commit 2f930aa into main Oct 7, 2026
15 of 18 checks passed
@maleadt
maleadt deleted the tb/gpuarrays-12.0.2 branch October 7, 2026 19:40
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