Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing dce pass to remove duplicate shape queries. #1673

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jjsjann123
Copy link
Collaborator

What does this PR do?

dce pass doesn't remove duplicate prims.shape node.

  # /volume/ttt.py:9:       shape_0 = x.shape
  (i0, i1, i2, i3) = prims.shape(x)
  # /volume/ttt.py:10:      shape_1 = x.shape
  (i0, i1, i2, i3) = prims.shape(x)

becomes

  # /volume/ttt.py:9:       shape_0 = x.shape
  (i0, i1, i2, i3) = prims.shape(x)
  # /volume/ttt.py:10:      shape_1 = x.shape
  (_, _, _, _) = prims.shape(x)

This PR patches it to instead emit

  # /volume/ttt.py:9:       shape_0 = x.shape
  (i0, i1, i2, i3) = prims.shape(x)

Helps #1579 .

Note that I don't think this fixes the whole issue, but I think it's a more consistent behavior, since dce is expected to remove un-used operations.

@jjsjann123 jjsjann123 marked this pull request as ready for review January 24, 2025 00:40
@jjsjann123
Copy link
Collaborator Author

tagging @t-vi for review. also cc'ing @tfogal

thunder/core/transform_common.py Outdated Show resolved Hide resolved
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