pub trait ComputationBackend: Clone + Send + Sync + Debug {
    type Vec<P: Send + Sync + Debug + 'static>: HalSlice<P>;

    // Required methods
    fn to_hal_slice<P: Debug + Send + Sync>(v: Vec<P>) -> Self::Vec<P>;
    fn tensor_product_full_query<P: PackedField>(
        &self,
        query: &[P::Scalar]
    ) -> Result<Self::Vec<P>, Error>;
    fn zerocheck_compute_round_coeffs<F, PW, FDomain>(
        &self,
        params: &ZerocheckRoundParameters,
        input: &ZerocheckRoundInput<'_, F, PW, FDomain>,
        cpu_handler: &mut dyn ZerocheckCpuBackendHelper<F, PW, FDomain>
    ) -> Result<Vec<PW::Scalar>, Error>
       where F: Field,
             PW: PackedField + PackedExtension<FDomain>,
             PW::Scalar: From<F> + Into<F> + ExtensionField<FDomain>,
             FDomain: Field;
}
Expand description

An abstraction to interface with acceleration hardware to perform computation intensive operations.

Required Associated Types§

source

type Vec<P: Send + Sync + Debug + 'static>: HalSlice<P>

Required Methods§

source

fn to_hal_slice<P: Debug + Send + Sync>(v: Vec<P>) -> Self::Vec<P>

Creates Self::Vec<P> from the given Vec<P>.

source

fn tensor_product_full_query<P: PackedField>( &self, query: &[P::Scalar] ) -> Result<Self::Vec<P>, Error>

Computes tensor product expansion.

source

fn zerocheck_compute_round_coeffs<F, PW, FDomain>( &self, params: &ZerocheckRoundParameters, input: &ZerocheckRoundInput<'_, F, PW, FDomain>, cpu_handler: &mut dyn ZerocheckCpuBackendHelper<F, PW, FDomain> ) -> Result<Vec<PW::Scalar>, Error>
where F: Field, PW: PackedField + PackedExtension<FDomain>, PW::Scalar: From<F> + Into<F> + ExtensionField<FDomain>, FDomain: Field,

Computes round coefficients for zerocheck. cpu_handler is a callback to handle the CpuBackend computation. It’s a leaky abstraction, but zerocheck is too complex to refactor for a clean abstraction separation just yet.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, T: 'a + ComputationBackend> ComputationBackend for &'a T
where &'a T: Debug + Sync + Clone + Send,

Make it unnecessary to clone backends. TODO: Refactor the codebase to use &backend instead of backend.clone().

§

type Vec<P: Send + Sync + Debug + 'static> = <T as ComputationBackend>::Vec<P>

source§

fn to_hal_slice<P: Debug + Send + Sync>(v: Vec<P>) -> Self::Vec<P>

source§

fn tensor_product_full_query<P: PackedField>( &self, query: &[P::Scalar] ) -> Result<Self::Vec<P>, Error>

source§

fn zerocheck_compute_round_coeffs<F, PW, FDomain>( &self, params: &ZerocheckRoundParameters, input: &ZerocheckRoundInput<'_, F, PW, FDomain>, cpu_handler: &mut dyn ZerocheckCpuBackendHelper<F, PW, FDomain> ) -> Result<Vec<PW::Scalar>, Error>
where F: Field, PW: PackedField + PackedExtension<FDomain>, PW::Scalar: From<F> + Into<F> + ExtensionField<FDomain>, FDomain: Field,

Implementors§

source§

impl ComputationBackend for CpuBackend

§

type Vec<P: Send + Sync + Debug + 'static> = Vec<P>