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

feat: Dynamic Address for Out-of-Domain Row in TASM AIR Evaluation #314

Merged
merged 26 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c843694
docs: Add AIR circuit node count to arithmetization overview
aszepieniec Aug 8, 2024
ac98c22
docs: Add constraints overview table after lowering AIR degree to 8
aszepieniec Aug 8, 2024
f8178df
docs: Test spec overview of tasm AIR eval cost only if code is present
aszepieniec Aug 8, 2024
c26cf9c
docs: Add column counts for various degree lowering targets
aszepieniec Aug 8, 2024
592d7bf
test: Deduplicate code using macros
aszepieniec Aug 8, 2024
3f363ae
refactor(constraints generator): Rename "tasm" --> "static tasm"
aszepieniec Aug 9, 2024
72b6f5b
feat: Add dynamic counterpart to tasm code generator
aszepieniec Aug 9, 2024
1dc54cc
refactor: Qualify `air_constraint_evaluation_tasm` by staticity
aszepieniec Aug 9, 2024
1fb9ddf
style: Abstract memory layouts properties for static and dynamic tasm
aszepieniec Aug 9, 2024
0c0310d
restructure: Add directory for logic related to AIR evaluation
aszepieniec Aug 9, 2024
3a6218c
feat: Emit dynamic tasm air evaluation code along with static
aszepieniec Aug 9, 2024
5e5a1a7
refactor: Factor out common imports
aszepieniec Aug 9, 2024
c7581aa
feat(dyn air): Copy row pointers to static dedicated memory locations
aszepieniec Aug 9, 2024
bea5f0e
feat(dyn air): Load input with pointer indirection
aszepieniec Aug 9, 2024
cb0bade
fix(dyn air): Fix auto-generated imports
aszepieniec Aug 9, 2024
c1f821e
style(dyn air): Rename variable after effect
aszepieniec Aug 9, 2024
be1029f
refactor(dyn air): Modify `push!` macro to not emit `+0`
aszepieniec Aug 9, 2024
009022f
fix(dyn air): Fix macro limit, wrong variable name
aszepieniec Aug 9, 2024
be9b441
docs: Add dynamic AIR eval cost to overview
aszepieniec Aug 9, 2024
574e407
test(dyn air): Verify that dynamic and static evaluators agree
aszepieniec Aug 9, 2024
38a6a1d
style: Rename test to shorter but equivalent description
aszepieniec Aug 9, 2024
14c270c
style: Move AIR tests to `air.rs`
aszepieniec Aug 9, 2024
6322c14
refactor: De-duplicate code
jan-ferdinand Aug 13, 2024
10405b0
refactor: Fix intra-doc links
jan-ferdinand Aug 14, 2024
67bc9df
refactor(test): Simplify spec generation
jan-ferdinand Aug 14, 2024
89aa21d
refactor(test): De-duplicate and streamline
jan-ferdinand Aug 14, 2024
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
21 changes: 18 additions & 3 deletions constraint-evaluation-generator/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ use twenty_first::prelude::XFieldElement;

use crate::constraints::Constraints;

pub(crate) mod common_tasm;
mod dynamic_tasm;
mod rust;
mod tasm;
mod static_tasm;

pub(crate) trait Codegen {
fn constraint_evaluation_code(constraints: &Constraints) -> TokenStream;
Expand All @@ -33,14 +35,27 @@ pub(crate) struct RustBackend {
}

#[derive(Debug, Default, Clone, Eq, PartialEq)]
pub(crate) struct TasmBackend {
pub(crate) struct StaticTasmBackend {
/// All [circuit] IDs known to be processed and stored to memory.
///
/// [circuit]: triton_vm::table::constraint_circuit::ConstraintCircuit
scope: HashSet<usize>,

/// The number of elements written to the output list.
///
/// See [`TasmBackend::doc_comment`] for details.
/// See [`StaticTasmBackend::doc_comment`] for details.
elements_written: usize,
}

#[derive(Debug, Default, Clone, Eq, PartialEq)]
pub(crate) struct DynamicTasmBackend {
/// All [circuit] IDs known to be processed and stored to memory.
///
/// [circuit]: triton_vm::table::constraint_circuit::ConstraintCircuit
scope: HashSet<usize>,

/// The number of elements written to the output list.
///
/// See [`DynamicTasmBackend::doc_comment`] for details.
elements_written: usize,
}
16 changes: 16 additions & 0 deletions constraint-evaluation-generator/src/codegen/common_tasm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use proc_macro2::TokenStream;
use quote::quote;

pub(crate) fn uses() -> TokenStream {
quote!(
use twenty_first::prelude::BFieldCodec;
use twenty_first::prelude::BFieldElement;
use crate::instruction::LabelledInstruction;
use crate::Program;
use crate::air::memory_layout::StaticTasmConstraintEvaluationMemoryLayout;
use crate::air::memory_layout::DynamicTasmConstraintEvaluationMemoryLayout;
// for rustdoc – https://github.com/rust-lang/rust/issues/74563
#[allow(unused_imports)]
use crate::table::extension_table::Quotientable;
)
}
Loading
Loading