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

Logup for o1vm #2757

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

Logup for o1vm #2757

wants to merge 31 commits into from

Conversation

Fizzixnerd
Copy link
Contributor

No description provided.

@Fizzixnerd Fizzixnerd self-assigned this Nov 13, 2024
@Fizzixnerd Fizzixnerd force-pushed the fizzixnerd/logup-pickles branch from b285710 to 0c17f3b Compare November 15, 2024 02:14
@Fizzixnerd Fizzixnerd force-pushed the fizzixnerd/logup-pickles branch from 0c17f3b to 1ec45d7 Compare November 15, 2024 02:36
Copy link
Contributor Author

@Fizzixnerd Fizzixnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some helpful comments.

/// All fixed lookup tables values, indexed by their ID
pub(crate) fixed_tables: BTreeMap<ID, T>,
pub fixed_tables: BTreeMap<ID, T>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be reverted.

msm/src/logup.rs Show resolved Hide resolved
o1vm/src/pickles/column_env.rs Outdated Show resolved Hide resolved
o1vm/src/pickles/column_env.rs Outdated Show resolved Hide resolved
pub scratch: [G; SCRATCH_SIZE],
pub instruction_counter: G,
pub error: G,
#[derive(Clone)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to do some evil clones, will likely need optimizing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, let's keep it for a follow-up

@Fizzixnerd
Copy link
Contributor Author

E2E tests pass! 🎉

@Fizzixnerd Fizzixnerd marked this pull request as ready for review November 26, 2024 21:37
@@ -184,6 +276,26 @@ where
absorb_commitment(&mut fq_sponge, comm)
}

let lookup_env = if !logups.is_empty() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow up I'd remove this if statement, our lookup are never empty

// FIXME: use a proper Challenge structure
let challenges = BerkeleyChallenges {
alpha,
// No permutation argument for the moment
// TODO: No permutation argument for the moment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it' not a TODO, the RAMLookup arg is sufficient, we do not need a perm arg

lookup_terms_evals_d8: &lookup_env.lookup_terms_evals_d8,
lookup_aggregation_evals_d8: &lookup_env.lookup_aggregation_evals_d8,
lookup_counters_evals_d8: &lookup_env.lookup_counters_evals_d8,
fixed_tables_evals_d8: &lookup_env.fixed_lookup_tables_evals_d8,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a follow up, this computation, and other related to fixed tables should be done at setup time

Comment on lines +49 to +53
pub struct Proof<G: KimchiCurve, ID: LookupTableID> {
pub commitments: WitnessColumns<PolyComm<G>, [PolyComm<G>; N_MIPS_SEL_COLS], ID>,
pub zeta_evaluations: WitnessColumns<G::ScalarField, [G::ScalarField; N_MIPS_SEL_COLS], ID>,
pub zeta_omega_evaluations:
WitnessColumns<G::ScalarField, [G::ScalarField; N_MIPS_SEL_COLS], ID>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we reorganize the proof to have less fields, by putting all the commitments in one field (which can have more structure itself), and same for evals ?
This might also help in how we order polys in the opening proof
Just a suggestion, no strong opinion on my side

@Fizzixnerd
Copy link
Contributor Author

Expecting failures.

@@ -90,6 +96,8 @@ pub struct Env<Fp, PreImageOracle: PreImageOracleT> {
pub preimage_key: Option<[u8; 32]>,
pub keccak_env: Option<KeccakEnv<Fp>>,
pub hash_counter: u64,
pub lookup_fixed_tables: FixedTableMap<LookupTableIDs, Fp>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, I would recommend using a fixed size array for efficiency, as we know how many, and which, tables are used in the MIPS interpreter. We focus on efficiency for the witness builder. The reason of using a fixed size array is to mostly use the cache of the CPU and to avoid hitting the memory by using pointers.

// No-op, constraints only
// TODO: keep track of multiplicities of fixed tables here as in Keccak?
fn add_lookup(&mut self, lookup: Lookup<Self::Variable>) {
if let Some(idx) = LookupTable::is_in_table(&lookup.table_id, lookup.value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend using an "assert" as we know exactly which table is used. We don't need this way to do a lookup in a table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants