Skip to content

feat(findall): Add findall kernel - #115

Draft
shreyas-omkar wants to merge 2 commits into
JuliaGPU:mainfrom
shreyas-omkar:sh/findall
Draft

feat(findall): Add findall kernel#115
shreyas-omkar wants to merge 2 commits into
JuliaGPU:mainfrom
shreyas-omkar:sh/findall

Conversation

@shreyas-omkar

Copy link
Copy Markdown
Member

NVIDIA GeForce RTX 5080

n selectivity AK (ms) CUDA.jl (ms)
1,000,000 0.5 0.212 0.281
1,000,000 0.1 0.214 0.297
1,000,000 0.9 0.190 0.262
4,000,000 0.5 0.436 0.353
4,000,000 0.1 0.226 0.292
4,000,000 0.9 0.237 0.299
16,000,000 0.5 1.756 1.334
16,000,000 0.1 1.075 1.006
16,000,000 0.9 1.276 1.500

AMD Radeon RX 9060 XT

n selectivity AK (ms) AMDGPU.jl (ms)
1,000,000 0.5 0.278 0.267
1,000,000 0.1 0.269 0.261
1,000,000 0.9 0.281 0.269
4,000,000 0.5 0.948 0.861
4,000,000 0.1 0.946 0.811
4,000,000 0.9 1.315 0.926
16,000,000 0.5 4.459 4.271
16,000,000 0.1 3.978 4.203
16,000,000 0.9 4.851 4.605

Apple M5

n selectivity AK (ms) Metal.jl (ms)
1,000,000 0.5 1.592 1.073
1,000,000 0.1 0.994 0.950
1,000,000 0.9 1.147 1.105
4,000,000 0.5 3.076 3.354
4,000,000 0.1 2.690 2.726
4,000,000 0.9 3.503 4.843
16,000,000 0.5 11.554 12.833
16,000,000 0.1 10.093 15.357
16,000,000 0.9 17.754 19.665

shreyas-omkar and others added 2 commits August 21, 2026 20:35
Add `findall(bools)` and `findall(pred, v)`, matching `Base.findall`:
Int keys for a 1-D input, CartesianIndex{N} for an N-D input. It is
stream compaction built from existing primitives - an inclusive prefix
sum of the predicate mask (`accumulate`) gives each selected element a
unique output slot and the total count, then `foreachindex` scatters
each index into its slot (slots are unique and increasing, so the writes
are race-free and input order is preserved). Composing primitives means
it runs on every backend and the CPU-threaded path from one
implementation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cover the predicate and Bool-mask forms, 1-D and N-D inputs (Int and
CartesianIndex keys), degenerate masks (empty, all-true, all-false,
single element) and tuning settings, fuzzed against Base.findall.
Verified on CPU-threaded, CUDA, AMDGPU, Metal and POCL backends.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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