Skip to content

Fix collision errors in EinsumDistributiveLawMapper.#644

Merged
inducer merged 2 commits intomainfrom
fix_collision_err_ensm_distributive
Mar 12, 2026
Merged

Fix collision errors in EinsumDistributiveLawMapper.#644
inducer merged 2 commits intomainfrom
fix_collision_err_ensm_distributive

Conversation

@kaushikcfd
Copy link
Collaborator

Provided test fails on main.

Copy link

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 addresses cache collision / “no-op duplication” errors triggered by EinsumDistributiveLawMapper when the distributive-law pass makes no semantic changes, and adds a regression test demonstrating the failure on main.

Changes:

  • Add a regression test ensuring a no-op distributive-law pass returns the original DictOfNamedArrays object.
  • Update EinsumDistributiveLawMapper to reuse existing nodes when recursion doesn’t change subexpressions, reducing duplicate node creation.
  • Add explicit handling for DictOfNamedArrays in the distributive-law mapper.

Reviewed changes

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

File Description
test/test_linalg.py Adds a regression test asserting identity-preserving behavior for a no-op pass on a DictOfNamedArrays graph.
pytato/transform/einsum_distributive_law.py Adjusts mapper behavior to avoid recreating structurally-equal nodes and adds a mapper method for DictOfNamedArrays.

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

You can also share your feedback on Copilot code review. Take the survey.

@kaushikcfd kaushikcfd force-pushed the fix_collision_err_ensm_distributive branch from 5b6cba2 to 5dcde40 Compare March 11, 2026 04:37
@kaushikcfd kaushikcfd force-pushed the fix_collision_err_ensm_distributive branch from 5dcde40 to b9962ac Compare March 11, 2026 04:37
@kaushikcfd kaushikcfd requested a review from inducer March 11, 2026 05:36
Copy link
Collaborator

@majosm majosm left a comment

Choose a reason for hiding this comment

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

Looks good from my end.

@inducer inducer merged commit ce1aec9 into main Mar 12, 2026
10 checks passed
@inducer
Copy link
Owner

inducer commented Mar 12, 2026

Thx!

@inducer inducer deleted the fix_collision_err_ensm_distributive branch March 12, 2026 15:23
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.

4 participants