diff --git a/barretenberg/cpp/CMakePresets.json b/barretenberg/cpp/CMakePresets.json index c6c2a0e2eb8..a967a67fb98 100644 --- a/barretenberg/cpp/CMakePresets.json +++ b/barretenberg/cpp/CMakePresets.json @@ -58,6 +58,18 @@ "DISABLE_ASM": "ON" } }, + { + "name": "clang16-dbg-fast", + "displayName": "Optimized debug build with Clang-16", + "description": "Build with globally installed Clang-16 in optimized debug mode", + "inherits": "clang16-dbg", + "environment": { + "CMAKE_BUILD_TYPE": "Debug", + "CFLAGS": "-O2 -gdwarf", + "CXXFLAGS": "-O2 -gdwarf-4", + "LDFLAGS": "-O2 -gdwarf-4" + } + }, { "name": "asan", "displayName": "Debugging build with address sanitizer on Clang-16", @@ -335,6 +347,11 @@ "inherits": "default", "configurePreset": "clang16-dbg" }, + { + "name": "clang16-dbg-fast", + "inherits": "default", + "configurePreset": "clang16-dbg-fast" + }, { "name": "asan", "inherits": "default", diff --git a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp index b19aeda7727..cbe139eb37c 100644 --- a/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp +++ b/barretenberg/cpp/src/barretenberg/protogalaxy/protogalaxy_prover.hpp @@ -155,40 +155,33 @@ template class ProtoGalaxyProver_ { const RelationParameters& relation_parameters) { auto instance_size = instance_polynomials.get_polynomial_size(); - FF linearly_dependent_contribution = FF(0); std::vector full_honk_evaluations(instance_size); + std::vector linearly_dependent_contributions(instance_size); + parallel_for(instance_size, [&](size_t row) { + auto row_evaluations = instance_polynomials.get_row(row); + RelationEvaluations relation_evaluations; + Utils::zero_elements(relation_evaluations); + + // Note that the evaluations are accumulated with the gate separation challenge + // being 1 at this stage, as this specific randomness is added later through the + // power polynomial univariate specific to ProtoGalaxy + Utils::template accumulate_relation_evaluations<>( + row_evaluations, relation_evaluations, relation_parameters, FF(1)); + + auto output = FF(0); + auto running_challenge = FF(1); + + // Sum relation evaluations, batched by their corresponding relation separator challenge, to + // get the value of the full honk relation at a specific row + linearly_dependent_contributions[row] = 0; + Utils::scale_and_batch_elements( + relation_evaluations, alpha, running_challenge, output, linearly_dependent_contributions[row]); + full_honk_evaluations[row] = output; + }); - run_loop_in_parallel_if_effective( - instance_size, - [&full_honk_evaluations, - &instance_polynomials, - &relation_parameters, - &alpha, - &linearly_dependent_contribution](size_t start, size_t end) { - for (size_t row = start; row < end; row++) { - auto row_evaluations = instance_polynomials.get_row(row); - RelationEvaluations relation_evaluations; - Utils::zero_elements(relation_evaluations); - - // Note that the evaluations are accumulated with the gate separation challenge - // being 1 at this stage, as this specific randomness is added later through the - // power polynomial univariate specific to ProtoGalaxy - Utils::template accumulate_relation_evaluations<>( - row_evaluations, relation_evaluations, relation_parameters, FF(1)); - - auto output = FF(0); - auto running_challenge = FF(1); - - // Sum relation evaluations, batched by their corresponding relation separator challenge, to get - // the value - // of the full honk relation at a specific row - Utils::scale_and_batch_elements( - relation_evaluations, alpha, running_challenge, output, linearly_dependent_contribution); - full_honk_evaluations[row] = output; - } - }); - - full_honk_evaluations[0] += linearly_dependent_contribution; + for (FF& linearly_dependent_contribution : linearly_dependent_contributions) { + full_honk_evaluations[0] += linearly_dependent_contribution; + } return full_honk_evaluations; }