From 1b5f52c8690bda4bc470008971e380bc108e5e46 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 11 Apr 2025 08:29:25 -0300 Subject: [PATCH] fix(gpu): fix a memory leak in ZK's expand --- backends/tfhe-cuda-backend/cuda/include/zk/zk_utilities.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backends/tfhe-cuda-backend/cuda/include/zk/zk_utilities.h b/backends/tfhe-cuda-backend/cuda/include/zk/zk_utilities.h index f10d9e0c6..222b70240 100644 --- a/backends/tfhe-cuda-backend/cuda/include/zk/zk_utilities.h +++ b/backends/tfhe-cuda-backend/cuda/include/zk/zk_utilities.h @@ -204,8 +204,8 @@ template struct zk_expand_mem { free(h_indexes_in); free(h_indexes_out); free(h_lut_indexes); - free(h_lwe_compact_input_indexes); free(h_body_id_per_compact_list); + free(h_lwe_compact_input_indexes); } } @@ -215,8 +215,11 @@ template struct zk_expand_mem { message_and_carry_extract_luts->release(streams, gpu_indexes, gpu_count); delete message_and_carry_extract_luts; - cuda_drop_async(tmp_expanded_lwes, streams[0], gpu_indexes[0]); cuda_drop_async(d_body_id_per_compact_list, streams[0], gpu_indexes[0]); + cuda_drop_async(d_lwe_compact_input_indexes, streams[0], gpu_indexes[0]); + cuda_drop_async(tmp_expanded_lwes, streams[0], gpu_indexes[0]); + cuda_drop_async(tmp_ksed_small_to_big_expanded_lwes, streams[0], + gpu_indexes[0]); } };