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

Beef up the allow_in_graph docs #127117

Closed
wants to merge 7 commits into from
Closed

Conversation

zou3519
Copy link
Contributor

@zou3519 zou3519 commented May 24, 2024

Stack from ghstack (oldest at bottom):

We make the following changes:

  • most of the time when someone uses allow_in_graph, they actually
    wanted to make a custom op. We add a link to the custom ops landing
    page and explain the differences between allow_in_graph and custom
    ops.
  • we warn people against using allow_in_graph footguns and document
    them.

Test Plan:

  • tests

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang

We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the Custom Operators
  Manual. You might notice it's a gdoc; our strategy for custom ops docs
  is a combination of tutorials (on pytorch/tutorials) and a single gdoc
  (so we can easily make changes)
- we warn people against using allow_in_graph and document some of its
  restrictions: input/output types and lack of ability to handle
  closures.

Test Plan:
- tests

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 24, 2024

🔗 Helpful Links

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

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

✅ You can merge normally! (5 Unrelated Failures)

As of commit 7613947 with merge base 4644def (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

UNSTABLE - The following jobs failed but were likely due to flakiness present on trunk and has been marked as unstable:

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

torch/_dynamo/decorators.py Outdated Show resolved Hide resolved
torch/compiler/__init__.py Show resolved Hide resolved
torch/_dynamo/decorators.py Outdated Show resolved Hide resolved
torch/_dynamo/decorators.py Outdated Show resolved Hide resolved
torch/_dynamo/decorators.py Outdated Show resolved Hide resolved
@zou3519
Copy link
Contributor Author

zou3519 commented May 28, 2024

Followups from chatting with @jansel

# (make issue) zero-tensor meta
# mutate args can be optional (and be pessimistic)
# raw pybind: use warning instead of graph break (because the graph break message gets suppressed)

We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request May 29, 2024
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

ghstack-source-id: bbba3697312c4963438ed8b8e631c853e59737ca
Pull Request resolved: #127117
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request May 29, 2024
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

ghstack-source-id: 33fb6ee68fa42876f5ee540ace572b5b4a426406
Pull Request resolved: #127117
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request May 29, 2024
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

ghstack-source-id: 8808ad63048fd0eee65e94c523774115b7752b2d
Pull Request resolved: #127117
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request May 30, 2024
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

ghstack-source-id: 0e10a418eca1a1ab2947c8620ca431fd4a01b426
Pull Request resolved: #127117
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request May 30, 2024
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

ghstack-source-id: 22b872fbea85b1db35fd32d12f5b39c9e651781d
Pull Request resolved: #127117
@zou3519
Copy link
Contributor Author

zou3519 commented May 30, 2024

This should be ready for another pass through. I updated the PR with jansel's feedback and our offline discussion:

  • removed mentions of torch.fx.wrap, because it's currently confusing (allow_in_graph is a torch.fx.wrap for Dynamo, but not for export today (because export today is Dynamo + AOTAutograd)).
  • added more clarity on when to use allow_in_graph and when to use custom ops
  • the docs page we link to is now a website

@zou3519 zou3519 requested a review from jansel May 30, 2024 13:25
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

Very clear comparison with custom ops. Thanks!

We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

[ghstack-poisoned]
zou3519 added a commit that referenced this pull request May 31, 2024
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

ghstack-source-id: 8de4e23606f66dfefd9e694e3f58e88097f98b72
Pull Request resolved: #127117
@zou3519
Copy link
Contributor Author

zou3519 commented Jun 1, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jun 1, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@jansel
Copy link
Contributor

jansel commented Jun 1, 2024

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@zou3519
Copy link
Contributor Author

zou3519 commented Jun 2, 2024

@pytorchbot merge -f "mergebot seems stuck"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

petrex pushed a commit to petrex/pytorch that referenced this pull request Jun 5, 2024
We make the following changes:
- most of the time when someone uses allow_in_graph, they actually
  wanted to make a custom op. We add a link to the custom ops landing
  page and explain the differences between allow_in_graph and custom
  ops.
- we warn people against using allow_in_graph footguns and document
  them.

Test Plan:
- tests

Pull Request resolved: pytorch#127117
Approved by: https://github.com/jansel, https://github.com/albanD
@github-actions github-actions bot deleted the gh/zou3519/990/head branch July 4, 2024 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants