MapperBuilder

Trait MapperBuilder 

Source
pub trait MapperBuilder<'a, DR, DW, D, E>
where DR: DataReader, DW: DataWriter, D: DataHolder<'a, DR, DW>, E: MapperExecutor<'a, DR, DW, D>,
{ type ErrorType; // Required methods fn user_defs(&mut self, user_defs: &str); fn transform_helpers(&mut self); unsafe fn add_internal<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, ) where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug; fn build(self) -> Result<Vec<E>, Self::ErrorType>; fn word_len(&self) -> u32; fn type_len(&self) -> u32; fn is_data_holder_global() -> bool; fn is_data_holder_in_builder() -> bool; fn preferred_input_count(&self) -> usize; // Provided methods fn add_with_config<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, ) where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug { ... } fn add<T>(&mut self, name: &str, circuit: Circuit<T>, arg_inputs: &[usize]) where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug { ... } }
Expand description

Trait defines builder for sequential mapper.

Usage of builder is simple: first step is adding circuits to builder. Next step is building executors by using build method. Additional methods adds helpers and an user defined code. Builder after building should returns same number of executor as number of added simulation configurations. This builder returns MapperExecutors.

Required Associated Types§

Source

type ErrorType

Error type used if error encountered while execution.

Required Methods§

Source

fn user_defs(&mut self, user_defs: &str)

Adds additional user definition to code of simulations.

Source

fn transform_helpers(&mut self)

Adds transform helpers.

Transform helpers provides macros that helps to transform data between form used while simulating circuit and external usage. They can be used in pop_input_code and aggr_output_code.

  • Macro INPUT_TRANSFORM_BXX(D0,...,DXX,S) transforms data in X-bit integers stored as 32-bit words to form fetched by simulation code. DX is output single pack element X, S array of 32-bit words.
  • Macro OUTPUT_TRANSFORM_BXX(D,S0,....,SXX) transforms from form fetched by simulation code to data in X-bit integers stored as 32-bit words. D is output data array of 32-bit words, SX is input pack element X.

Transform helpers are much faster than data transformers.

Source

unsafe fn add_internal<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, )
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug,

Only for implementation.

Adds circuit to builder. name is name of function, circuit is circuit to simulate, code_config is code configuration.

Source

fn build(self) -> Result<Vec<E>, Self::ErrorType>

Build code to simulations. If build succeeded then returns executors for simulations in addition order.

Source

fn word_len(&self) -> u32

Returns length processor word in bits.

Source

fn type_len(&self) -> u32

Returns type length in bits (includes only type length not word length if group_vec enabled).

Source

fn is_data_holder_global() -> bool

Returns true if any data holder is global and it can be shared between any executors from any builder of that type.

Source

fn is_data_holder_in_builder() -> bool

Returns true if any data holder is global and it can be shared between any executors from this builder.

Source

fn preferred_input_count(&self) -> usize

Returns hint about preferred count of input.

Provided Methods§

Source

fn add_with_config<T>( &mut self, name: &str, circuit: Circuit<T>, code_config: CodeConfig<'_>, )
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug,

Adds circuit to builder. name is name of function, circuit is circuit to simulate, code_config is code configuration.

Source

fn add<T>(&mut self, name: &str, circuit: Circuit<T>, arg_inputs: &[usize])
where T: Clone + Copy + Ord + PartialEq + Eq + Hash + Default + TryFrom<usize>, <T as TryFrom<usize>>::Error: Debug, usize: TryFrom<T>, <usize as TryFrom<T>>::Error: Debug,

Adds circuit to builder. name is name of function, circuit is circuit to simulate, arg_inputs are circuit inputs to be assigned to arg input.

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.

Implementors§

Source§

impl<'a, DR, DW, D, E, B> MapperBuilder<'a, DR, DW, D, BasicMapperExecutor<'a, DR, DW, D, E>> for BasicMapperBuilder<'a, DR, DW, D, E, B>
where DR: DataReader, DW: DataWriter, D: DataHolder<'a, DR, DW>, E: Executor<'a, DR, DW, D>, B: Builder<'a, DR, DW, D, E>,

Source§

type ErrorType = <B as Builder<'a, DR, DW, D, E>>::ErrorType