Repository navigation
Conversation
Benchmark ResultsShow table
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #781 +/- ##
==========================================
- Coverage 90.79% 89.21% -1.59%
==========================================
Files 33 33
Lines 3293 3004 -289
==========================================
- Hits 2990 2680 -310
- Misses 303 324 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| A backend must not assume that `__ndrange(ctx)` is a `CartesianIndices` or that | ||
| `expand` is an affine map: the `mapping` field of the `NDRange` lets a package | ||
| define its own iteration space, for example a list of indices to visit, by |
There was a problem hiding this comment.
This is a new contract, I am not supper happy about. These are private implementation details and a packing extending them is doing fishy work, and potentially type piracy.
I would be much happier if we had a public interface that folks could extend
abstract type Mapping end
And then Oceananigans could do its subtype of that, and so ndrange=Mapping()
Since #771 the `mapping` of an `NDRange` decides how blocked indices map to `ndrange` indices, and every backend derives the index, validity and linear index of a work item from `expand`, `in` and `linear_index`. That makes it possible for a package to launch kernels over an iteration space of its own, such as a list of indices, by specializing `partition` and `cartesian` for its launch object and `expand` for its mapping, but nothing said so, and a backend overriding `__validindex` for a generic context would silently break such an extension. The `NDRange` docstring now lists the functions a custom mapping defines, `partition` and the new `cartesian` and `expand` docstrings point to it, and the notes for backend implementations state that a backend must go through `expand`, `in` and `linear_index` and must not assume the `ndrange` of a context is a `CartesianIndices`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHciC8x39gm97sABrSvBkt
Drop the section on what backends must do from the implementation notes, as the notes on launching `@kernel` kernels already forbid overriding the index functions, and point them at the custom mapping contract instead. Document `partition`, `cartesian`, `NDRange`, `expand` and `linear_index` in a section of their own in the API docs, rather than with the internals, and state that the methods of a custom iteration space dispatch on the package's own types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WMgptbAJCWVM9f2oykYof8
- only `expand` with `CartesianIndex` positions is needed: the methods taking `Integer` positions call it; - mention the `linear_index(iterspace, ndrange, groupidx, idx)` hook (#848), which makes `linear_index` on the `ndrange` object optional; - `in` is only checked when `partition` reports work-items without an index; - `cartesian` is applied again to its own result when the context is adapted, and its result isn't adapted; - `extents` is needed to tune the workgroup size of a launch without one; - KernelAbstractions computes the indices itself, rather than backends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WMgptbAJCWVM9f2oykYof8
- `partition` returns `DynamicCheck()` or `NoDynamicCheck()`, not a `Bool`; - require a static or given workgroup size for a custom iteration space rather than making `extents` part of the contract, as no user needs to tune its workgroup size (Oceananigans uses a static one); - the result of `cartesian` must be usable on the device, as it isn't adapted; - `partition` is no longer only for backends and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WMgptbAJCWVM9f2oykYof8
7f06431 to
3a24a82
Compare
|
I updated the PR following previous review comments, but the bot really insisted for me to ask you one question:
|
|
Documentation preview: https://juliagpu.github.io/KernelAbstractions.jl/previews/PR781/ |
Benchmark resultsCompared with a585449d8, the merge base. 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.
No unusual changes. All benchmarks
|
No description provided.