mirror of
https://github.com/ml-explore/mlx.git
synced 2025-07-23 01:51:18 +08:00
Stop the fence in the destructor
This commit is contained in:
parent
3835a428c5
commit
90801467d8
@ -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) {
|
||||
gpu_count_++;
|
||||
auto& d = metal::device(stream_.device);
|
||||
|
@ -21,6 +21,7 @@ namespace mlx::core {
|
||||
class Fence {
|
||||
public:
|
||||
Fence(const Stream& stream);
|
||||
~Fence();
|
||||
|
||||
void update_gpu(const array& x);
|
||||
void wait_gpu(array& x);
|
||||
|
Loading…
Reference in New Issue
Block a user