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

o1vm/mips: use batch_inversion for the witness generation #2813

Merged
merged 15 commits into from
Nov 25, 2024

Conversation

dannywillems
Copy link
Member

@dannywillems dannywillems commented Nov 21, 2024

These fields will be used to keep track of the elements that should be inverted while generating the proof.

Speed from ~250kHz (commit 82464fb) to ~420kHz (head of this branch, i.e. o1vm/batch-inversion).

In a follow-up PR, we should take a look at mrmr1993 idea here to get the same expected performances. Also, we should decrease the number of columns in scratch_state as stated in the FIXME.

On commit 82464fb, getting:

[2024-11-21T14:11:34Z INFO  o1vm::interpreters::mips::witness] processing step=0 pc=00000ae88c insn=000802ba1f ips=0.00 pages=8598 mem=33.6 MiB name=_rt0_mips_linux
[2024-11-21T14:11:38Z INFO  o1vm::interpreters::mips::witness] Snapshot state in snapshot-state-0.json, step 0
[2024-11-21T14:11:42Z INFO  o1vm::interpreters::mips::witness] processing step=1000000 pc=0000016be0 insn=008fa20010 ips=111111.11 pages=8640 mem=33.8 MiB name=runtime.cmpstring
[2024-11-21T14:11:45Z INFO  o1vm::interpreters::mips::witness] processing step=2000000 pc=000029f324 insn=008fa100ac ips=153846.15 pages=8666 mem=33.9 MiB name=crypto/internal/edwards25519/field.feSquareGeneric
[2024-11-21T14:11:49Z INFO  o1vm::interpreters::mips::witness] processing step=3000000 pc=00003ceb20 insn=003c170217 ips=176470.59 pages=8697 mem=34.0 MiB name=encoding/gob.setTypeId
[2024-11-21T14:11:53Z INFO  o1vm::interpreters::mips::witness] processing step=4000000 pc=00000274c0 insn=0000c52821 ips=190476.19 pages=8706 mem=34.0 MiB name=runtime.mapassign_fast32
[2024-11-21T14:11:57Z INFO  o1vm::interpreters::mips::witness] processing step=5000000 pc=00000ebcd0 insn=00afa30004 ips=208333.33 pages=8724 mem=34.1 MiB name=sort.Search
[2024-11-21T14:12:01Z INFO  o1vm::interpreters::mips::witness] processing step=6000000 pc=000037d2e4 insn=0000000027 ips=214285.71 pages=8738 mem=34.1 MiB name=github.com/consensys/gnark-crypto/ecc/bls12-381/fr.(*Element).Mul
[2024-11-21T14:12:04Z INFO  o1vm::interpreters::mips::witness] processing step=7000000 pc=00000eb6ac insn=0003e00008 ips=218750.00 pages=8738 mem=34.1 MiB name=math/bits.Mul64
[2024-11-21T14:12:08Z INFO  o1vm::interpreters::mips::witness] processing step=8000000 pc=00000eb6a4 insn=00afa5002c ips=222222.22 pages=8738 mem=34.1 MiB name=math/bits.Mul64
[2024-11-21T14:12:12Z INFO  o1vm::interpreters::mips::witness] processing step=9000000 pc=000037bda8 insn=0000e31825 ips=225000.00 pages=8738 mem=34.1 MiB name=github.com/consensys/gnark-crypto/ecc/bls12-381/fr.(*Element).Mul
[2024-11-21T14:12:16Z INFO  o1vm::interpreters::mips::witness] processing step=10000000 pc=000037c504 insn=008faa00a8 ips=232558.14 pages=8740 mem=34.1 MiB name=github.com/consensys/gnark-crypto/ecc/bls12-381/fr.(*Element).Mul
[2024-11-21T14:12:19Z INFO  o1vm::interpreters::mips::witness] Snapshot state in snapshot-state-10000000.json, step 10000000
[2024-11-21T14:12:23Z INFO  o1vm::interpreters::mips::witness] processing step=11000000 pc=0000134b24 insn=008fa20078 ips=220000.00 pages=8748 mem=34.2 MiB name=reflect.(*rtype).Field
[2024-11-21T14:12:26Z INFO  o1vm::interpreters::mips::witness] processing step=12000000 pc=0000213ce4 insn=0015800020 ips=222222.22 pages=8759 mem=34.2 MiB name=regexp/syntax.(*parser).parseClass
[2024-11-21T14:12:29Z INFO  o1vm::interpreters::mips::witness] processing step=13000000 pc=000021462c insn=001120004b ips=228070.18 pages=8779 mem=34.3 MiB name=regexp/syntax.appendRange
[2024-11-21T14:12:33Z INFO  o1vm::interpreters::mips::witness] processing step=14000000 pc=000002cc5c insn=002c270200 ips=233333.33 pages=8794 mem=34.4 MiB name=runtime.writeHeapBits.flush
[2024-11-21T14:12:36Z INFO  o1vm::interpreters::mips::witness] processing step=15000000 pc=00000ae49c insn=00ac2efff8 ips=238095.24 pages=8805 mem=34.4 MiB name=runtime.memmove
[2024-11-21T14:12:39Z INFO  o1vm::interpreters::mips::witness] processing step=16000000 pc=00001d4000 insn=0024860001 ips=242424.24 pages=8815 mem=34.4 MiB name=encoding/json.checkValid
[2024-11-21T14:12:42Z INFO  o1vm::interpreters::mips::witness] processing step=17000000 pc=000002ca2c insn=00afa00034 ips=242857.14 pages=8820 mem=34.5 MiB name=runtime.writeHeapBits.write
[2024-11-21T14:12:45Z INFO  o1vm::interpreters::mips::witness] processing step=18000000 pc=000002247c insn=0071ce7020 ips=246575.34 pages=8824 mem=34.5 MiB name=runtime.mallocgc
[2024-11-21T14:12:48Z INFO  o1vm::interpreters::mips::witness] processing step=19000000 pc=000002cc4c insn=008ee6bd14 ips=250000.00 pages=8830 mem=34.5 MiB name=runtime.writeHeapBits.flush
[2024-11-21T14:12:51Z INFO  o1vm::interpreters::mips::witness] processing step=20000000 pc=00003391f8 insn=008c870080 ips=253164.56 pages=8836 mem=34.5 MiB name=gopkg.in/yaml%2ev3.yaml_parser_update_buffer
[2024-11-21T14:12:55Z INFO  o1vm::interpreters::mips::witness] Snapshot state in snapshot-state-20000000.json, step 20000000
[2024-11-21T14:12:58Z INFO  o1vm::interpreters::mips::witness] processing step=21000000 pc=000033c98c insn=0030a60080 ips=244186.05 pages=8842 mem=34.5 MiB name=gopkg.in/yaml%2ev3.read
[2024-11-21T14:13:01Z INFO  o1vm::interpreters::mips::witness] processing step=22000000 pc=0000338f50 insn=0000414823 ips=247191.01 pages=8851 mem=34.6 MiB name=gopkg.in/yaml%2ev3.yaml_parser_update_buffer
[2024-11-21T14:13:05Z INFO  o1vm::interpreters::mips::witness] processing step=23000000 pc=000033d770 insn=00afa30068 ips=250000.00 pages=8854 mem=34.6 MiB name=gopkg.in/yaml%2ev3.yaml_parser_fetch_next_token
[2024-11-21T14:13:08Z INFO  o1vm::interpreters::mips::witness] processing step=24000000 pc=0000349c24 insn=00afa80044 ips=252631.58 pages=8863 mem=34.6 MiB name=gopkg.in/yaml%2ev3.yaml_parser_scan_plain_scalar
[2024-11-21T14:13:11Z INFO  o1vm::interpreters::mips::witness] processing step=25000000 pc=00001c87a4 insn=0000000000 ips=252525.25 pages=8867 mem=34.6 MiB name=encoding/json.unquoteBytes

On the head of this branch:

[2024-11-21T14:14:32Z INFO  o1vm::interpreters::mips::witness] processing step=0 pc=00000ae88c insn=000802ba1f ips=0.00 pages=8598 mem=33.6 MiB name=_rt0_mips_linux
[2024-11-21T14:14:36Z INFO  o1vm::interpreters::mips::witness] Snapshot state in snapshot-state-0.json, step 0
[2024-11-21T14:14:38Z INFO  o1vm::interpreters::mips::witness] processing step=1000000 pc=0000016be0 insn=008fa20010 ips=125000.00 pages=8640 mem=33.8 MiB name=runtime.cmpstring
[2024-11-21T14:14:40Z INFO  o1vm::interpreters::mips::witness] processing step=2000000 pc=000029f324 insn=008fa100ac ips=200000.00 pages=8666 mem=33.9 MiB name=crypto/internal/edwards25519/field.feSquareGeneric
[2024-11-21T14:14:43Z INFO  o1vm::interpreters::mips::witness] processing step=3000000 pc=00003ceb20 insn=003c170217 ips=250000.00 pages=8697 mem=34.0 MiB name=encoding/gob.setTypeId
[2024-11-21T14:14:45Z INFO  o1vm::interpreters::mips::witness] processing step=4000000 pc=00000274c0 insn=0000c52821 ips=266666.67 pages=8706 mem=34.0 MiB name=runtime.mapassign_fast32
[2024-11-21T14:14:48Z INFO  o1vm::interpreters::mips::witness] processing step=5000000 pc=00000ebcd0 insn=00afa30004 ips=294117.65 pages=8724 mem=34.1 MiB name=sort.Search
[2024-11-21T14:14:50Z INFO  o1vm::interpreters::mips::witness] processing step=6000000 pc=000037d2e4 insn=0000000027 ips=300000.00 pages=8738 mem=34.1 MiB name=github.com/consensys/gnark-crypto/ecc/bls12-381/fr.(*Element).Mul
[2024-11-21T14:14:52Z INFO  o1vm::interpreters::mips::witness] processing step=7000000 pc=00000eb6ac insn=0003e00008 ips=318181.82 pages=8738 mem=34.1 MiB name=math/bits.Mul64
[2024-11-21T14:14:54Z INFO  o1vm::interpreters::mips::witness] processing step=8000000 pc=00000eb6a4 insn=00afa5002c ips=333333.33 pages=8738 mem=34.1 MiB name=math/bits.Mul64
[2024-11-21T14:14:56Z INFO  o1vm::interpreters::mips::witness] processing step=9000000 pc=000037bda8 insn=0000e31825 ips=346153.85 pages=8738 mem=34.1 MiB name=github.com/consensys/gnark-crypto/ecc/bls12-381/fr.(*Element).Mul
[2024-11-21T14:14:58Z INFO  o1vm::interpreters::mips::witness] processing step=10000000 pc=000037c504 insn=008faa00a8 ips=357142.86 pages=8740 mem=34.1 MiB name=github.com/consensys/gnark-crypto/ecc/bls12-381/fr.(*Element).Mul
[2024-11-21T14:15:02Z INFO  o1vm::interpreters::mips::witness] Snapshot state in snapshot-state-10000000.json, step 10000000
[2024-11-21T14:15:04Z INFO  o1vm::interpreters::mips::witness] processing step=11000000 pc=0000134b24 insn=008fa20078 ips=323529.41 pages=8748 mem=34.2 MiB name=reflect.(*rtype).Field
[2024-11-21T14:15:06Z INFO  o1vm::interpreters::mips::witness] processing step=12000000 pc=0000213ce4 insn=0015800020 ips=333333.33 pages=8759 mem=34.2 MiB name=regexp/syntax.(*parser).parseClass
[2024-11-21T14:15:08Z INFO  o1vm::interpreters::mips::witness] processing step=13000000 pc=000021462c insn=001120004b ips=342105.26 pages=8779 mem=34.3 MiB name=regexp/syntax.appendRange
[2024-11-21T14:15:10Z INFO  o1vm::interpreters::mips::witness] processing step=14000000 pc=000002cc5c insn=002c270200 ips=358974.36 pages=8794 mem=34.4 MiB name=runtime.writeHeapBits.flush
[2024-11-21T14:15:11Z INFO  o1vm::interpreters::mips::witness] processing step=15000000 pc=00000ae49c insn=00ac2efff8 ips=365853.66 pages=8805 mem=34.4 MiB name=runtime.memmove
[2024-11-21T14:15:13Z INFO  o1vm::interpreters::mips::witness] processing step=16000000 pc=00001d4000 insn=0024860001 ips=372093.02 pages=8815 mem=34.4 MiB name=encoding/json.checkValid
[2024-11-21T14:15:15Z INFO  o1vm::interpreters::mips::witness] processing step=17000000 pc=000002ca2c insn=00afa00034 ips=377777.78 pages=8820 mem=34.5 MiB name=runtime.writeHeapBits.write
[2024-11-21T14:15:17Z INFO  o1vm::interpreters::mips::witness] processing step=18000000 pc=000002247c insn=0071ce7020 ips=382978.72 pages=8824 mem=34.5 MiB name=runtime.mallocgc
[2024-11-21T14:15:19Z INFO  o1vm::interpreters::mips::witness] processing step=19000000 pc=000002cc4c insn=008ee6bd14 ips=395833.33 pages=8830 mem=34.5 MiB name=runtime.writeHeapBits.flush
[2024-11-21T14:15:20Z INFO  o1vm::interpreters::mips::witness] processing step=20000000 pc=00003391f8 insn=008c870080 ips=400000.00 pages=8836 mem=34.5 MiB name=gopkg.in/yaml%2ev3.yaml_parser_update_buffer
[2024-11-21T14:15:24Z INFO  o1vm::interpreters::mips::witness] Snapshot state in snapshot-state-20000000.json, step 20000000
[2024-11-21T14:15:26Z INFO  o1vm::interpreters::mips::witness] processing step=21000000 pc=000033c98c insn=0030a60080 ips=375000.00 pages=8842 mem=34.5 MiB name=gopkg.in/yaml%2ev3.read
[2024-11-21T14:15:28Z INFO  o1vm::interpreters::mips::witness] processing step=22000000 pc=0000338f50 insn=0000414823 ips=379310.34 pages=8851 mem=34.6 MiB name=gopkg.in/yaml%2ev3.yaml_parser_update_buffer
[2024-11-21T14:15:30Z INFO  o1vm::interpreters::mips::witness] processing step=23000000 pc=000033d770 insn=00afa30068 ips=389830.51 pages=8854 mem=34.6 MiB name=gopkg.in/yaml%2ev3.yaml_parser_fetch_next_token
[2024-11-21T14:15:31Z INFO  o1vm::interpreters::mips::witness] processing step=24000000 pc=0000349c24 insn=00afa80044 ips=393442.62 pages=8863 mem=34.6 MiB name=gopkg.in/yaml%2ev3.yaml_parser_scan_plain_scalar
[2024-11-21T14:15:33Z INFO  o1vm::interpreters::mips::witness] processing step=25000000 pc=00001c87a4 insn=0000000000 ips=396825.40 pages=8867 mem=34.6 MiB name=encoding/json.unquoteBytes
[2024-11-21T14:15:35Z INFO  o1vm::interpreters::mips::witness] processing step=26000000 pc=0000349730 insn=0000011825 ips=400000.00 pages=8872 mem=34.7 MiB name=gopkg.in/yaml%2ev3.yaml_parser_scan_plain_scalar
[2024-11-21T14:15:37Z INFO  o1vm::interpreters::mips::witness] processing step=27000000 pc=0000349640 insn=0024420004 ips=402985.07 pages=8878 mem=34.7 MiB name=gopkg.in/yaml%2ev3.yaml_parser_scan_plain_scalar
[2024-11-21T14:15:39Z INFO  o1vm::interpreters::mips::witness] processing step=28000000 pc=0000148a3c insn=0030220060 ips=411764.71 pages=8881 mem=34.7 MiB name=reflect.valueInterface
[2024-11-21T14:15:40Z INFO  o1vm::interpreters::mips::witness] processing step=29000000 pc=00000610ac insn=00ac240014 ips=414285.71 pages=8886 mem=34.7 MiB name=runtime.deferreturn
[2024-11-21T14:15:42Z INFO  o1vm::interpreters::mips::witness] processing step=30000000 pc=000021f3bc insn=00240e0002 ips=416666.67 pages=8891 mem=34.7 MiB name=regexp.(*Regexp).doOnePass
[2024-11-21T14:15:46Z INFO  o1vm::interpreters::mips::witness] Snapshot state in snapshot-state-30000000.json, step 30000000
[2024-11-21T14:15:48Z INFO  o1vm::interpreters::mips::witness] processing step=31000000 pc=00003172b8 insn=0024210004 ips=397435.90 pages=8901 mem=34.8 MiB name=gopkg.in/yaml%2ev3.yaml_insert_token
[2024-11-21T14:15:50Z INFO  o1vm::interpreters::mips::witness] processing step=32000000 pc=0000016bfc insn=001068000c ips=400000.00 pages=8911 mem=34.8 MiB name=runtime.cmpstring
[2024-11-21T14:15:51Z INFO  o1vm::interpreters::mips::witness] processing step=33000000 pc=00003173cc insn=0000000000 ips=407407.41 pages=8915 mem=34.8 MiB name=gopkg.in/yaml%2ev3.yaml_insert_token
[2024-11-21T14:15:53Z INFO  o1vm::interpreters::mips::witness] processing step=34000000 pc=000031a314 insn=00afbf0000 ips=409638.55 pages=8920 mem=34.8 MiB name=gopkg.in/yaml%2ev3.(*decoder).prepare
[2024-11-21T14:15:55Z INFO  o1vm::interpreters::mips::witness] processing step=35000000 pc=00000222b8 insn=0001e84025 ips=411764.71 pages=8935 mem=34.9 MiB name=runtime.mallocgc
[2024-11-21T14:15:57Z INFO  o1vm::interpreters::mips::witness] processing step=36000000 pc=00002155a0 insn=008fa30014 ips=413793.10 pages=8952 mem=35.0 MiB name=regexp/syntax.ranges.Less
[2024-11-21T14:15:59Z INFO  o1vm::interpreters::mips::witness] processing step=37000000 pc=000021443c insn=0000000000 ips=415730.34 pages=8952 mem=35.0 MiB name=regexp/syntax.cleanClass
[2024-11-21T14:16:01Z INFO  o1vm::interpreters::mips::witness] processing step=38000000 pc=00000ef5f4 insn=00afa5000c ips=417582.42 pages=8980 mem=35.1 MiB name=sort.partialInsertionSort

@dannywillems dannywillems marked this pull request as draft November 21, 2024 08:01
@dannywillems dannywillems changed the title o1vm/mips: introduce scratch_state_inverse o1vm/mips: use batch_inversion for the witness generation Nov 21, 2024
@dannywillems dannywillems changed the base branch from master to o1vm/mips/interpreter-remove-inverse-or-zero November 21, 2024 08:36
@dannywillems dannywillems force-pushed the o1vm/batch-inversion branch 2 times, most recently from f384222 to e6169b1 Compare November 21, 2024 10:14
@dannywillems dannywillems force-pushed the o1vm/batch-inversion branch 2 times, most recently from 799172e to b45339e Compare November 21, 2024 14:05
@dannywillems dannywillems marked this pull request as ready for review November 21, 2024 14:16
@dannywillems dannywillems force-pushed the o1vm/batch-inversion branch 2 times, most recently from 4122619 to 8be102a Compare November 21, 2024 16:30
@@ -121,3 +125,31 @@ fn test_small_circuit() {
);
assert!(verif, "Verification fails");
}

#[test]
Copy link
Member Author

@dannywillems dannywillems Nov 21, 2024

Choose a reason for hiding this comment

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

Feel free to disagree with these changes. It is a single commit we can simply delete. I only want to keep a regression test in case arkworks changes.

Copy link
Member

Choose a reason for hiding this comment

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

These are good to visualize the behavior when zeroes are involved.

@@ -50,10 +50,17 @@ pub const NUM_INSTRUCTION_LOOKUP_TERMS: usize = 5;
pub const NUM_LOOKUP_TERMS: usize =
NUM_GLOBAL_LOOKUP_TERMS + NUM_DECODING_LOOKUP_TERMS + NUM_INSTRUCTION_LOOKUP_TERMS;
// TODO: Delete and use a vector instead
// FIXME: since the introduction of the scratch size inverse, the value below
Copy link
Member Author

Choose a reason for hiding this comment

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

This is fixed in #2815.

scratch_state: [Fp::from(0); SCRATCH_SIZE],
scratch_state_inverse: [Fp::from(0); SCRATCH_SIZE_INVERSE],
Copy link
Member Author

Choose a reason for hiding this comment

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

In a future PR, as suggested by @mrmr1993, we can try to use BigInt/BigUInt directly to avoid computation in Montgomery representation. I do not know if it would make it better.

// MIPS + hash_counter + byte_counter + eof + num_bytes_read + chunk + bytes
// + length + has_n_bytes + chunk_bytes + preimage
pub const SCRATCH_SIZE: usize = 98;

/// Number of columns used by the MIPS interpreter to keep values to be
Copy link
Member Author

Choose a reason for hiding this comment

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

To verify it was the minimal value, I did try to use 11, and it failed.
From there, I run for some millions instructions the op-program, and it never failed.

Base automatically changed from o1vm/mips/interpreter-remove-inverse-or-zero to master November 21, 2024 18:19
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 78.62069% with 31 lines in your changes missing coverage. Please review.

Project coverage is 72.15%. Comparing base (1e91814) to head (a11a350).
Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
o1vm/src/interpreters/mips/witness.rs 65.38% 9 Missing ⚠️
o1vm/src/interpreters/mips/column.rs 52.94% 8 Missing ⚠️
o1vm/src/pickles/main.rs 0.00% 7 Missing ⚠️
o1vm/src/pickles/column_env.rs 57.14% 6 Missing ⚠️
o1vm/src/pickles/proof.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2813      +/-   ##
==========================================
+ Coverage   72.10%   72.15%   +0.04%     
==========================================
  Files         256      256              
  Lines       59946    60042      +96     
==========================================
+ Hits        43227    43326      +99     
+ Misses      16719    16716       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Member

@querolita querolita left a comment

Choose a reason for hiding this comment

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

This looks neat to me. It integrates nicely with the existing code. I would merge this for now and then think about optimizations later.

@@ -106,6 +115,12 @@ impl<Fp: Field, PreImageOracle: PreImageOracleT> InterpreterEnv for Env<Fp, PreI
Column::ScratchState(scratch_idx)
}

fn alloc_scratch_inverse(&mut self) -> Self::Position {
Copy link
Member

Choose a reason for hiding this comment

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

It seems like this function for the mips witness is the same as the one in the mips constraints. I wonder if it could be generically defined in the interpreter itself, but probably not directly given that it uses the fact that it accesses a self.scratch_state_idx_inverse. Maybe environments can be defined to implement a trait that returns it, but not sure if it is worth the code duplication.

Copy link
Member Author

Choose a reason for hiding this comment

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

I do think it is fine at the moment. Agree it is a bit "annoying"/"ugly" to have duplicated code. But lgtm for the moment.

let inv_or_zero = if *x == 0 {
Fp::zero()
let pos = self.alloc_scratch_inverse();
if *x == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure why there's this if-else distinction if it always writes in the inverse scratch state. Is it to avoid a conversion in case Fp::zero() is faster than Fp:from(0)? Either way I suppose the batch inversion algorithm will just ignore zeros, I believe I checked that in the arkworks code.

Copy link
Member Author

Choose a reason for hiding this comment

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

No reason. Seems to be an ugly code 😅. For a follow-up.

o1vm/src/interpreters/mips/witness.rs Show resolved Hide resolved
@@ -36,8 +39,9 @@ pub struct ColumnEnvironment<'a, F: FftField> {
}

pub fn get_all_columns() -> Vec<Column> {
let mut cols = Vec::<Column>::with_capacity(SCRATCH_SIZE + 2 + N_MIPS_SEL_COLS);
for i in 0..SCRATCH_SIZE + 2 {
let mut cols =
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps use N_MIPS_REL_COLS, or you want to be super explicit here?

Copy link
Member Author

@dannywillems dannywillems Nov 25, 2024

Choose a reason for hiding this comment

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

No, you are right about using N_MIPS_REL_COLS.

o1vm/src/pickles/prover.rs Show resolved Hide resolved
@@ -121,3 +125,31 @@ fn test_small_circuit() {
);
assert!(verif, "Verification fails");
}

#[test]
Copy link
Member

Choose a reason for hiding this comment

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

These are good to visualize the behavior when zeroes are involved.

@dannywillems dannywillems merged commit 1f1ceb8 into master Nov 25, 2024
8 checks passed
@dannywillems dannywillems deleted the o1vm/batch-inversion branch November 25, 2024 13:34
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.

2 participants