Skip to content

fix[next-dace]: Reject MoveDataflowIntoIfBody when tasklet free symbol clashes with inner data descriptor#2614

Open
edopao wants to merge 1 commit into
GridTools:mainfrom
edopao:fix/move-dataflow-symbol-inner-data-conflict
Open

fix[next-dace]: Reject MoveDataflowIntoIfBody when tasklet free symbol clashes with inner data descriptor#2614
edopao wants to merge 1 commit into
GridTools:mainfrom
edopao:fix/move-dataflow-symbol-inner-data-conflict

Conversation

@edopao
Copy link
Copy Markdown
Contributor

@edopao edopao commented May 29, 2026

Summary

  • MoveDataflowIntoIfBody could relocate a tasklet whose code references an outer SDFG symbol as a free variable (no input connector), even when the nested SDFG already has a data descriptor with the same name. After relocation the tasklet would silently read the inner descriptor instead of the outer symbol, producing incorrect results.
  • Fix: _check_for_data_and_symbol_conflicts now returns False when any name in required_symbols matches an existing data descriptor in if_block.sdfg.
  • Regression test test_if_mover_symbol_clashes_with_inner_data added to test_move_dataflow_into_if_body.py.

Test plan

  • New test test_if_mover_symbol_clashes_with_inner_data fails before the fix and passes after.
  • All 17 existing tests in test_move_dataflow_into_if_body.py continue to pass.

🤖 Generated with Claude Code

…bol clashes with an inner data descriptor

A tasklet being relocated may reference a symbol from the outer SDFG as
a free variable (no input connector). If the nested SDFG already contains
a data descriptor with the same name, the relocated tasklet would silently
read that inner descriptor instead of the outer symbol, producing wrong
results.

Fix _check_for_data_and_symbol_conflicts to return False whenever any
symbol in required_symbols shares its name with a data descriptor in the
nested SDFG. A regression test is included.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a correctness issue in the DaCe MoveDataflowIntoIfBody transformation where relocating a tasklet that references an outer SDFG symbol as a free variable could silently change semantics if the nested SDFG already contains a data descriptor with the same name.

Changes:

  • Reject relocation when any symbol required by the relocatable subgraph conflicts with an existing data descriptor name inside the nested SDFG.
  • Add a regression test covering the “free symbol name clashes with inner scalar descriptor” case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/gt4py/next/program_processors/runners/dace/transformations/move_dataflow_into_if_body.py Adds an additional safety check in _check_for_data_and_symbol_conflicts to prevent symbol/data name shadowing after relocation.
tests/next_tests/unit_tests/program_processor_tests/runners_tests/dace_tests/transformation_tests/test_move_dataflow_into_if_body.py Adds a regression test ensuring the transformation refuses to apply when a tasklet’s free symbol would clash with an inner data descriptor name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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