Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4711613
Establish entry
darth-cy Jun 8, 2025
0354d4e
Add opcode MULTI_OBSERVE
darth-cy Jun 10, 2025
5b12fe8
feat: rewrite sample_ext using new IR instruction
roynalnaruto Jun 5, 2025
e074e27
chore(doc): update comment
roynalnaruto Jun 10, 2025
9860915
feat(openvm_circuit): store span info in cycle tracker for convenient…
roynalnaruto Jun 11, 2025
0107c85
Fix annotation, address spaces and register assignments
darth-cy Jun 11, 2025
b0c782a
Consolidate MultiObserve chip debugging
darth-cy Jul 16, 2025
c837427
Preserve testing environment
darth-cy Jul 16, 2025
fe98b6c
Fix constraints
darth-cy Jul 17, 2025
99b0593
Fix constraints
darth-cy Jul 18, 2025
ddd2f30
Fix constraints
darth-cy Jul 18, 2025
67a2aed
Fix constraints
darth-cy Jul 18, 2025
9bf9b78
Fix constraint
darth-cy Jul 20, 2025
a639d74
Fix constraints
darth-cy Jul 20, 2025
a7e29b5
Complete constraints
darth-cy Jul 20, 2025
704de9d
Remove debug code
darth-cy Jul 20, 2025
b6d2fcf
Remove multi observe logic from poseidon2 chip
darth-cy Jul 21, 2025
b6629ca
Resolve minor build issue
darth-cy Jul 22, 2025
831470c
Resolve minor build issue
darth-cy Jul 22, 2025
30e2e3f
set log_blowup=1
kunxian-xia Aug 7, 2025
b3f2557
Debug constraints
darth-cy Aug 10, 2025
ab395c9
Debug constraints
darth-cy Aug 10, 2025
e48121a
Debug constraints
darth-cy Aug 10, 2025
a04ac45
Debug constraints
darth-cy Aug 10, 2025
694fb2f
Remove standalone chip
darth-cy Aug 11, 2025
e4b2046
Populate poseidon2 columns
darth-cy Aug 11, 2025
76c1db6
Reduce columns
darth-cy Aug 11, 2025
e0a6d29
Add more constraints
darth-cy Aug 11, 2025
af58970
Remove debug flags
darth-cy Aug 11, 2025
e7e88b8
Grammatic correction
darth-cy Aug 12, 2025
85d7d0b
Add constraints
darth-cy Aug 13, 2025
b7351bb
remove unrelated log file
kunxian-xia Aug 13, 2025
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
14 changes: 8 additions & 6 deletions crates/vm/src/arch/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,18 @@ impl<F: PrimeField32, VC: VmConfig<F>> ExecutionSegment<F, VC> {
Some(SysPhantom::CtStart) =>
{
#[cfg(feature = "bench-metrics")]
metrics
.cycle_tracker
.start(dsl_instr.cloned().unwrap_or("Default".to_string()))
metrics.cycle_tracker.start(
dsl_instr.cloned().unwrap_or("Default".to_string()),
metrics.cycle_count,
)
}
Some(SysPhantom::CtEnd) =>
{
#[cfg(feature = "bench-metrics")]
metrics
.cycle_tracker
.end(dsl_instr.cloned().unwrap_or("Default".to_string()))
metrics.cycle_tracker.end(
dsl_instr.cloned().unwrap_or("Default".to_string()),
metrics.cycle_count,
)
}
_ => {}
}
Expand Down
47 changes: 37 additions & 10 deletions crates/vm/src/metrics/cycle_tracker/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
/// Stats for a nested span in the execution segment that is tracked by the [`CycleTracker`].
#[derive(Clone, Debug, Default)]
pub struct SpanInfo {
/// The name of the span.
pub tag: String,
/// The cycle count at which the span starts.
pub start: usize,
}

#[derive(Clone, Debug, Default)]
pub struct CycleTracker {
/// Stack of span names, with most recent at the end
stack: Vec<String>,
stack: Vec<SpanInfo>,
/// Depth of the stack.
depth: usize,
}

impl CycleTracker {
Expand All @@ -10,29 +21,41 @@ impl CycleTracker {
}

pub fn top(&self) -> Option<&String> {
self.stack.last()
match self.stack.last() {
Some(span) => Some(&span.tag),
_ => None
}
}

/// Starts a new cycle tracker span for the given name.
/// If a span already exists for the given name, it ends the existing span and pushes a new one
/// to the vec.
pub fn start(&mut self, mut name: String) {
/// If a span already exists for the given name, it ends the existing span and pushes a new one to the vec.
pub fn start(&mut self, mut name: String, cycles_count: usize) {
// hack to remove "CT-" prefix
if name.starts_with("CT-") {
name = name.split_off(3);
}
self.stack.push(name);
self.stack.push(SpanInfo {
tag: name.clone(),
start: cycles_count,
});
let padding = "│ ".repeat(self.depth);
tracing::info!("{}┌╴{}", padding, name);
self.depth += 1;
}

/// Ends the cycle tracker span for the given name.
/// If no span exists for the given name, it panics.
pub fn end(&mut self, mut name: String) {
pub fn end(&mut self, mut name: String, cycles_count: usize) {
// hack to remove "CT-" prefix
if name.starts_with("CT-") {
name = name.split_off(3);
}
let stack_top = self.stack.pop();
assert_eq!(stack_top.unwrap(), name, "Stack top does not match name");
let SpanInfo { tag, start } = self.stack.pop().unwrap();
assert_eq!(tag, name, "Stack top does not match name");
self.depth -= 1;
let padding = "│ ".repeat(self.depth);
let span_cycles = cycles_count - start;
tracing::info!("{}└╴{} cycles", padding, span_cycles);
}

/// Ends the current cycle tracker span.
Expand All @@ -42,7 +65,11 @@ impl CycleTracker {

/// Get full name of span with all parent names separated by ";" in flamegraph format
pub fn get_full_name(&self) -> String {
self.stack.join(";")
self.stack
.iter()
.map(|span_info| span_info.tag.clone())
.collect::<Vec<String>>()
.join(";")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl VmMetrics {
.map(|(_, func)| (*func).clone())
.unwrap();
if pc == self.current_fn.start {
self.cycle_tracker.start(self.current_fn.name.clone());
self.cycle_tracker.start(self.current_fn.name.clone(), 0);
} else {
while let Some(name) = self.cycle_tracker.top() {
if name == &self.current_fn.name {
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/system/memory/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub const MERKLE_AIR_OFFSET: usize = 1;
pub const BOUNDARY_AIR_OFFSET: usize = 0;

#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
pub struct RecordId(pub usize);

pub type MemoryImage<F> = AddressMap<F, PAGE_SIZE>;
Expand Down
1 change: 0 additions & 1 deletion extensions/native/circuit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ openvm-instructions = { workspace = true }
openvm-rv32im-circuit = { workspace = true }
openvm-native-compiler = { workspace = true }


strum.workspace = true
itertools.workspace = true
tracing.workspace = true
Expand Down
5 changes: 3 additions & 2 deletions extensions/native/circuit/src/extension.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use air::VerifyBatchBus;
use poseidon2::air::VerifyBatchBus;
use alu_native_adapter::AluNativeAdapterChip;
use branch_native_adapter::BranchNativeAdapterChip;
use derive_more::derive::From;
Expand Down Expand Up @@ -30,7 +30,7 @@ use strum::IntoEnumIterator;

use crate::{
adapters::{convert_adapter::ConvertAdapterChip, *},
chip::NativePoseidon2Chip,
poseidon2::chip::NativePoseidon2Chip,
phantom::*,
*,
};
Expand Down Expand Up @@ -203,6 +203,7 @@ impl<F: PrimeField32> VmExtension<F> for Native {
VerifyBatchOpcode::VERIFY_BATCH.global_opcode(),
Poseidon2Opcode::PERM_POS2.global_opcode(),
Poseidon2Opcode::COMP_POS2.global_opcode(),
Poseidon2Opcode::MULTI_OBSERVE.global_opcode(),
],
)?;

Expand Down
Loading
Loading