Skip to content

Allocate findall's result like the searched array - #151

Merged
maleadt merged 2 commits into
mainfrom
tb/findall-similar
Oct 7, 2026
Merged

maleadt merged 2 commits into
mainfrom
tb/findall-similar

Conversation

@maleadt

@maleadt maleadt commented Oct 7, 2026

Copy link
Copy Markdown
Member

findall allocated its result on the back-end with KernelAbstractions.allocate, so a GPU array's properties were lost: on Metal, findall of an array in private storage returned one in the default (shared) storage mode, which fails Metal's own test once GPUArrays 12 routes findall and logical indexing through AK (JuliaGPU/Metal.jl#1013).

The result is now allocated like the searched array, with _similar as AK's other results are, and not like the predicate's mask, which lives in scratch memory. The CPU path is unchanged.

Verified on an M1 for both storage modes (predicate and Bool forms, logical indexing, empty results); cpu/findall and cuda/findall pass. Bumps the version to 0.5.2.

findall allocated its result on the back-end with KernelAbstractions.allocate,
so a GPU array's properties were lost: Metal's findall of an array in
private storage returned one in the default storage mode. Allocate it like
the searched array instead, as AK's other results are, and not like the
predicate's mask, which lives in scratch memory.
@maleadt
maleadt merged commit 0a4ea91 into main Oct 7, 2026
37 of 39 checks passed
@maleadt
maleadt deleted the tb/findall-similar branch October 7, 2026 18:47
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