Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
scalar_multiplication_fast.hpp File Reference
#include "barretenberg/common/thread.hpp"
#include "barretenberg/ecc/curves/bn254/bn254.hpp"
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp"
#include "barretenberg/polynomials/polynomial.hpp"
#include <string>
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <span>
#include <vector>

Go to the source code of this file.

Classes

class  bb::scalar_multiplication::MSM_fast< Curve >
 

Namespaces

namespace  bb
 Entry point for Barretenberg command-line interface.
 
namespace  bb::scalar_multiplication
 
namespace  bb::scalar_multiplication::round_parallel_detail
 

Functions

size_t bb::scalar_multiplication::window_bits_tuning_oversub_factor (size_t n_input)
 N-dependent oversubscription factor used ONLY for choose_window_bits' target_load formula (not for actual thread dispatch).
 
template<typename Curve >
Curve::Element bb::scalar_multiplication::pippenger_round_parallel (PolynomialSpan< const typename Curve::ScalarField > scalars, std::span< const typename Curve::AffineElement > points, bool dedup_hint=false, std::span< const typename Curve::AffineElement > external_glv_doubled={}, std::span< std::byte > external_arena={}) noexcept
 State of the art pippenger_fast multiscalar multiplication algorithm.
 
template curve::BN254::Element bb::scalar_multiplication::pippenger_round_parallel< curve::BN254 > (PolynomialSpan< const curve::BN254::ScalarField > scalars, std::span< const curve::BN254::AffineElement > points, bool dedup_hint, std::span< const curve::BN254::AffineElement > external_glv_doubled, std::span< std::byte > external_arena) noexcept
 
template curve::Grumpkin::Element bb::scalar_multiplication::pippenger_round_parallel< curve::Grumpkin > (PolynomialSpan< const curve::Grumpkin::ScalarField > scalars, std::span< const curve::Grumpkin::AffineElement > points, bool dedup_hint, std::span< const curve::Grumpkin::AffineElement > external_glv_doubled, std::span< std::byte > external_arena) noexcept
 
template<typename Curve >
Curve::Element bb::scalar_multiplication::pippenger_fast (PolynomialSpan< const typename Curve::ScalarField > scalars, std::span< const typename Curve::AffineElement > points, bool handle_edge_cases, bool dedup_hint) noexcept
 
template<typename Curve >
Curve::Element bb::scalar_multiplication::pippenger_unsafe_fast (PolynomialSpan< const typename Curve::ScalarField > scalars, std::span< const typename Curve::AffineElement > points, bool dedup_hint) noexcept
 
template curve::BN254::Element bb::scalar_multiplication::pippenger_fast< curve::BN254 > (PolynomialSpan< const curve::BN254::ScalarField > scalars, std::span< const curve::BN254::AffineElement > points, bool handle_edge_cases, bool dedup_hint) noexcept
 
template curve::Grumpkin::Element bb::scalar_multiplication::pippenger_fast< curve::Grumpkin > (PolynomialSpan< const curve::Grumpkin::ScalarField > scalars, std::span< const curve::Grumpkin::AffineElement > points, bool handle_edge_cases, bool dedup_hint) noexcept
 
template curve::BN254::Element bb::scalar_multiplication::pippenger_unsafe_fast< curve::BN254 > (PolynomialSpan< const curve::BN254::ScalarField > scalars, std::span< const curve::BN254::AffineElement > points, bool dedup_hint) noexcept
 
template curve::Grumpkin::Element bb::scalar_multiplication::pippenger_unsafe_fast< curve::Grumpkin > (PolynomialSpan< const curve::Grumpkin::ScalarField > scalars, std::span< const curve::Grumpkin::AffineElement > points, bool dedup_hint) noexcept
 
template<typename Curve >
size_t bb::scalar_multiplication::compute_arena_bytes_for_msm (size_t n_input, bool external_glv_provided, bool dedup_active) noexcept
 Round-parallel Pippenger MSM_fast. Windows process sequentially (high-to-low) but each window is fully parallel across threads. Windows are processed in batches of windows_in_batch to amortise parallel_for barriers; the batch count is sized at runtime to fit BATCH_MEM_BUDGET (~32 MiB).
 
template<typename Curve >
Curve::Element bb::scalar_multiplication::round_parallel_detail::pippenger_round_parallel_jacobian_fast (std::span< const typename Curve::ScalarField > scalars, std::span< const typename Curve::AffineElement > points, size_t min_pts_per_thread_override) noexcept
 Small-N fast-path: per-thread Jacobian Pippenger over a partition of the input.
 
template curve::BN254::Element bb::scalar_multiplication::round_parallel_detail::pippenger_round_parallel_jacobian_fast< curve::BN254 > (std::span< const curve::BN254::ScalarField > scalars, std::span< const curve::BN254::AffineElement > points, size_t min_pts_per_thread_override) noexcept
 
template curve::Grumpkin::Element bb::scalar_multiplication::round_parallel_detail::pippenger_round_parallel_jacobian_fast< curve::Grumpkin > (std::span< const curve::Grumpkin::ScalarField > scalars, std::span< const curve::Grumpkin::AffineElement > points, size_t min_pts_per_thread_override) noexcept
 
template<typename Curve >
Curve::Element bb::scalar_multiplication::trivial_msm (PolynomialSpan< const typename Curve::ScalarField > scalars_span, std::span< const typename Curve::AffineElement > all_points) noexcept
 Single-threaded small-MSM_fast driver: Element::straus_msm over the input slice.
 
template curve::BN254::Element bb::scalar_multiplication::trivial_msm< curve::BN254 > (PolynomialSpan< const curve::BN254::ScalarField > scalars_span, std::span< const curve::BN254::AffineElement > all_points) noexcept
 
template curve::Grumpkin::Element bb::scalar_multiplication::trivial_msm< curve::Grumpkin > (PolynomialSpan< const curve::Grumpkin::ScalarField > scalars_span, std::span< const curve::Grumpkin::AffineElement > all_points) noexcept
 
template<typename Curve >
Curve::Element bb::scalar_multiplication::trivial_msm_threaded (PolynomialSpan< const typename Curve::ScalarField > scalars_span, std::span< const typename Curve::AffineElement > all_points) noexcept
 Multi-threaded small-MSM_fast driver: parallel Element::straus_msm over zero-skipped input slices.
 
template curve::BN254::Element bb::scalar_multiplication::trivial_msm_threaded< curve::BN254 > (PolynomialSpan< const curve::BN254::ScalarField > scalars_span, std::span< const curve::BN254::AffineElement > all_points) noexcept
 
template curve::Grumpkin::Element bb::scalar_multiplication::trivial_msm_threaded< curve::Grumpkin > (PolynomialSpan< const curve::Grumpkin::ScalarField > scalars_span, std::span< const curve::Grumpkin::AffineElement > all_points) noexcept
 

Variables

constexpr size_t bb::scalar_multiplication::MIN_PTS_PER_THREAD_FOR_PIPPENGER = 24
 
constexpr size_t bb::scalar_multiplication::round_parallel_detail::GLV_SMALL_N_THRESHOLD = size_t{ 1 } << 13