Skip to content

Commit 06cfaf3

Browse files
committed
[perf] optimize dynamic engine fat path
1 parent f2cab84 commit 06cfaf3

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/GraphCtrl/GraphElement/_GEngine/GDynamicEngine/GDynamicEngine.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CStatus GDynamicEngine::setup(const GSortedGElementPtrSet& elements) {
1818
* 3. 计算element的结构类型
1919
* 4. 分析当前dag类型信息
2020
*/
21+
CGRAPH_ASSERT_NOT_NULL(thread_pool_);
2122
CGRAPH_RETURN_ERROR_STATUS_BY_CONDITION(!GEngine::isDag(elements),
2223
"it is not a dag struct");
2324
mark(elements);
@@ -67,6 +68,7 @@ CVoid GDynamicEngine::mark(const GSortedGElementPtrSet& elements) {
6768
total_element_arr_.clear();
6869
front_element_arr_.clear();
6970
total_end_size_ = 0;
71+
wait_busy_epoch_ = thread_pool_->getConfig().pipeline_wait_busy_epoch_;
7072

7173
for (GElementPtr element : elements) {
7274
if (element->run_before_.empty()) {
@@ -316,7 +318,7 @@ CVoid GDynamicEngine::prepareRun() {
316318

317319
template<typename Pred>
318320
CBool GDynamicEngine::isFastFinished(Pred&& check) {
319-
auto epoch = thread_pool_->getConfig().pipeline_wait_busy_epoch_;
321+
auto epoch = wait_busy_epoch_;
320322
while (epoch-- > 0 && !check()) {
321323
CGRAPH_YIELD();
322324
}

‎src/GraphCtrl/GraphElement/_GEngine/GDynamicEngine/GDynamicEngine.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class GDynamicEngine : public GEngine {
126126
std::atomic<CSize> parallel_run_num_ {0}; // 纯并行时,执行的个数信息
127127
GElementPtrMat2D parallel_element_matrix_ {}; // 纯并行时,记录分解后的数据
128128
internal::GEngineDagType dag_type_ = { internal::GEngineDagType::COMMON }; // 当前元素的排布形式
129+
CInt wait_busy_epoch_ {0}; // dag执行结束前,轮询等待的次数
129130

130131
UCvMutex locker_;
131132
std::mutex status_lock_;

0 commit comments

Comments
 (0)