-
Notifications
You must be signed in to change notification settings - Fork 0
Proof of concept of column names without touching stark-backend #46
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
base: upstream-main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ use openvm_stark_backend::{ | |
| types::{AirProvingContext, ProvingContext}, | ||
| }, | ||
| rap::AnyRap, | ||
| AirRef, AnyChip, Chip, | ||
| AnyChip, Chip, | ||
| }; | ||
| use rustc_hash::FxHashMap; | ||
| use tracing::info_span; | ||
|
|
@@ -145,7 +145,7 @@ pub struct AirInventory<SC: StarkGenericConfig> { | |
| /// Note that the system will ensure that the first AIR in the list is always the | ||
| /// [VariableRangeCheckerAir]. | ||
| #[get = "pub"] | ||
| ext_airs: Vec<AirRef<SC>>, | ||
| ext_airs: Vec<AirRefWithColumnNames<SC>>, | ||
| /// `ext_start[i]` will have the starting index in `ext_airs` for extension `i` | ||
| ext_start: Vec<usize>, | ||
|
|
||
|
|
@@ -399,6 +399,16 @@ impl<F, E> ExecutorInventoryBuilder<'_, F, E> { | |
| } | ||
| } | ||
|
|
||
| pub trait ColumnNames {} | ||
|
|
||
| impl<T> ColumnNames for T {} | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently we implement it for all types just to prove the approach, but in practice this would be done for each air, as we currently do. |
||
|
|
||
| pub trait AnyRapWithColumnNames<SC: StarkGenericConfig>: AnyRap<SC> + ColumnNames {} | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This extends the stark-backend trait with our |
||
|
|
||
| pub type AirRefWithColumnNames<SC> = Arc<dyn AnyRapWithColumnNames<SC>>; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does the same for |
||
|
|
||
| impl<SC: StarkGenericConfig, R: AnyRap<SC> + ColumnNames> AnyRapWithColumnNames<SC> for R {} | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This implementation would stay: if |
||
|
|
||
| impl<SC: StarkGenericConfig> AirInventory<SC> { | ||
| /// Outside of this crate, [AirInventory] must be constructed via [SystemConfig]. | ||
| pub(crate) fn new( | ||
|
|
@@ -434,11 +444,11 @@ impl<SC: StarkGenericConfig> AirInventory<SC> { | |
| .filter_map(|air| air.as_any().downcast_ref()) | ||
| } | ||
|
|
||
| pub fn add_air<A: AnyRap<SC> + 'static>(&mut self, air: A) { | ||
| pub fn add_air<A: AnyRapWithColumnNames<SC> + 'static>(&mut self, air: A) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We replace all usages of |
||
| self.add_air_ref(Arc::new(air)); | ||
| } | ||
|
|
||
| pub fn add_air_ref(&mut self, air: AirRef<SC>) { | ||
| pub fn add_air_ref(&mut self, air: AirRefWithColumnNames<SC>) { | ||
| self.ext_airs.push(air); | ||
| } | ||
|
|
||
|
|
@@ -452,7 +462,7 @@ impl<SC: StarkGenericConfig> AirInventory<SC> { | |
| /// This is the system AIRs, followed by the other AIRs in the **reverse** of the order they | ||
| /// were added in the VM extension definitions. In particular, the AIRs that have dependencies | ||
| /// appear later. The system guarantees that the last AIR is the [VariableRangeCheckerAir]. | ||
| pub fn into_airs(self) -> impl Iterator<Item = AirRef<SC>> { | ||
| pub fn into_airs(self) -> impl Iterator<Item = AirRefWithColumnNames<SC>> { | ||
| self.system | ||
| .into_airs() | ||
| .into_iter() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1315,6 +1315,8 @@ pub fn debug_proving_ctx<E, VB>( | |
| let (airs, pks, proof_inputs): (Vec<_>, Vec<_>, Vec<_>) = | ||
| multiunzip(ctx.per_air.iter().map(|(air_id, air_ctx)| { | ||
| // Transfer from device **back** to host so the debugger can read the data. | ||
|
|
||
| use openvm_stark_backend::rap::AnyRap; | ||
| let cached_mains = air_ctx | ||
| .cached_mains | ||
| .iter() | ||
|
|
@@ -1331,7 +1333,7 @@ pub fn debug_proving_ctx<E, VB>( | |
| public_values, | ||
| }; | ||
| ( | ||
| global_airs[*air_id].clone(), | ||
| global_airs[*air_id].clone() as Arc<dyn AnyRap<_>>, | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we need to reach into stark-backend, we lower to the original
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no other compile errors, so I suspect Rust is able to do this lowering automatically in other cases (for example, keygen) |
||
| pk.per_air[*air_id].clone(), | ||
| raw, | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trait would have the column_name method