Skip to content

fix[next]: canonical order for gather output dims#2627

Open
havogt wants to merge 1 commit into
GridTools:mainfrom
havogt:canonical_gather_dims
Open

fix[next]: canonical order for gather output dims#2627
havogt wants to merge 1 commit into
GridTools:mainfrom
havogt:canonical_gather_dims

Conversation

@havogt

@havogt havogt commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Description

return_type_field (frontend type deduction) and _gather_output_domain
(embedded runtime) built the gather output domain in insertion order. When a
connectivity introduces a dimension of a different kind than the codomain it
replaced (e.g. a vertical iteration axis while a local dimension survives),
insertion order is non-canonical: the result is rejected by check_dims /
mismatches the out field, and the runtime- and frontend-deduced dimensions can
disagree.

Both now order their dimensions through common.order_dimensions, so runtime
and frontend agree on a canonical, valid field domain.

Tests: vertical-axis canonicalization regressions (frontend + embedded), the
raw-premap tests updated to expect canonical order, and a guard that same-dim
connectivities (V2V) keep the source dimension.

Requirements

  • All fixes and/or new features come with corresponding tests.
  • Important design decisions have been documented in the appropriate ADR inside the docs/development/ADRs/ folder.

`return_type_field` (frontend) and `_gather_output_domain` (embedded) built the
gather output in insertion order. When a connectivity introduces a dim of a
different kind than the codomain it replaced (e.g. a vertical iteration axis
while a local dim survives), insertion order is non-canonical: the result is
rejected by `check_dims` / mismatches the out field, and runtime and frontend
can disagree.

Return both outputs via `order_dimensions` so they agree on a canonical, valid
field domain. The frontend deduces the dims as the set `(field.dims - source) |
target`; the source dim survives iff it reappears in the target.

Tests: vertical-axis canonicalization regressions (frontend + embedded), update
the raw-premap tests to expect canonical order, and a guard that same-dim
connectivities (V2V) keep the source dim.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant