feat(findall): Add findall kernel - #115
Draft
shreyas-omkar wants to merge 2 commits into
Draft
Conversation
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>
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.
NVIDIA GeForce RTX 5080
AMD Radeon RX 9060 XT
Apple M5