|
9 | 9 | * ----------------------------------------------------------------------------------------------------------- |
10 | 10 | */ |
11 | 11 |
|
| 12 | +// NOLINTBEGIN |
12 | 13 | #include <atomic> |
13 | 14 | #include <cstdint> |
14 | 15 | #include <cstdio> |
15 | 16 | #include <mutex> |
16 | 17 |
|
17 | | -#include "aicpu/device_log.h" |
| 18 | +#include "aicpu/device_log.h" // NOLINT(clang-diagnostic-error) |
18 | 19 | #include "aicpu/device_time.h" |
19 | 20 | #include "aicpu/performance_collector_aicpu.h" |
20 | 21 | #include "aicpu/platform_regs.h" |
@@ -604,12 +605,14 @@ int AicpuExecutor::resolve_and_dispatch(Runtime &runtime, int thread_idx, const |
604 | 605 | uint64_t reg_addr = core_id_to_reg_addr_[core_id]; |
605 | 606 | Handshake *h = &hank[core_id]; |
606 | 607 |
|
607 | | - uint64_t reg_val = read_reg(reg_addr, RegId::COND); |
| 608 | + uint64_t reg_val = poll_reg(reg_addr, RegId::COND); |
608 | 609 | int reg_task_id = EXTRACT_TASK_ID(reg_val); |
609 | 610 | int reg_state = EXTRACT_TASK_STATE(reg_val); |
610 | 611 |
|
611 | 612 | // Case 1: Pending task finished directly |
612 | 613 | if (reg_task_id == pending_task_ids_[core_id] && reg_state == TASK_FIN_STATE) { |
| 614 | + poll_acquire_barrier(); |
| 615 | + |
613 | 616 | LOG_INFO( |
614 | 617 | "Thread %d: Core %d completed task %d (running_id=%d)", thread_idx, core_id, |
615 | 618 | pending_task_ids_[core_id], running_task_ids_[core_id] |
@@ -712,6 +715,8 @@ int AicpuExecutor::resolve_and_dispatch(Runtime &runtime, int thread_idx, const |
712 | 715 | } |
713 | 716 | } else if (reg_task_id == pending_task_ids_[core_id] && reg_state == TASK_ACK_STATE) { |
714 | 717 | // Case 2: Pending task received ACK |
| 718 | + poll_acquire_barrier(); |
| 719 | + |
715 | 720 | LOG_INFO( |
716 | 721 | "Thread %d: Core %d ACKed task %d (running_id=%d)", thread_idx, core_id, pending_task_ids_[core_id], |
717 | 722 | running_task_ids_[core_id] |
@@ -766,6 +771,8 @@ int AicpuExecutor::resolve_and_dispatch(Runtime &runtime, int thread_idx, const |
766 | 771 | // Continue to Case 4 to dispatch next task |
767 | 772 | } else if (reg_task_id == running_task_ids_[core_id] && reg_state == TASK_FIN_STATE) { |
768 | 773 | // Case 3: Running task finished |
| 774 | + poll_acquire_barrier(); |
| 775 | + |
769 | 776 | LOG_INFO( |
770 | 777 | "Thread %d: Core %d completed task %d (pending_id=%d)", thread_idx, core_id, |
771 | 778 | running_task_ids_[core_id], pending_task_ids_[core_id] |
@@ -1207,3 +1214,4 @@ extern "C" int aicpu_execute(Runtime *runtime) { |
1207 | 1214 | LOG_INFO("%s", "aicpu_execute: Kernel execution completed successfully"); |
1208 | 1215 | return 0; |
1209 | 1216 | } |
| 1217 | +// NOLINTEND |
0 commit comments