Skip to content

Commit

Permalink
bug[next]: Fix implicit offset provider (#1638)
Browse files Browse the repository at this point in the history
#1484 introduced support for writing `field(I+1)`. The implicit offset providers we generate for this accidentally also included local dimensions, which broke e.g. Icon4Py with errors like:
```
                    if not dim.kind == common.DimensionKind.VERTICAL:
>                       raise ValueError(
                            "Mapping an offset to a horizontal dimension in unstructured is not allowed."
                        )
E                       ValueError: Mapping an offset to a horizontal dimension in unstructured is not allowed.
```
This PR fixes that by only including horizontal and vertical, but not local dimensions in the implicit offset providers.
  • Loading branch information
tehrengruber authored Sep 11, 2024
1 parent 712324c commit cd20826
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gt4py/next/ffront/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ def _implicit_offset_provider(self) -> dict[common.Tag, common.OffsetProviderEle
for param in params:
if isinstance(param.type, ts.FieldType):
for dim in param.type.dims:
implicit_offset_provider.update(
{common.dimension_to_implicit_offset(dim.value): dim}
)
if dim.kind in (common.DimensionKind.HORIZONTAL, common.DimensionKind.VERTICAL):
implicit_offset_provider.update(
{common.dimension_to_implicit_offset(dim.value): dim}
)
return implicit_offset_provider

def __call__(self, *args, offset_provider: dict[str, Dimension], **kwargs: Any) -> None:
Expand Down

0 comments on commit cd20826

Please sign in to comment.