diff --git a/mlx/scheduler.cpp b/mlx/scheduler.cpp index 9e9e4ac1b3..d1e559c9cf 100644 --- a/mlx/scheduler.cpp +++ b/mlx/scheduler.cpp @@ -26,6 +26,10 @@ Stream new_stream(Device d, int threads /* = 1 */) { throw std::invalid_argument( "[new_stream] Cannot make gpu stream without gpu backend."); } + if (d == Device::gpu && threads > 1) { + throw std::invalid_argument( + "[new_stream] Cannot make multi-threaded gpu stream."); + } return scheduler::scheduler().new_stream(d, threads); }