Skip to content

Commit

Permalink
Other strategy; 3% improvement on folding
Browse files Browse the repository at this point in the history
  • Loading branch information
codygunton committed Mar 12, 2024
1 parent 99f9d12 commit e40a827
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,17 @@ std::shared_ptr<typename ProverInstances::Instance> ProtoGalaxyProver_<ProverIns

// Fold the prover polynomials
for (size_t inst_idx = 0; inst_idx < ProverInstances::NUM; inst_idx++) {
for (auto [acc_poly, inst_poly] :
zip_view(acc_prover_polynomials.get_all(), instances[inst_idx]->prover_polynomials.get_all())) {
run_loop_in_parallel(acc_poly.size(), [&](size_t start_idx, size_t end_idx) {
for (size_t idx = start_idx; idx < end_idx; idx++) {
acc_poly[idx] += inst_poly[idx] * lagranges[inst_idx];
auto accumulator_polys = acc_prover_polynomials.get_all();
auto input_polys = instances[inst_idx]->prover_polynomials.get_all();
run_loop_in_parallel(Flavor::NUM_ALL_ENTITIES, [&](size_t start_idx, size_t end_idx) {
for (size_t poly_idx = start_idx; poly_idx < end_idx; poly_idx++) {
auto& acc_poly = accumulator_polys[poly_idx];
auto& inst_poly = input_polys[poly_idx];
for (auto [acc_el, inst_el] : zip_view(acc_poly, inst_poly)) {
acc_el += inst_el * lagranges[inst_idx];
}
});
}
}
});
}
next_accumulator->prover_polynomials = std::move(acc_prover_polynomials);

Expand Down

0 comments on commit e40a827

Please sign in to comment.