Skip to content

Commit 509c62b

Browse files
committed
3
1 parent 2fef03d commit 509c62b

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

src/a2a3/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,17 +836,16 @@ struct AicpuExecutor {
836836
if (block_num == 0) return;
837837

838838
uint32_t all_acked = (1u << active_sched_threads_) - 1;
839-
uint32_t my_ack = (1u << thread_idx);
840839

841840
// Ack barrier — signal this thread has stopped dispatch.
842-
drain_state_.drain_ack_mask.fetch_or(my_ack, std::memory_order_release);
841+
drain_state_.drain_ack_mask.fetch_or(1u << thread_idx, std::memory_order_release);
843842

844843
// Spin until all threads have acked.
845844
// If our bit is cleared while waiting, elected reset due to insufficient resources.
846845
while (true) {
847846
uint32_t ack = drain_state_.drain_ack_mask.load(std::memory_order_acquire);
848847
if ((ack & all_acked) == all_acked) break;
849-
if ((ack & my_ack) == 0) return;
848+
if ((ack & (1u << thread_idx)) == 0) return;
850849
SPIN_WAIT_HINT();
851850
}
852851

src/a5/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,17 +824,16 @@ struct AicpuExecutor {
824824
if (block_num == 0) return;
825825

826826
uint32_t all_acked = (1u << active_sched_threads_) - 1;
827-
uint32_t my_ack = (1u << thread_idx);
828827

829828
// Ack barrier — signal this thread has stopped dispatch.
830-
drain_state_.drain_ack_mask.fetch_or(my_ack, std::memory_order_release);
829+
drain_state_.drain_ack_mask.fetch_or(1u << thread_idx, std::memory_order_release);
831830

832831
// Spin until all threads have acked.
833832
// If our bit is cleared while waiting, elected reset due to insufficient resources.
834833
while (true) {
835834
uint32_t ack = drain_state_.drain_ack_mask.load(std::memory_order_acquire);
836835
if ((ack & all_acked) == all_acked) break;
837-
if ((ack & my_ack) == 0) return;
836+
if ((ack & (1u << thread_idx)) == 0) return;
838837
SPIN_WAIT_HINT();
839838
}
840839

0 commit comments

Comments
 (0)