Skip to content

Commit d517c8b

Browse files
fix(new-execution): fix some rv32im loadstore tests (#1611)
- fix some loadstore tests - remove records - wrap unsafe memory read/writes into safe wrappers --------- Co-authored-by: Jonathan Wang <[email protected]>
1 parent e279ba2 commit d517c8b

File tree

46 files changed

+274
-641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+274
-641
lines changed

benchmarks/execute/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ enum BuildProfile {
1818
// const DEFAULT_APP_CONFIG_PATH: &str = "./openvm.toml";
1919

2020
static AVAILABLE_PROGRAMS: &[&str] = &[
21-
// "fibonacci_recursive",
22-
// "fibonacci_iterative",
21+
"fibonacci_recursive",
22+
"fibonacci_iterative",
2323
"quicksort",
24-
// "bubblesort",
24+
"bubblesort",
2525
// "pairing",
2626
// "keccak256",
2727
// "keccak256_iter",

crates/toolchain/tests/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ homepage.workspace = true
88
repository.workspace = true
99

1010
[dependencies]
11+
openvm-build.workspace = true
12+
openvm-transpiler.workspace = true
13+
eyre.workspace = true
14+
tempfile.workspace = true
15+
16+
[dev-dependencies]
1117
openvm-stark-backend.workspace = true
1218
openvm-stark-sdk.workspace = true
1319
openvm-circuit = { workspace = true, features = ["test-utils"] }
14-
openvm-transpiler.workspace = true
15-
openvm-build.workspace = true
1620
openvm-algebra-transpiler.workspace = true
1721
openvm-bigint-circuit.workspace = true
1822
openvm-rv32im-circuit.workspace = true
@@ -21,10 +25,7 @@ openvm-algebra-circuit.workspace = true
2125
openvm-ecc-guest = { workspace = true, features = ["halo2curves", "k256"] }
2226
openvm-instructions = { workspace = true }
2327
openvm-platform = { workspace = true }
24-
25-
eyre.workspace = true
2628
test-case.workspace = true
27-
tempfile.workspace = true
2829
serde = { workspace = true, features = ["alloc"] }
2930
derive_more = { workspace = true, features = ["from"] }
3031

crates/toolchain/tests/src/utils.rs

Whitespace-only changes.

crates/vm/derive/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub fn ins_executor_e1_executor_derive(input: TokenStream) -> TokenStream {
144144
impl #impl_generics ::openvm_circuit::arch::InsExecutorE1<F> for #name #ty_generics #where_clause {
145145
fn execute_e1<Mem, Ctx>(
146146
&mut self,
147-
state: ::openvm_circuit::arch::execution::VmStateMut<Mem, Ctx>,
147+
state: ::openvm_circuit::arch::VmStateMut<Mem, Ctx>,
148148
instruction: &::openvm_circuit::arch::instructions::instruction::Instruction<F>,
149149
) -> ::openvm_circuit::arch::Result<()>
150150
where
@@ -192,7 +192,7 @@ pub fn ins_executor_e1_executor_derive(input: TokenStream) -> TokenStream {
192192
impl #impl_generics ::openvm_circuit::arch::InsExecutorE1<#first_ty_generic> for #name #ty_generics {
193193
fn execute_e1<Mem, Ctx>(
194194
&mut self,
195-
state: ::openvm_circuit::arch::execution::VmStateMut<Mem, Ctx>,
195+
state: ::openvm_circuit::arch::VmStateMut<Mem, Ctx>,
196196
instruction: &::openvm_circuit::arch::instructions::instruction::Instruction<#first_ty_generic>,
197197
) -> ::openvm_circuit::arch::Result<()>
198198
where

crates/vm/src/arch/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod config;
22
/// Instruction execution traits and types.
33
/// Execution bus and interface.
4-
pub mod execution;
4+
mod execution;
55
/// Module for controlling VM execution flow, including segmentation and instruction execution
66
pub mod execution_control;
77
/// Traits and builders to compose collections of chips into a virtual machine.

crates/vm/src/arch/testing/memory/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<F: PrimeField32> MemoryTester<F> {
4040
let controller = &mut self.controller;
4141
let t = controller.memory.timestamp();
4242
// TODO: hack
43-
let (t_prev, data) = if addr_space <= 2 {
43+
let (t_prev, data) = if addr_space <= 3 {
4444
let (t_prev, data) = unsafe {
4545
controller
4646
.memory
@@ -73,7 +73,7 @@ impl<F: PrimeField32> MemoryTester<F> {
7373
let controller = &mut self.controller;
7474
let t = controller.memory.timestamp();
7575
// TODO: hack
76-
let (t_prev, data_prev) = if addr_space <= 2 {
76+
let (t_prev, data_prev) = if addr_space <= 3 {
7777
let (t_prev, data_prev) = unsafe {
7878
controller.memory.write::<u8, N, 4>(
7979
addr_space as u32,

crates/vm/src/arch/vm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ where
330330

331331
let mut segment = E1VmSegmentExecutor::new(
332332
&self.config,
333+
// TODO(ayush): avoid clones
333334
exe.program.clone(),
334335
state.input,
335336
Some(state.memory),

crates/vm/src/system/memory/online.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl TracingMemory {
145145
let num_cells = paged_vec.bytes_capacity() / cell_size;
146146

147147
// TMP: hardcoding for now
148-
if i <= 3 {
148+
if i < 3 {
149149
min_block_size.push(4);
150150
} else {
151151
min_block_size.push(1);

crates/vm/src/system/memory/paged_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<const PAGE_SIZE: usize> AddressMap<PAGE_SIZE> {
303303
debug_assert_ne!(addr_space, 0);
304304
// TODO: fix this
305305
unsafe {
306-
if addr_space <= 2 {
306+
if addr_space <= 3 {
307307
F::from_canonical_u8(self.get::<u8>((addr_space, ptr)))
308308
} else {
309309
self.get::<F>((addr_space, ptr))

crates/vm/src/system/memory/tree/public_values.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::{
1111
},
1212
};
1313

14+
pub const PUBLIC_VALUES_AS: u32 = 3;
1415
pub const PUBLIC_VALUES_ADDRESS_SPACE_OFFSET: u32 = 2;
1516

1617
/// Merkle proof for user public values in the memory state.

0 commit comments

Comments
 (0)