binius_hal

Trait ComputationBackend

Source
pub trait ComputationBackend:
    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 sumcheck_compute_first_round_evals<FDomain, FBase, F, PBase, P, M, Evaluator, Composition>(
        &self,
        n_vars: usize,
        multilinears: &[SumcheckMultilinear<P, M>],
        evaluators: &[Evaluator],
        evaluation_points: &[FDomain],
    ) -> Result<Vec<RoundEvals<P::Scalar>>, Error>
       where FDomain: Field,
             FBase: ExtensionField<FDomain>,
             F: Field + ExtensionField<FDomain> + ExtensionField<FBase>,
             PBase: PackedField<Scalar = FBase> + PackedExtension<FDomain>,
             P: PackedField<Scalar = F> + PackedExtension<FDomain> + RepackedExtension<PBase>,
             M: MultilinearPoly<P> + Send + Sync,
             Evaluator: SumcheckEvaluator<PBase, P, Composition> + Sync,
             Composition: CompositionPolyOS<P>;
    fn sumcheck_compute_later_round_evals<FDomain, F, P, M, Evaluator, Composition>(
        &self,
        n_vars: usize,
        tensor_query: Option<MultilinearQueryRef<'_, P>>,
        multilinears: &[SumcheckMultilinear<P, M>],
        evaluators: &[Evaluator],
        evaluation_points: &[FDomain],
    ) -> Result<Vec<RoundEvals<P::Scalar>>, Error>
       where FDomain: Field,
             F: Field + ExtensionField<FDomain>,
             P: PackedField<Scalar = F> + PackedExtension<FDomain>,
             M: MultilinearPoly<P> + Send + Sync,
             Evaluator: SumcheckEvaluator<P, P, Composition> + Sync,
             Composition: CompositionPolyOS<P>;
    fn evaluate_partial_high<P: PackedField>(
        &self,
        multilinear: &impl MultilinearPoly<P>,
        query_expansion: MultilinearQueryRef<'_, P>,
    ) -> Result<MultilinearExtension<P>, Error>;
}
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 sumcheck_compute_first_round_evals<FDomain, FBase, F, PBase, P, M, Evaluator, Composition>( &self, n_vars: usize, multilinears: &[SumcheckMultilinear<P, M>], evaluators: &[Evaluator], evaluation_points: &[FDomain], ) -> Result<Vec<RoundEvals<P::Scalar>>, Error>
where FDomain: Field, FBase: ExtensionField<FDomain>, F: Field + ExtensionField<FDomain> + ExtensionField<FBase>, PBase: PackedField<Scalar = FBase> + PackedExtension<FDomain>, P: PackedField<Scalar = F> + PackedExtension<FDomain> + RepackedExtension<PBase>, M: MultilinearPoly<P> + Send + Sync, Evaluator: SumcheckEvaluator<PBase, P, Composition> + Sync, Composition: CompositionPolyOS<P>,

Calculate the accumulated evaluations for the first round of zerocheck.

Source

fn sumcheck_compute_later_round_evals<FDomain, F, P, M, Evaluator, Composition>( &self, n_vars: usize, tensor_query: Option<MultilinearQueryRef<'_, P>>, multilinears: &[SumcheckMultilinear<P, M>], evaluators: &[Evaluator], evaluation_points: &[FDomain], ) -> Result<Vec<RoundEvals<P::Scalar>>, Error>
where FDomain: Field, F: Field + ExtensionField<FDomain>, P: PackedField<Scalar = F> + PackedExtension<FDomain>, M: MultilinearPoly<P> + Send + Sync, Evaluator: SumcheckEvaluator<P, P, Composition> + Sync, Composition: CompositionPolyOS<P>,

Calculate the accumulated evaluations for an arbitrary round of zerocheck.

Source

fn evaluate_partial_high<P: PackedField>( &self, multilinear: &impl MultilinearPoly<P>, query_expansion: MultilinearQueryRef<'_, P>, ) -> Result<MultilinearExtension<P>, Error>

Partially evaluate the polynomial with assignment to the high-indexed variables.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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 + Send,

Makes it unnecessary to clone backends. Can’t use auto_impl because of the complex associated type.

Source§

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 sumcheck_compute_first_round_evals<FDomain, FBase, F, PBase, P, M, Evaluator, Composition>( &self, n_vars: usize, multilinears: &[SumcheckMultilinear<P, M>], evaluators: &[Evaluator], evaluation_points: &[FDomain], ) -> Result<Vec<RoundEvals<P::Scalar>>, Error>
where FDomain: Field, FBase: ExtensionField<FDomain>, F: Field + ExtensionField<FDomain> + ExtensionField<FBase>, PBase: PackedField<Scalar = FBase> + PackedExtension<FDomain>, P: PackedField<Scalar = F> + PackedExtension<FDomain> + RepackedExtension<PBase>, M: MultilinearPoly<P> + Send + Sync, Evaluator: SumcheckEvaluator<PBase, P, Composition> + Sync, Composition: CompositionPolyOS<P>,

Source§

fn sumcheck_compute_later_round_evals<FDomain, F, P, M, Evaluator, Composition>( &self, n_vars: usize, tensor_query: Option<MultilinearQueryRef<'_, P>>, multilinears: &[SumcheckMultilinear<P, M>], evaluators: &[Evaluator], evaluation_points: &[FDomain], ) -> Result<Vec<RoundEvals<P::Scalar>>, Error>
where FDomain: Field, F: Field + ExtensionField<FDomain>, P: PackedField<Scalar = F> + PackedExtension<FDomain>, M: MultilinearPoly<P> + Send + Sync, Evaluator: SumcheckEvaluator<P, P, Composition> + Sync, Composition: CompositionPolyOS<P>,

Source§

fn evaluate_partial_high<P: PackedField>( &self, multilinear: &impl MultilinearPoly<P>, query_expansion: MultilinearQueryRef<'_, P>, ) -> Result<MultilinearExtension<P>, Error>

Implementors§

Source§

impl ComputationBackend for CpuBackend

Source§

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