Skip to content

fix[next]: more dace transformation determinism - #2778

Merged
tehrengruber merged 4 commits into
GridTools:mainfrom
tehrengruber:dace_ordered_sets
Aug 13, 2026
Merged

fix[next]: more dace transformation determinism#2778
tehrengruber merged 4 commits into
GridTools:mainfrom
tehrengruber:dace_ordered_sets

Conversation

@tehrengruber

Copy link
Copy Markdown
Contributor

Remaining changes from #2568 not in #2635.

@tehrengruber
tehrengruber requested a review from edopao August 11, 2026 11:57

# This is the dataflow that can not be relocated.
non_relocatable_connectors: set[str] = set()
non_relocatable_connectors: OrderedSet[str] = OrderedSet()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is returning a list. I was thinking whether we could keep non_relocatable_connectors a regular set, but in the return statement sort the connectors alphabetically: sorted(list(non_relocatable_connectors))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would propose the exact opposite: remove the sorting and return an ordered set:

  • Sorting statements usually hinder readability and they amplify performance indeterminism from unstable symbols, whereas relying on insertion order makes unstable symbols mostly harmless as they only matter for comparability.
  • The sorting approach only works for sortable entities, whereas insertion order always works so just relying on insertion order gives a simple recipe.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I like in particular the argument "Sorting statements amplify performance indeterminism from unstable symbols".

OK, agreed. Let's return an OrderetSet instead of a list.

@tehrengruber

Copy link
Copy Markdown
Contributor Author

cscs-ci run dace-determinism

@tehrengruber

Copy link
Copy Markdown
Contributor Author

cscs-ci run dace-determinism

@tehrengruber
tehrengruber requested a review from edopao August 13, 2026 07:24

@edopao edopao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tehrengruber tehrengruber changed the title fix[next]: More Dace transformation determinism fix[next]: more Dace transformation determinism Aug 13, 2026
@tehrengruber tehrengruber changed the title fix[next]: more Dace transformation determinism fix[next]: more dace transformation determinism Aug 13, 2026
@tehrengruber
tehrengruber merged commit 47bd6d7 into GridTools:main Aug 13, 2026
24 checks passed
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.

2 participants