Trait SystemChipComplex

Source
pub trait SystemChipComplex<RA, PB: ProverBackend> {
    // Required methods
    fn load_program(&mut self, cached_program_trace: CommittedTraceData<PB>);
    fn transport_init_memory_to_device(&mut self, memory: &GuestMemory);
    fn generate_proving_ctx(
        &mut self,
        system_records: SystemRecords<PB::Val>,
        record_arenas: Vec<RA>,
    ) -> Vec<AirProvingContext<PB>>;
    fn memory_top_tree(&self) -> Option<&[[PB::Val; 8]]>;

    // Provided method
    fn finalize_trace_heights(&self, _heights: &mut [usize]) { ... }
}
Expand description

Trait for trace generation of all system AIRs. The system chip complex is special because we may not exactly following the exact matching between Air and Chip. Moreover we may require more flexibility than what is provided through the trait object [AnyChip].

The SystemChipComplex is meant to be constructible once the VM configuration is known, and it can be loaded with arbitrary programs supported by the instruction set available to its configuration. The SystemChipComplex is meant to persistent between instances of proof generation.

Required Methods§

Source

fn load_program(&mut self, cached_program_trace: CommittedTraceData<PB>)

Loads the program in the form of a cached trace with prover data.

Source

fn transport_init_memory_to_device(&mut self, memory: &GuestMemory)

Transport the initial memory state to device. This may be called before preflight execution begins and start async device processes in parallel to execution.

Source

fn generate_proving_ctx( &mut self, system_records: SystemRecords<PB::Val>, record_arenas: Vec<RA>, ) -> Vec<AirProvingContext<PB>>

The caller must guarantee that record_arenas has length equal to the number of system AIRs, although some arenas may be empty if they are unused.

Source

fn memory_top_tree(&self) -> Option<&[[PB::Val; 8]]>

This function only returns Some when continuations is enabled. When continuations is enabled, it returns the top merkle sub-tree of the memory merkle tree as a segment tree with 2 * (2^addr_space_height) - 1 nodes, representing the Merkle tree formed from the roots of the sub-trees for each address space.

This function must return Some if called after generate_proving_ctx and may return None if called before that.

Provided Methods§

Source

fn finalize_trace_heights(&self, _heights: &mut [usize])

This function is only used for metric collection purposes and custom implementations are free to ignore it.

Since system chips (primarily memory) will only have all information needed to compute the true used trace heights after generate_proving_ctx is called, this method will be called after generate_proving_ctx on the trace heights of all AIRs (including non-system AIRs) in the AIR ID order.

The default implementation does nothing.

Implementors§