diff --git a/mindspore/ccsrc/runtime/device/ascend/ge_runtime/runtime_model.cc b/mindspore/ccsrc/runtime/device/ascend/ge_runtime/runtime_model.cc index af1e43cb420..9f8bddd5139 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ge_runtime/runtime_model.cc +++ b/mindspore/ccsrc/runtime/device/ascend/ge_runtime/runtime_model.cc @@ -93,15 +93,19 @@ void RuntimeModel::InitStream(const std::shared_ptr &davinci_model } } -void RuntimeModel::InitEvent(uint32_t event_num) { +void RuntimeModel::InitEvent(uint32_t event_num, rtStream_t model_stream) { MS_LOG(INFO) << "Event number: " << event_num; for (uint32_t i = 0; i < event_num; ++i) { rtEvent_t rt_event; - rtError_t rt_ret = rtEventCreate(&rt_event); + rtError_t rt_ret = rtEventCreateWithFlag(&rt_event, RT_EVENT_DDSYNC_NS); if (rt_ret != RT_ERROR_NONE) { MS_LOG(EXCEPTION) << "Call rt api rtEventCreate failed, ret: " << rt_ret; } event_list_.push_back(rt_event); + rt_ret = rtEventReset(rt_event, model_stream); + if (rt_ret != RT_ERROR_NONE) { + MS_LOG(EXCEPTION) << "Call rt api rtEventReset failed, ret: " << rt_ret; + } } } @@ -147,7 +151,7 @@ void RuntimeModel::InitResource(const std::shared_ptr &davinci_mod MS_LOG(INFO) << "rtStreamCreate end"; InitStream(davinci_model); - InitEvent(davinci_model->GetEventNum()); + InitEvent(davinci_model->GetEventNum(), rt_model_stream_); InitLabel(davinci_model); MS_LOG(INFO) << "InitResource success"; diff --git a/mindspore/ccsrc/runtime/device/ascend/ge_runtime/runtime_model.h b/mindspore/ccsrc/runtime/device/ascend/ge_runtime/runtime_model.h index af8c1ecfeae..749ff334907 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ge_runtime/runtime_model.h +++ b/mindspore/ccsrc/runtime/device/ascend/ge_runtime/runtime_model.h @@ -47,7 +47,7 @@ class RuntimeModel { void InitResource(const std::shared_ptr &davinci_model); void GenerateTask(uint32_t device_id, uint64_t session_id, const std::shared_ptr &davinci_model); void InitStream(const std::shared_ptr &davinci_model); - void InitEvent(uint32_t event_num); + void InitEvent(uint32_t event_num, rtStream_t model_stream); void InitLabel(const std::shared_ptr &davinci_model); void RtModelUnbindStream() noexcept; void RtStreamDestory() noexcept;