Skip to content

Commit ee2d133

Browse files
committed
chore(gpu): fix parameter name mismatches between declarations and definitions
1 parent 496189e commit ee2d133

13 files changed

Lines changed: 180 additions & 196 deletions

backends/tfhe-cuda-backend/cuda/include/pbs/programmable_bootstrap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ void cuda_programmable_bootstrap_128_async(
8888
uint32_t level_count, uint32_t num_samples);
8989

9090
void cleanup_cuda_programmable_bootstrap_64(void *stream, uint32_t gpu_index,
91-
int8_t **pbs_buffer);
91+
int8_t **buffer);
9292

9393
void cleanup_cuda_programmable_bootstrap_128(void *stream, uint32_t gpu_index,
94-
int8_t **pbs_buffer);
94+
int8_t **buffer);
9595
}
9696
#endif // CUDA_BOOTSTRAP_H

backends/tfhe-cuda-backend/cuda/include/pbs/programmable_bootstrap_multibit.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ void cuda_convert_lwe_multi_bit_programmable_bootstrap_key_128_async(
2121
uint32_t polynomial_size, uint32_t grouping_factor);
2222

2323
uint64_t scratch_cuda_multi_bit_programmable_bootstrap_64_async(
24-
void *stream, uint32_t gpu_index, int8_t **pbs_buffer,
25-
uint32_t glwe_dimension, uint32_t polynomial_size, uint32_t level_count,
24+
void *stream, uint32_t gpu_index, int8_t **buffer, uint32_t glwe_dimension,
25+
uint32_t polynomial_size, uint32_t level_count,
2626
uint32_t input_lwe_ciphertext_count, bool allocate_gpu_memory);
2727

2828
void cuda_multi_bit_programmable_bootstrap_64_async(
@@ -37,17 +37,17 @@ void cuda_multi_bit_programmable_bootstrap_64_async(
3737

3838
void cleanup_cuda_multi_bit_programmable_bootstrap_64(void *stream,
3939
uint32_t gpu_index,
40-
int8_t **pbs_buffer);
40+
int8_t **buffer);
4141

4242
// Noise-tests-namespaced wrappers for scratch/cleanup, so that callers
4343
// working with the noise-tests PBS variant use a consistent naming scheme.
4444
uint64_t scratch_cuda_multi_bit_programmable_bootstrap_noise_tests_64_async(
45-
void *stream, uint32_t gpu_index, int8_t **pbs_buffer,
46-
uint32_t glwe_dimension, uint32_t polynomial_size, uint32_t level_count,
45+
void *stream, uint32_t gpu_index, int8_t **buffer, uint32_t glwe_dimension,
46+
uint32_t polynomial_size, uint32_t level_count,
4747
uint32_t input_lwe_ciphertext_count, bool allocate_gpu_memory);
4848

4949
void cleanup_cuda_multi_bit_programmable_bootstrap_noise_tests_64(
50-
void *stream, uint32_t gpu_index, int8_t **pbs_buffer);
50+
void *stream, uint32_t gpu_index, int8_t **buffer);
5151

5252
// Noise tests variant: 64-bit torus, polynomial_size=2048 only. Uses the
5353
// NOISE_TESTS keybundle mode for noise analysis purposes.

backends/tfhe-cuda-backend/cuda/src/crypto/keyswitch.cu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void cuda_keyswitch_gemm_64_64_async(
2525
void const *lwe_output_indexes, void const *lwe_array_in,
2626
void const *lwe_input_indexes, void const *ksk, uint32_t lwe_dimension_in,
2727
uint32_t lwe_dimension_out, uint32_t base_log, uint32_t level_count,
28-
uint32_t num_samples, bool uses_trivial_indices) {
28+
uint32_t num_samples, bool uses_trivial_indexes) {
2929

3030
host_gemm_keyswitch_lwe_ciphertext_vector<uint64_t, uint64_t>(
3131
static_cast<cudaStream_t>(stream), gpu_index,
@@ -34,7 +34,7 @@ void cuda_keyswitch_gemm_64_64_async(
3434
static_cast<const uint64_t *>(lwe_array_in),
3535
static_cast<const uint64_t *>(lwe_input_indexes),
3636
static_cast<const uint64_t *>(ksk), lwe_dimension_in, lwe_dimension_out,
37-
base_log, level_count, num_samples, uses_trivial_indices);
37+
base_log, level_count, num_samples, uses_trivial_indexes);
3838
}
3939

4040
/* Perform keyswitch on a batch of 64 bits input LWE ciphertexts
@@ -46,7 +46,7 @@ void cuda_keyswitch_gemm_64_32_async(
4646
void const *lwe_output_indexes, void const *lwe_array_in,
4747
void const *lwe_input_indexes, void const *ksk, uint32_t lwe_dimension_in,
4848
uint32_t lwe_dimension_out, uint32_t base_log, uint32_t level_count,
49-
uint32_t num_samples, bool uses_trivial_indices) {
49+
uint32_t num_samples, bool uses_trivial_indexes) {
5050

5151
host_gemm_keyswitch_lwe_ciphertext_vector<uint64_t, uint32_t>(
5252
static_cast<cudaStream_t>(stream), gpu_index,
@@ -55,7 +55,7 @@ void cuda_keyswitch_gemm_64_32_async(
5555
static_cast<const uint64_t *>(lwe_array_in),
5656
static_cast<const uint64_t *>(lwe_input_indexes),
5757
static_cast<const uint32_t *>(ksk), lwe_dimension_in, lwe_dimension_out,
58-
base_log, level_count, num_samples, uses_trivial_indices);
58+
base_log, level_count, num_samples, uses_trivial_indexes);
5959
}
6060

6161
void cuda_keyswitch_lwe_ciphertext_vector_64_64_async(

backends/tfhe-cuda-backend/cuda/src/integer/comparison.cu

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
uint64_t scratch_cuda_integer_comparison_64_async(
44
CudaStreamsFFI streams, int8_t **mem_ptr,
55
CudaLweBootstrapKeyParamsFFI bsk_params,
6-
CudaLweKeyswitchKeyParamsFFI ksk_params, uint32_t num_radix_blocks,
6+
CudaLweKeyswitchKeyParamsFFI ksk_params, uint32_t lwe_ciphertext_count,
77
uint32_t message_modulus, uint32_t carry_modulus, COMPARISON_TYPE op_type,
88
bool is_signed, bool allocate_gpu_memory,
99
PBS_MS_REDUCTION_T noise_reduction_type) {
@@ -17,7 +17,8 @@ uint64_t scratch_cuda_integer_comparison_64_async(
1717
case NE:
1818
size_tracker += scratch_cuda_comparison_check<uint64_t>(
1919
CudaStreams(streams), (int_comparison_buffer<uint64_t> **)mem_ptr,
20-
num_radix_blocks, params, op_type, false, false, allocate_gpu_memory);
20+
lwe_ciphertext_count, params, op_type, false, false,
21+
allocate_gpu_memory);
2122
break;
2223
case GT:
2324
case GE:
@@ -27,7 +28,7 @@ uint64_t scratch_cuda_integer_comparison_64_async(
2728
case MIN:
2829
size_tracker += scratch_cuda_comparison_check<uint64_t>(
2930
CudaStreams(streams), (int_comparison_buffer<uint64_t> **)mem_ptr,
30-
num_radix_blocks, params, op_type, is_signed, true,
31+
lwe_ciphertext_count, params, op_type, is_signed, true,
3132
allocate_gpu_memory);
3233
break;
3334
}
@@ -38,7 +39,7 @@ uint64_t scratch_cuda_integer_comparison_64_async(
3839
uint64_t scratch_cuda_integer_scalar_comparison_64_async(
3940
CudaStreamsFFI streams, int8_t **mem_ptr,
4041
CudaLweBootstrapKeyParamsFFI bsk_params,
41-
CudaLweKeyswitchKeyParamsFFI ksk_params, uint32_t num_radix_blocks,
42+
CudaLweKeyswitchKeyParamsFFI ksk_params, uint32_t lwe_ciphertext_count,
4243
uint32_t message_modulus, uint32_t carry_modulus, COMPARISON_TYPE op_type,
4344
bool is_signed, bool allocate_gpu_memory,
4445
PBS_MS_REDUCTION_T noise_reduction_type) {
@@ -52,7 +53,8 @@ uint64_t scratch_cuda_integer_scalar_comparison_64_async(
5253
case NE:
5354
size_tracker += scratch_cuda_comparison_check<uint64_t>(
5455
CudaStreams(streams), (int_comparison_buffer<uint64_t> **)mem_ptr,
55-
num_radix_blocks, params, op_type, false, false, allocate_gpu_memory);
56+
lwe_ciphertext_count, params, op_type, false, false,
57+
allocate_gpu_memory);
5658
break;
5759
case GT:
5860
case GE:
@@ -62,7 +64,7 @@ uint64_t scratch_cuda_integer_scalar_comparison_64_async(
6264
case MIN:
6365
size_tracker += scratch_cuda_comparison_check<uint64_t>(
6466
CudaStreams(streams), (int_comparison_buffer<uint64_t> **)mem_ptr,
65-
num_radix_blocks, params, op_type, is_signed, false,
67+
lwe_ciphertext_count, params, op_type, is_signed, false,
6668
allocate_gpu_memory);
6769
break;
6870
}

backends/tfhe-cuda-backend/cuda/src/integer/integer.cu

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,17 @@ void cleanup_cuda_integer_overflowing_sub_64_inplace(CudaStreamsFFI streams,
174174
uint64_t scratch_cuda_apply_univariate_lut_64_async(
175175
CudaStreamsFFI streams, int8_t **mem_ptr, void const *input_lut,
176176
CudaLweBootstrapKeyParamsFFI bsk_params,
177-
CudaLweKeyswitchKeyParamsFFI ksk_params, uint32_t num_radix_blocks,
178-
uint32_t message_modulus, uint32_t carry_modulus, uint64_t lut_degree,
179-
bool allocate_gpu_memory, PBS_MS_REDUCTION_T noise_reduction_type) {
177+
CudaLweKeyswitchKeyParamsFFI ksk_params,
178+
uint32_t input_lwe_ciphertext_count, uint32_t message_modulus,
179+
uint32_t carry_modulus, uint64_t lut_degree, bool allocate_gpu_memory,
180+
PBS_MS_REDUCTION_T noise_reduction_type) {
180181
int_radix_params params(bsk_params, ksk_params, message_modulus,
181182
carry_modulus, noise_reduction_type);
182183

183184
return scratch_cuda_apply_univariate_lut<uint64_t>(
184185
CudaStreams(streams), (int_radix_lut<uint64_t> **)mem_ptr,
185-
static_cast<const uint64_t *>(input_lut), num_radix_blocks, params,
186-
lut_degree, allocate_gpu_memory);
186+
static_cast<const uint64_t *>(input_lut), input_lwe_ciphertext_count,
187+
params, lut_degree, allocate_gpu_memory);
187188
}
188189

189190
uint64_t scratch_cuda_apply_many_univariate_lut_64_async(
@@ -238,16 +239,16 @@ void cleanup_cuda_apply_many_univariate_lut_64(CudaStreamsFFI streams,
238239
void cuda_apply_many_univariate_lut_64_async(
239240
CudaStreamsFFI streams, CudaRadixCiphertextFFI *output_radix_lwe,
240241
CudaRadixCiphertextFFI const *input_radix_lwe, int8_t *mem_ptr,
241-
void *const *ksks, void *const *bsks, uint32_t num_many_lut,
242+
void *const *ksks, void *const *bsks, uint32_t num_luts,
242243
uint32_t lut_stride) {
243244
PANIC_IF_FALSE(output_radix_lwe != input_radix_lwe,
244245
"Output and input pointers must be different for out-of-place "
245246
"operations");
246247

247248
host_apply_many_univariate_lut<uint64_t>(
248249
CudaStreams(streams), output_radix_lwe, input_radix_lwe,
249-
(int_radix_lut<uint64_t> *)mem_ptr, (uint64_t **)(ksks), bsks,
250-
num_many_lut, lut_stride);
250+
(int_radix_lut<uint64_t> *)mem_ptr, (uint64_t **)(ksks), bsks, num_luts,
251+
lut_stride);
251252
}
252253

253254
void cuda_integer_reverse_blocks_64_inplace_async(
@@ -291,7 +292,7 @@ uint64_t scratch_cuda_apply_noise_squashing_async(
291292
CudaStreamsFFI streams, int8_t **mem_ptr,
292293
CudaLweBootstrapKeyParamsFFI bsk_params, uint32_t input_glwe_dimension,
293294
uint32_t input_polynomial_size, CudaLweKeyswitchKeyParamsFFI ksk_params,
294-
uint32_t num_radix_blocks, uint32_t original_num_blocks,
295+
uint32_t num_radix_blocks, uint32_t num_original_blocks,
295296
uint32_t message_modulus, uint32_t carry_modulus, bool allocate_gpu_memory,
296297
PBS_MS_REDUCTION_T noise_reduction_type) {
297298
int_radix_params params(bsk_params, ksk_params, message_modulus,
@@ -300,7 +301,7 @@ uint64_t scratch_cuda_apply_noise_squashing_async(
300301
return scratch_cuda_apply_noise_squashing_mem(
301302
streams, params, (int_noise_squashing_lut<uint64_t> **)mem_ptr,
302303
input_glwe_dimension, input_polynomial_size, num_radix_blocks,
303-
original_num_blocks, allocate_gpu_memory);
304+
num_original_blocks, allocate_gpu_memory);
304305
}
305306

306307
void cuda_apply_noise_squashing_async(

backends/tfhe-cuda-backend/cuda/src/integer/scalar_mul.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ uint64_t scratch_cuda_integer_scalar_mul_64_async(
1717
void cuda_integer_scalar_mul_64_async(
1818
CudaStreamsFFI streams, CudaRadixCiphertextFFI *lwe_array,
1919
uint64_t const *decomposed_scalar, uint64_t const *has_at_least_one_set,
20-
int8_t *mem, void *const *bsks, void *const *ksks,
20+
int8_t *mem_ptr, void *const *bsks, void *const *ksks,
2121
uint32_t /*polynomial_size*/, uint32_t message_modulus,
2222
uint32_t num_scalars) {
2323

2424
host_integer_scalar_mul_radix<uint64_t>(
2525
CudaStreams(streams), lwe_array, decomposed_scalar, has_at_least_one_set,
26-
reinterpret_cast<int_scalar_mul_buffer<uint64_t> *>(mem), bsks,
26+
reinterpret_cast<int_scalar_mul_buffer<uint64_t> *>(mem_ptr), bsks,
2727
(uint64_t **)(ksks), message_modulus, num_scalars);
2828
}
2929

backends/tfhe-cuda-backend/cuda/src/linearalgebra/multiplication.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ void cuda_wrapping_polynomial_mul_one_to_many_64_async(
3434
}
3535

3636
void cuda_glwe_wrapping_polynomial_mul_one_to_many_64_async(
37-
void *stream, uint32_t gpu_index, void *result, void const *glwe_lhs,
37+
void *stream, uint32_t gpu_index, void *result, void const *poly_lhs,
3838
int8_t *circulant, void const *poly_rhs, uint32_t polynomial_size,
3939
uint32_t glwe_dimension, uint32_t n_rhs) {
40-
PANIC_IF_FALSE(result != glwe_lhs,
40+
PANIC_IF_FALSE(result != poly_lhs,
4141
"Output and left input pointers must be different for "
4242
"out-of-place operations");
4343
PANIC_IF_FALSE(result != poly_rhs,
@@ -46,7 +46,7 @@ void cuda_glwe_wrapping_polynomial_mul_one_to_many_64_async(
4646

4747
host_glwe_wrapping_polynomial_mul_one_to_many<uint64_t, ulonglong4>(
4848
static_cast<cudaStream_t>(stream), gpu_index,
49-
static_cast<uint64_t *>(result), static_cast<uint64_t const *>(glwe_lhs),
49+
static_cast<uint64_t *>(result), static_cast<uint64_t const *>(poly_lhs),
5050
circulant, static_cast<uint64_t const *>(poly_rhs), polynomial_size,
5151
glwe_dimension, n_rhs);
5252
}

0 commit comments

Comments
 (0)