CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[CINN] CINN plug-in Inference Executor #61949
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] CINN plug-in Inference Executor #61949
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -105,6 +105,10 @@ | |||
#include "paddle/fluid/platform/device/gpu/cuda/cuda_profiler.h" | |||
#endif | |||
|
|||
#ifdef PADDLE_WITH_CINN | |||
#include "paddle/fluid/pybind/add_cinn_pass.h" |
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/fluid/inference/api/analysis_predictor.cc
这么一个底层文件需要引用一个python相关的头文件
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.
done, thanks~
… Executor-With-Cinn
… Executor-With-Cinn
@@ -129,6 +133,9 @@ | |||
|
|||
COMMON_DECLARE_bool(enable_pir_in_executor); | |||
COMMON_DECLARE_bool(pir_apply_inplace_pass); | |||
#ifdef PADDLE_WITH_CINN | |||
COMMON_DECLARE_bool(use_cinn); |
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.
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.
按照线下沟通,此处修改完毕~
@@ -797,6 +804,15 @@ bool AnalysisPredictor::PrepareExecutor() { | |||
DecompProgram decomp_object(pir_program_.get()); | |||
decomp_object.decomp_program(); | |||
} | |||
#ifdef PADDLE_WITH_CINN | |||
if (FLAGS_use_cinn) { |
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.
use_cinn和use_gpu是否冲突?如果跑到了此分支,那么817行的分支也进去了,会有问题吗?
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.
不会有冲突,use_cinn 和 use_gpu 的功能是相互独立的
auto cinn_pm = std::make_shared<::pir::PassManager>( | ||
::pir::IrContext::Instance(), 2); | ||
cinn::dialect::ir::AddCinnPass(cinn_pm, *pir_program_.get()); | ||
cinn_pm->Run(pir_program_.get()); |
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_.glog_info_disabled()) {
gpu_pm.EnablePrintStatistics();
}
if (config_.ir_debug_) {
gpu_pm.EnableIRPrinting();
}
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.
Done,thanks~
if (FLAGS_print_ir) { | ||
pass_manager->EnableIRPrinting(); | ||
} |
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.
非推理流程也可能执行这个函数,因此需要保留这个 flag
@@ -1187,7 +1187,7 @@ struct PD_INFER_DECL AnalysisConfig { | |||
/// | |||
/// \brief Enable use cinn compiler optimization. | |||
/// | |||
void Exp_EnableCINNCompiler(); | |||
void EnableCINN(); |
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.
下面的cinn_compiler_enabled改为cinn_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.
Done,thanks~
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
PR types
New features
PR changes
Others
Description
pcard-76996
ProgramTranslator + 推理执行器流程中,接入 CINN 的 pass。配置推理 config 时,通过
config.enable_cinn()
开启 CINN