Skip to content

V2 powdr#56

Draft
leonardoalt wants to merge 9 commits into
develop-v2.0.0-rc.1from
v2-powdr
Draft

V2 powdr#56
leonardoalt wants to merge 9 commits into
develop-v2.0.0-rc.1from
v2-powdr

Conversation

@leonardoalt

Copy link
Copy Markdown
Member

No description provided.

leonardoalt and others added 4 commits March 11, 2026 10:14
- Add PC tracing in execute_trampoline and TCO derive for PGO collection
- Make VmStateMut.custom_pvs public for powdr executor destructuring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add apc_by_pc_index to Program for APC instruction overrides
- Add APC override in interpreter (TCO handlers, pre_compute, pre_compute_max_size)
- Add APC override in interpreter_preflight with is_apc flag on PcEntry
- Add APC override in AOT metered execution assembly generation
- Add MutGetters on AppProver for mutable instance access
- Improve debug assert message for timestamp bounds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add ColumnsAir<F> impl for all AIR types (default empty impl)
- Add custom ColumnsAir impl for VmAirWrapper that chains adapter + core columns
- Add custom_pvs field to VmState for powdr executor destructuring
- Update WhirParams construction for new upstream fields
- Point workspace dependencies to powdr-labs/stark-backend v2-powdr branch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… names

- Add struct-reflection dependency to openvm-circuit-primitives, re-export
  StructReflection and StructReflectionHelper
- Add #[derive(StructReflection)] to ~60 Cols structs across primitives,
  VM system, and extensions
- Populate ColumnsAir impls with struct_reflection() calls for ~50 AIRs
- Manual StructReflectionHelper impls for Poseidon2PeripheryCols and
  KeccakfPermCols (external p3 inner types)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
k: k_whir,
log_final_poly_len: 11,
query_phase_pow_bits: WHIR_POW_BITS,
};

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this looks weird

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

revert

query_phase_pow_bits: WHIR_POW_BITS,
};
let whir_config = WhirConfig::new(log_blowup, l_skip + n_stack, whir_params, SECURITY_LEVEL);
SystemParams {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

weird

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

revert

{
pub program_name: Option<String>,
#[getset(get = "pub")]
#[getset(get = "pub", get_mut = "pub")]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

why

let pc_index = ((pc - pc_base) / openvm_instructions::program::DEFAULT_PC_STEP) as usize;
if let Some((apc_inst, _)) = exe.program.apc_by_pc_index.get(&pc_index) {
instruction = apc_inst.clone();
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

apc stuff

memory: &mut self.memory.memory,
streams: &mut self.streams,
rng: &mut self.rng,
custom_pvs: &mut custom_pvs,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

why?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove

pub streams: &'a mut Streams<F>,
pub rng: &'a mut StdRng,
/// Custom public values to be set by the system PublicValuesExecutor
pub custom_pvs: &'a mut Vec<Option<F>>,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

why?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove

let handlers = repeat_n(&None, get_pc_index(program.pc_base))
let base_index = get_pc_index(program.pc_base);
#[cfg(feature = "tco")]
let handlers = repeat_n(&None, base_index)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

apc stuff here and below

pub insn: Instruction<F>,
pub executor_idx: ExecutorId,
/// Whether this instruction was overridden by an APC (auto-precompile) instruction.
pub is_apc: bool,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

apc stuff here and lower

pub memory: MEM,
pub streams: Streams<F>,
pub rng: StdRng,
pub custom_pvs: Vec<Option<F>>,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

why was this added in our update branch?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove

@leonardoalt

Copy link
Copy Markdown
Member Author

Do we also need the POWDR_SEGMENT_DELTA thing here?

The v2-powdr branch of powdr-labs/stark-backend is up to date,
no need for local path overrides.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread crates/vm/src/arch/execution.rs Outdated

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Default, AlignedBorrow, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Default, AlignedBorrow, StructReflection, Serialize, Deserialize)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove?

Comment thread crates/vm/src/arch/interpreter.rs Outdated
.map(
|(pc_idx, (inst_opt, pre_compute))| -> Result<Handler<F, Ctx>, StaticProgramError> {
if let Some((inst, _)) = inst_opt {
let program_idx = if pc_idx >= base_index { pc_idx - base_index } else { usize::MAX };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

odd

Comment thread crates/vm/src/arch/interpreter.rs Outdated
.map(
|(pc_idx, (inst_opt, pre_compute))| -> Result<Handler<F, Ctx>, StaticProgramError> {
if let Some((inst, _)) = inst_opt {
let program_idx = if pc_idx >= base_index { pc_idx - base_index } else { usize::MAX };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

odd

Comment thread crates/vm/src/arch/interpreter.rs Outdated
// `PreComputeInstruction`s.
let buf: &mut [u8] = unsafe { &mut *(*buf as *mut [u8]) };
let pre_inst = if let Some((inst, _)) = inst_opt {
let program_idx = if i >= base_index { i - base_index } else { usize::MAX };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

odd

leonardoalt and others added 4 commits March 11, 2026 16:09
…tion

- Revert APC override pattern in interpreter.rs, interpreter_preflight.rs,
  and metered_execute.rs back to the cleaner if-let style with proper
  pc_index computation and unwrap() instead of unwrap_or(0)
- Add timestamp field back to MeteredCtx, tracked via on_memory_operation
- Add POWDR_OPENVM_SEGMENT_DELTA env-var-based timestamp segmentation
  to SegmentationCtx::should_segment_with_ts()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AOT execution does not emit pc tracing events needed by the PGO
collector. Add execute_interpreted() which always uses the interpreter
path, so PGO profiling works regardless of the aot feature flag.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The internal verifier circuit can produce traces of height 2^20,
which exceeds the max stacked height of 2^19 (l_skip=2 + n_stack=17).
Bump n_stack to 18 so max log height is 20.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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