KEMBAR78
Add missing in-place on view check to custom autograd.Function by soulitzer · Pull Request #153094 · pytorch/pytorch · GitHub
Skip to content

Conversation

soulitzer
Copy link
Contributor

@soulitzer soulitzer commented May 7, 2025

@pytorch-bot
Copy link

pytorch-bot bot commented May 7, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 3 Unrelated Failures

As of commit d5c8945 with merge base e2c7ae5 (image):

NEW FAILURE - The following job has failed:

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

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

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

@soulitzer soulitzer added the release notes: autograd release notes category label May 7, 2025
soulitzer added a commit that referenced this pull request May 7, 2025
if (cdata) {
impl::rebase_history(var, {cdata, output_nr});
}
check_inplace(var, true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You assume this will never raise right? Because we do more restrictive checks above?
If so, let's leave a small comment about it.

Copy link
Contributor Author

@soulitzer soulitzer May 8, 2025

Choose a reason for hiding this comment

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

Indeed it will never raise for some of its checks like leaf mutation.
However, it will raise in cases like checking whether the view is default (which is why we add it here :P)

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.

Is this BC-breaking then?

soulitzer added a commit that referenced this pull request May 9, 2025
@soulitzer
Copy link
Contributor Author

soulitzer commented May 9, 2025

Is this BC-breaking then?

Yes, specifically in the case of in-place on view of leaf case where we previously leaked, but now properly raise an error! (Just added a test for this)

In summary:

  • for the non-default view case, the change here is that the error message is better and no longer an internal assert
  • for the in-place on leaf case, nothing is changed
  • for the in-place on view of leaf case, previously we leaked, now we properly raise an error

@soulitzer soulitzer added the module: bc-breaking Related to a BC-breaking change label May 9, 2025
@pytorch-bot pytorch-bot bot added the topic: bc breaking topic category label May 9, 2025
@soulitzer
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 9, 2025
@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

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@soulitzer
Copy link
Contributor Author

@pytorchbot merge -i

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 4 checks: pull / linux-focal-py3_9-clang9-xla / build, pull / unstable-linux-focal-cuda12.6-py3.10-gcc11-sm89-xfail / build, pull / linux-jammy-py3-clang12-executorch / test (executorch, 1, 1, ephemeral.linux.2xlarge), trunk / macos-py3-arm64 / test (default, 1, 3, macos-m1-stable)

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

@github-actions github-actions bot deleted the gh/soulitzer/361/head branch June 17, 2025 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: bc-breaking Related to a BC-breaking change release notes: autograd release notes category topic: bc breaking topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants