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 NoNeedBuffer for final state codegen #39628

Merged

Conversation

jim19930609
Copy link
Contributor

@jim19930609 jim19930609 commented Feb 16, 2022

PR types

New features

PR changes

Others

Describe

Op developers may now write "no_need_buffer: X, Y" in Yaml file, so as to drop the underlying allocation for Tensor X and Tensor Y when creating TensorWrapper.

77d95802797988a3134174a40fd05a83

AutoCoden script will detect "no_need_buffer" field and set a special boolean when constructing TensorWrapper. In that scenario, TensorWrapper will only copy everything except for the underlying allocation from Tensor X or Tensor.

993c7be9eefdef4727dec7c7adb274ec

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@@ -48,7 +49,22 @@ class TensorWrapper {
}

// shallow copy tensor_impl here
intermidiate_tensor_.set_impl(tensor.impl());
if (no_need_buffer) {
if (pten::DenseTensor::classof(tensor.impl().get())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的pten估计有代码冲突

@jim19930609 jim19930609 merged commit 911cb2e into PaddlePaddle:develop Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants