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

[xpu]:fix scope new tensor: max weight is unchanged #9641

Merged
merged 2 commits into from
Nov 9, 2022

Conversation

gitliuyf
Copy link
Contributor

@gitliuyf gitliuyf commented Nov 4, 2022

No description provided.

@paddle-bot
Copy link

paddle-bot bot commented Nov 4, 2022

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Nov 4, 2022

CLA assistant check
All committers have signed the CLA.

zhupengyang
zhupengyang previously approved these changes Nov 7, 2022
Copy link
Collaborator

@zhupengyang zhupengyang left a comment

Choose a reason for hiding this comment

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

LGTM

@newway
Copy link
Collaborator

newway commented Nov 9, 2022

LGTM

@@ -1310,7 +1311,7 @@ class XPUMultiEncoderFuser {
weight_tensor_vec[0]->Resize({weight_dim1_acc, weight_dims_vec[0][0]});
float max_f =
paddle::lite::xpu::math::FindMaxAbs(weight_qkv_trans.get(), qkv_len);
auto max_tensor = scope->NewTensor(max_tensor_name);
auto max_tensor = scope->MutableParent()->NewTensor(max_tensor_name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

为什么需要在 parent scope 创建一个tensor 呢?是为了解决什么问题呢?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

1、如果是scope->NewTensor()就是从current scope创建,如果是scope->MutableParent()->NewTensor()就是从root scope创建。
2、因为PaddleLite 现在将权重信息保存在了 root scope中,如果clone多个predictor,会共用一个root scope。
3、需要存放权重才用的MutableParent,如果说你的tensor不需要存放权重,是特征值,是不需要MutableParent的。

Copy link
Collaborator

@zhupengyang zhupengyang left a comment

Choose a reason for hiding this comment

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

LGTM

@zhupengyang zhupengyang merged commit 4dc658b into PaddlePaddle:develop Nov 9, 2022
newway pushed a commit to newway/Paddle-Lite that referenced this pull request Nov 19, 2022
zhupengyang pushed a commit that referenced this pull request Nov 24, 2022
* [Cherry-Pick][XPU] fixed inplace op mem reuse issue when the previous op is an invalid op (#9562) (#9564)

* [XPU] support roformer relative embedding (#9536)

* fix sampling_id, fix xpu python whl, fix quant_dequant pass (#9636)

* [XPU] support ffn intermediate size M!=4 (#9646)

* [xpu] fix scope new tensor, max weight is unchanged (#9641)

* [XPU] Fixed the bug in op calib. (#9700)

* [XPU] support skip ffn quant in K200 (#9704)
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.

5 participants