Skip to content

[Trace Python dispatcher] Support torch.DispatchKey & torch.DispatchKeySet #144439

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

Closed
wants to merge 7 commits into from

Conversation

[ghstack-poisoned]
yanboliang added a commit that referenced this pull request Jan 8, 2025
Copy link

pytorch-bot bot commented Jan 8, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/144439

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 2 Unrelated Failures

As of commit 8732618 with merge base d44c390 (image):

NEW FAILURE - The following job has failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

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

some qs

Comment on lines 1197 to 1200
@classmethod
def create_with_source(cls, value, source):
install_guard(source.make_guard(GuardBuilder.ID_MATCH))
return cls(value, source=source)
Copy link
Contributor

Choose a reason for hiding this comment

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

DispatchKeys with the same items in them do not end up with the same ID_MATCH because they can be different objects. Is there something like an INT_MATCH we could do on the integer representation of the DispatchKeySet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I think there are two options here:

  • Add a .python_set attribute to DispatchKeySet and guard on it. However, I’m uncertain about its potential impact on existing eager mode logic.
  • Introduce a new guard type specifically for DispatchKeySet in Dynamo. But I'm not sure if this is overengineering that we have to implement guard for every new custom data type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just chatted with @anijain2305, we already checked DispatchKeySet in the TENSOR_MATCH guard:

dispatch_key_(state.apply(dispatch_key_set).raw_repr()),

So probably I can add the DispatchKeySet guard by leveraging that.

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@yanboliang yanboliang added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 14, 2025
@yanboliang yanboliang requested a review from zou3519 January 15, 2025 19:19
[ghstack-poisoned]
Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

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

just want some more testing, otherwise this lgtm

[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants