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

Support inplace update for PythonOp/Grad #17687

Merged
merged 18 commits into from
Oct 11, 2023
Merged

Support inplace update for PythonOp/Grad #17687

merged 18 commits into from
Oct 11, 2023

Conversation

pengwa
Copy link
Contributor

@pengwa pengwa commented Sep 25, 2023

Support inplace update for PythonOp/Grad

This PR is based on another PR #17685 branch, to make it easier to review.

With PR: PR #17685, By default all PythonOp inputs/outputs are assumed to not be inplaced, if during run, we found some inplace update happens (by checking output data address with all inputs data address), we add clone before set it as PythonOp/Grad's outputs. In this case, results are correct, but implicit copies overheads are introduced.

This PR allow users to define output input reuse map, to let ORT know how to do the reuse map, avoid such unnecessary copies.

@pengwa pengwa added the training issues related to ONNX Runtime training; typically submitted using template label Sep 25, 2023
@pengwa pengwa changed the base branch from main to pengwa/inplace_pythonop September 25, 2023 11:02
@pengwa pengwa requested review from askhade and ajindal1 September 25, 2023 11:03
Copy link
Contributor Author

@pengwa pengwa left a comment

Choose a reason for hiding this comment

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

Thanks for the comment. Fixed most of them.

Base automatically changed from pengwa/inplace_pythonop to main October 7, 2023 00:40
@askhade askhade merged commit 0e27824 into main Oct 11, 2023
91 checks passed
@askhade askhade deleted the pythonop_inplace branch October 11, 2023 04:36
kleiti pushed a commit to kleiti/onnxruntime that referenced this pull request Mar 22, 2024
### Support inplace update for PythonOp/Grad

This PR is based on another PR
microsoft#17685 branch, to make it
easier to review.

With PR: PR microsoft#17685, By
default all PythonOp inputs/outputs are assumed to not be inplaced, if
during run, we found some inplace update happens (by checking output
data address with all inputs data address), we add clone before set it
as PythonOp/Grad's outputs. In this case, results are correct, but
implicit copies overheads are introduced.

This PR allow users to define output input reuse map, to let ORT know
how to do the reuse map, avoid such unnecessary copies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training issues related to ONNX Runtime training; typically submitted using template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants