forked from mindspore-Ecosystem/mindspore
!14799 【unify runtime】remove HideNopNode after SetKernelInfo and code refine
From: @zyli2020 Reviewed-by: @cristoval,@wilfchen,@limingqi107 Signed-off-by: @wilfchen,@limingqi107
This commit is contained in:
commit
d1c6c15a42
|
@ -179,14 +179,6 @@ void GPUDeviceContext::OptimizeGraphWithoutDeviceInfo(const KernelGraphPtr &grap
|
|||
|
||||
// Update Graph Dynamic Shape Attr.
|
||||
UpdateGraphDynamicShapeAttr(NOT_NULL(graph));
|
||||
|
||||
auto context_ptr = MsContext::GetInstance();
|
||||
MS_EXCEPTION_IF_NULL(context_ptr);
|
||||
const bool pynative_mode = context_ptr->get_param<int>(MS_CTX_EXECUTION_MODE) == kPynativeMode;
|
||||
// Hide NopOp from execution graph in graph mode
|
||||
if (!pynative_mode) {
|
||||
opt::HideNopNode(graph.get());
|
||||
}
|
||||
}
|
||||
|
||||
void GPUDeviceContext::OptimizeGraphWithDeviceInfo(const KernelGraphPtr &graph) const {
|
||||
|
@ -211,6 +203,9 @@ void GPUDeviceContext::OptimizeGraphWithDeviceInfo(const KernelGraphPtr &graph)
|
|||
optimizer->AddPassManager(pm);
|
||||
(void)optimizer->Optimize(graph);
|
||||
graph->SetExecOrderByDefault();
|
||||
|
||||
// Hide NopOp from execution order.
|
||||
opt::HideNopNode(graph.get());
|
||||
}
|
||||
|
||||
void GPUDeviceContext::FuseOperators(const KernelGraphPtr &graph) const {
|
||||
|
@ -235,11 +230,10 @@ void GPUDeviceContext::FuseOperators(const KernelGraphPtr &graph) const {
|
|||
graph->SetExecOrderByDefault();
|
||||
|
||||
// Graph kernel fusion optimization
|
||||
if (!context::GraphKernelFlags::GetInstance().IsEnableGraphKernel()) {
|
||||
return;
|
||||
}
|
||||
if (context::GraphKernelFlags::GetInstance().IsEnableGraphKernel()) {
|
||||
opt::GraphKernelOptimize(graph);
|
||||
graph->SetExecOrderByDefault();
|
||||
}
|
||||
}
|
||||
|
||||
void GPUDeviceContext::UpdateGraphDynamicShapeAttr(const NotNull<KernelGraphPtr> &graph) const {
|
||||
|
|
Loading…
Reference in New Issue