!22936 Disable parallel build when PYNATIVE_SYNCHRONIZE flag is on

Merge pull request !22936 from caifubi/master-pynative-ascend-performance
This commit is contained in:
i-robot 2021-09-08 01:46:20 +00:00 committed by Gitee
commit 6da6713e7a
3 changed files with 4 additions and 6 deletions

View File

@ -779,7 +779,8 @@ void AscendSession::RunOpImpl(const GraphInfo &graph_info, OpRunInfo *op_run_inf
const std::vector<int64_t> &tensors_mask) {
auto ms_context = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(ms_context);
if (ms_context->get_param<int>(MS_CTX_EXECUTION_MODE) == kGraphMode || op_run_info->is_dynamic_shape) {
if (ms_context->get_param<int>(MS_CTX_EXECUTION_MODE) == kGraphMode || op_run_info->is_dynamic_shape ||
ms_context->get_param<bool>(MS_CTX_ENABLE_PYNATIVE_SYNCHRONIZE)) {
session::PynativeTaskManager::GetInstance().ExecuteRemainingTasks();
RunOpImplOrigin(graph_info, op_run_info, input_tensors, outputs, tensors_mask);
return;

View File

@ -1226,10 +1226,7 @@ void SessionBasic::GetSingleOpRunInfo(const CNodePtr cnode, OpRunInfo *run_info)
run_info->abstract = abstract;
const auto &shape = abstract->BuildShape();
MS_EXCEPTION_IF_NULL(shape);
const auto &shape_info = shape->ToString();
if (shape_info.find("-1") != string::npos) {
run_info->is_dynamic_shape = true;
}
run_info->is_dynamic_shape = shape->IsDynamic();
}
void SessionBasic::GetParameterIndex(const KernelGraph *graph, const std::vector<tensor::TensorPtr> &inputs,

View File

@ -134,7 +134,7 @@ void KernelRuntime::RunOpMallocPre(const session::KernelGraph &graph,
continue;
}
auto op_runtime_info = item->user_data<session::OpRuntimeInfo>();
MS_EXCEPTION_IF_NULL(op_runtime_info);
TypeId output_type_id = op_runtime_info->output_type(index);
auto output_tensor_size = op_runtime_info->output_tensor_size(index);
auto output_format = op_runtime_info->output_format(index);