Skip to content

Commit

Permalink
small segment bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyasa committed Jan 2, 2025
1 parent 9693684 commit 4ce8529
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion icicle/backend/cpu/src/curve/cpu_msm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class Msm
// Constructor
Msm(const int msm_size, const MSMConfig& config) : m_msm_size(msm_size), m_config(config)
{
// std::cout << "msm_size = " << msm_size << std::endl;
// std::cout << "c = " << config.c << std::endl;
// std::cout << "precompute_factor = " << config.precompute_factor << std::endl;
// std::cout << "batch_size = " << config.batch_size << std::endl;
calc_optimal_parameters();

// resize the thread buckets according to the parameters
Expand All @@ -47,6 +51,9 @@ class Msm
init_workers_buckets_busy();

phase1_populate_buckets(scalars, bases);
// for (int i=0; i<m_workers_buckets[0].size();++i) {
// std::cout << "bkt " << i << " : " << m_workers_buckets_busy[0][i] << ", val = " << m_workers_buckets[0][i].point.to_affine() << std::endl;
// }

phase2_collapse_segments();

Expand Down Expand Up @@ -114,7 +121,7 @@ class Msm
m_precompute_factor > 1 ? m_bm_size : 1 << (m_scalar_size - ((m_nof_buckets_module - 1) * m_c));
m_nof_total_buckets = (m_nof_buckets_module - 1) * m_bm_size + last_bm_size;

m_segment_size = 1 << (uint32_t)(std::log2(m_nof_total_buckets / m_nof_workers) - 4);
m_segment_size = std::min(m_bm_size, (uint32_t)(1 << (uint32_t)(std::log2(m_nof_total_buckets / m_nof_workers) - 4)));
std::cout << "m_segment_size = " << m_segment_size << std::endl;
const int nof_segments = (m_nof_total_buckets + m_segment_size - 1) / m_segment_size;
m_segments.resize(nof_segments);
Expand Down

0 comments on commit 4ce8529

Please sign in to comment.