[CUDA] Make CudaEvent work with multi-device (#2614)

* Set current device when creating cuda event

* Separate cuda events by device

* Avoid race condition in pool
This commit is contained in:
Cheng
2025-09-27 11:27:17 +09:00
committed by GitHub
parent 7a6adda1e6
commit b466dea982
7 changed files with 73 additions and 26 deletions

View File

@@ -5,9 +5,9 @@
namespace mlx::core::cu {
Worker::Worker()
: signal_stream_(device(mlx::core::Device::gpu)),
signal_event_(cudaEventDisableTiming | cudaEventBlockingSync),
Worker::Worker(Device& d)
: signal_stream_(d),
signal_event_(d, cudaEventDisableTiming | cudaEventBlockingSync),
worker_(&Worker::thread_fn, this) {}
Worker::~Worker() {