!33439 reset event after create

Merge pull request !33439 from zhoufeng/reset-event-1.6
This commit is contained in:
i-robot 2022-06-07 11:31:14 +00:00 committed by Gitee
commit 82c19cbaf9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 8 additions and 4 deletions

View File

@ -93,15 +93,19 @@ void RuntimeModel::InitStream(const std::shared_ptr<DavinciModel> &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<DavinciModel> &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";

View File

@ -47,7 +47,7 @@ class RuntimeModel {
void InitResource(const std::shared_ptr<DavinciModel> &davinci_model);
void GenerateTask(uint32_t device_id, uint64_t session_id, const std::shared_ptr<DavinciModel> &davinci_model);
void InitStream(const std::shared_ptr<DavinciModel> &davinci_model);
void InitEvent(uint32_t event_num);
void InitEvent(uint32_t event_num, rtStream_t model_stream);
void InitLabel(const std::shared_ptr<DavinciModel> &davinci_model);
void RtModelUnbindStream() noexcept;
void RtStreamDestory() noexcept;