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

[SOT][dynamic shape] Adapt some InferMeta for dynamic shape #65517

Merged
merged 16 commits into from
Jul 2, 2024

Conversation

zrr1999
Copy link
Member

@zrr1999 zrr1999 commented Jun 27, 2024

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

修复部分在非运行时的检查条件,之前只考虑到只有一个动态shape参数,现在使用anyof代替product,从而支持多个参数。

Copy link

paddle-bot bot commented Jun 27, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Jun 27, 2024
@@ -753,7 +753,7 @@ void BatchNormInferMeta(const MetaTensor& x,
check = false;
}
Copy link
Member

@SigureMo SigureMo Jun 27, 2024

Choose a reason for hiding this comment

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

750-754 行看起来就是处理了动态 shape 场景?因为取的就是 product 结果为负(离谱,俩 -1 不就是正的了吗),可以看看这里的处理逻辑的漏洞,并看看是否可以清理还是怎样做比较合适

Copy link
Member Author

Choose a reason for hiding this comment

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

done

}

if ((!config.is_runtime) &&
(contain_unknown_dim(scale.dims()) || contain_unknown_dim(bias.dims()))) {
check = false;
}
Copy link
Member

Choose a reason for hiding this comment

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

2024-06-28 17:38:10 --------------------------------------
2024-06-28 17:38:10 C++ Traceback (most recent call last):
2024-06-28 17:38:10 --------------------------------------
2024-06-28 17:38:10 0   paddle::pybind::static_api_batch_norm_(_object*, _object*, _object*)
2024-06-28 17:38:10 1   paddle::dialect::batch_norm_(pir::Value const&, pir::Value const&, pir::Value const&, paddle::optional<pir::Value> const&, paddle::optional<pir::Value> const&, bool, float, float, std::string const&, bool, bool)
2024-06-28 17:38:10 2   paddle::dialect::BatchNorm_Op::Build(pir::Builder&, pir::OperationArgument&, pir::Value, pir::Value, pir::Value, pir::Value, pir::Value, bool, float, float, std::string const&, bool, bool)
2024-06-28 17:38:10 3   paddle::dialect::BatchNorm_Op::InferMeta(std::vector<pir::Value, std::allocator<pir::Value> > const&, std::unordered_map<std::string, pir::Attribute, std::hash<std::string >, std::equal_to<std::string >, std::allocator<std::pair<std::string const, pir::Attribute> > >*)
2024-06-28 17:38:10 4   common::enforce::EnforceNotMet::EnforceNotMet(common::ErrorSummary const&, char const*, int)
2024-06-28 17:38:10 5   common::enforce::GetCurrentTraceBackString[abi:cxx11](bool)
2024-06-28 17:38:10 
2024-06-28 17:38:10 ----------------------
2024-06-28 17:38:10 Error Message Summary:
2024-06-28 17:38:10 ----------------------
2024-06-28 17:38:10 InvalidArgumentError: ShapeError: the shape of scale must equal to [-1]But received: the shape of scale is [3]
2024-06-28 17:38:10   [Hint: Expected scale.dims()[0] == C, but received scale.dims()[0]:3 != C:-1.] (at ../paddle/phi/infermeta/multiary.cc:925)

这是没成功跳过吗

Copy link
Member

Choose a reason for hiding this comment

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

coverage 这个单测还超时了,很奇怪

Copy link
Member Author

Choose a reason for hiding this comment

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

看起来是因为没判断C==-1,但是为什么我本地没有报错好奇怪

@SigureMo
Copy link
Member

PR-CI-Py3-PIR 下 bn 单测挂了,奇怪

}

if ((!config.is_runtime) && (contain_unknown_dim(scale.dims()) ||
contain_unknown_dim(bias.dims()) || C == -1)) {
Copy link
Contributor

@WintersMontagne10335 WintersMontagne10335 Jul 2, 2024

Choose a reason for hiding this comment

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

这里试下

if (!scale || !bias ||
      ((!config.is_runtime) && (contain_unknown_dim(scale.dims()) ||
                                contain_unknown_dim(bias.dims()))))

我测了下py好像没报错 #65612

Copy link
Member

Choose a reason for hiding this comment

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

嗯,我等会看下,这个 PR 后续我来推进

Copy link
Member Author

Choose a reason for hiding this comment

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

那这块是不是可以直接在contain_unknown_dim里判断一下

@SigureMo SigureMo changed the title [SOT][dynamic shape] fix check when input_spec is dynamic [SOT][dynamic shape] Adapt some InferMeta for dynamic shape Jul 2, 2024
Co-authored-by: Winters Montagne <[email protected]>
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

@SigureMo SigureMo merged commit f6ae216 into PaddlePaddle:develop Jul 2, 2024
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants