Repository navigation
Let a custom mapping define the linear index of its work-items - #848
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #848 +/- ##
=======================================
Coverage 79.82% 79.83%
=======================================
Files 26 26
Lines 2151 2152 +1
=======================================
+ Hits 1717 1718 +1
Misses 434 434 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Benchmark ResultsShow table
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
vchuravy
marked this pull request as ready for review
October 6, 2026 14:55
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 6, 2026
…ns' hook `@index(Global, Linear)` in a kernel launched over an active cells map returned the work item's position in the map through a method of `KernelAbstractions.__index_Global_Linear` for the context of mapped launches. That's an internal function, which KernelAbstractions documents as not to be extended, and the method only worked as long as `@index` lowered through it. KernelAbstractions now lets a custom `NDRange` mapping define the linear index of its work items with `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), so implement that for `MappedNDRange` instead, and drop the then unused `MappedCompilerMetadata`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
giordano
approved these changes
Oct 6, 2026
giordano
left a comment
Collaborator
There was a problem hiding this comment.
Seems to do the job for Oceananigans!
`@index(Global, Linear)` for a custom `NDRange` mapping was the position of the expanded index in the context's `ndrange`. A mapping whose linear index isn't a function of the expanded index alone, such as a list of indices whose linear index is the position in the list, had to override the internal `__index_Global_Linear` instead. Add `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)`, which defaults to the previous definition and which a mapping can specialize on its `NDRange` type. Test a launch over a list of indices in the launch testsuite. Assisted-by: Claude Code
vchuravy
force-pushed
the
vc/mapping-linear-index
branch
from
October 6, 2026 18:35
0235cae to
1656bf6
Compare
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 6, 2026
…ns' hook `@index(Global, Linear)` in a kernel launched over an active cells map returned the work item's position in the map through a method of `KernelAbstractions.__index_Global_Linear` for the context of mapped launches. That's an internal function, which KernelAbstractions documents as not to be extended, and the method only worked as long as `@index` lowered through it. KernelAbstractions now lets a custom `NDRange` mapping define the linear index of its work items with `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), so implement that for `MappedNDRange` instead, and drop the then unused `MappedCompilerMetadata`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 7, 2026
…ns' hook `@index(Global, Linear)` in a kernel launched over an active cells map returned the work item's position in the map through a method of `KernelAbstractions.__index_Global_Linear` for the context of mapped launches. That's an internal function, which KernelAbstractions documents as not to be extended, and the method only worked as long as `@index` lowered through it. KernelAbstractions now lets a custom `NDRange` mapping define the linear index of its work items with `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), so implement that for `MappedNDRange` instead, and drop the then unused `MappedCompilerMetadata`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 9, 2026
…ns' hook `@index(Global, Linear)` in a kernel launched over an active cells map returned the work item's position in the map through a method of `KernelAbstractions.__index_Global_Linear` for the context of mapped launches. That's an internal function, which KernelAbstractions documents as not to be extended, and the method only worked as long as `@index` lowered through it. KernelAbstractions now lets a custom `NDRange` mapping define the linear index of its work items with `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), so implement that for `MappedNDRange` instead, and drop the then unused `MappedCompilerMetadata`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 10, 2026
…ns' hook `@index(Global, Linear)` in a kernel launched over an active cells map returned the work item's position in the map through a method of `KernelAbstractions.__index_Global_Linear` for the context of mapped launches. That's an internal function, which KernelAbstractions documents as not to be extended, and the method only worked as long as `@index` lowered through it. KernelAbstractions now lets a custom `NDRange` mapping define the linear index of its work items with `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), so implement that for `MappedNDRange` instead, and drop the then unused `MappedCompilerMetadata`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 10, 2026
…ns' hook `@index(Global, Linear)` in a kernel launched over an active cells map returned the work item's position in the map through a method of `KernelAbstractions.__index_Global_Linear` for the context of mapped launches. That's an internal function, which KernelAbstractions documents as not to be extended, and the method only worked as long as `@index` lowered through it. KernelAbstractions now lets a custom `NDRange` mapping define the linear index of its work items with `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), so implement that for `MappedNDRange` instead, and drop the then unused `MappedCompilerMetadata`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 10, 2026
…ns' hook `@index(Global, Linear)` in a kernel launched over an active cells map returned the work item's position in the map through a method of `KernelAbstractions.__index_Global_Linear` for the context of mapped launches. That's an internal function, which KernelAbstractions documents as not to be extended, and the method only worked as long as `@index` lowered through it. KernelAbstractions now lets a custom `NDRange` mapping define the linear index of its work items with `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), so implement that for `MappedNDRange` instead, and drop the then unused `MappedCompilerMetadata`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 13, 2026
…ns' hook `@index(Global, Linear)` in a kernel launched over an active cells map returned the work item's position in the map through a method of `KernelAbstractions.__index_Global_Linear` for the context of mapped launches. That's an internal function, which KernelAbstractions documents as not to be extended, and the method only worked as long as `@index` lowered through it. KernelAbstractions now lets a custom `NDRange` mapping define the linear index of its work items with `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), so implement that for `MappedNDRange` instead, and drop the then unused `MappedCompilerMetadata`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 13, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 13, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 13, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 15, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 15, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 16, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 17, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 17, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 17, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 17, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 18, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 20, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Oct 25, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 2, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 3, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 6, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 6, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 6, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 6, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 9, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 12, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 12, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 12, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 12, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 12, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 19, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 19, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 19, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 19, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 26, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 26, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 26, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Nov 26, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
that referenced
this pull request
Nov 28, 2026
- 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
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Dec 1, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Dec 3, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
giordano
added a commit
to CliMA/Oceananigans.jl
that referenced
this pull request
Dec 3, 2026
…ange mapping The active cells map was implemented by wrapping the kernel function in a `MappedFunction` and overriding KernelAbstractions 0.9 internals (`__validindex`, `expand` with the map stored in place of the workitems), plus `@device_override`s of `__validindex` in the CUDA, AMDGPU and Metal extensions. KernelAbstractions 0.10 validates work items differently, as `expand(iterspace, group, item) in ndrange` for iteration spaces with a custom mapping, so every kernel launched over a map failed to compile on the POCL CPU backend (a `MethodError` in `in`). The adaptation of the context also dropped its new launch configuration. KernelAbstractions 0.10 supports custom mappings in `NDRange` through `expand`, `in` and `linear_index`, so the map now uses that hook: `launch!` passes an `IndexMap` as the `ndrange` of the kernel, `partition` stores it as the `NDRange` mapping, `expand` looks up the index of each work item, and the context's `ndrange` is a `MappedIndices` containing every index but the one returned past the end of the map. The linear index of a mapped work item, its position in the map, is defined through `NDIteration.linear_index(iterspace, ndrange, groupidx, idx)` (JuliaGPU/KernelAbstractions.jl#848), KernelAbstractions' hook for custom `NDRange` mappings, rather than by extending the internal `__index_Global_Linear`, which KernelAbstractions documents as not to be extended. KernelAbstractions adapts the mapping and keeps the launch configuration itself, and the backend overrides are no longer needed. All the new methods are on Oceananigans types. The split-explicit substep loops, including the multi-region one, configure their kernels once with `configure_kernel` and then launch them directly, many times. They discarded the work size it returns and launched without an `ndrange`, which with a kernel configured over a map fails ("Can not partition kernel!"). They now keep the work size and launch with `ndrange = launch_ndrange(worksize)`, which is `nothing` for the launches without a map and the `IndexMap` with one. There was no direct test of launches over a map, so add one checking that each listed cell is visited exactly once over several workgroups, unlisted cells aren't touched, and the linear index is the position in the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtLmZUPY4g9hi8aJsM4Wrs Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PrdqyLiieQJGV868Vz4zvt
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.
For a custom
NDRangemapping,@index(Global, Linear)islinear_index(__ndrange(ctx), expand(iterspace, group, item)): the position of the expanded index within the context'sndrange. That doesn't fit a mapping whose linear index isn't a function of the expanded index alone. The motivating case is Oceananigans launching kernels over a list of active cells (CliMA/Oceananigans.jl#5799), where the linear index of a work-item is its position in the list. A cell can't be mapped back to that position without a reverse lookup, so that PR overrides the internal__index_Global_Linearfor its context type instead. #781 documents that as something not to do, and it only works as long as@indexlowers through that function.This adds a hook on the iteration space:
It defaults to the previous definition,
linear_index(ndrange, expand(iterspace, groupidx, idx)), andglobal_linearcalls it for iteration spaces other than KernelAbstractions' own. A mapping specializes it on itsNDRangetype, e.g. for Oceananigans:KernelAbstractions' built-in iteration spaces (identity and offsets) still take the direct path, so their code doesn't change.
Open points
NDRangemappings #781 should list the hook next toexpandandcartesian. I've left Document the contract of customNDRangemappings #781 alone.Testing
@index(Global, Linear)is the position in the list. Without the hook the kernel doesn't compile (linear_index(::ListedIndices, ::CartesianIndex)has no method); with it the test passes on the CPU backend. The GPU back-ends will run it through the shared testsuite.IndexMaplaunch from CliMA/Oceananigans.jl@6852216 passes with the hook in place of the__index_Global_Linearoverride.🤖 Generated with Claude Code