From baf161e1f6b2f8e3226d001894387f3b3492f302 Mon Sep 17 00:00:00 2001 From: Agnes Leroy Date: Mon, 25 Nov 2024 15:26:28 +0100 Subject: [PATCH] chore(gpu): panic if (k + 1)*l > 8 to avoid issue with tbc --- .../cuda/src/pbs/programmable_bootstrap_classic.cu | 2 ++ .../cuda/src/pbs/programmable_bootstrap_multibit.cu | 2 ++ 2 files changed, 4 insertions(+) diff --git a/backends/tfhe-cuda-backend/cuda/src/pbs/programmable_bootstrap_classic.cu b/backends/tfhe-cuda-backend/cuda/src/pbs/programmable_bootstrap_classic.cu index a77db81e19..bd5e1f33ec 100644 --- a/backends/tfhe-cuda-backend/cuda/src/pbs/programmable_bootstrap_classic.cu +++ b/backends/tfhe-cuda-backend/cuda/src/pbs/programmable_bootstrap_classic.cu @@ -656,6 +656,8 @@ void cuda_programmable_bootstrap_lwe_ciphertext_vector_64( uint32_t num_samples, uint32_t num_many_lut, uint32_t lut_stride) { if (base_log > 64) PANIC("Cuda error (classical PBS): base log should be <= 64") + if ((glwe_dimension + 1) * level_count > 8) + PANIC("Cuda error (multi-bit PBS): (k + 1)*l should be <= 8") pbs_buffer *buffer = (pbs_buffer *)mem_ptr; diff --git a/backends/tfhe-cuda-backend/cuda/src/pbs/programmable_bootstrap_multibit.cu b/backends/tfhe-cuda-backend/cuda/src/pbs/programmable_bootstrap_multibit.cu index b2a7f214e2..1610c12072 100644 --- a/backends/tfhe-cuda-backend/cuda/src/pbs/programmable_bootstrap_multibit.cu +++ b/backends/tfhe-cuda-backend/cuda/src/pbs/programmable_bootstrap_multibit.cu @@ -220,6 +220,8 @@ void cuda_multi_bit_programmable_bootstrap_lwe_ciphertext_vector_64( if (base_log > 64) PANIC("Cuda error (multi-bit PBS): base log should be <= 64") + if ((glwe_dimension + 1) * level_count > 8) + PANIC("Cuda error (multi-bit PBS): (k + 1)*l should be <= 8") pbs_buffer *buffer = (pbs_buffer *)mem_ptr;