-
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
add inference api:exp_disable_tensorrt_dynamic_shape_ops #62352
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -813,6 +813,8 @@ struct PD_INFER_DECL AnalysisConfig { | |||
void Exp_DisableTensorRtSubgraph( | |||
const std::vector<std::string>& var_name_not_trt); | |||
|
|||
void Exp_DisableDynamicTensorRTOPs(bool trt_forbid_dynamic_op); |
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.
Exp_DisableDynamicTensorRTOPs -> Exp_DisableTensorRTDynamicShapeOPs是不是更易理解?
@@ -34,6 +34,41 @@ namespace paddle { | |||
namespace inference { | |||
namespace tensorrt { | |||
|
|||
bool checkForDynamicShapes(const framework::OpDesc& desc) { |
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.
根据Paddle命名规范,checkForDynamicShapes->CheckForDynamicShapes
if (forbid_dynamic_op_enter_into_trt) { | ||
bool is_dynamic = checkForDynamicShapes(desc); | ||
return is_dynamic; | ||
} |
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.
这里逻辑不太对吧,如果是动态shape,返回true?如果当前op没有支持trt converter并且是动态shape也返回true?
if (forbid_dynamic_op_enter_into_trt) { | ||
bool is_dynamic = checkForDynamicShapes(desc); | ||
return is_dynamic; | ||
} |
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.
同上
if (forbid_dynamic_op_enter_into_trt) { | ||
bool is_dynamic = checkForDynamicShapes(desc); | ||
return is_dynamic; | ||
} |
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.
同上
if (forbid_dynamic_op_enter_into_trt && IsDynamicShapeOp(desc)) { | ||
return false; | ||
} | ||
|
||
if (with_dynamic_shape) { |
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.
这里需要加这几个op判断吗?
if (forbid_dynamic_op_enter_into_trt && IsDynamicShapeOp(desc)) { | ||
return false; | ||
} | ||
|
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.
按照前面op teller的架构写判断
@@ -34,6 +34,42 @@ namespace paddle { | |||
namespace inference { | |||
namespace tensorrt { | |||
|
|||
// 检查是否是动态shape,如果是动态shape,则返回true,否则返回false |
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.
换个英文的注释
@@ -34,6 +34,42 @@ namespace paddle { | |||
namespace inference { | |||
namespace tensorrt { | |||
|
|||
// 检查是否是动态shape,如果是动态shape,则返回true,否则返回false | |||
bool IsDynamicShapeOp(const framework::OpDesc& desc) { |
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.
DynamicShape 这个是和tensorrt的DynamicShape 一样吗?
最近添加的几个相关api,需要在paddle-inference-demo仓库中补充下api文档~ |
|
PR types
New features
PR changes
Others
Description
Pcard-71501
推理新增dynamic_shape op禁止使用trt推理,使用原生gpu推理。
此处的dynamic shape op指的是,运行的时候shape会改变的Op,这些Op被禁止进入TRT。
如上图,tensorrt_engine的输入为dynamic_shape,使用
如图所示,使用原生gpu推理