chore(gpu): remove device synchronize in drop for cudavec

This commit is contained in:
Agnes Leroy
2025-10-20 11:35:14 +02:00
committed by Agnès Leroy
parent 42644349ef
commit b4b6275ca5
3 changed files with 13 additions and 11 deletions

View File

@@ -660,17 +660,17 @@ mod cuda_utils {
impl<T: Numeric> CudaIndexes<T> {
pub fn new(indexes: &[T], stream: &CudaStreams, stream_index: u32) -> Self {
let length = indexes.len();
let mut d_input = unsafe { CudaVec::<T>::new_async(length, stream, stream_index) };
let mut d_output = unsafe { CudaVec::<T>::new_async(length, stream, stream_index) };
let mut d_lut = unsafe { CudaVec::<T>::new_async(length, stream, stream_index) };
let mut d_input = CudaVec::<T>::new(length, stream, stream_index);
let mut d_output = CudaVec::<T>::new(length, stream, stream_index);
let mut d_lut = CudaVec::<T>::new(length, stream, stream_index);
let zeros = vec![T::ZERO; length];
unsafe {
d_input.copy_from_cpu_async(indexes.as_ref(), stream, stream_index);
d_output.copy_from_cpu_async(indexes.as_ref(), stream, stream_index);
d_lut.copy_from_cpu_async(zeros.as_ref(), stream, stream_index);
stream.synchronize();
}
stream.synchronize();
Self {
d_input,