Repository navigation
[KernelInterface] barrier: add optional memory flags - #983
Conversation
|
Documentation preview: https://juliagpu.github.io/KernelAbstractions.jl/previews/PR983/ |
Benchmark resultsCompared with 301c8f3b8, the latest measured ancestor of the merge base (1 commit before it). Times are the minimum time of every benchmark. A change is unusual when it exceeds both three times the benchmark's typical change between consecutive runs on the default branch and a minimum per category (performance 3%, latency 5%, applications 3%, other 3%). A benchmark that starts or stops allocating is listed however few the allocations. A single run can still be a fluke, so rerun before drawing conclusions.
All benchmarks
|
5178cb4 to
c9cb4d9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #983 +/- ##
==========================================
+ Coverage 85.61% 89.27% +3.65%
==========================================
Files 31 33 +2
Lines 2969 3012 +43
==========================================
+ Hits 2542 2689 +147
+ Misses 427 323 -104 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
12e5d9b to
3b7f428
Compare
|
After a quick look: seems worth it. Local-only barriers give 8–11% on the base matmul and ~15% on Not so sure about Also not a fan of This also conflicts with #990 (KI 0.5), so we need to pick a merge order and version, obviously. oneAPI.jl can get the same two-line override as JuliaGPU/OpenCL.jl#617. |
Yay!
I had claude add this so it could test on Metal that no flags gave errors and with flags worked, but
Yeah I wasn't sure about this one either. I'll stick to
If we can get this out quickly, I'd like to have this as 0.4.7 since it's non-breaking, and once this is in, I can deprecate Metal.jl's scalar algorithm and have it point to GPUArrays implementation that'll be either identical or faster. |
79c9773 to
125c1a8
Compare
Add `KI.barrier(flags)`, which orders only the memory in `flags`: `KI.LOCAL_MEM_FENCE`, `KI.GLOBAL_MEM_FENCE` or both. Backends may implement it; the fallback is the full `barrier()`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The barriers of `@groupreduce` and `@groupscan` only order accesses to their `KI.localmemory` storage, so they use `KI.barrier(KI.LOCAL_MEM_FENCE)`. This requires KernelInterface 0.4.7. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The barriers of the histogram and matrix multiplication examples only order accesses to local memory. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
125c1a8 to
3d60ed9
Compare
Backends with support for these flags (OpenCL, Metal) can implement it, while those that don't (AMDGPU, CUDA) keep the full barrier.
The goal for this implementation was to mimic OpenCL's interface. Open to suggestions for improvements.
The KA version will be a follow-up