chore: delete IsFoldingFlavor concept#15427
Conversation
| // These concepts are relevant for Sumcheck, where the logic is different for BN254 and Grumpkin Flavors | ||
| // These concept is relevant for the Sumcheck Prover, where the logic is different for BN254 and Grumpkin Flavors | ||
| template <typename T> concept IsGrumpkinFlavor = IsAnyOf<T, ECCVMFlavor, ECCVMRecursiveFlavor_<UltraCircuitBuilder>>; | ||
| template <typename T> concept IsECCVMRecursiveFlavor = IsAnyOf<T, ECCVMRecursiveFlavor_<UltraCircuitBuilder>>; |
| template <typename T> concept IsECCVMRecursiveFlavor = IsAnyOf<T, ECCVMRecursiveFlavor_<UltraCircuitBuilder>>; | ||
|
|
||
| #ifdef STARKNET_GARAGA_FLAVORS | ||
| template <typename T> concept IsFoldingFlavor = IsAnyOf<T, UltraFlavor, |
There was a problem hiding this comment.
not needed anymore
| const size_t polynomial_size = polynomials.get_polynomial_size(); | ||
| Polynomial<FF> aggregated_relation_evaluations(polynomial_size); | ||
|
|
||
| const std::array<FF, NUM_SUBRELATIONS> alphas = [&alphas_]() { |
There was a problem hiding this comment.
don't need to prepend 1 to the array of challenges, as it's done in Oink
| static void scale_univariates(auto& tuple, const RelationSeparator& subrelation_separators) | ||
| { | ||
| size_t idx = 0; | ||
| std::array<FF, NUM_SUBRELATIONS> tmp{ current_scalar }; |
There was a problem hiding this comment.
cleaner this way + nano optimization: Prover avoids copying and re-computing the powers of alpha in every round of Sumcheck
| static void scale_and_batch_elements(auto& tuple, const RelationSeparator& challenges, FF& result) | ||
| { | ||
| size_t idx = 0; | ||
| std::array<FF, NUM_SUBRELATIONS> tmp{ current_scalar }; |
| class TranslatorVerifier { | ||
| public: | ||
| using Flavor = TranslatorFlavor; | ||
| using FF = typename Flavor::FF; |
There was a problem hiding this comment.
TranslatorVerifier is not templated on Flavor
| * @param result Batched result | ||
| */ | ||
| static void scale_and_batch_elements(auto& tuple, const RelationSeparator& challenge, FF current_scalar, FF& result) | ||
| requires(!bb::IsFoldingFlavor<Flavor>) |
| @@ -191,7 +201,6 @@ template <typename Flavor, const size_t virtual_log_n = CONST_PROOF_SIZE_LOG_N> | |||
| */ | |||
| SumcheckOutput<Flavor> prove(ProverPolynomials& full_polynomials, | |||
There was a problem hiding this comment.
I think all arguments for prove and verify methods can be moved to the constructots, cause currently it looks somewhat random
There was a problem hiding this comment.
agreed, I think its always been a bit arbitrary
ledwards2225
left a comment
There was a problem hiding this comment.
LG! Nince cleanup. Just some minor comments
| avm2::AvmRecursiveFlavor_<MegaCircuitBuilder>>; | ||
|
|
||
| // These concepts are relevant for Sumcheck, where the logic is different for BN254 and Grumpkin Flavors | ||
| // These concept is relevant for the Sumcheck Prover, where the logic is different for BN254 and Grumpkin Flavors |
There was a problem hiding this comment.
| // These concept is relevant for the Sumcheck Prover, where the logic is different for BN254 and Grumpkin Flavors | |
| // This concept is relevant for the Sumcheck Prover, where the logic differs between BN254 and Grumpkin |
| */ | ||
| static void scale_univariates(auto& tuple, const RelationSeparator& challenges, FF& current_scalar) | ||
| requires bb::IsFoldingFlavor<Flavor> | ||
| static void scale_univariates(auto& tuple, const RelationSeparator& subrelation_separators) |
There was a problem hiding this comment.
Ah, I see you've come to the same naming :)
| @@ -191,7 +201,6 @@ template <typename Flavor, const size_t virtual_log_n = CONST_PROOF_SIZE_LOG_N> | |||
| */ | |||
| SumcheckOutput<Flavor> prove(ProverPolynomials& full_polynomials, | |||
There was a problem hiding this comment.
agreed, I think its always been a bit arbitrary
| # - Upload the compressed results: aws s3 cp bb-civc-inputs.tar.gz s3://aztec-ci-artifacts/protocol/bb-civc-inputs-[hash(0:8)].tar.gz | ||
| # Note: In case of the "Test suite failed to run ... Unexpected token 'with' " error, need to run: docker pull aztecprotocol/build:3.0 | ||
| pinned_civc_inputs_url="https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/protocol/bb-civc-inputs-95b3f0bb.tar.gz" | ||
| pinned_civc_inputs_url="https://aztec-ci-artifacts.s3.us-east-2.amazonaws.com/protocol/bb-civc-inputs-9a32575f.tar.gz" |
There was a problem hiding this comment.
I didnt catch why this is changing VKs?
…umcheckProver members to constructos
…l/aztec-packages into si/remove-is-folding-flavor
| public_inputs.emplace_back(FF::from_witness(builder, native_public_input)); | ||
| } | ||
| for (size_t alpha_idx = 0; alpha_idx < alphas.size(); alpha_idx++) { | ||
| for (size_t alpha_idx = 1; alpha_idx < alphas.size(); alpha_idx++) { |
There was a problem hiding this comment.
@ledwards2225 this was breaking the vk pinning test, turned the first element into a circuit constant - the test is fixed
| [&]<size_t relation_idx, size_t subrelation_idx, typename Element>(Element& element) { | ||
| using Relation = typename std::tuple_element_t<relation_idx, Relations>; | ||
| const Element contribution = element * challenges[idx]; | ||
| if (subrelation_is_linearly_independent<Relation, subrelation_idx>()) { |
There was a problem hiding this comment.
missing constexpr - subrelation_is_linearly_independent is known at compile time, no need for runtime branching
| // avoid Montgomery allocating 0 and doing a mul. This is about 60ns per row. | ||
| FF linearly_independent_contribution{ 0 }; | ||
| // Initialize result with the contribution from the first subrelation | ||
| FF linearly_independent_contribution = std::get<0>(evals)[0]; |
There was a problem hiding this comment.
Initially I wanted to turn SubrelationSeparators into an array of size of NUM_SUBRELATIONS with the first entry = 1, but it made vk hashing inconsistent - so I removed the first entry of this array completely. Previously we were creating a bunch of temporary arrays of NUM_SUBRELATIONS size just to prepend 1 to the challenges.
As a nice side effect - closed another issue
…l/aztec-packages into si/remove-is-folding-flavor
conflict resolution cause my PR #15427 stopped the train --------- Co-authored-by: Jean M <132435771+jeanmon@users.noreply.github.com> Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com> Co-authored-by: Santiago Palladino <spalladino@users.noreply.github.com> Co-authored-by: Santiago Palladino <santiago@aztec-labs.com>
In my [previous PR](#15427), I moved the `GateSeparatorPolynomial` into the SumcheckProver class as a member, which extended its lifetime and increased memory usage in CIVC by the size of this polynomial, e.g. by 21 MB in `ecdsar1+transfer_0_recursions+sponsored_fpc` bench
Closes AztecProtocol/barretenberg#1443
Closes AztecProtocol/barretenberg#1426
Closes AztecProtocol/barretenberg#1115