Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Clean up legacy access adapter code #1032

Merged
merged 4 commits into from
Dec 14, 2024
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/benchmark-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ jobs:
echo "FEATURE_FLAGS=${FEATURE_FLAGS},aggregation" >> $GITHUB_ENV

- name: Setup e2e (halo2 and arguments)
working-directory: extensions/native/recursion # We only ever run halo2 for recursion
run: |
E2E_BENCH=${{ inputs.e2e_bench }}
echo "E2E_BENCH=${E2E_BENCH}" >> $GITHUB_ENV
Expand All @@ -169,6 +168,7 @@ jobs:
INTERNAL_ARG="--internal_log_blowup ${{ inputs.internal_log_blowup }}"
echo "INPUT_ARGS=${ROOT_ARG} ${INTERNAL_ARG} ${INPUT_ARGS}" >> $GITHUB_ENV
bash ./extensions/native/recursion/trusted_setup_s3.sh
export PARAMS_DIR=$(pwd)/params
fi

- name: Set BIN_NAME and CMD_ARGS
Expand All @@ -185,8 +185,8 @@ jobs:
select(.name == $name) |
.working_directory
' ./ci/benchmark-config.json)
RELATIVE_PATH=$(python3 -c "import os.path; print(os.path.relpath('.', '$WORKSPACE_DIR'))")
echo "working_dir=$WORKSPACE_DIR" >> $GITHUB_OUTPUT
RELATIVE_PATH=$(python3 -c "import os.path; print(os.path.relpath('.', '$WORKING_DIR'))")
echo "working_dir=$WORKING_DIR" >> $GITHUB_OUTPUT
echo "relative_path=$RELATIVE_PATH" >> $GITHUB_OUTPUT

# Metric name is unique within a run (matrix)
Expand Down
14 changes: 6 additions & 8 deletions benchmarks/src/bin/fib_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use openvm_rv32im_transpiler::{
use openvm_sdk::{
commit::commit_app_exe,
config::{AggConfig, AggStarkConfig, AppConfig, Halo2Config},
prover::ContinuationProver,
Sdk, StdIn,
};
use openvm_stark_sdk::{
Expand Down Expand Up @@ -87,14 +88,11 @@ async fn main() -> Result<()> {
let mut stdin = StdIn::default();
stdin.write(&n);
run_with_metric_collection("OUTPUT_PATH", || {
Sdk.generate_evm_proof(
&halo2_params_reader,
app_pk,
app_committed_exe,
full_agg_pk,
stdin,
)
.unwrap();
let mut e2e_prover =
ContinuationProver::new(&halo2_params_reader, app_pk, app_committed_exe, full_agg_pk)
.with_profiling();
e2e_prover.set_program_name("fib_e2e");
let _proof = e2e_prover.generate_proof_for_evm(stdin);
});

Ok(())
Expand Down
7 changes: 2 additions & 5 deletions benchmarks/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,8 @@ where
let committed_exe = time(gauge!("commit_exe_time_ms"), || {
commit_app_exe(app_config.app_fri_params, exe)
});
// 3. Executes runtime again without metric collection and generate trace.
time(gauge!("execute_and_trace_gen_time_ms"), || {
vm.execute_and_generate_with_cached_program(committed_exe.clone(), input_stream.clone())
})?;
// 4. Executes runtime once with full metric collection for flamegraphs (slow).
// 3. Executes runtime once with full metric collection for flamegraphs (slow).
// 4. Executes runtime again without metric collection and generate trace.
// 5. Generate STARK proofs for each segment (segmentation is determined by `config`), with timer.
// generate_app_proof will emit metrics for proof time of each
let vk = app_pk.app_vm_pk.vm_pk.get_vk();
Expand Down
8 changes: 4 additions & 4 deletions ci/scripts/metric_unify/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def generate_row(md_file, sections, aggregation_groups, gh_pages_link):
group_row = section_by_group.get(section)
if group_row is None:
res += [format_cell("-", None, None)] * COLS_PER_SECTION
else:
else:
res.append(str(group_row.log_blowup))
for cell in group_row.cells:
res.append(str(cell))
Expand Down Expand Up @@ -154,16 +154,16 @@ def main():
md_files = args.metrics_md_files.split(',')
outputs = []
for md_file in md_files:
outputs.append(generate_row(md_file, ["leaf_verifier"], {}, args.gh_pages_link))
outputs.append(generate_row(md_file, ["leaf"], {}, args.gh_pages_link))
write_md_table(outputs, "Benchmarks", headers, rewrite=True)

if args.e2e_md_files and args.e2e_md_files.strip():
outputs = []
md_files = args.e2e_md_files.split(',')
for md_file in md_files:
outputs.append(generate_row(md_file, ["root_verifier", "leaf_verifier", "internal_verifier"], {"internal.*": "internal_verifier"}, args.gh_pages_link))
outputs.append(generate_row(md_file, ["root", "leaf", "internal"], {"internal.*": "internal"}, args.gh_pages_link))
if outputs:
write_md_table(outputs, "E2E Benchmarks", e2e_headers)

if __name__ == '__main__':
main()
main()
5 changes: 5 additions & 0 deletions crates/sdk/src/prover/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ impl<VC> ContinuationProver<VC> {
self
}

pub fn with_profiling(mut self) -> Self {
self.set_profile(true);
self
}

pub fn set_program_name(&mut self, program_name: impl AsRef<str>) -> &mut Self {
self.stark_prover.set_program_name(program_name);
self
Expand Down
3 changes: 3 additions & 0 deletions crates/vm/src/system/memory/adapter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ impl<F> AccessAdapterInventory<F> {
.map(|chip| chip.current_trace_height())
.collect()
}
pub fn get_widths(&self) -> Vec<usize> {
self.chips.iter().map(|chip| chip.trace_width()).collect()
}
pub fn airs<SC: StarkGenericConfig>(&self) -> Vec<Arc<dyn AnyRap<SC>>>
where
F: PrimeField32,
Expand Down
30 changes: 4 additions & 26 deletions crates/vm/src/system/memory/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use itertools::{izip, zip_eq};
pub use memory::{MemoryReadRecord, MemoryWriteRecord};
use openvm_circuit_primitives::{
assert_less_than::{AssertLtSubAir, LessThanAuxCols},
is_less_than::IsLtSubAir,
is_zero::IsZeroSubAir,
utils::next_power_of_two_or_zero,
var_range::{VariableRangeCheckerBus, VariableRangeCheckerChip},
Expand All @@ -36,12 +35,9 @@ use self::interface::MemoryInterface;
use super::{merkle::DirectCompressionBus, volatile::VolatileBoundaryChip};
use crate::{
arch::{hasher::HasherChip, MemoryConfig},
system::memory::{
adapter::AccessAdapterAir,
offline_checker::{
MemoryBridge, MemoryBus, MemoryReadAuxCols, MemoryReadOrImmediateAuxCols,
MemoryWriteAuxCols, AUX_LEN,
},
system::memory::offline_checker::{
MemoryBridge, MemoryBus, MemoryReadAuxCols, MemoryReadOrImmediateAuxCols,
MemoryWriteAuxCols, AUX_LEN,
},
};

Expand Down Expand Up @@ -450,14 +446,6 @@ impl<F: PrimeField32> MemoryController<F> {
self.memory.timestamp()
}

fn access_adapter_air<const N: usize>(&self) -> AccessAdapterAir<N> {
let lt_air = IsLtSubAir::new(self.range_checker.bus(), self.mem_config.clk_max_bits);
AccessAdapterAir::<N> {
memory_bus: self.memory_bus,
lt_air,
}
}

/// Returns the final memory state if persistent.
pub fn finalize(
&mut self,
Expand Down Expand Up @@ -681,19 +669,9 @@ impl<F: PrimeField32> MemoryController<F> {
widths.push(BaseAir::<F>::width(&merkle_chip.air));
}
};
self.add_access_adapter_width::<2>(&mut widths);
self.add_access_adapter_width::<4>(&mut widths);
self.add_access_adapter_width::<8>(&mut widths);
self.add_access_adapter_width::<16>(&mut widths);
self.add_access_adapter_width::<32>(&mut widths);
self.add_access_adapter_width::<64>(&mut widths);
widths.extend(self.access_adapters.get_widths());
widths
}
fn add_access_adapter_width<const N: usize>(&self, widths: &mut Vec<usize>) {
if self.mem_config.max_access_adapter_n >= N {
widths.push(BaseAir::<F>::width(&self.access_adapter_air::<N>()));
}
}

pub fn current_trace_cells(&self) -> Vec<usize> {
zip_eq(self.current_trace_heights(), self.trace_widths())
Expand Down
3 changes: 1 addition & 2 deletions extensions/native/recursion/trusted_setup_s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ else
fi
echo "maxk=$maxk"

bash scripts/install_s5cmd.sh
mkdir -p params/
cd params
for k in $(seq 10 $maxk)
Expand All @@ -20,4 +19,4 @@ do
s5cmd --no-sign-request cp --concurrency 10 "s3://axiom-crypto/challenge_0085/${pkey_file}" .
fi
done
cd ..
cd ..
Loading