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] support custom segmentation strategy #1245

Closed
wants to merge 7 commits into from

Conversation

luffykai
Copy link
Contributor

@luffykai luffykai commented Jan 21, 2025

based on discussion from #1217

fix INT-3005

@@ -27,6 +29,40 @@ use crate::{
/// Check segment every 100 instructions.
const SEGMENT_CHECK_INTERVAL: usize = 100;

const DEFAULT_MAX_SEGMENT_LEN: usize = (1 << 22) - 100;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

from #1217

const DEFAULT_MAX_CELLS_PER_CHIP_IN_SEGMENT: usize = DEFAULT_MAX_SEGMENT_LEN * 120;

pub trait SegmentationStrategy {
fn should_segment(&self, trace_heights: &[usize], trace_cells: &[usize]) -> bool;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think it's more general to take the chip_complex as the input, but that has some generic types and I wasn't able to get it work with Arc<dyn>.
Do we think there are other information needed to determine if one should segment?

@luffykai luffykai marked this pull request as draft January 21, 2025 22:23

This comment has been minimized.

This comment has been minimized.

@@ -59,6 +59,16 @@ impl<VC> ContinuationProver<VC> {
self
}

pub fn set_max_segment_len(&mut self, max_segment_len: usize) -> &mut Self {
self.stark_prover
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should refactor somehow

This comment has been minimized.

@@ -67,8 +67,7 @@ impl NativeConfig {
..Default::default()
},
num_public_values,
)
.with_max_segment_len((1 << 24) - 100),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm i am not sure where should put this.
It might be more ideal for this segment strategy to be vm_config so all the "config values" are in one place... but couldn't not make it serde

Copy link

group app.proof_time_ms app.cycles app.cells_used leaf.proof_time_ms leaf.cycles leaf.cells_used
verify_fibair 2,268 511,832 19,309,989 - - -
fibonacci_program (+254 [+4.2%]) 6,266 1,500,137 51,505,102 - - -
regex_program (+413 [+2.2%]) 19,340 4,190,904 165,028,173 - - -
ecrecover_program (+62 [+2.4%]) 2,645 285,401 15,092,297 - - -

Commit: 7bf930d

Benchmark Workflow

@luffykai luffykai marked this pull request as ready for review January 22, 2025 12:42
@luffykai
Copy link
Contributor Author

for #1254

@luffykai luffykai closed this Jan 22, 2025
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.

1 participant