From 58e5d8b3f0f7751b950249f3dc2e9754c381e17a Mon Sep 17 00:00:00 2001 From: yanghaoran Date: Fri, 23 Oct 2020 11:18:03 +0800 Subject: [PATCH 1/2] add rpath for opp default directories --- mindspore/ccsrc/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mindspore/ccsrc/CMakeLists.txt b/mindspore/ccsrc/CMakeLists.txt index 60cb31a25f..2916a085f7 100644 --- a/mindspore/ccsrc/CMakeLists.txt +++ b/mindspore/ccsrc/CMakeLists.txt @@ -267,6 +267,8 @@ if (ENABLE_D) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/fwkacllib/lib64) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/add-ons) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling) + set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling) + set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling) elseif (ENABLE_GPU) set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/cuda/lib64) endif () From 7a2a714a11f7b26572b409cb5e6d8f89dc8dae69 Mon Sep 17 00:00:00 2001 From: yanghaoran Date: Fri, 23 Oct 2020 14:53:04 +0800 Subject: [PATCH 2/2] run dynamic shape in existing context --- .../ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc | 6 ++++++ .../ccsrc/runtime/device/ascend/ascend_kernel_runtime.h | 1 + .../runtime/device/ascend/executor/hccl_dynamic_kernel.cc | 6 +----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc index b2746c99f8..004062525a 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.cc @@ -316,6 +316,7 @@ bool AscendKernelRuntime::Load(session::KernelGraph *graph, bool is_task_sink) { if (!is_task_sink) { return true; } + rtCtxSetCurrent(rt_context_hccl_); // Do HcomExecutorInitialize if (graph->is_dynamic_shape() && !HcclExecutorManager::GetInstance().Initialize()) { MS_LOG(ERROR) << "Init Hccl Executor Failed"; @@ -651,6 +652,11 @@ bool AscendKernelRuntime::InitDevice() { } } + ret = rtCtxGetCurrent(&rt_context_hccl_); + if (ret != RT_ERROR_NONE || rt_context_hccl_ == nullptr) { + MS_LOG(ERROR) << "Call rtCtxGetCurrent failed, ret[" << ret << "]"; + } + ret = rtCtxCreate(&rt_context_, 0, device_id_); if (ret != RT_ERROR_NONE) { MS_EXCEPTION(DeviceProcessError) << "Call rtCtxCreate, ret[" << static_cast(ret) << "]"; diff --git a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.h b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.h index cd1e0da263..c91990eb62 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.h +++ b/mindspore/ccsrc/runtime/device/ascend/ascend_kernel_runtime.h @@ -76,6 +76,7 @@ class AscendKernelRuntime : public KernelRuntime { void LaunchDataDump(GraphId graph_id); rtContext_t rt_context_{nullptr}; + rtContext_t rt_context_hccl_{nullptr}; bool initialized_{false}; unordered_map>> task_map_; unordered_map> graph_model_map_; diff --git a/mindspore/ccsrc/runtime/device/ascend/executor/hccl_dynamic_kernel.cc b/mindspore/ccsrc/runtime/device/ascend/executor/hccl_dynamic_kernel.cc index 9de582d38e..597fc583f1 100644 --- a/mindspore/ccsrc/runtime/device/ascend/executor/hccl_dynamic_kernel.cc +++ b/mindspore/ccsrc/runtime/device/ascend/executor/hccl_dynamic_kernel.cc @@ -87,11 +87,7 @@ void HcclDynamicKernel::StaticShapeExecute() { void HcclDynamicKernel::Execute() { MS_LOG(INFO) << "Start Execute"; - if (!is_dynamic_shape_) { - MS_LOG(INFO) << "Not Dynamic, call hcom api"; - StaticShapeExecute(); - return; - } + auto handle = HcclExecutorManager::GetInstance().handle(); auto EnqueueHcomOperation = (HcclResult(*)(ge::HcomOpertion, std::function))dlsym(handle, "EnqueueHcomOpertion");