@@ -1887,14 +1887,8 @@ void host_compute_propagation_simulators_and_group_carries(
18871887 num_groups - 1 );
18881888 }
18891889}
1890- // This function is used to perform step 1 of Thomas' new borrow propagation
1891- // algorithm It uses a many lut to calculate two luts in parallel
1892- // shifted_blocks: contains (block % message modulus) << 1
1893- // block states: contains the propagation states for the different blocks
1894- // depending on the group it belongs to and the internal position within the
1895- // block.
18961890template <typename Torus>
1897- void host_compute_shifted_blocks_and_borrow_states (
1891+ void legacy_host_compute_shifted_blocks_and_borrow_states (
18981892 cudaStream_t const *streams, uint32_t const *gpu_indexes,
18991893 uint32_t gpu_count, Torus *lwe_array, int_radix_params params,
19001894 int_shifted_blocks_and_borrow_states_memory<Torus> *mem, void *const *bsks,
@@ -1906,16 +1900,17 @@ void host_compute_shifted_blocks_and_borrow_states(
19061900 uint32_t big_lwe_size = glwe_dimension * polynomial_size + 1 ;
19071901 auto big_lwe_size_bytes = big_lwe_size * sizeof (Torus);
19081902
1909- auto shifted_blocks_and_borrow_states = mem->shifted_blocks_and_borrow_states ;
1903+ auto shifted_blocks_and_borrow_states =
1904+ (Torus *)mem->shifted_blocks_and_borrow_states ->ptr ;
19101905 auto luts_array_first_step = mem->luts_array_first_step ;
19111906
19121907 legacy_integer_radix_apply_many_univariate_lookup_table_kb<Torus>(
19131908 streams, gpu_indexes, gpu_count, shifted_blocks_and_borrow_states,
19141909 lwe_array, bsks, ksks, num_radix_blocks, luts_array_first_step,
19151910 num_many_lut, lut_stride);
19161911
1917- auto shifted_blocks = mem->shifted_blocks ;
1918- auto borrow_states = mem->borrow_states ;
1912+ auto shifted_blocks = (Torus *) mem->shifted_blocks -> ptr ;
1913+ auto borrow_states = (Torus *) mem->borrow_states -> ptr ;
19191914 cuda_memcpy_async_gpu_to_gpu (borrow_states, shifted_blocks_and_borrow_states,
19201915 big_lwe_size_bytes * num_radix_blocks,
19211916 streams[0 ], gpu_indexes[0 ]);
@@ -2735,10 +2730,8 @@ void scratch_cuda_integer_overflowing_sub(
27352730 compute_overflow, allocate_gpu_memory);
27362731}
27372732
2738- // This function perform the three steps of Thomas' new borrow propagation
2739- // includes the logic to extract overflow when requested
27402733template <typename Torus>
2741- void host_single_borrow_propagate (
2734+ void legacy_host_single_borrow_propagate (
27422735 cudaStream_t const *streams, uint32_t const *gpu_indexes,
27432736 uint32_t gpu_count, Torus *lhsrhs_array, Torus *overflow_block,
27442737 const Torus *input_borrow, int_borrow_prop_memory<Torus> *mem,
@@ -2758,19 +2751,20 @@ void host_single_borrow_propagate(
27582751
27592752 assert (mem->num_groups >= num_groups);
27602753 if (uses_input_borrow == 1 ) {
2761- host_unchecked_sub_with_correcting_term <Torus>(
2754+ legacy_host_unchecked_sub_with_correcting_term <Torus>(
27622755 streams[0 ], gpu_indexes[0 ], lhsrhs_array, lhsrhs_array, input_borrow,
27632756 big_lwe_dimension, 1 , message_modulus, carry_modulus,
27642757 message_modulus - 1 );
27652758 }
27662759 // Step 1
2767- host_compute_shifted_blocks_and_borrow_states <Torus>(
2760+ legacy_host_compute_shifted_blocks_and_borrow_states <Torus>(
27682761 streams, gpu_indexes, gpu_count, lhsrhs_array, params,
27692762 mem->shifted_blocks_borrow_state_mem , bsks, ksks, num_radix_blocks,
27702763 lut_stride, num_many_lut);
27712764
2772- auto borrow_states = mem->shifted_blocks_borrow_state_mem ->borrow_states ;
2773- cuda_memcpy_async_gpu_to_gpu (mem->overflow_block ,
2765+ auto borrow_states =
2766+ (Torus *)mem->shifted_blocks_borrow_state_mem ->borrow_states ->ptr ;
2767+ cuda_memcpy_async_gpu_to_gpu ((Torus *)mem->overflow_block ->ptr ,
27742768 borrow_states +
27752769 (num_radix_blocks - 1 ) * big_lwe_size,
27762770 big_lwe_size_bytes, streams[0 ], gpu_indexes[0 ]);
@@ -2781,7 +2775,8 @@ void host_single_borrow_propagate(
27812775 mem->prop_simu_group_carries_mem , bsks, ksks, num_radix_blocks,
27822776 num_groups);
27832777
2784- auto shifted_blocks = mem->shifted_blocks_borrow_state_mem ->shifted_blocks ;
2778+ auto shifted_blocks =
2779+ (Torus *)mem->shifted_blocks_borrow_state_mem ->shifted_blocks ->ptr ;
27852780 auto prepared_blocks =
27862781 (Torus *)mem->prop_simu_group_carries_mem ->prepared_blocks ->ptr ;
27872782 auto simulators = (Torus *)mem->prop_simu_group_carries_mem ->simulators ->ptr ;
@@ -2790,13 +2785,14 @@ void host_single_borrow_propagate(
27902785 shifted_blocks, simulators, big_lwe_dimension,
27912786 num_radix_blocks);
27922787
2793- host_integer_radix_add_scalar_one_inplace <Torus>(
2788+ legacy_host_integer_radix_add_scalar_one_inplace <Torus>(
27942789 streams, gpu_indexes, gpu_count, prepared_blocks, big_lwe_dimension,
27952790 num_radix_blocks, message_modulus, carry_modulus);
27962791
27972792 if (compute_overflow == outputFlag::FLAG_OVERFLOW ) {
27982793 legacy_host_addition<Torus>(
2799- streams[0 ], gpu_indexes[0 ], mem->overflow_block , mem->overflow_block ,
2794+ streams[0 ], gpu_indexes[0 ], (Torus *)mem->overflow_block ->ptr ,
2795+ (Torus *)mem->overflow_block ->ptr ,
28002796 (Torus *)mem->prop_simu_group_carries_mem ->simulators ->ptr +
28012797 (num_radix_blocks - 1 ) * big_lwe_size,
28022798 big_lwe_dimension, 1 );
@@ -2809,7 +2805,8 @@ void host_single_borrow_propagate(
28092805 // borrows
28102806 if (compute_overflow == outputFlag::FLAG_OVERFLOW ) {
28112807 legacy_host_addition<Torus>(
2812- streams[0 ], gpu_indexes[0 ], mem->overflow_block , mem->overflow_block ,
2808+ streams[0 ], gpu_indexes[0 ], (Torus *)mem->overflow_block ->ptr ,
2809+ (Torus *)mem->overflow_block ->ptr ,
28132810 resolved_borrows + (num_groups - 1 ) * big_lwe_size, big_lwe_dimension,
28142811 1 );
28152812 }
@@ -2826,7 +2823,7 @@ void host_single_borrow_propagate(
28262823 auto borrow_flag = mem->lut_borrow_flag ;
28272824 legacy_integer_radix_apply_univariate_lookup_table_kb<Torus>(
28282825 mem->sub_streams_1 , gpu_indexes, gpu_count, overflow_block,
2829- mem->overflow_block , bsks, ksks, 1 , borrow_flag);
2826+ (Torus *) mem->overflow_block -> ptr , bsks, ksks, 1 , borrow_flag);
28302827 }
28312828 for (int j = 0 ; j < mem->active_gpu_count ; j++) {
28322829 cuda_event_record (mem->outgoing_events1 [j], mem->sub_streams_1 [j],
0 commit comments