Struct Chip

Source
pub struct Chip<F: Field, A> {
    pub air: A,
    pub sends: Vec<Interaction<F>>,
    pub receives: Vec<Interaction<F>>,
    pub log_quotient_degree: usize,
}
Expand description

An Air that encodes lookups based on interactions.

Fields§

§air: A

The underlying AIR of the chip for constraint evaluation.

§sends: Vec<Interaction<F>>

The interactions that the chip sends.

§receives: Vec<Interaction<F>>

The interactions that the chip receives.

§log_quotient_degree: usize

The relative log degree of the quotient polynomial, i.e. log2(max_constraint_degree - 1).

Implementations§

Source§

impl<F: Field, A> Chip<F, A>

Source

pub fn sends(&self) -> &[Interaction<F>]

The send interactions of the chip.

Source

pub fn receives(&self) -> &[Interaction<F>]

The receive interactions of the chip.

Source

pub const fn log_quotient_degree(&self) -> usize

The relative log degree of the quotient polynomial, i.e. log2(max_constraint_degree - 1).

Source

pub fn into_inner(self) -> A

Consumes the chip and returns the underlying air.

Source§

impl<F: PrimeField32, A: MachineAir<F>> Chip<F, A>

Source

pub fn included(&self, shard: &A::Record) -> bool

Returns whether the given chip is included in the execution record of the shard.

Source§

impl<F, A> Chip<F, A>
where F: Field, A: BaseAir<F>,

Source

pub fn new(air: A) -> Self

Records the interactions and constraint degree from the air and crates a new chip.

Source

pub fn num_interactions(&self) -> usize

Returns the number of interactions in the chip.

Source

pub fn num_sent_byte_lookups(&self) -> usize

Returns the number of sent byte lookups in the chip.

Source

pub fn num_sends_by_kind(&self, kind: InteractionKind) -> usize

Returns the number of sends of the given kind.

Source

pub fn num_receives_by_kind(&self, kind: InteractionKind) -> usize

Returns the number of receives of the given kind.

Source

pub fn generate_permutation_trace<EF: ExtensionField<F>>( &self, preprocessed: Option<&RowMajorMatrix<F>>, main: &RowMajorMatrix<F>, random_elements: &[EF], ) -> (RowMajorMatrix<EF>, EF)
where F: PrimeField, A: MachineAir<F>,

Generates a permutation trace for the given matrix.

Source

pub fn permutation_width(&self) -> usize

Returns the width of the permutation trace.

Source

pub fn cost(&self) -> u64
where A: MachineAir<F>,

Returns the cost of a row in the chip.

Source

pub const fn quotient_width(&self) -> usize

Returns the width of the quotient polynomial.

Source

pub const fn logup_batch_size(&self) -> usize

Returns the log2 of the batch size.

Trait Implementations§

Source§

impl<'a, F, A, AB> Air<AB> for Chip<F, A>
where F: Field, A: Air<AB> + MachineAir<F>, AB: SP1AirBuilder<F = F> + MultiTableAirBuilder<'a> + PairBuilder + 'a,

Source§

fn eval(&self, builder: &mut AB)

Source§

impl<F, A> BaseAir<F> for Chip<F, A>
where F: Field, A: BaseAir<F>,

Source§

fn width(&self) -> usize

The number of columns (a.k.a. registers) in this AIR.
Source§

fn preprocessed_trace(&self) -> Option<RowMajorMatrix<F>>

Source§

impl<F, A> Hash for Chip<F, A>
where F: Field, A: Hash,

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<F, A> MachineAir<F> for Chip<F, A>
where F: Field, A: MachineAir<F>,

Source§

type Record = <A as MachineAir<F>>::Record

The execution record containing events for producing the air trace.
Source§

type Program = <A as MachineAir<F>>::Program

The program that defines the control flow of the machine.
Source§

fn name(&self) -> String

A unique identifier for this AIR as part of a machine.
Source§

fn preprocessed_width(&self) -> usize

The width of the preprocessed trace.
Source§

fn preprocessed_num_rows( &self, program: &Self::Program, instrs_len: usize, ) -> Option<usize>

The number of rows in the preprocessed trace
Source§

fn generate_preprocessed_trace( &self, program: &A::Program, ) -> Option<RowMajorMatrix<F>>

Generate the preprocessed trace given a specific program.
Source§

fn num_rows(&self, input: &A::Record) -> Option<usize>

The number of rows in the trace
Source§

fn generate_trace( &self, input: &A::Record, output: &mut A::Record, ) -> RowMajorMatrix<F>

Generate the trace for a given execution record. Read more
Source§

fn generate_dependencies(&self, input: &A::Record, output: &mut A::Record)

Generate the dependencies for a given execution record.
Source§

fn included(&self, shard: &Self::Record) -> bool

Whether this execution record contains events for this air.
Source§

fn commit_scope(&self) -> InteractionScope

Specifies whether it’s trace should be part of either the global or local commit.
Source§

fn local_only(&self) -> bool

Specifies whether the air only uses the local row, and not the next row.
Source§

impl<F, A> PartialEq for Chip<F, A>
where F: Field, A: PartialEq,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F, A: Eq> Eq for Chip<F, A>
where F: Field + Eq,

Auto Trait Implementations§

§

impl<F, A> Freeze for Chip<F, A>
where A: Freeze,

§

impl<F, A> RefUnwindSafe for Chip<F, A>

§

impl<F, A> Send for Chip<F, A>
where A: Send,

§

impl<F, A> Sync for Chip<F, A>
where A: Sync,

§

impl<F, A> Unpin for Chip<F, A>
where A: Unpin, F: Unpin,

§

impl<F, A> UnwindSafe for Chip<F, A>
where A: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more