fix[next]: accept unused connectivities in offset provider for gtfn#2633
Draft
havogt wants to merge 1 commit into
Draft
fix[next]: accept unused connectivities in offset provider for gtfn#2633havogt wants to merge 1 commit into
havogt wants to merge 1 commit into
Conversation
A field operator called with an offset provider that contains connectivities it does not use is lowered to a cartesian grid type (using a connectivity would force unstructured). The gtfn backend then asserted `grid_type == UNSTRUCTURED` while collecting offset definitions and crashed. In cartesian mode, ignore such connectivities: they are still declared as wrapper parameters so the runtime call signature stays stable, but are passed through the bindings without building a SID, since the generated program neither defines their dimension tags nor accesses them. Fixes GridTools#863.
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.
What
Fixes #863.
A
@field_operator/@programcalled with an offset provider that contains connectivities it does not use currently crashes on thegtfnbackend. Such a program is lowered to a cartesian grid type (using a connectivity would force unstructured), but the offset provider still carries the connectivity — e.g. when a single offset provider is shared across many programs (the icon4py pattern).The embedded,
roundtrip, anddacebackends already handle this; onlygtfnraised:How
In cartesian mode, ignore connectivities from the offset provider:
itir_to_gtfn_ir._collect_offset_definitions: skip connectivity entries instead of assertingUNSTRUCTURED(a cartesian program never references their tags).gtfn_module._process_connectivity_args: still declare a wrapper parameter for every connectivity so the runtime's positional connectivity arguments line up, but mark cartesian-mode onespass_throughand don't forward them into the generated program.otf/binding: apass_throughparameter is forwarded to the callee raw, without constructing a buffer SID — so nogenerated::<dim>_ttags are required for it.The unstructured path is unchanged.
Test
Added
test_unused_connectivity_in_offset_provider(runs across the backend matrix): a cartesian copy operator invoked with a connectivity in the offset provider. Verified passing on embedded / roundtrip / gtfn / dace (CPU).