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

Disable trt op by output var #49497

Merged
merged 1 commit into from
Mar 3, 2023
Merged

Conversation

JZZ-NOTE
Copy link
Contributor

@JZZ-NOTE JZZ-NOTE commented Jan 3, 2023

PR types

Others

PR changes

Others

Describe

扩展接口 AnalysisConfig::Exp_DisableTensorRtOPs;
原接口支持传入 op names 禁用某一类 op;
扩展后,支持通过指定输出 var 的 name,禁用某个 op。

使用方法:
config.Exp_DisableTensorRtOPs({"op_name", "output_var_name"});

TODO:
修改官网文档说明。

@paddle-bot
Copy link

paddle-bot bot commented Jan 3, 2023

你的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.

@@ -694,7 +694,8 @@ struct PD_INFER_DECL AnalysisConfig {
/// \brief Prevent ops running in Paddle-TRT
/// NOTE: just experimental, not an official stable API, easy to be broken.
///
void Exp_DisableTensorRtOPs(const std::vector<std::string>& ops);
void Exp_DisableTensorRtOPs(const std::vector<std::string>& ops,
Copy link
Contributor

Choose a reason for hiding this comment

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

修改下注释,可以描述地更详细些~

@@ -694,7 +694,8 @@ struct PD_INFER_DECL AnalysisConfig {
/// \brief Prevent ops running in Paddle-TRT
/// NOTE: just experimental, not an official stable API, easy to be broken.
///
void Exp_DisableTensorRtOPs(const std::vector<std::string>& ops);
void Exp_DisableTensorRtOPs(const std::vector<std::string>& ops,
Copy link
Contributor

Choose a reason for hiding this comment

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

新增了默认参数,python api bind没有更新吧?使用应该会报错

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不会报错,python api bind 不会指定参数数量
image
可以直接使用。

@jiweibo
Copy link
Contributor

jiweibo commented Jan 3, 2023

已知问题:
两个op共用权重,一个进入trt,一个没进trt;
进入trt的op的权重被 convert 操作,例如 mul 的权重在某些情况下会被转置;
则没进trt的op因权重被转置而计算错误

如果遇到了这样的case,应该比较难定位和发现问题,是否有warning信息或者把涉及到的相关算子都规范为同样的行为(如都进trt或都不进trt)

Copy link
Contributor

@jiweibo jiweibo left a comment

Choose a reason for hiding this comment

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

LGTM

@jiweibo jiweibo merged commit db47dec into PaddlePaddle:develop Mar 3, 2023
@JZZ-NOTE JZZ-NOTE deleted the disable_trt_op branch March 8, 2023 11:19
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.

3 participants