Skip to main content

CpuBackend

Struct CpuBackend 

Source
pub struct CpuBackend<SC: StarkProtocolConfig>(/* private fields */);
Expand description

Row-major CPU prover backend.

Uses RowMajorMatrix<SC::F> as the matrix type for better cache locality during constraint evaluation.

Implementations§

Source§

impl<SC: StarkProtocolConfig> CpuBackend<SC>

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl<SC: Clone + StarkProtocolConfig> Clone for CpuBackend<SC>

Source§

fn clone(&self) -> CpuBackend<SC>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<SC: Copy + StarkProtocolConfig> Copy for CpuBackend<SC>

Source§

impl<SC: StarkProtocolConfig> Default for CpuBackend<SC>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<SC: StarkProtocolConfig> DeviceDataTransporter<SC, CpuBackend<SC>> for CpuDevice<SC>

Source§

fn transport_pk_to_device( &self, mpk: &MultiStarkProvingKey<SC>, ) -> DeviceMultiStarkProvingKey<CpuBackend<SC>>

Transport the proving key to the device, filtering for only the provided air_ids.
Source§

fn transport_matrix_to_device( &self, matrix: &ColMajorMatrix<SC::F>, ) -> RowMajorMatrix<SC::F>

Source§

fn transport_pcs_data_to_device( &self, pcs_data: &StackedPcsData<SC::F, SC::Digest>, ) -> CpuStackedPcsData<SC::F, SC::Digest>

The commitment and prover_data are assumed to have been previously computed from the trace.
Source§

fn transport_matrix_from_device_to_host( &self, matrix: &RowMajorMatrix<SC::F>, ) -> ColMajorMatrix<SC::F>

Transport a device matrix to host. This should only be used for testing / debugging purposes.
Source§

fn transport_committed_trace_data_to_device( &self, committed_trace: &CommittedTraceData<CpuColMajorBackend<SC>>, ) -> CommittedTraceData<PB>

Source§

fn transport_proving_ctx_to_device( &self, ctx: &ProvingContext<CpuColMajorBackend<SC>>, ) -> ProvingContext<PB>

Source§

impl<SC, TS> MultiRapProver<CpuBackend<SC>, TS> for CpuDevice<SC>
where SC: StarkProtocolConfig, SC::EF: TwoAdicField + ExtensionField<SC::F>, TS: FiatShamirTranscript<SC>,

Source§

type PartialProof = (GkrProof<SC>, BatchConstraintProof<SC>)

The partial proof is the proof that the trace matrices satisfy all constraints assuming that certain polynomial opening claims are validated. In other words, it is a proof that reduces the constraint satisfaction claim to certain polynomial opening claims.
Source§

type Artifacts = Vec<<SC as StarkProtocolConfig>::EF>

Other artifacts of the proof (e.g., sampled randomness) that may be passed to later stages of the protocol.
Source§

type Error = CpuProverError

Source§

fn prove_rap_constraints( &self, transcript: &mut TS, mpk: &DeviceMultiStarkProvingKey<CpuBackend<SC>>, ctx: &ProvingContext<CpuBackend<SC>>, _common_main_pcs_data: &CpuStackedPcsData<SC::F, SC::Digest>, ) -> Result<((GkrProof<SC>, BatchConstraintProof<SC>), Vec<SC::EF>), Self::Error>

Source§

impl<SC, TS> OpeningProver<CpuBackend<SC>, TS> for CpuDevice<SC>
where SC: StarkProtocolConfig, SC::F: Ord, SC::EF: TwoAdicField + ExtensionField<SC::F> + Ord, TS: FiatShamirTranscript<SC>,

Source§

type OpeningProof = (StackingProof<SC>, WhirProof<SC>)

PCS opening proof on host. This should not be a reference.
Source§

type OpeningPoints = Vec<<SC as StarkProtocolConfig>::EF>

Source§

type Error = CpuProverError

Computes the opening proof. The common_main_pcs_data is the PcsData for the collection of common main trace matrices. It is owned by the function and may be mutated. The pre_cached_pcs_data_per_commit is the PcsData for the preprocessed and cached trace matrices. These are specified by their PcsData per commitment.
Source§

fn prove_openings( &self, transcript: &mut TS, mpk: &DeviceMultiStarkProvingKey<CpuBackend<SC>>, ctx: ProvingContext<CpuBackend<SC>>, common_main_pcs_data: CpuStackedPcsData<SC::F, SC::Digest>, r: Vec<SC::EF>, ) -> Result<(StackingProof<SC>, WhirProof<SC>), Self::Error>

Source§

impl<SC: StarkProtocolConfig> ProverBackend for CpuBackend<SC>

Source§

const CHALLENGE_EXT_DEGREE: u8

Extension field degree for the challenge field Self::Challenge over base field Self::Val.
Source§

type Val = <SC as StarkProtocolConfig>::F

Base field type, on host.
Source§

type Challenge = <SC as StarkProtocolConfig>::EF

Challenge field (extension field of base field), on host.
Source§

type Commitment = <SC as StarkProtocolConfig>::Digest

Single commitment on host.
Source§

type Matrix = DenseMatrix<<SC as StarkProtocolConfig>::F>

Single matrix buffer on device together with dimension metadata. Owning this means nothing else has a shared reference to the buffer.
Source§

type OtherAirData = ()

Backend specific type for any pre-computed data associated with a single AIR. For example, it may contain prover-specific precomputations based on the AIR constraints (but independent from any trace data).
Source§

type PcsData = CpuStackedPcsData<<SC as StarkProtocolConfig>::F, <SC as StarkProtocolConfig>::Digest>

Owned buffer for the preimage of a PCS commitment on device, together with any metadata necessary for computing opening proofs. Read more
Source§

impl<SC, TS> ProverDevice<CpuBackend<SC>, TS> for CpuDevice<SC>
where SC: StarkProtocolConfig, SC::F: Ord, SC::EF: TwoAdicField + ExtensionField<SC::F> + Ord, TS: FiatShamirTranscript<SC>,

Source§

type Error = CpuProverError

Source§

type DeviceCtx = ()

Device-specific context (e.g., CUDA stream). Unit () for CPU devices.
Source§

fn device_ctx(&self) -> &()

Source§

impl<SC: StarkProtocolConfig> TraceCommitter<CpuBackend<SC>> for CpuDevice<SC>
where SC::F: Ord,

Source§

type Error = CpuProverError

Source§

fn commit( &self, traces: &[&RowMajorMatrix<SC::F>], ) -> Result<(SC::Digest, CpuStackedPcsData<SC::F, SC::Digest>), Self::Error>

Auto Trait Implementations§

§

impl<SC> Freeze for CpuBackend<SC>

§

impl<SC> RefUnwindSafe for CpuBackend<SC>
where SC: RefUnwindSafe,

§

impl<SC> Send for CpuBackend<SC>

§

impl<SC> Sync for CpuBackend<SC>

§

impl<SC> Unpin for CpuBackend<SC>
where SC: Unpin,

§

impl<SC> UnsafeUnpin for CpuBackend<SC>

§

impl<SC> UnwindSafe for CpuBackend<SC>
where SC: 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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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