Trait binius_hal::ComputationBackend
source · 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§
Required Methods§
sourcefn to_hal_slice<P: Debug + Send + Sync>(v: Vec<P>) -> Self::Vec<P>
fn to_hal_slice<P: Debug + Send + Sync>(v: Vec<P>) -> Self::Vec<P>
Creates Self::Vec<P>
from the given Vec<P>
.
sourcefn tensor_product_full_query<P: PackedField>(
&self,
query: &[P::Scalar]
) -> Result<Self::Vec<P>, Error>
fn tensor_product_full_query<P: PackedField>( &self, query: &[P::Scalar] ) -> Result<Self::Vec<P>, Error>
Computes tensor product expansion.
sourcefn 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,
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
impl<'a, T: 'a + ComputationBackend> ComputationBackend for &'a T
Make it unnecessary to clone backends.
TODO: Refactor the codebase to use &backend
instead of backend.clone()
.