mirror of
https://github.com/ml-explore/mlx.git
synced 2025-11-06 12:09:43 +08:00
fix
This commit is contained in:
@@ -32,9 +32,10 @@ void Fence::update(Stream s, const array& a, bool cross_device) {
|
|||||||
void* new_data;
|
void* new_data;
|
||||||
CHECK_CUDA_ERROR(cudaMallocManaged(&new_data, cbuf.size));
|
CHECK_CUDA_ERROR(cudaMallocManaged(&new_data, cbuf.size));
|
||||||
cbuf.device = -1;
|
cbuf.device = -1;
|
||||||
|
auto& encoder = cu::device(s.device).get_command_encoder(s);
|
||||||
|
encoder.commit();
|
||||||
CHECK_CUDA_ERROR(
|
CHECK_CUDA_ERROR(
|
||||||
cudaMemcpyAsync(new_data, cbuf.data, cbuf.size, cudaMemcpyDefault));
|
cudaMemcpyAsync(new_data, cbuf.data, cbuf.size, cudaMemcpyDefault));
|
||||||
auto& encoder = cu::device(s.device).get_command_encoder(s);
|
|
||||||
CHECK_CUDA_ERROR(cudaFreeAsync(cbuf.data, encoder.stream()));
|
CHECK_CUDA_ERROR(cudaFreeAsync(cbuf.data, encoder.stream()));
|
||||||
cbuf.data = new_data;
|
cbuf.data = new_data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user