Browse Source

dynamic shape bug fix: output shape is not updated

tags/v1.1.0
liubuyu 5 years ago
parent
commit
2b14316e40
2 changed files with 5 additions and 4 deletions
  1. +1
    -4
      mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc
  2. +4
    -0
      mindspore/ccsrc/runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc

+ 1
- 4
mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc View File

@@ -557,7 +557,6 @@ bool AscendKernelRuntime::RunDynamicKernelAsync(const session::KernelGraph *grap
} }


if (dynamic_kernel->is_dynamic_shape()) { if (dynamic_kernel->is_dynamic_shape()) {
ExecutorCallback::GetInstance().Consume();
dynamic_kernel->InferShape(); dynamic_kernel->InferShape();
dynamic_kernel->UpdateArgs(); dynamic_kernel->UpdateArgs();
} }
@@ -571,15 +570,13 @@ bool AscendKernelRuntime::RunDynamicKernelAsync(const session::KernelGraph *grap
// Enable profiling trace point end // Enable profiling trace point end
rt_callback.RegisterCallback( rt_callback.RegisterCallback(
[&]() { RECORD_CALLBACK_EVENT(&async_profiler, dynamic_kernel->GetKernelName().c_str(), "[Callback] end"); }); [&]() { 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()) { if (!SyncStream()) {
MS_LOG(ERROR) << "SyncStream failed"; MS_LOG(ERROR) << "SyncStream failed";
return false; return false;
} }
ExecutorCallback::GetInstance().Consume();


rt_callback.Destroy(); rt_callback.Destroy();
async_profiler.Dump(std::cout); async_profiler.Dump(std::cout);


+ 4
- 0
mindspore/ccsrc/runtime/device/ascend/executor/ai_cpu_dynamic_kernel.cc View File

@@ -194,6 +194,10 @@ bool AiCpuDynamicKernel::UpdateOutputShapeFromExtInfo() {


void AiCpuDynamicKernel::PostExecute() { void AiCpuDynamicKernel::PostExecute() {
MS_LOG(INFO) << "Aicpu " << cnode_ptr_->fullname_with_scope() << " 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) { if (AnfAlgo::IsDynamicShape(cnode_ptr_) && unknow_type_ == DEPEND_COMPUTE) {
MS_LOG(INFO) << "Update aicpu kernel output shape from ext_info"; MS_LOG(INFO) << "Update aicpu kernel output shape from ext_info";
UpdateOutputShapeFromExtInfo(); UpdateOutputShapeFromExtInfo();


Loading…
Cancel
Save