Stop the fence in the destructor

This commit is contained in:
Angelos Katharopoulos 2025-03-04 16:21:15 -08:00
parent 3835a428c5
commit 90801467d8
2 changed files with 7 additions and 0 deletions

View File

@ -34,6 +34,12 @@ Fence::Fence(const Stream& stream) : stream_(stream) {
} }
} }
Fence::~Fence() {
if (use_fast_) {
cpu_value()[0] = INT_MAX;
}
}
void Fence::wait_gpu(array& x) { void Fence::wait_gpu(array& x) {
gpu_count_++; gpu_count_++;
auto& d = metal::device(stream_.device); auto& d = metal::device(stream_.device);

View File

@ -21,6 +21,7 @@ namespace mlx::core {
class Fence { class Fence {
public: public:
Fence(const Stream& stream); Fence(const Stream& stream);
~Fence();
void update_gpu(const array& x); void update_gpu(const array& x);
void wait_gpu(array& x); void wait_gpu(array& x);