feat(reverse): Add dims support to reverse - #114
Conversation
Add a `dims` keyword to `reverse!`/`reverse`, reaching parity with `Base.reverse` and the vendor reverse kernels. `dims=:` (the default) keeps the fast flat path - each thread swaps one mirrored pair - while `dims=d` (an integer or iterable) reverses only along those dimensions via a general ND kernel written on `foreachindex`, so it runs on every backend (CUDA/AMDGPU/oneAPI/Metal/POCL) and the CPU-threaded path from one implementation. Invalid dims throw `ArgumentError`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Exercise single-dim, multi-dim ((1,2)/(2,3)/(1,3)/:), size-1 degenerate dims and 3-D arrays across in-place, out-of-place and allocating forms, plus ArgumentError on out-of-range dims. Verified on CPU-threaded, AMDGPU (ROCm) and POCL backends. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ec406ec to
9f1a608
Compare
|
@christiangnrd I have added dims support for reverse. Please check it out once. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
350c3e2 to
bc021bb
Compare
|
I had Claude take a look and it added a few test cases. Was you plan to finish the reverse interface to add |
I planned on making a follow up PR once this is merged. We can do it in this PR too. What would be ideal?? |
|
Separate is fine and should make them easier to merge |
NVIDIA RTX 5080 (CUDA 13.3.0)1D
1D
N-D
AMD RX 9060 XT (RDNA4 / gfx1200, AMDGPU 2.5.1)1D
1D
N-D
|
No description provided.