Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: avm logup #5577

Merged
merged 8 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class incl_main_tag_err_lookup_settings {
* @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed
*
*/
static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 2;
static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4;

/**
* @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class incl_mem_tag_err_lookup_settings {
* @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed
*
*/
static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 2;
static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4;

/**
* @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class lookup_byte_lengths_lookup_settings {
* @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed
*
*/
static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 2;
static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4;

/**
* @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class lookup_byte_operations_lookup_settings {
* @brief The polynomial degree of the relation telling us if the inverse polynomial value needs to be computed
*
*/
static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 2;
static constexpr size_t INVERSE_EXISTS_POLYNOMIAL_DEGREE = 4;

/**
* @brief The degree of the read term if implemented arbitrarily. This value is not used by basic and scaled read
Expand Down
2 changes: 1 addition & 1 deletion barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ template <typename Flavor> class SumcheckProver {
pow_univariate.partially_evaluate(round_challenge);
round.round_size = round.round_size >> 1; // TODO(#224)(Cody): Maybe partially_evaluate should do this and
// release memory? // All but final round
// We operate on partially_evaluated_polynomials in place.
// We operate on partially_evaluated_polynomials in place.
for (size_t round_idx = 1; round_idx < multivariate_d; round_idx++) {
// Write the round univariate to the transcript
round_univariate =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ template <typename Flavor> class SumcheckProverRound {
{
BB_OP_COUNT_TIME();

// Compute the constant contribution of pow polynomials for each edge. This is the product of the partial
// Compute the constant contribution of pow polynomials for each edge. This is the product of the partial
// evaluation result c_l (i.e. pow(u_0,...,u_{l-1})) where u_0,...,u_{l-1} are the verifier challenges from
// previous rounds) and the elements of pow(\vec{β}) not containing β_0,..., β_l.
std::vector<FF> pow_challenges(round_size >> 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ template <IsUltraFlavor Flavor> void UltraProver_<Flavor>::execute_relation_chec
std::vector<FF> gate_challenges(numeric::get_msb(circuit_size));
for (size_t idx = 0; idx < gate_challenges.size(); idx++) {
gate_challenges[idx] = transcript->template get_challenge<FF>("Sumcheck:gate_challenge_" + std::to_string(idx));
info("gate_challenges[", idx, "] = ", gate_challenges[idx]);
}
instance->gate_challenges = gate_challenges;
sumcheck_output = sumcheck.prove(instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ template <typename Flavor> bool UltraVerifier_<Flavor>::verify_proof(const HonkP
transcript);
auto pcs_verified = key->pcs_verification_key->pairing_check(pairing_points[0], pairing_points[1]);
return sumcheck_verified.value() && pcs_verified;
;
}

template class UltraVerifier_<UltraFlavor>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ class AvmCircuitBuilder {
polys.avm_mem_val[i] = rows[i].avm_mem_val;
polys.avm_mem_w_in_tag[i] = rows[i].avm_mem_w_in_tag;
polys.perm_main_alu[i] = rows[i].perm_main_alu;

polys.lookup_byte_lengths_counts[i] = rows[i].lookup_byte_lengths_counts;
polys.lookup_byte_operations_counts[i] = rows[i].lookup_byte_operations_counts;
polys.incl_main_tag_err_counts[i] = rows[i].incl_main_tag_err_counts;
polys.incl_mem_tag_err_counts[i] = rows[i].incl_mem_tag_err_counts;

// TODO: check that these are calculated at circuit building time - I believe they
// are rather added at proving time, and thus can be removed
polys.perm_main_bin[i] = rows[i].perm_main_bin;
polys.perm_main_mem_a[i] = rows[i].perm_main_mem_a;
polys.perm_main_mem_b[i] = rows[i].perm_main_mem_b;
Expand All @@ -356,10 +364,6 @@ class AvmCircuitBuilder {
polys.lookup_byte_operations[i] = rows[i].lookup_byte_operations;
polys.incl_main_tag_err[i] = rows[i].incl_main_tag_err;
polys.incl_mem_tag_err[i] = rows[i].incl_mem_tag_err;
polys.lookup_byte_lengths_counts[i] = rows[i].lookup_byte_lengths_counts;
polys.lookup_byte_operations_counts[i] = rows[i].lookup_byte_operations_counts;
polys.incl_main_tag_err_counts[i] = rows[i].incl_main_tag_err_counts;
polys.incl_mem_tag_err_counts[i] = rows[i].incl_mem_tag_err_counts;
}

polys.avm_alu_u16_r0_shift = Polynomial(polys.avm_alu_u16_r0.shifted());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ AvmProver AvmComposer::create_prover(CircuitConstructor& circuit_constructor)
compute_witness(circuit_constructor);
compute_commitment_key(circuit_constructor.get_circuit_subgroup_size());

AvmProver output_state(proving_key, commitment_key);
// TODO: check ptrs - align with other impls
AvmProver output_state(proving_key, proving_key->commitment_key);

return output_state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ class AvmComposer {

void add_table_column_selector_poly_to_proving_key(bb::polynomial& small, const std::string& tag);

// TODO: probably need to move - feels like a hack
void compute_commitment_key(size_t circuit_size)
{
commitment_key = std::make_shared<CommitmentKey>(circuit_size);
proving_key->commitment_key = std::make_shared<CommitmentKey>(circuit_size);
};
};

Expand Down
Loading
Loading