Struct calyx_opt::analysis::InferenceAnalysis
source · [−]pub struct InferenceAnalysis {
pub latency_data: HashMap<Id, GoDone>,
pub static_component_latencies: HashMap<Id, u64>,
/* private fields */
}
Expand description
Default implemnetation is almost certainly not helpful.
You should probably use from_ctx
instead.
Fields
latency_data: HashMap<Id, GoDone>
component name -> vec<(go signal, done signal, latency)>
static_component_latencies: HashMap<Id, u64>
Maps static component names to their latencies, but there can only be one go port on the component. (This is a subset of the information given by latency_data), and is helpful for inferring invokes. Perhaps someday we should get rid of it and only make it one field.
Implementations
sourceimpl InferenceAnalysis
impl InferenceAnalysis
sourcepub fn from_ctx(ctx: &Context) -> Self
pub fn from_ctx(ctx: &Context) -> Self
Builds FixUp struct from a ctx. Looks at all primitives and component signatures to get latency information.
sourcepub fn add_component(&mut self, (comp_name, latency, go_done): (Id, u64, GoDone))
pub fn add_component(&mut self, (comp_name, latency, go_done): (Id, u64, GoDone))
Updates the component, given a component name and a new latency and GoDone object.
sourcepub fn remove_component(&mut self, comp_name: Id)
pub fn remove_component(&mut self, comp_name: Id)
Updates the component, given a component name and a new latency. Note that this expects that the component already is accounted for in self.latency_data and self.static_component_latencies.
sourcepub fn adjust_component(&mut self, (comp_name, adjusted_latency): (Id, u64))
pub fn adjust_component(&mut self, (comp_name, adjusted_latency): (Id, u64))
Updates the component, given a component name and a new latency. Note that this expects that the component already is accounted for in self.latency_data and self.static_component_latencies.
sourcepub fn get_possible_latency(c: &Control) -> Option<u64>
pub fn get_possible_latency(c: &Control) -> Option<u64>
Returns Some(latency) if a control statement has a latency, because it is static or is has the @promotable attribute
pub fn remove_promotable_from_seq(seq: &mut Seq)
sourcepub fn remove_promotable_attribute(c: &mut Control)
pub fn remove_promotable_attribute(c: &mut Control)
Removes the @promotable attribute from the control program. Recursively visits the children of the control.
pub fn fixup_seq(&self, seq: &mut Seq)
pub fn fixup_par(&self, par: &mut Par)
pub fn fixup_if(&self, _if: &mut If)
pub fn fixup_while(&self, _while: &mut While)
pub fn fixup_repeat(&self, repeat: &mut Repeat)
pub fn fixup_ctrl(&self, ctrl: &mut Control)
sourcepub fn fixup_timing(&self, comp: &mut Component)
pub fn fixup_timing(&self, comp: &mut Component)
“Fixes Up” the component. In particular:
- Removes @promotable annotations for any groups that write to any
updated_components
. - Try to re-infer groups’ latencies.
- Removes all @promotable annotation from the control program.
- Re-infers the @promotable annotations for any groups or control. Note that this only fixes up the component’s ``internals’’. It does not fix the component’s signature.