Merged
feat: 保证同一捕获模型跨流执行有序 #4479
nevermoreAdd on Aug 25
feat: 保证同一捕获模型跨流执行有序 #4479
Merged
Total: 10 files changed+167-2
| @@ -38,4 +38,4 @@ TaskInfo* AllocNonCaptureTask( | |||
| 38 | 38 | ||
| 39 | } // namespace runtime | 39 | } // namespace runtime |
| 40 | } // namespace cce | 40 | } // namespace cce |
| 41 | -#endif | 41 | +#endif |
| @@ -92,6 +92,7 @@ public: | |||
| 92 | rtError_t Execute(Stream* const stm, int32_t timeout = -1) override; | 92 | rtError_t Execute(Stream* const stm, int32_t timeout = -1) override; |
| 93 | rtError_t ExecuteAsync(Stream* const stm) override; | 93 | rtError_t ExecuteAsync(Stream* const stm) override; |
| 94 | rtError_t TearDown() override; | 94 | rtError_t TearDown() override; |
| 95 | + rtError_t InitExecutionOrderEvent(); | ||
| 95 | rtError_t AddStreamToCaptureModel(Stream* const stm); | 96 | rtError_t AddStreamToCaptureModel(Stream* const stm); |
| 96 | rtError_t SetNotifyBeforeExecute(Stream* const exeStm, CaptureModel* const captureMdl); | 97 | rtError_t SetNotifyBeforeExecute(Stream* const exeStm, CaptureModel* const captureMdl); |
| 97 | rtError_t SetNotifyAfterExecute(Stream* const exeStm, CaptureModel* const captureMdl); | 98 | rtError_t SetNotifyAfterExecute(Stream* const exeStm, CaptureModel* const captureMdl); |
| @@ -339,6 +340,7 @@ private: | |||
| 339 | Stream* const stm, int32_t timeout, const uint8_t executeMode, ExternalEventRefreshInfo* refreshInfo); | 340 | Stream* const stm, int32_t timeout, const uint8_t executeMode, ExternalEventRefreshInfo* refreshInfo); |
| 340 | rtError_t PostModelExecute(Stream* const stm, ExternalEventRefreshInfo* refreshInfo); | 341 | rtError_t PostModelExecute(Stream* const stm, ExternalEventRefreshInfo* refreshInfo); |
| 341 | rtError_t ExecuteCommon(Stream* const stm, int32_t timeout, const uint8_t executeMode); | 342 | rtError_t ExecuteCommon(Stream* const stm, int32_t timeout, const uint8_t executeMode); |
| 343 | + rtError_t AddPreviousExecutionDependency(Stream* const stm) const; | ||
| 342 | rtError_t BindSqCqAndSendSqe(void); | 344 | rtError_t BindSqCqAndSendSqe(void); |
| 343 | rtError_t RebuildAllExternalTaskSqes() const; | 345 | rtError_t RebuildAllExternalTaskSqes() const; |
| 344 | // capture end阶段创建external refresh表并替换record/wait占位任务。 | 346 | // capture end阶段创建external refresh表并替换record/wait占位任务。 |
| @@ -382,6 +384,8 @@ private: | |||
| 382 | std::vector<Notify*> addStreamNotifyList_; | 384 | std::vector<Notify*> addStreamNotifyList_; |
| 383 | std::vector<Notify*> executeNotifyList_; | 385 | std::vector<Notify*> executeNotifyList_; |
| 384 | std::mutex notifyMutex_; | 386 | std::mutex notifyMutex_; |
| 387 | + std::mutex executionOrderMutex_; | ||
| 388 | + Event* executionOrderEvent_{nullptr}; | ||
| 385 | std::mutex taskGroupListMutex_; | 389 | std::mutex taskGroupListMutex_; |
| 386 | std::set<uint16_t> taskGroupStmIds_; | 390 | std::set<uint16_t> taskGroupStmIds_; |
| 387 | std::vector<std::unique_ptr<TaskGroup>> taskGroupList_; | 391 | std::vector<std::unique_ptr<TaskGroup>> taskGroupList_; |
| @@ -15,6 +15,8 @@ | |||
| 15 | #include "task_info_v100.h" | 15 | #include "task_info_v100.h" |
| 16 | #include "maintenance_task.h" | 16 | #include "maintenance_task.h" |
| 17 | #include "aclgraph_cond_task.h" | 17 | #include "aclgraph_cond_task.h" |
| 18 | +#include "event.hpp" | ||
| 19 | +#include "event_c.hpp" | ||
| 18 | 20 | ||
| 19 | namespace cce { | 21 | namespace cce { |
| 20 | namespace runtime { | 22 | namespace runtime { |
| @@ -99,6 +101,10 @@ rtError_t EndGraphNtyWait(Notify* const inNotify, Stream* const streamIn, const | |||
| 99 | return inNotify->EndGraphWait(streamIn, timeOut); | 101 | return inNotify->EndGraphWait(streamIn, timeOut); |
| 100 | } | 102 | } |
| 101 | 103 | ||
| 104 | +rtError_t EvtRecord(Event* const evt, Stream* const stm) { return evt->Record(stm); } | ||
| 105 | + | ||
| 106 | +rtError_t EvtWait(Event* const evt, Stream* const stm, const uint32_t timeout) { return evt->Wait(stm, timeout); } | ||
| 107 | + | ||
| 102 | rtError_t ModelSerialSchedPostProc(Stream* const stm, Notify* const notify, Model* const model) | 108 | rtError_t ModelSerialSchedPostProc(Stream* const stm, Notify* const notify, Model* const model) |
| 103 | { | 109 | { |
| 104 | UNUSED(stm); | 110 | UNUSED(stm); |
| @@ -41,6 +41,7 @@ | |||
| 41 | #include "model_maintaince_task.h" | 41 | #include "model_maintaince_task.h" |
| 42 | #include "memcpy_c.hpp" | 42 | #include "memcpy_c.hpp" |
| 43 | #include "notify_c.hpp" | 43 | #include "notify_c.hpp" |
| 44 | +#include "event_c.hpp" | ||
| 44 | #include <securec.h> | 45 | #include <securec.h> |
| 45 | #include <algorithm> | 46 | #include <algorithm> |
| 46 | #include "task.hpp" | 47 | #include "task.hpp" |
| @@ -101,6 +102,10 @@ CaptureModel::~CaptureModel() noexcept | |||
| 101 | } | 102 | } |
| 102 | ReleaseExternalRefreshTable(); | 103 | ReleaseExternalRefreshTable(); |
| 103 | 104 | ||
| 105 | + if (executionOrderEvent_ != nullptr) { | ||
| 106 | + TryToFreeEventIdAndDestroyEvent(&executionOrderEvent_, executionOrderEvent_->EventId_(), true); | ||
参考110行释放,isCaptureDestroy应该传true。 ![]() ![]() | |||
| 107 | + } | ||
| 108 | + | ||
| 104 | // 清空capturestream和单算子流关系 | 109 | // 清空capturestream和单算子流关系 |
| 105 | singleOperStmIdAndCaptureStmIdMap_.clear(); | 110 | singleOperStmIdAndCaptureStmIdMap_.clear(); |
| 106 | 111 | ||
| @@ -462,7 +467,13 @@ rtError_t CaptureModel::CheckExecuteReady(void) const | |||
| 462 | 467 | ||
| 463 | rtError_t CaptureModel::PreModelExecute(Stream* const stm, ExternalEventRefreshInfo* refreshInfo) | 468 | rtError_t CaptureModel::PreModelExecute(Stream* const stm, ExternalEventRefreshInfo* refreshInfo) |
| 464 | { | 469 | { |
| 465 | - rtError_t error = SetNotifyBeforeExecute(stm, this); | 470 | + rtError_t error = AddPreviousExecutionDependency(stm); |
| 471 | + COND_RETURN_ERROR_MSG_INNER( | ||
| 472 | + error != RT_ERROR_NONE, error, | ||
| 473 | + "Failed to wait for previous model execution, stream_id=%d, model_id=%u, retCode=%#x.", stm->Id_(), Id_(), | ||
| 474 | + static_cast<uint32_t>(error)); | ||
| 475 | + | ||
| 476 | + error = SetNotifyBeforeExecute(stm, this); | ||
| 466 | COND_RETURN_ERROR_MSG_INNER( | 477 | COND_RETURN_ERROR_MSG_INNER( |
| 467 | error != RT_ERROR_NONE, error, | 478 | error != RT_ERROR_NONE, error, |
| 468 | "Set notify before model execute failed, stream_id=%d, model_id=%u, retCode=%#x.", stm->Id_(), Id_(), | 479 | "Set notify before model execute failed, stream_id=%d, model_id=%u, retCode=%#x.", stm->Id_(), Id_(), |
| @@ -522,12 +533,19 @@ rtError_t CaptureModel::PostModelExecute(Stream* const stm, ExternalEventRefresh | |||
| 522 | COND_RETURN_ERROR( | 533 | COND_RETURN_ERROR( |
| 523 | error != RT_ERROR_NONE, error, "Set notify after model execute failed, stream_id=%d, model_id=%u, retCode=%#x.", | 534 | error != RT_ERROR_NONE, error, "Set notify after model execute failed, stream_id=%d, model_id=%u, retCode=%#x.", |
| 524 | stm->Id_(), Id_(), static_cast<uint32_t>(error)); | 535 | stm->Id_(), Id_(), static_cast<uint32_t>(error)); |
| 536 | + | ||
| 537 | + error = EvtRecord(executionOrderEvent_, stm); | ||
| 538 | + COND_RETURN_ERROR_MSG_INNER( | ||
| 539 | + error != RT_ERROR_NONE, error, | ||
| 540 | + "Failed to record model execution order event, stream_id=%d, model_id=%u, retCode=%#x.", stm->Id_(), Id_(), | ||
| 541 | + static_cast<uint32_t>(error)); | ||
| 525 | return RT_ERROR_NONE; | 542 | return RT_ERROR_NONE; |
| 526 | } | 543 | } |
| 527 | 544 | ||
| 528 | rtError_t CaptureModel::ExecuteCommon(Stream* const stm, int32_t timeout, const uint8_t executeMode) | 545 | rtError_t CaptureModel::ExecuteCommon(Stream* const stm, int32_t timeout, const uint8_t executeMode) |
| 529 | { | 546 | { |
| 530 | RT_LOG(RT_LOG_INFO, "capture model execute, model_id=%u!", Id_()); | 547 | RT_LOG(RT_LOG_INFO, "capture model execute, model_id=%u!", Id_()); |
| 548 | + const std::lock_guard<std::mutex> executeLock(executionOrderMutex_); | ||
| 531 | rtError_t error = CheckExecuteReady(); | 549 | rtError_t error = CheckExecuteReady(); |
| 532 | if (error != RT_ERROR_NONE) { | 550 | if (error != RT_ERROR_NONE) { |
| 533 | return error; | 551 | return error; |
| @@ -544,6 +562,16 @@ rtError_t CaptureModel::ExecuteCommon(Stream* const stm, int32_t timeout, const | |||
| 544 | } | 562 | } |
| 545 | return PostModelExecute(stm, &refreshInfo); | 563 | return PostModelExecute(stm, &refreshInfo); |
| 546 | } | 564 | } |
| 565 | + | ||
| 566 | +rtError_t CaptureModel::AddPreviousExecutionDependency(Stream* const stm) const | ||
资源占用太多了,建议优化下,多数情况下,都是1条执行流,可以考虑2个优化方向 1、切换执行流的再申请 2、模型执行完及时释放 ![]() ![]() | |||
| 567 | +{ | ||
| 568 | + const Stream* const previousStream = GetExeStream(); | ||
| 569 | + if ((previousStream == nullptr) || (previousStream == stm)) { | ||
| 570 | + return RT_ERROR_NONE; | ||
| 571 | + } | ||
| 572 | + | ||
| 573 | + return EvtWait(executionOrderEvent_, stm, MAX_UINT32_NUM); | ||
| 574 | +} | ||
| 547 | rtError_t CaptureModel::Execute(Stream* const stm, int32_t timeout) | 575 | rtError_t CaptureModel::Execute(Stream* const stm, int32_t timeout) |
| 548 | { | 576 | { |
| 549 | Context* const context = Context_(); | 577 | Context* const context = Context_(); |
| @@ -35,6 +35,8 @@ rtError_t CaptureModel::LoadCompleteByStreamPostp(Stream* const stream) | |||
| 35 | 35 | ||
| 36 | rtError_t CaptureModel::LoadCompleteByStream() { return RT_ERROR_FEATURE_NOT_SUPPORT; } | 36 | rtError_t CaptureModel::LoadCompleteByStream() { return RT_ERROR_FEATURE_NOT_SUPPORT; } |
| 37 | 37 | ||
| 38 | +rtError_t CaptureModel::InitExecutionOrderEvent() { return RT_ERROR_NONE; } | ||
| 39 | + | ||
| 38 | rtError_t CaptureModel::Execute(Stream* const stm, int32_t timeout) | 40 | rtError_t CaptureModel::Execute(Stream* const stm, int32_t timeout) |
| 39 | { | 41 | { |
| 40 | UNUSED(stm); | 42 | UNUSED(stm); |
| @@ -123,5 +123,18 @@ TaskInfo* AllocNonCaptureTask( | |||
| 123 | return pTask; | 123 | return pTask; |
| 124 | } | 124 | } |
| 125 | } | 125 | } |
| 126 | + | ||
| 127 | +rtError_t CaptureModel::InitExecutionOrderEvent() | ||
| 128 | +{ | ||
| 129 | + Context* const ctx = Context_(); | ||
| 130 | + Device* const dev = ctx->Device_(); | ||
| 131 | + executionOrderEvent_ = new (std::nothrow) Event(dev, RT_EVENT_DEFAULT, ctx, false, true); | ||
| 132 | + COND_RETURN_AND_MSG_OUTER( | ||
| 133 | + executionOrderEvent_ == nullptr, RT_ERROR_EVENT_NEW, ErrorCode::EE1013, sizeof(Event), "new"); | ||
| 134 | + executionOrderEvent_->SetEventOwner(EventOwner::EVENT_INNER); | ||
| 135 | + dev->PushEvent(executionOrderEvent_); | ||
| 136 | + return RT_ERROR_NONE; | ||
| 137 | +} | ||
| 138 | + | ||
| 126 | } // namespace runtime | 139 | } // namespace runtime |
| 127 | } // namespace cce | 140 | } // namespace cce |
| @@ -11,7 +11,9 @@ | |||
| 11 | #include "capture_adapt.hpp" | 11 | #include "capture_adapt.hpp" |
| 12 | #include "task_recycle.hpp" | 12 | #include "task_recycle.hpp" |
| 13 | #include "capture_model.hpp" | 13 | #include "capture_model.hpp" |
| 14 | +#include "context.hpp" | ||
| 14 | #include "event_c.hpp" | 15 | #include "event_c.hpp" |
| 16 | +#include "event_david.hpp" | ||
| 15 | #include "stream_c.hpp" | 17 | #include "stream_c.hpp" |
| 16 | #include "thread_local_container.hpp" | 18 | #include "thread_local_container.hpp" |
| 17 | #include "stream_sqcq_manage.hpp" | 19 | #include "stream_sqcq_manage.hpp" |
| @@ -107,5 +109,19 @@ bool TaskTypeIsSupportTaskGroup(const TaskInfo* const task) | |||
| 107 | } | 109 | } |
| 108 | return false; | 110 | return false; |
| 109 | } | 111 | } |
| 112 | + | ||
| 113 | +rtError_t CaptureModel::InitExecutionOrderEvent() | ||
| 114 | +{ | ||
| 115 | + Context* const ctx = Context_(); | ||
| 116 | + Device* const dev = ctx->Device_(); | ||
| 117 | + executionOrderEvent_ = new (std::nothrow) DavidEvent(dev, RT_EVENT_DEFAULT, ctx, true); | ||
| 118 | + COND_RETURN_AND_MSG_OUTER( | ||
| 119 | + executionOrderEvent_ == nullptr, RT_ERROR_EVENT_NEW, ErrorCode::EE1013, std::to_string(sizeof(DavidEvent)), | ||
| 120 | + "new"); | ||
| 121 | + executionOrderEvent_->SetEventOwner(EventOwner::EVENT_INNER); | ||
| 122 | + dev->PushEvent(executionOrderEvent_); | ||
| 123 | + return RT_ERROR_NONE; | ||
| 124 | +} | ||
| 125 | + | ||
| 110 | } // namespace runtime | 126 | } // namespace runtime |
| 111 | } // namespace cce | 127 | } // namespace cce |
| @@ -198,6 +198,9 @@ rtError_t Model::Setup(Context* const contextIn) | |||
| 198 | } | 198 | } |
| 199 | } | 199 | } |
| 200 | InitEmbeddedInnerHandle<Model>(this); | 200 | InitEmbeddedInnerHandle<Model>(this); |
| 201 | + if (modelType_ == RT_MODEL_CAPTURE_MODEL) { | ||
| 202 | + return static_cast<CaptureModel*>(this)->InitExecutionOrderEvent(); | ||
| 203 | + } | ||
| 201 | return error; | 204 | return error; |
| 202 | } | 205 | } |
| 203 | 206 | ||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include "runtime.hpp" | 17 | #include "runtime.hpp" |
| 18 | #include "model.hpp" | 18 | #include "model.hpp" |
| 19 | #include "capture_model.hpp" | 19 | #include "capture_model.hpp" |
| 20 | +#include "capture_adapt.hpp" | ||
| 20 | #include "cond_handle/cond_handle.hpp" | 21 | #include "cond_handle/cond_handle.hpp" |
| 21 | #include "rt_unwrap.h" | 22 | #include "rt_unwrap.h" |
| 22 | #include "rt_capture_model_mock_helper.hpp" | 23 | #include "rt_capture_model_mock_helper.hpp" |
| @@ -24,7 +25,9 @@ | |||
| 24 | #include "module.hpp" | 25 | #include "module.hpp" |
| 25 | #include "notify.hpp" | 26 | #include "notify.hpp" |
| 26 | #include "event.hpp" | 27 | #include "event.hpp" |
| 28 | +#include "event_c.hpp" | ||
| 27 | #include "task_info.hpp" | 29 | #include "task_info.hpp" |
| 30 | +#include "event_task.h" | ||
| 28 | #include "memory_task.h" | 31 | #include "memory_task.h" |
| 29 | #include "ffts_task.h" | 32 | #include "ffts_task.h" |
| 30 | #include "device/device_error_proc.hpp" | 33 | #include "device/device_error_proc.hpp" |
| @@ -132,6 +135,54 @@ TEST_F(CloudV2CaptureModelTest, CheckCaptureModelForUpdateRefreshesSupportResult | |||
| 132 | EXPECT_EQ(rtStreamDestroy(stream), RT_ERROR_NONE); | 135 | EXPECT_EQ(rtStreamDestroy(stream), RT_ERROR_NONE); |
| 133 | } | 136 | } |
| 134 | 137 | ||
| 138 | +TEST_F(CloudV2CaptureModelTest, CaptureModelPreviousExecutionDependency) | ||
| 139 | +{ | ||
| 140 | + rtStream_t streamHandle = nullptr; | ||
| 141 | + ASSERT_EQ(rtStreamCreate(&streamHandle, 0), RT_ERROR_NONE); | ||
| 142 | + Stream* const stream = rt_ut::UnwrapOrNull<Stream>(streamHandle); | ||
| 143 | + ASSERT_NE(stream, nullptr); | ||
| 144 | + | ||
| 145 | + Event event; | ||
| 146 | + CaptureModel captureModel; | ||
| 147 | + captureModel.context_ = stream->Context_(); | ||
| 148 | + captureModel.executionOrderEvent_ = &event; | ||
| 149 | + | ||
| 150 | + MOCKER(EvtWait).expects(once()).with(&event, stream, MAX_UINT32_NUM).will(returnValue(RT_ERROR_INVALID_VALUE)); | ||
| 151 | + | ||
| 152 | + captureModel.SetExeStream(nullptr); | ||
| 153 | + EXPECT_EQ(captureModel.AddPreviousExecutionDependency(stream), RT_ERROR_NONE); | ||
| 154 | + captureModel.SetExeStream(stream); | ||
| 155 | + EXPECT_EQ(captureModel.AddPreviousExecutionDependency(stream), RT_ERROR_NONE); | ||
| 156 | + | ||
| 157 | + Stream previousStream(stream->Device_(), 0U); | ||
| 158 | + captureModel.SetExeStream(&previousStream); | ||
| 159 | + EXPECT_EQ(captureModel.AddPreviousExecutionDependency(stream), RT_ERROR_INVALID_VALUE); | ||
| 160 | + EXPECT_EQ(captureModel.GetExeStream(), &previousStream); | ||
| 161 | + | ||
| 162 | + captureModel.executionOrderEvent_ = nullptr; | ||
| 163 | + captureModel.SetExeStream(nullptr); | ||
| 164 | + EXPECT_EQ(rtStreamDestroy(streamHandle), RT_ERROR_NONE); | ||
| 165 | +} | ||
| 166 | + | ||
| 167 | +TEST_F(CloudV2CaptureModelTest, CaptureModelExecutionOrderEventUsesV100Event) | ||
| 168 | +{ | ||
| 169 | + Context* const context = Runtime::Instance()->CurrentContext(); | ||
| 170 | + ASSERT_NE(context, nullptr); | ||
| 171 | + Device* const device = context->Device_(); | ||
| 172 | + ASSERT_NE(device, nullptr); | ||
| 173 | + | ||
| 174 | + CaptureModel captureModel; | ||
| 175 | + Model* const model = &captureModel; | ||
| 176 | + ASSERT_EQ(model->Setup(context), RT_ERROR_NONE); | ||
| 177 | + Event*& event = captureModel.executionOrderEvent_; | ||
| 178 | + ASSERT_NE(event, nullptr); | ||
| 179 | + EXPECT_EQ(event->EventOwner_(), EventOwner::EVENT_INNER); | ||
| 180 | + EXPECT_TRUE(event->isNewMode_); | ||
| 181 | + | ||
| 182 | + TryToFreeEventIdAndDestroyEvent(&event, event->EventId_(), true); | ||
| 183 | + EXPECT_EQ(event, nullptr); | ||
| 184 | +} | ||
| 185 | + | ||
| 135 | TEST_F(CloudV2CaptureModelTest, SUBMIT_RDMA_PI_VALUE_MODIFY_TASK) | 186 | TEST_F(CloudV2CaptureModelTest, SUBMIT_RDMA_PI_VALUE_MODIFY_TASK) |
| 136 | { | 187 | { |
| 137 | Runtime* rtInstance = (Runtime*)Runtime::Instance(); | 188 | Runtime* rtInstance = (Runtime*)Runtime::Instance(); |
| @@ -39,6 +39,7 @@ | |||
| 39 | #include "event_david.hpp" | 39 | #include "event_david.hpp" |
| 40 | #include "raw_device.hpp" | 40 | #include "raw_device.hpp" |
| 41 | #include "task_info.hpp" | 41 | #include "task_info.hpp" |
| 42 | +#include "event_task.h" | ||
| 42 | #include "context.hpp" | 43 | #include "context.hpp" |
| 43 | #include "stream_david.hpp" | 44 | #include "stream_david.hpp" |
| 44 | #include "stars_david.hpp" | 45 | #include "stars_david.hpp" |
| @@ -299,6 +300,47 @@ TEST_F(TaskTestDavid, TestDavidModelMaintainceTaskInit) | |||
| 299 | EXPECT_EQ(error, RT_ERROR_NONE); | 300 | EXPECT_EQ(error, RT_ERROR_NONE); |
| 300 | } | 301 | } |
| 301 | 302 | ||
| 303 | +TEST_F(TaskTestDavid, CaptureModelPreviousExecutionDependency) | ||
| 304 | +{ | ||
| 305 | + Event event; | ||
| 306 | + CaptureModel captureModel; | ||
| 307 | + captureModel.context_ = stream_->Context_(); | ||
| 308 | + captureModel.executionOrderEvent_ = &event; | ||
| 309 | + | ||
| 310 | + MOCKER(EvtWait).expects(once()).with(&event, stream_, MAX_UINT32_NUM).will(returnValue(RT_ERROR_INVALID_VALUE)); | ||
| 311 | + | ||
| 312 | + captureModel.SetExeStream(nullptr); | ||
| 313 | + EXPECT_EQ(captureModel.AddPreviousExecutionDependency(stream_), RT_ERROR_NONE); | ||
| 314 | + captureModel.SetExeStream(stream_); | ||
| 315 | + EXPECT_EQ(captureModel.AddPreviousExecutionDependency(stream_), RT_ERROR_NONE); | ||
| 316 | + | ||
| 317 | + Stream previousStream(stream_->Device_(), 0U); | ||
| 318 | + captureModel.SetExeStream(&previousStream); | ||
| 319 | + EXPECT_EQ(captureModel.AddPreviousExecutionDependency(stream_), RT_ERROR_INVALID_VALUE); | ||
| 320 | + EXPECT_EQ(captureModel.GetExeStream(), &previousStream); | ||
| 321 | + | ||
| 322 | + captureModel.executionOrderEvent_ = nullptr; | ||
| 323 | + captureModel.SetExeStream(nullptr); | ||
| 324 | +} | ||
| 325 | + | ||
| 326 | +TEST_F(TaskTestDavid, CaptureModelExecutionOrderEventUsesDavidCountNotify) | ||
| 327 | +{ | ||
| 328 | + Context* const context = Runtime::Instance()->CurrentContext(); | ||
| 329 | + ASSERT_NE(context, nullptr); | ||
| 330 | + | ||
| 331 | + CaptureModel captureModel; | ||
| 332 | + Model* const model = &captureModel; | ||
| 333 | + ASSERT_EQ(model->Setup(context), RT_ERROR_NONE); | ||
| 334 | + Event*& event = captureModel.executionOrderEvent_; | ||
| 335 | + const DavidEvent* const davidEvent = dynamic_cast<const DavidEvent*>(event); | ||
| 336 | + ASSERT_NE(davidEvent, nullptr); | ||
| 337 | + EXPECT_EQ(davidEvent->EventOwner_(), EventOwner::EVENT_INNER); | ||
| 338 | + EXPECT_TRUE(davidEvent->IsCntNotify()); | ||
| 339 | + | ||
| 340 | + TryToFreeEventIdAndDestroyEvent(&event, event->EventId_(), true); | ||
| 341 | + EXPECT_EQ(event, nullptr); | ||
| 342 | +} | ||
| 343 | + | ||
| 302 | TEST_F(TaskTestDavid, AicAivBiuPerfStreamSupportKeepsBindLimit) | 344 | TEST_F(TaskTestDavid, AicAivBiuPerfStreamSupportKeepsBindLimit) |
| 303 | { | 345 | { |
| 304 | stream_->SetBindFlag(false); | 346 | stream_->SetBindFlag(false); |


每次在model exec下发结束都会刷新exeStream_模型的执行流,模型执行报错场景可能找到的是错误的执行流