!49658 disable op fusion pass in the dynamic shape scene

Merge pull request !49658 from limingqi107/bug_fix3
This commit is contained in:
i-robot 2023-03-03 09:48:02 +00:00 committed by Gitee
commit 1a583ae24d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 26 additions and 17 deletions

View File

@ -38,7 +38,7 @@ const AnfNodePtr DynamicSequenceOpsAdaptation::Process(const FuncGraphPtr &, con
if (common::AnfAlgo::HasDynamicTupleInput(cnode) || common::AnfAlgo::IsDynamicSequence(cnode)) {
auto primitive = GetCNodePrimitive(cnode);
MS_EXCEPTION_IF_NULL(primitive);
constexpr auto kDynamicTupleInputOpNamePrefix = "Tuple";
constexpr auto kDynamicTupleInputOpNamePrefix = "Sequence";
auto new_op_name = kDynamicTupleInputOpNamePrefix + op_name;
primitive->set_name(new_op_name);
// reset full scope name

View File

@ -363,22 +363,28 @@ void GPUKernelExecutor::OptimizeGraphWithDeviceInfo(const KernelGraphPtr &graph)
pm->AddPass(std::make_shared<opt::ReplaceAddNFusion>());
// PrintReduceFusion depends on the input expansion of Print, so must be after the operator select.
pm->AddPass(std::make_shared<opt::PrintReduceFusion>("print_reduce"));
pm->AddPass(std::make_shared<opt::BatchNormReluFusion>());
pm->AddPass(std::make_shared<opt::BatchNormReluGradFusion>());
pm->AddPass(std::make_shared<opt::BatchNormAddReluFusion>());
pm->AddPass(std::make_shared<opt::PostBatchNormAddReluFusion>());
pm->AddPass(std::make_shared<opt::BatchNormAddReluGradFusion>());
pm->AddPass(std::make_shared<opt::InsertFormatTransformOp>());
pm->AddPass(std::make_shared<opt::RemoveFormatTransformPair>());
pm->AddPass(std::make_shared<opt::RemoveRedundantFormatTransform>());
if (ms_context->get_param<int>(MS_CTX_EXECUTION_MODE) == kGraphMode) {
// Remove node only used by UpdateState, in order to ensure the correct execution sequence in CudnnInplaceAggregate.
pm->AddPass(std::make_shared<opt::OptimizeUpdateState>());
pm->AddPass(std::make_shared<opt::CudnnInplaceAggregate>());
// The fusion operator generates a new primitive and can't be supported in dynamic shape scene.
if (!graph->is_dynamic_shape()) {
pm->AddPass(std::make_shared<opt::BatchNormReluFusion>());
pm->AddPass(std::make_shared<opt::BatchNormReluGradFusion>());
pm->AddPass(std::make_shared<opt::BatchNormAddReluFusion>());
pm->AddPass(std::make_shared<opt::PostBatchNormAddReluFusion>());
pm->AddPass(std::make_shared<opt::BatchNormAddReluGradFusion>());
pm->AddPass(std::make_shared<opt::InsertFormatTransformOp>());
pm->AddPass(std::make_shared<opt::RemoveFormatTransformPair>());
pm->AddPass(std::make_shared<opt::RemoveRedundantFormatTransform>());
if (ms_context->get_param<int>(MS_CTX_EXECUTION_MODE) == kGraphMode) {
// Remove node only used by UpdateState, in order to ensure the correct execution sequence in
// CudnnInplaceAggregate.
pm->AddPass(std::make_shared<opt::OptimizeUpdateState>());
pm->AddPass(std::make_shared<opt::CudnnInplaceAggregate>());
}
pm->AddPass(std::make_shared<opt::ReluV2Pass>());
pm->AddPass(std::make_shared<opt::AddReluV2Fusion>());
pm->AddPass(std::make_shared<opt::AddReluGradV2Fusion>());
}
pm->AddPass(std::make_shared<opt::ReluV2Pass>());
pm->AddPass(std::make_shared<opt::AddReluV2Fusion>());
pm->AddPass(std::make_shared<opt::AddReluGradV2Fusion>());
pm->AddPass(std::make_shared<opt::AllReduceFusion>());
pm->AddPass(std::make_shared<opt::AdjustDependForParallelOptimizerRecomputeAllGather>());
pm->AddPass(std::make_shared<opt::AllGatherFusion>());

View File

@ -2049,7 +2049,10 @@ void GraphScheduler::LinkControlArrowForCustomActor(const ActorSet *actor_set,
auto to_kernel_type = FetchKernelTransformType(to_node, graph, graph_compiler_info.origin_parameters_order_,
graph_compiler_info.strategy_);
auto to_actor = FetchActor(to_kernel_type, graph_compiler_info.name_, to_node, graph);
MS_EXCEPTION_IF_NULL(to_actor);
if (to_actor == nullptr) {
MS_LOG(EXCEPTION) << "Fetch no actor for node:" << to_node->fullname_with_scope()
<< ", from node:" << from_node->fullname_with_scope();
}
AbstractActor *from_actor = nullptr;
// InternalParameter --> CustomActor.