From 45660e6224cdcaa3054d1810bdde5e54f57d83cb Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Tue, 6 Jan 2026 10:30:02 -0800 Subject: [PATCH 1/6] feat: update segmentation weights for v2 --- benchmarks/prove/src/bin/async_regex.rs | 4 +- benchmarks/prove/src/util.rs | 8 +- crates/cli/src/commands/prove.rs | 12 +-- .../vm/src/arch/execution_mode/metered/ctx.rs | 14 ++- .../execution_mode/metered/segment_ctx.rs | 86 +++++++++++++------ .../src/arch/execution_mode/metered_cost.rs | 4 +- 6 files changed, 88 insertions(+), 40 deletions(-) diff --git a/benchmarks/prove/src/bin/async_regex.rs b/benchmarks/prove/src/bin/async_regex.rs index c41d730f59..0aa7e4bfa7 100644 --- a/benchmarks/prove/src/bin/async_regex.rs +++ b/benchmarks/prove/src/bin/async_regex.rs @@ -23,13 +23,13 @@ async fn main() -> eyre::Result<()> { .limits .set_max_trace_height(max_height); } - if let Some(max_cells) = args.segment_max_cells { + if let Some(max_memory) = args.segment_max_memory { config .app_vm_config .as_mut() .segmentation_config .limits - .set_max_cells(max_cells); + .set_max_memory(max_memory); } let sdk = Sdk::new(config)?; diff --git a/benchmarks/prove/src/util.rs b/benchmarks/prove/src/util.rs index 52b02ba862..e4d7942118 100644 --- a/benchmarks/prove/src/util.rs +++ b/benchmarks/prove/src/util.rs @@ -66,9 +66,9 @@ pub struct BenchmarkCli { #[arg(long, alias = "max_segment_length")] pub max_segment_length: Option, - /// Total cells used in all chips in segment for continuations + /// Total memory in bytes used in all chips in segment for continuations #[arg(long)] - pub segment_max_cells: Option, + pub segment_max_memory: Option, /// Controls the arity (num_children) of the aggregation tree #[command(flatten)] @@ -96,12 +96,12 @@ impl BenchmarkCli { .limits .set_max_trace_height(max_height); } - if let Some(max_cells) = self.segment_max_cells { + if let Some(max_memory) = self.segment_max_memory { app_vm_config .as_mut() .segmentation_config .limits - .set_max_cells(max_cells); + .set_max_memory(max_memory); } AppConfig { app_fri_params: FriParameters::standard_with_100_bits_conjectured_security( diff --git a/crates/cli/src/commands/prove.rs b/crates/cli/src/commands/prove.rs index 640fd0c5ef..e652039d66 100644 --- a/crates/cli/src/commands/prove.rs +++ b/crates/cli/src/commands/prove.rs @@ -4,7 +4,7 @@ use clap::Parser; use eyre::Result; use openvm_circuit::arch::{ execution_mode::metered::segment_ctx::{ - SegmentationConfig, SegmentationLimits, DEFAULT_MAX_CELLS, DEFAULT_MAX_TRACE_HEIGHT_BITS, + SegmentationConfig, SegmentationLimits, DEFAULT_MAX_MEMORY, DEFAULT_MAX_TRACE_HEIGHT_BITS, }, instructions::exe::VmExe, }; @@ -133,14 +133,14 @@ pub struct SegmentationArgs { help_heading = "OpenVM Options" )] pub segment_max_height_bits: u8, - /// Total cells used across all chips for triggering segmentation for continuations in the app - /// proof. These thresholds are not exceeded except when they are too small. + /// Total memory in bytes used across all chips for triggering segmentation for continuations + /// in the app proof. These thresholds are not exceeded except when they are too small. #[arg( long, - default_value_t = DEFAULT_MAX_CELLS, + default_value_t = DEFAULT_MAX_MEMORY, help_heading = "OpenVM Options" )] - pub segment_max_cells: usize, + pub segment_max_memory: usize, } impl ProveCmd { @@ -318,7 +318,7 @@ impl From for SegmentationConfig { 1u32.checked_shl(args.segment_max_height_bits as u32) .expect("segment_max_height_bits too large"), ) - .with_max_cells(args.segment_max_cells), + .with_max_memory(args.segment_max_memory), ..Default::default() } } diff --git a/crates/vm/src/arch/execution_mode/metered/ctx.rs b/crates/vm/src/arch/execution_mode/metered/ctx.rs index 7d133abcba..0aeac3343e 100644 --- a/crates/vm/src/arch/execution_mode/metered/ctx.rs +++ b/crates/vm/src/arch/execution_mode/metered/ctx.rs @@ -103,8 +103,8 @@ impl MeteredCtx { self } - pub fn with_max_cells(mut self, max_cells: usize) -> Self { - self.segmentation_ctx.set_max_cells(max_cells); + pub fn with_max_memory(mut self, max_memory: usize) -> Self { + self.segmentation_ctx.set_max_memory(max_memory); self } @@ -127,11 +127,21 @@ impl MeteredCtx { self } + pub fn with_main_cell_weight(mut self, weight: usize) -> Self { + self.segmentation_ctx.set_main_cell_weight(weight); + self + } + pub fn with_interaction_cell_weight(mut self, weight: usize) -> Self { self.segmentation_ctx.set_interaction_cell_weight(weight); self } + pub fn with_base_field_size(mut self, base_field_size: usize) -> Self { + self.segmentation_ctx.set_base_field_size(base_field_size); + self + } + pub fn segments(&self) -> &[Segment] { &self.segmentation_ctx.segments } diff --git a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs index e495736976..0fe879435c 100644 --- a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs +++ b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs @@ -1,3 +1,5 @@ +use std::mem::size_of; + use getset::{Setters, WithSetters}; use openvm_stark_backend::p3_field::PrimeField32; use p3_baby_bear::BabyBear; @@ -7,7 +9,7 @@ pub const DEFAULT_SEGMENT_CHECK_INSNS: u64 = 1000; pub const DEFAULT_MAX_TRACE_HEIGHT_BITS: u8 = 22; pub const DEFAULT_MAX_TRACE_HEIGHT: u32 = 1 << DEFAULT_MAX_TRACE_HEIGHT_BITS; -pub const DEFAULT_MAX_CELLS: usize = 1_200_000_000; // 1.2B +pub const DEFAULT_MAX_MEMORY: usize = 15 << 30; // 15GB const DEFAULT_MAX_INTERACTIONS: usize = BabyBear::ORDER_U32 as usize; #[derive(derive_new::new, Clone, Debug, Serialize, Deserialize)] @@ -17,19 +19,36 @@ pub struct Segment { pub trace_heights: Vec, } -#[derive(Clone, Debug, Default, WithSetters)] +#[derive(Clone, Debug, WithSetters)] pub struct SegmentationConfig { pub limits: SegmentationLimits, - /// Cells per row contributed by each interaction in cell count. + /// Weight multiplier for main trace cells in memory calculation. + #[getset(set_with = "pub")] + pub main_cell_weight: usize, + /// Weight multiplier for interaction cells in memory calculation. #[getset(set_with = "pub")] pub interaction_cell_weight: usize, + /// Size of the base field in bytes. Used to convert cell count to memory bytes. + #[getset(set_with = "pub")] + pub base_field_size: usize, +} + +impl Default for SegmentationConfig { + fn default() -> Self { + Self { + limits: SegmentationLimits::default(), + main_cell_weight: 3, + interaction_cell_weight: 8, + base_field_size: size_of::(), + } + } } #[derive(Clone, Debug, WithSetters, Setters)] pub struct SegmentationLimits { pub max_trace_height: u32, #[getset(set = "pub", set_with = "pub")] - pub max_cells: usize, + pub max_memory: usize, #[getset(set_with = "pub")] pub max_interactions: usize, } @@ -38,21 +57,21 @@ impl Default for SegmentationLimits { fn default() -> Self { Self { max_trace_height: DEFAULT_MAX_TRACE_HEIGHT, - max_cells: DEFAULT_MAX_CELLS, + max_memory: DEFAULT_MAX_MEMORY, max_interactions: DEFAULT_MAX_INTERACTIONS, } } } impl SegmentationLimits { - pub fn new(max_trace_height: u32, max_cells: usize, max_interactions: usize) -> Self { + pub fn new(max_trace_height: u32, max_memory: usize, max_interactions: usize) -> Self { debug_assert!( max_trace_height.is_power_of_two(), "max_trace_height should be a power of two" ); Self { max_trace_height, - max_cells, + max_memory, max_interactions, } } @@ -120,18 +139,26 @@ impl SegmentationCtx { self.config.limits.set_max_trace_height(max_trace_height); } - pub fn set_max_cells(&mut self, max_cells: usize) { - self.config.limits.max_cells = max_cells; + pub fn set_max_memory(&mut self, max_memory: usize) { + self.config.limits.max_memory = max_memory; } pub fn set_max_interactions(&mut self, max_interactions: usize) { self.config.limits.max_interactions = max_interactions; } + pub fn set_main_cell_weight(&mut self, weight: usize) { + self.config.main_cell_weight = weight; + } + pub fn set_interaction_cell_weight(&mut self, weight: usize) { self.config.interaction_cell_weight = weight; } + pub fn set_base_field_size(&mut self, base_field_size: usize) { + self.config.base_field_size = base_field_size; + } + /// Calculate the maximum trace height and corresponding air name #[inline(always)] fn calculate_max_trace_height_with_name(&self, trace_heights: &[u32]) -> (u32, &str) { @@ -144,22 +171,29 @@ impl SegmentationCtx { .unwrap_or((0, "unknown")) } - /// Calculate the total cells used based on trace heights and widths, - /// including weighted contribution from interactions if `interaction_cell_weight > 0`. + /// Calculate total memory in bytes based on trace heights and widths. + /// Formula: base_field_size * (main_cell_weight * main_cells + interaction_cell_weight * + /// interaction_cells) #[inline(always)] - fn calculate_total_cells(&self, trace_heights: &[u32]) -> usize { + fn calculate_total_memory(&self, trace_heights: &[u32]) -> usize { debug_assert_eq!(trace_heights.len(), self.widths.len()); + let main_weight = self.config.main_cell_weight; let interaction_weight = self.config.interaction_cell_weight; - trace_heights + let base_field_size = self.config.base_field_size; + + let total_cells: usize = trace_heights .iter() .zip(self.widths.iter()) .zip(self.interactions.iter()) .map(|((&height, &width), &interactions)| { let padded_height = height.next_power_of_two() as usize; - padded_height * (width + interactions * interaction_weight) + padded_height * width * main_weight + + padded_height * interactions * interaction_weight }) - .sum() + .sum(); + + total_cells * base_field_size } /// Calculate the total interactions based on trace heights @@ -199,8 +233,10 @@ impl SegmentationCtx { return false; } + let main_weight = self.config.main_cell_weight; let interaction_weight = self.config.interaction_cell_weight; - let mut total_cells = 0; + let base_field_size = self.config.base_field_size; + let mut total_cells: usize = 0; for (i, (((padded_height, width), interactions), is_constant)) in trace_heights .iter() .map(|&height| height.next_power_of_two()) @@ -223,15 +259,17 @@ impl SegmentationCtx { ); return true; } - total_cells += padded_height as usize * (width + interactions * interaction_weight); + total_cells += padded_height as usize * width * main_weight + + padded_height as usize * interactions * interaction_weight; } + let total_memory = total_cells * base_field_size; - if total_cells > self.config.limits.max_cells { + if total_memory > self.config.limits.max_memory { tracing::info!( - "instret {:10} | total cells ({:10}) > max ({:10})", + "instret {:10} | total memory ({:10}) > max ({:10})", instret, - total_cells, - self.config.limits.max_cells + total_memory, + self.config.limits.max_memory ); return true; } @@ -403,18 +441,18 @@ impl SegmentationCtx { trace_heights: &[u32], ) { let (max_trace_height, air_name) = self.calculate_max_trace_height_with_name(trace_heights); - let total_cells = self.calculate_total_cells(trace_heights); + let total_memory = self.calculate_total_memory(trace_heights); let total_interactions = self.calculate_total_interactions(trace_heights); let utilization = self.calculate_trace_utilization(trace_heights); let final_marker = if IS_FINAL { " [TERMINATED]" } else { "" }; tracing::info!( - "Segment {:3} | instret {:10} | {:8} instructions | {:10} cells | {:10} interactions | {:8} max height ({}) | {:.2}% utilization{}", + "Segment {:3} | instret {:10} | {:8} instructions | {:10} memory | {:10} interactions | {:8} max height ({}) | {:.2}% utilization{}", self.segments.len(), instret_start, num_insns, - total_cells, + total_memory, total_interactions, max_trace_height, air_name, diff --git a/crates/vm/src/arch/execution_mode/metered_cost.rs b/crates/vm/src/arch/execution_mode/metered_cost.rs index 925bd25af2..924d05edf9 100644 --- a/crates/vm/src/arch/execution_mode/metered_cost.rs +++ b/crates/vm/src/arch/execution_mode/metered_cost.rs @@ -5,14 +5,14 @@ use openvm_instructions::riscv::RV32_IMM_AS; use crate::{ arch::{ - execution_mode::metered::segment_ctx::DEFAULT_MAX_CELLS as DEFAULT_SEGMENT_MAX_CELLS, + execution_mode::metered::segment_ctx::DEFAULT_MAX_MEMORY as DEFAULT_SEGMENT_MAX_MEMORY, ExecutionCtxTrait, MeteredExecutionCtxTrait, SystemConfig, VmExecState, }, system::memory::online::GuestMemory, }; const DEFAULT_MAX_SEGMENTS: u64 = 100; -pub const DEFAULT_MAX_COST: u64 = DEFAULT_MAX_SEGMENTS * DEFAULT_SEGMENT_MAX_CELLS as u64; +pub const DEFAULT_MAX_COST: u64 = DEFAULT_MAX_SEGMENTS * DEFAULT_SEGMENT_MAX_MEMORY as u64; #[derive(Clone, Debug)] pub struct AccessAdapterCtx { From c716616e0d964aae3ab47891319116203806590e Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Tue, 6 Jan 2026 10:55:25 -0800 Subject: [PATCH 2/6] chore: constants --- crates/vm/src/arch/execution_mode/metered/segment_ctx.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs index 0fe879435c..6223de9e69 100644 --- a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs +++ b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs @@ -11,6 +11,8 @@ pub const DEFAULT_MAX_TRACE_HEIGHT_BITS: u8 = 22; pub const DEFAULT_MAX_TRACE_HEIGHT: u32 = 1 << DEFAULT_MAX_TRACE_HEIGHT_BITS; pub const DEFAULT_MAX_MEMORY: usize = 15 << 30; // 15GB const DEFAULT_MAX_INTERACTIONS: usize = BabyBear::ORDER_U32 as usize; +const DEFAULT_MAIN_CELL_WEIGHT: usize = 3; // 1 + 2^{log_blowup=1} +const DEFAULT_INTERACTION_CELL_WEIGHT: usize = 8; // 2 * D_EF #[derive(derive_new::new, Clone, Debug, Serialize, Deserialize)] pub struct Segment { @@ -37,8 +39,8 @@ impl Default for SegmentationConfig { fn default() -> Self { Self { limits: SegmentationLimits::default(), - main_cell_weight: 3, - interaction_cell_weight: 8, + main_cell_weight: DEFAULT_MAIN_CELL_WEIGHT, + interaction_cell_weight: DEFAULT_INTERACTION_CELL_WEIGHT, base_field_size: size_of::(), } } From efc7ad6217cc732f43eb4705b8076549628cae11 Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Tue, 6 Jan 2026 19:03:23 +0000 Subject: [PATCH 3/6] chore: comment --- .github/workflows/base-tests.cuda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/base-tests.cuda.yml b/.github/workflows/base-tests.cuda.yml index 0095b2d9ad..2a799eccb9 100644 --- a/.github/workflows/base-tests.cuda.yml +++ b/.github/workflows/base-tests.cuda.yml @@ -74,4 +74,4 @@ jobs: # - name: Run async concurrency test # working-directory: benchmarks/prove # run: | - # CUDA_OPT_LEVEL=3 MAX_CONCURRENCY=5 cargo run --bin async_regex --features cuda,async -- --max-segment-length $((1<<20)) --segment-max-cells 150000000 + # CUDA_OPT_LEVEL=3 MAX_CONCURRENCY=5 cargo run --bin async_regex --features cuda,async -- --max-segment-length $((1<<20)) --segment-max-memory 16106127360 From 3406f616d12e658fe9781ed2a992cc05338b1e44 Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Tue, 6 Jan 2026 20:13:27 +0000 Subject: [PATCH 4/6] feat: logging and n_logup adjustment --- Cargo.toml | 1 + crates/vm/Cargo.toml | 1 + .../execution_mode/metered/segment_ctx.rs | 61 +++++++++++++------ 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c9de6ae048..2b0f3bf636 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -233,6 +233,7 @@ libloading = "0.8" tracing-subscriber = { version = "0.3.20", features = ["std", "env-filter"] } tokio = "1" # >=1.0.0 to allow downstream flexibility abi_stable = "0.11.3" +bytesize = "2.0" # default-features = false for no_std for use in guest programs itertools = { version = "0.14.0", default-features = false } diff --git a/crates/vm/Cargo.toml b/crates/vm/Cargo.toml index 702675f73a..240cfef4b3 100644 --- a/crates/vm/Cargo.toml +++ b/crates/vm/Cargo.toml @@ -46,6 +46,7 @@ cfg-if.workspace = true libloading = { workspace = true, optional = true } tempfile = { workspace = true, optional = true } abi_stable.workspace = true +bytesize.workspace = true [build-dependencies] openvm-cuda-builder = { workspace = true, optional = true } diff --git a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs index 6223de9e69..fa2d707932 100644 --- a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs +++ b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs @@ -1,5 +1,6 @@ use std::mem::size_of; +use bytesize::ByteSize; use getset::{Setters, WithSetters}; use openvm_stark_backend::p3_field::PrimeField32; use p3_baby_bear::BabyBear; @@ -177,25 +178,40 @@ impl SegmentationCtx { /// Formula: base_field_size * (main_cell_weight * main_cells + interaction_cell_weight * /// interaction_cells) #[inline(always)] - fn calculate_total_memory(&self, trace_heights: &[u32]) -> usize { + fn calculate_total_memory( + &self, + trace_heights: &[u32], + ) -> ( + usize, /* memory */ + usize, /* main */ + usize, /* interaction */ + ) { debug_assert_eq!(trace_heights.len(), self.widths.len()); let main_weight = self.config.main_cell_weight; let interaction_weight = self.config.interaction_cell_weight; let base_field_size = self.config.base_field_size; - let total_cells: usize = trace_heights + let mut main_cnt = 0; + let mut interaction_cnt = 0; + for ((&height, &width), &interactions) in trace_heights .iter() .zip(self.widths.iter()) .zip(self.interactions.iter()) - .map(|((&height, &width), &interactions)| { - let padded_height = height.next_power_of_two() as usize; - padded_height * width * main_weight - + padded_height * interactions * interaction_weight - }) - .sum(); + { + let padded_height = height.next_power_of_two() as usize; + main_cnt += padded_height * width; + interaction_cnt += padded_height * interactions; + } - total_cells * base_field_size + let main_memory = main_cnt * main_weight * base_field_size; + let interaction_memory = + (interaction_cnt + 1).next_power_of_two() * interaction_weight * base_field_size; + ( + main_memory + interaction_memory, + main_memory, + interaction_memory, + ) } /// Calculate the total interactions based on trace heights @@ -238,7 +254,8 @@ impl SegmentationCtx { let main_weight = self.config.main_cell_weight; let interaction_weight = self.config.interaction_cell_weight; let base_field_size = self.config.base_field_size; - let mut total_cells: usize = 0; + let mut main_cnt = 0usize; + let mut interaction_cnt = 0usize; for (i, (((padded_height, width), interactions), is_constant)) in trace_heights .iter() .map(|&height| height.next_power_of_two()) @@ -261,17 +278,22 @@ impl SegmentationCtx { ); return true; } - total_cells += padded_height as usize * width * main_weight - + padded_height as usize * interactions * interaction_weight; + main_cnt += padded_height as usize * width; + interaction_cnt += padded_height as usize * interactions; } - let total_memory = total_cells * base_field_size; + // interaction rounding to match n_logup calculation + let total_memory = (main_cnt * main_weight + + (interaction_cnt + 1).next_power_of_two() * interaction_weight) + * base_field_size; if total_memory > self.config.limits.max_memory { tracing::info!( - "instret {:10} | total memory ({:10}) > max ({:10})", + "instret {:10} | total memory ({:10}) > max ({:10}) | main ({:10}) | interaction ({:10})", instret, total_memory, - self.config.limits.max_memory + self.config.limits.max_memory, + main_cnt, + interaction_cnt ); return true; } @@ -443,18 +465,21 @@ impl SegmentationCtx { trace_heights: &[u32], ) { let (max_trace_height, air_name) = self.calculate_max_trace_height_with_name(trace_heights); - let total_memory = self.calculate_total_memory(trace_heights); + let (total_memory, main_memory, interaction_memory) = + self.calculate_total_memory(trace_heights); let total_interactions = self.calculate_total_interactions(trace_heights); let utilization = self.calculate_trace_utilization(trace_heights); let final_marker = if IS_FINAL { " [TERMINATED]" } else { "" }; tracing::info!( - "Segment {:3} | instret {:10} | {:8} instructions | {:10} memory | {:10} interactions | {:8} max height ({}) | {:.2}% utilization{}", + "Segment {:3} | instret {:10} | {:8} instructions | {:5} memory ({:5}, {:5}) | {:10} interactions | {:8} max height ({}) | {:.2}% utilization{}", self.segments.len(), instret_start, num_insns, - total_memory, + ByteSize::b(total_memory as u64), + ByteSize::b(main_memory as u64), + ByteSize::b(interaction_memory as u64), total_interactions, max_trace_height, air_name, From 9f04eef864c16010b2c80bc72e3fcbb6534e23a1 Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:42:37 -0800 Subject: [PATCH 5/6] Update crates/vm/src/arch/execution_mode/metered/segment_ctx.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- crates/vm/src/arch/execution_mode/metered/segment_ctx.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs index fa2d707932..c5b8101784 100644 --- a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs +++ b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs @@ -10,7 +10,7 @@ pub const DEFAULT_SEGMENT_CHECK_INSNS: u64 = 1000; pub const DEFAULT_MAX_TRACE_HEIGHT_BITS: u8 = 22; pub const DEFAULT_MAX_TRACE_HEIGHT: u32 = 1 << DEFAULT_MAX_TRACE_HEIGHT_BITS; -pub const DEFAULT_MAX_MEMORY: usize = 15 << 30; // 15GB +pub const DEFAULT_MAX_MEMORY: usize = 15 << 30; // 15GiB const DEFAULT_MAX_INTERACTIONS: usize = BabyBear::ORDER_U32 as usize; const DEFAULT_MAIN_CELL_WEIGHT: usize = 3; // 1 + 2^{log_blowup=1} const DEFAULT_INTERACTION_CELL_WEIGHT: usize = 8; // 2 * D_EF From dbe57a8fcb432881e8d53038028523d81d537c03 Mon Sep 17 00:00:00 2001 From: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com> Date: Tue, 6 Jan 2026 20:49:03 +0000 Subject: [PATCH 6/6] chore: clarify logging --- crates/vm/src/arch/execution_mode/metered/segment_ctx.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs index c5b8101784..88389d726b 100644 --- a/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs +++ b/crates/vm/src/arch/execution_mode/metered/segment_ctx.rs @@ -269,7 +269,7 @@ impl SegmentationCtx { if !is_constant && padded_height > self.config.limits.max_trace_height { let air_name = unsafe { self.air_names.get_unchecked(i) }; tracing::info!( - "instret {:10} | height ({:8}) > max ({:8}) | chip {:3} ({}) ", + "overshoot: instret {:10} | height ({:8}) > max ({:8}) | chip {:3} ({}) ", instret, padded_height, self.config.limits.max_trace_height, @@ -288,7 +288,7 @@ impl SegmentationCtx { if total_memory > self.config.limits.max_memory { tracing::info!( - "instret {:10} | total memory ({:10}) > max ({:10}) | main ({:10}) | interaction ({:10})", + "overshoot: instret {:10} | total memory ({:10}) > max ({:10}) | main ({:10}) | interaction ({:10})", instret, total_memory, self.config.limits.max_memory, @@ -301,7 +301,7 @@ impl SegmentationCtx { let total_interactions = self.calculate_total_interactions(trace_heights); if total_interactions > self.config.limits.max_interactions { tracing::info!( - "instret {:10} | total interactions ({:10}) > max ({:10})", + "overshoot: instret {:10} | total interactions ({:10}) > max ({:10})", instret, total_interactions, self.config.limits.max_interactions