Skip to content

fix: Raise error when registering Packet-keyed converter #2285

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

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

gs-olive
Copy link
Collaborator

@gs-olive gs-olive commented Sep 5, 2023

Description

  • Packet-keyed converters are too error-prone, since new overloads could be added or existing overloads may have been overlooked

Type of change

  • Improved error-checking

Checklist:

  • [ x ] My code follows the style guidelines of this project (You can use the linters)
  • [ x ] I have performed a self-review of my own code
  • [ x ] I have commented my code, particularly in hard-to-understand areas and hacks
  • [ x ] I have made corresponding changes to the documentation
  • [ - ] I have added tests to verify my fix or my feature
    • CI-validated
  • [ x ] New and existing unit tests pass locally with my changes
  • [ x ] I have added the relevant labels to my PR in so that relevant reviewers are notified

@gs-olive gs-olive requested a review from apbose September 5, 2023 17:09
@gs-olive gs-olive self-assigned this Sep 5, 2023
@github-actions github-actions bot added component: api [Python] Issues re: Python API component: conversion Issues re: Conversion stage component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Sep 5, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to C++ style guidelines

@gs-olive gs-olive force-pushed the converter_registry_op_overload branch from bcd3511 to fcd6913 Compare September 5, 2023 18:11
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to C++ style guidelines

@gs-olive gs-olive force-pushed the converter_registry_op_overload branch from fcd6913 to 894eb67 Compare September 6, 2023 05:09
@github-actions github-actions bot added the component: tests Issues re: Tests label Sep 6, 2023
Comment on lines +162 to +249
class PacketAsOperator(torch.nn.Module):
def forward(self, x):
return torch.ops.aten.tanh(x)

# Operations expected to be removed in the traced graph
expected_ops = {torch.ops.aten.tanh.default}
unexpected_ops = {
torch.ops.aten.tanh,
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Validates that the Packet callable torch.ops.aten.tanh is transformed into torch.ops.aten.tanh.default by AOT autograd.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to Python style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to C++ style guidelines

@gs-olive gs-olive force-pushed the converter_registry_op_overload branch from 894eb67 to 1255f71 Compare September 9, 2023 06:45
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to Python style guidelines

@gs-olive gs-olive force-pushed the converter_registry_op_overload branch from 1255f71 to 8f39c94 Compare September 19, 2023 17:49
- Packet-keyed converters are too error-prone, since new overloads could
be added or existing overloads may have been overlooked
@gs-olive gs-olive force-pushed the converter_registry_op_overload branch from 8f39c94 to ff0c7d5 Compare September 20, 2023 17:33
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to C++ style guidelines

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code conforms to Python style guidelines

@gs-olive gs-olive merged commit b50290d into main Sep 20, 2023
@gs-olive gs-olive deleted the converter_registry_op_overload branch September 20, 2023 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed component: api [Python] Issues re: Python API component: conversion Issues re: Conversion stage component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants