From 36a09b1565d0da6d47487aa94cc331d18287dec2 Mon Sep 17 00:00:00 2001 From: yanghaoran Date: Mon, 16 Nov 2020 21:33:58 +0800 Subject: [PATCH] check kernel type and do syncStream for hccl dynamic kernels --- mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc | 2 +- mindspore/ccsrc/runtime/device/executor/dynamic_kernel.cc | 2 ++ mindspore/ccsrc/runtime/device/executor/dynamic_kernel.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc index e115e24528..524cb6296e 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc @@ -606,7 +606,7 @@ bool AscendKernelRuntime::RunDynamicKernelAsync(const session::KernelGraph *grap auto dynamic_kernels = iter->second; for (const auto &dynamic_kernel : dynamic_kernels) { - if (dynamic_kernel->have_depends()) { + if (dynamic_kernel->have_depends() || dynamic_kernel->GetKernelType() == KernelType::HCCL_KERNEL) { MS_LOG(INFO) << "Match Dynamic Kernel, Start SyncStream"; if (!SyncStream()) { MS_LOG(ERROR) << "SyncStream failed"; diff --git a/mindspore/ccsrc/runtime/device/executor/dynamic_kernel.cc b/mindspore/ccsrc/runtime/device/executor/dynamic_kernel.cc index e4512e3b5c..bc3165133c 100644 --- a/mindspore/ccsrc/runtime/device/executor/dynamic_kernel.cc +++ b/mindspore/ccsrc/runtime/device/executor/dynamic_kernel.cc @@ -49,6 +49,8 @@ void DynamicKernel::Initialize() { MS_LOG(INFO) << "Init End"; } +int DynamicKernel::GetKernelType() { return AnfAlgo::GetKernelType(cnode_ptr_); } + bool IsTupleGetItem(const AnfNodePtr &anf_node) { MS_EXCEPTION_IF_NULL(anf_node); if (!anf_node->isa()) { diff --git a/mindspore/ccsrc/runtime/device/executor/dynamic_kernel.h b/mindspore/ccsrc/runtime/device/executor/dynamic_kernel.h index fc1f37fdf9..6f97775191 100644 --- a/mindspore/ccsrc/runtime/device/executor/dynamic_kernel.h +++ b/mindspore/ccsrc/runtime/device/executor/dynamic_kernel.h @@ -47,6 +47,7 @@ class DynamicKernel { bool have_depends() const { return !depend_list_.empty(); } virtual void Initialize(); std::string GetKernelName() { return cnode_ptr_->fullname_with_scope(); } + int GetKernelType(); protected: void RebuildDependTensor();