!7630 dynamic shape bug fix

Merge pull request !7630 from liubuyu/master
This commit is contained in:
mindspore-ci-bot 2020-10-22 19:16:51 +08:00 committed by Gitee
commit d54ea04df3
2 changed files with 5 additions and 4 deletions

View File

@ -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);

View File

@ -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();