From 2b14316e407620c8325fffb890d589c61b81c145 Mon Sep 17 00:00:00 2001 From: liubuyu Date: Thu, 22 Oct 2020 16:56:05 +0800 Subject: [PATCH] dynamic shape bug fix: output shape is not updated --- .../ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc | 5 +---- .../runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc index 700165fa663..b2746c99f8d 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc @@ -557,7 +557,6 @@ bool AscendKernelRuntime::RunDynamicKernelAsync(const session::KernelGraph *grap } if (dynamic_kernel->is_dynamic_shape()) { - ExecutorCallback::GetInstance().Consume(); dynamic_kernel->InferShape(); dynamic_kernel->UpdateArgs(); } @@ -571,15 +570,13 @@ bool AscendKernelRuntime::RunDynamicKernelAsync(const session::KernelGraph *grap // Enable profiling trace point end rt_callback.RegisterCallback( [&]() { RECORD_CALLBACK_EVENT(&async_profiler, dynamic_kernel->GetKernelName().c_str(), "[Callback] end"); }); - - ExecutorCallback::GetInstance().RegistCallback([&dynamic_kernel] { dynamic_kernel->PostExecute(); }); + dynamic_kernel->PostExecute(); } if (!SyncStream()) { MS_LOG(ERROR) << "SyncStream failed"; return false; } - ExecutorCallback::GetInstance().Consume(); rt_callback.Destroy(); async_profiler.Dump(std::cout); diff --git a/mindspore/ccsrc/runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc b/mindspore/ccsrc/runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc index c083a88ea05..be249bda7c4 100644 --- a/mindspore/ccsrc/runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc +++ b/mindspore/ccsrc/runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc @@ -194,6 +194,10 @@ bool AiCpuDynamicKernel::UpdateOutputShapeFromExtInfo() { void AiCpuDynamicKernel::PostExecute() { MS_LOG(INFO) << "Aicpu " << cnode_ptr_->fullname_with_scope() << " PostExecute"; + if (RT_ERROR_NONE != rtStreamSynchronize(stream_)) { + MS_LOG(ERROR) << "Call runtime rtStreamSynchronize error."; + return; + } if (AnfAlgo::IsDynamicShape(cnode_ptr_) && unknow_type_ == DEPEND_COMPUTE) { MS_LOG(INFO) << "Update aicpu kernel output shape from ext_info"; UpdateOutputShapeFromExtInfo();