CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Inference] Add a config api to use PIR #61968
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -52,6 +52,7 @@ int main(int argc, char **argv) { | |||
config.SetModel(FLAGS_modeldir + "/custom_relu.pdmodel", | |||
FLAGS_modeldir + "/custom_relu.pdiparams"); | |||
config.EnableNewExecutor(true); | |||
config.EnableUsePIR(); |
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.
想了一下config的api名字改为EnableNewIR吧,和EnableNewExecutor一致
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.
只改这个对外暴露的config的api命名即可,内部变量还是以pir***命名就行
void EnableUsePIR() { use_pir_ = true; } | ||
|
||
void DisableUsePIR() { use_pir_ = false; } | ||
|
||
bool pir_enabled() const { return use_pir_; } |
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.
api参考这个void EnableNewExecutor(bool x = true) { use_new_executor_ = x; },就不需要额外DisableUsePIR了
paddle/fluid/pybind/inference_api.cc
Outdated
@@ -794,6 +794,8 @@ void BindAnalysisConfig(py::module *m) { | |||
&AnalysisConfig::Exp_DisableMixedPrecisionOps) | |||
.def("exp_enable_mixed_precision_ops", | |||
&AnalysisConfig::Exp_EnableMixedPrecisionOps) | |||
.def("enable_use_pir", &AnalysisConfig::EnableUsePIR) | |||
.def("disable_use_pir", &AnalysisConfig::DisableUsePIR) |
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.
disable_use_pir不需要
# def enable_pir(self, flag: bool): | ||
# paddle.set_flags({'FLAGS_enable_pir_in_executor': flag}) |
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.
无用注释删掉,其他地方同
@@ -369,7 +369,7 @@ AnalysisPredictor::AnalysisPredictor(const AnalysisConfig &config) | |||
} | |||
if (config_.new_executor_enabled()) { | |||
config_.EnableMemoryOptim(false); | |||
if (FLAGS_enable_pir_in_executor) { | |||
if (config_.pir_enabled()) { |
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.
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
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
bdab828
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
@@ -376,7 +375,7 @@ AnalysisPredictor::AnalysisPredictor(const AnalysisConfig &config) | |||
} | |||
if (config_.new_executor_enabled()) { | |||
config_.EnableMemoryOptim(false); | |||
if (FLAGS_enable_pir_in_executor) { | |||
if (config_.new_ir_enabled()) { |
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 (config_.new_ir_enabled()) { | |
if (config_.pir_enabled()) { |
PR types
New features
PR changes
APIs
Description
Pcard-71500
This PR provides an interface in Paddle Inference for users to enable the new ir.