Skip to content

Commit

Permalink
change riscv tests to use composite backends (#1583)
Browse files Browse the repository at this point in the history
Also in preparation for registers in memory.
Removing the `public`s for continuations as discussed with @georgwiese ,
since those are not sound anyway and we might change it completely soon.
  • Loading branch information
leonardoalt authored Jul 17, 2024
1 parent eb3bdfb commit e6bc15d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
1 change: 0 additions & 1 deletion pipeline/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ pub fn verify_pipeline(
pipeline: Pipeline<GoldilocksField>,
backend: BackendType,
) -> Result<(), String> {
// TODO: Also test Composite variants
let mut pipeline = pipeline.with_backend(backend, None);

if pipeline.output_dir().is_none() {
Expand Down
20 changes: 10 additions & 10 deletions riscv/src/continuations/bootloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ pub fn bootloader_preamble() -> String {
for (i, reg) in REGISTER_NAMES.iter().enumerate() {
let reg = reg.strip_prefix("main.").unwrap();
preamble.push_str(&format!(
" public initial_{reg} = main_bootloader_inputs.value({i});\n"
" //public initial_{reg} = main_bootloader_inputs.value({i});\n"
));
}
for (i, reg) in REGISTER_NAMES.iter().enumerate() {
let reg = reg.strip_prefix("main.").unwrap();
preamble.push_str(&format!(
" public final_{reg} = main_bootloader_inputs.value({});\n",
" //public final_{reg} = main_bootloader_inputs.value({});\n",
i + REGISTER_NAMES.len()
));
}
preamble.push_str(&format!(
r#"
public initial_memory_hash_1 = main_bootloader_inputs.value({});
public initial_memory_hash_2 = main_bootloader_inputs.value({});
public initial_memory_hash_3 = main_bootloader_inputs.value({});
public initial_memory_hash_4 = main_bootloader_inputs.value({});
//public initial_memory_hash_1 = main_bootloader_inputs.value({});
//public initial_memory_hash_2 = main_bootloader_inputs.value({});
//public initial_memory_hash_3 = main_bootloader_inputs.value({});
//public initial_memory_hash_4 = main_bootloader_inputs.value({});
"#,
MEMORY_HASH_START_INDEX,
MEMORY_HASH_START_INDEX + 1,
Expand All @@ -97,10 +97,10 @@ pub fn bootloader_preamble() -> String {
));
preamble.push_str(&format!(
r#"
public final_memory_hash_1 = main_bootloader_inputs.value({});
public final_memory_hash_2 = main_bootloader_inputs.value({});
public final_memory_hash_3 = main_bootloader_inputs.value({});
public final_memory_hash_4 = main_bootloader_inputs.value({});
//public final_memory_hash_1 = main_bootloader_inputs.value({});
//public final_memory_hash_2 = main_bootloader_inputs.value({});
//public final_memory_hash_3 = main_bootloader_inputs.value({});
//public final_memory_hash_4 = main_bootloader_inputs.value({});
"#,
MEMORY_HASH_START_INDEX + 4,
MEMORY_HASH_START_INDEX + 5,
Expand Down
2 changes: 1 addition & 1 deletion riscv/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ pub fn verify_riscv_asm_file(asm_file: &Path, runtime: &Runtime, use_pie: bool)
&powdr_asm,
&[],
None,
BackendType::EStarkDump,
BackendType::EStarkDumpComposite,
);
}
2 changes: 1 addition & 1 deletion riscv/tests/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod instruction_tests {
&powdr_asm,
Default::default(),
None,
BackendType::EStarkDump,
BackendType::EStarkDumpComposite,
);
}

Expand Down
18 changes: 10 additions & 8 deletions riscv/tests/riscv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use common::{verify_riscv_asm_file, verify_riscv_asm_string};
use mktemp::Temp;
use powdr_backend::BackendType;
use powdr_number::GoldilocksField;
use powdr_pipeline::{verify::verify, Pipeline};
use powdr_pipeline::{test_util::verify_pipeline, Pipeline};
use std::path::{Path, PathBuf};
use test_log::test;

Expand Down Expand Up @@ -47,11 +47,7 @@ fn run_continuations_test(case: &str, powdr_asm: String) {
.with_prover_inputs(Default::default())
.with_output(tmp_dir.to_path_buf(), false);
let pipeline_callback = |pipeline: Pipeline<GoldilocksField>| -> Result<(), ()> {
// Can't use `verify_pipeline`, because the pipeline was renamed in the middle of after
// computing the constants file.
let mut pipeline = pipeline.with_backend(BackendType::EStarkDump, None);
pipeline.compute_proof().unwrap();
verify(pipeline.output_dir().as_ref().unwrap()).unwrap();
verify_pipeline(pipeline, BackendType::EStarkDumpComposite).unwrap();

Ok(())
};
Expand Down Expand Up @@ -154,7 +150,7 @@ fn vec_median_estark_polygon() {
.map(|x| x.into())
.collect(),
&Runtime::base(),
BackendType::EStarkPolygon,
BackendType::EStarkPolygonComposite,
);
}

Expand Down Expand Up @@ -387,7 +383,13 @@ fn verify_riscv_crate_with_data<S: serde::Serialize + Send + Sync + 'static>(
runtime: &Runtime,
data: Vec<(u32, S)>,
) {
verify_riscv_crate_from_both_paths(case, inputs, runtime, Some(data), BackendType::EStarkDump)
verify_riscv_crate_from_both_paths(
case,
inputs,
runtime,
Some(data),
BackendType::EStarkDumpComposite,
)
}

fn verify_riscv_crate_from_both_paths<S: serde::Serialize + Send + Sync + 'static>(
Expand Down

0 comments on commit e6bc15d

Please sign in to comment.