Skip to content

fix[next][dace]: Make all node labels unique#2436

Merged
edopao merged 4 commits intoGridTools:mainfrom
edopao:dace_unique_labels
Jan 15, 2026
Merged

fix[next][dace]: Make all node labels unique#2436
edopao merged 4 commits intoGridTools:mainfrom
edopao:dace_unique_labels

Conversation

@edopao
Copy link
Copy Markdown
Contributor

@edopao edopao commented Jan 14, 2026

This PR ensures that some temporary scalars get unique name. The same fix was applied to the labels of nested SDFGs.

This should be the last source of duplicated labels. It was tested using this piece of code after the SDFG lowering:

all_data = []
all_maps = []
all_tlets = []
all_nsdfgs = []
for nsdfg in sdfg.all_sdfgs_recursive():
    all_data.extend(str(d) for d, desc in nsdfg.arrays.items() if isinstance(desc, (dace.data.Scalar, dace.data.Array)) and (d.startswith("__tmp" or d.startswith("gtir_tmp"))))
    all_maps.extend(n.label for st in nsdfg.states() for n in st.nodes() if isinstance(n, dace.nodes.MapEntry))
    all_tlets.extend(n.label for st in nsdfg.states() for n in st.nodes() if isinstance(n, dace.nodes.Tasklet))
    all_nsdfgs.append(nsdfg.label)
assert len(all_data) == len(set(all_data))
assert len(all_maps) == len(set(all_maps))
assert len(all_tlets) == len(set(all_tlets))
assert len(all_nsdfgs) == len(set(all_nsdfgs))

Copy link
Copy Markdown
Contributor

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

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

It looks good, I just have two comments here:

  • I would add your check, that everything is unique as a check that is checked in an assert.
  • You forgot to the nested SDFGs in your checks.

@edopao
Copy link
Copy Markdown
Contributor Author

edopao commented Jan 15, 2026

It looks good, I just have two comments here:

* I would add your check, that everything is unique as a check that is checked in an `assert`.

* You forgot to the nested SDFGs in your checks.

I've now also ensured that the nested SDFG labels are unique.

Copy link
Copy Markdown
Contributor

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

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

LGTM.

@edopao edopao merged commit 72b7615 into GridTools:main Jan 15, 2026
23 checks passed
@edopao edopao deleted the dace_unique_labels branch January 15, 2026 08:16
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