Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 12 additions & 6 deletions crates/host-bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ pub struct HostArgs {
#[arg(long)]
apc_skip: usize,

#[arg(long)]
pgo_type: PgoType,
// #[arg(long)]
// pgo_type: PgoType,
}

/// Segments based on total trace cells across all chips
Expand Down Expand Up @@ -324,26 +324,32 @@ pub async fn run_reth_benchmark<E: StarkFriEngine<SC>>(
let elf = Elf::decode(openvm_client_eth_elf, MEM_SIZE as u32)?;
let exe = VmExe::from_elf(elf, sdk_vm_config.transpiler()).unwrap();

let CompiledProgram { exe, vm_config } = powdr::apc(
let compiled_program = powdr::apc(
OriginalCompiledProgram { exe, sdk_vm_config },
openvm_client_eth_elf,
args.apc,
args.apc_skip,
args.pgo_type,
PgoType::Cell(Some(60000)),
stdin.clone(),
);

let program_name = format!("reth.{}.block_{}", args.mode, args.block_number);
// NOTE: args.benchmark.app_config resets SegmentationStrategy if max_segment_length is set
args.benchmark.max_segment_length = None;
let app_config = args.benchmark.app_config(vm_config.clone());
let app_config = args.benchmark.app_config(compiled_program.vm_config.clone());

// Comment out the 3 lines below to get powdr logs instead of openvm logs.
// If these are enabled the powdr logs above need to be disabled.
// Look for similar comments at the beginning of this function.
run_with_metric_collection("OUTPUT_PATH", || {
info_span!("reth-block", block_number = args.block_number).in_scope(
|| -> eyre::Result<()> {

let metrics = compiled_program.powdr_airs_metrics();
println!("Created {} apcs out of max {}, total powdr column count {}", metrics.len(), args.apc, metrics.iter().map(|m| m.width).sum::<usize>());
Comment on lines +348 to +349
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

powdr_airs_metrics() only counts the APC columns, not the non APC columns, but it's perplexing because in customize_exe.rs we also only cutoff by the APC columns, so it should match the input 60k max column.


let CompiledProgram { exe, vm_config } = compiled_program;

match args.mode {
BenchMode::Compile => {
// This mode is used to compile the program with APCs, no execution.
Expand Down Expand Up @@ -498,7 +504,7 @@ mod powdr {
PgoType::Instruction => {
PgoConfig::Instruction(execution_profile(original_program.clone(), stdin))
}
PgoType::Cell => PgoConfig::Cell(execution_profile(original_program.clone(), stdin)),
PgoType::Cell(max_total_apc_columns) => PgoConfig::Cell(execution_profile(original_program.clone(), stdin), max_total_apc_columns),
};

let config = PowdrConfig::new(apc as u64, apc_skip as u64)
Expand Down
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ RUST_LOG="debug" OUTPUT_PATH="metrics.json" ./target/$PROFILE/openvm-reth-benchm
--cache-dir "rpc-cache" \
--apc "$APC" \
--apc-skip "$APC_SKIP" \
--pgo-type "$PGO_TYPE"
# --pgo-type "$PGO_TYPE"

Loading