-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[CINN Zero-Dim] CINN supports 0D-Tensor with trick temporarily #53382
[CINN Zero-Dim] CINN supports 0D-Tensor with trick temporarily #53382
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
|
||
void CinnZeroTensorTrickPass::ApplyImpl(ir::Graph* graph) const { | ||
// fix shape attr of these ops | ||
const std::unordered_set<std::string> op_cases_fix_attr{"fill_constant", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前是只有这些算子可能会引入0D-tensor么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个算子集合可能不是完备的,本 PR 只是暂时提供了绕过的机制,拉取受影响 PR 经本地测试是可以全部绕过的:
后续如果有 op 引入 0D-Tensor,可以往这个集合里面添加。
@@ -0,0 +1,56 @@ | |||
/* Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2020 -> 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks~ 下个 PR 改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ly (PaddlePaddle#53382) * [CINN Support 0D-Tensor] CINN supports 0D-Tensor with trick temporarily * Add unittest
#53601) * [Zero-Dim] fix functool.reduce more safe with intial value, to support empty list (#53182) * [Zero-Dim] support 0d tensor for shape and squeeze onednn kernel (#52832) * support 0d tensor for shape and squeeze onednn kernel * set python api for shape op ut * [Zero-Dim] distributed scatter/all_to_all support input 0D tensor (#53186) * [Zero-Dim] Support paddle.sum/mean/loss api output 0D,test=allcase (#52739) * [CINN Support 0D-Tensor] CINN supports 0D-Tensor with trick temporarily (#53382) * [CINN Support 0D-Tensor] CINN supports 0D-Tensor with trick temporarily * Add unittest * [CINN Support 0D-Tensor] CINN hack squeeze2 with trick temporarily (#53454) * fix test_autograd_dynamic (#53473) Co-authored-by: zhwesky2010 <zhouwei25@baidu.com> --------- Co-authored-by: YangQun <qun.yang@intel.com> Co-authored-by: HongyuJia <jiahongyu@baidu.com> Co-authored-by: HydrogenSulfate <490868991@qq.com>
PR types
New features
PR changes
Others
Description
Pcard-66989
Paddle 0D-Tensor 机制需要合入 2.5 分支,目前该机制依赖于 CINN 提供 0D-Tensor 支持。由于开发时间较紧张,本 PR 提供了一种低成本快速适配 CINN 0D-Tensor 的机制,在 build_cinn_pass 前新增 cinn_zero_tensor_trick_pass,将 CINN 的所有 0D-Tensor 输入转换为 1D-Tensor。
本 PR 只是一种临时方案,待 CINN 全面原生支持 0D-Tensor 后,会将本 PR 中的 pass 移除,本 pass 的移除也标志着 CINN 全面支持 0D-Tensor 子项的完结。
Paddle's 0D-Tensor mechanism must be merged in the release/2.5 branch, but this mechanism requires CINN to provide corresponding support. This PR adds
cinn_zero_tensor_trick_pass
beforebuild_cinn_pass
to convert all CINN's 0D-Tensor inputs into 1D-Tensor, which can support Paddle's 0D-Tensor with low costs.Note that this PR only provides a temporary trick, the
cinn_zero_tensor_trick_pass
in this PR will be removed after CINN fully supports 0D-Tensor.