feat(findall): Add findall kernel - #115
Conversation
|
@christiangnrd @maleadt give it a check please. :) |
|
This looks good to me |
0865767 to
9e42b8b
Compare
Move the block-local exclusive scan into a reusable helper without changing its operation order or barriers. Remove the redundant synchronization before the helper call.
Add Base-compatible array mask and predicate forms with stable, key-preserving output. Configure the GPU path through ScanScatter and expose its count and predicate-mask buffers for reuse. Use count-scan-scatter on GPUs and task-partitioned compaction on CPUs. Cover strict Bool conditions, custom axes, zero-dimensional and empty inputs, tile boundaries, buffer validation, and tuning settings. Co-authored-by: Tim Besard <tim.besard@gmail.com>
|
LGTM. I did some more benchmarking against all platforms I have access to, and CUB's
The mask is read twice (a byte per element) and the output written once. There are no atomics and no device-scope fences, so it runs unchanged on every backend, Metal included. The predicate form still evaluates the predicate exactly once per element into a This seems to perform significantly better.
Mask-only compaction ( I did introduce an Algorithm struct as we have with other abstractions, so if you think it's valuable we could restore the old approach as well under a different entry. |
|
Took another look, and I don't think the old implementation is worth keeping. |
|
I validated the new Correctness: full findall test suite 205/205 on the GPU path. Perf —
So the ~3-4x speedup holds on AMD too, matching your RTX 5080 / M1 / Intel numbers. (Aside: the vendor AMDGPU.jl On restoring the old approach as a second algorithm: I'd rather not - it's slower on every backend and reads more bytes, so there's no case where it wins. I'd keep the |
NVIDIA GeForce RTX 5080
AMD Radeon RX 9060 XT
Apple M5