mirror of
				https://github.com/ml-explore/mlx.git
				synced 2025-11-01 00:28:11 +08:00 
			
		
		
		
	Stop the fence in the destructor
This commit is contained in:
		| @@ -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); | ||||||
|   | |||||||
| @@ -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); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Angelos Katharopoulos
					Angelos Katharopoulos