Skip to content

Investigate: is single-threaded bucket accumulation in Pippenger a bottleneck? #1656

Description

@johnathan79717

There is a TODO in scalar_multiplication.cpp questioning whether the single-threaded bucket accumulation loop is a performance concern for large MSMs with many threads:

https://github.com/AztecProtocol/aztec-packages/blob/next/barretenberg/cpp/src/barretenberg/ecc/scalar_multiplication/scalar_multiplication.cpp#L478-L486

// Accumulate results. This part needs to be single threaded, but amount of work done here should be small
// TODO(@zac-williamson) check this? E.g. if we are doing a 2^16 MSM with 256 threads this single-threaded part
// will be painful.

Action items:

  1. Benchmark the bucket accumulation phase relative to the overall MSM for representative sizes (2^16, 2^20) to determine if this is actually a bottleneck.
  2. If it is, explore parallelization options. Note that BitVector::set() in bitvector.hpp performs a non-atomic read-modify-write, so any parallelization of the bucket loop must keep BucketAccumulators per-thread or use atomic operations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions