[CUDA] synch properly waits for all tasks to finish and clear (#2303)

* cuda synch properly waits for all tasks to finish and clear

* fix copy
This commit is contained in:
Awni Hannun
2025-06-17 12:03:25 -07:00
committed by GitHub
parent b8022c578a
commit cad5c0241c
7 changed files with 27 additions and 8 deletions

View File

@@ -80,7 +80,9 @@ void Worker::thread_fn() {
}
worker_tasks_.erase(worker_tasks_.begin(), end);
}
for (auto& task : tasks) {
// Make sure tasks are cleared before the next wait
for (int i = 0; i < tasks.size(); ++i) {
auto task = std::move(tasks[i]);
task();
}
worker_event_.wait(batch + 1);