pub struct TieredBackend { /* private fields */ }Expand description
A SimBackend that interprets immediately and promotes to generated
code as soon as background compilation completes.
Implementations§
Source§impl TieredBackend
impl TieredBackend
Sourcepub fn new(laid_out: &LaidOutProgram, options: &SimulatorOptions) -> Self
pub fn new(laid_out: &LaidOutProgram, options: &SimulatorOptions) -> Self
Build a tiered simulation targeting this host’s default compiled tier: ready to run immediately on the interpreter while the compiled tier is prepared in the background.
The native tier observes cancellation (see
TieredBackend::cancel_background_compilation); the Cranelift tier
runs to completion once started.
Sourcepub fn is_compiled(&self) -> bool
pub fn is_compiled(&self) -> bool
Whether the compiled tier has been adopted.
Sourcepub fn execution_stats(&self) -> TieredExecutionStats
pub fn execution_stats(&self) -> TieredExecutionStats
Return deterministic lifecycle and execution measurements.
Sourcepub fn start_execution_timing(&mut self)
pub fn start_execution_timing(&mut self)
Start measuring time to promotion for a benchmark workload.
Sourcepub fn finish_execution_timing(&mut self) -> Option<TieredExecutionTiming>
pub fn finish_execution_timing(&mut self) -> Option<TieredExecutionTiming>
Stop timing and return the observed promotion interval.
Sourcepub fn promotion_error(&self) -> Option<&SimulatorError>
pub fn promotion_error(&self) -> Option<&SimulatorError>
Why promotion has not happened yet, for diagnostics.
Returns None once running fully compiled or while background
compilation is still in progress.
Sourcepub fn cancel_background_compilation(&mut self) -> bool
pub fn cancel_background_compilation(&mut self) -> bool
Request cancellation of background compilation.
The native-tier worker unwinds at its next task boundary and the
simulation stays on the interpreter permanently; the reason becomes
retrievable through TieredBackend::promotion_error. A result that
already reached the channel (or arrives afterwards, for example from
a tier that ignores the token) is rejected so cancellation is
honored regardless of compiler timing. Returns whether a background
compilation was still pending, so callers that only want to reclaim
a finished worker can ignore the call cheaply.
Trait Implementations§
Source§impl Drop for TieredBackend
impl Drop for TieredBackend
Source§impl SimBackend for TieredBackend
impl SimBackend for TieredBackend
Source§type Event = TieredEventRef
type Event = TieredEventRef
fn eval_comb(&mut self) -> Result<(), SimulatorErrorCode>
Source§fn eval_apply_ff_at(
&mut self,
event: TieredEventRef,
) -> Result<(), SimulatorErrorCode>
fn eval_apply_ff_at( &mut self, event: TieredEventRef, ) -> Result<(), SimulatorErrorCode>
Source§fn eval_comb_apply_ff_at(
&mut self,
event: TieredEventRef,
) -> Result<(), SimulatorErrorCode>
fn eval_comb_apply_ff_at( &mut self, event: TieredEventRef, ) -> Result<(), SimulatorErrorCode>
Source§fn eval_comb_apply_ff_many_at(
&mut self,
event: TieredEventRef,
count: u64,
) -> (u64, Result<(), SimulatorErrorCode>)
fn eval_comb_apply_ff_many_at( &mut self, event: TieredEventRef, count: u64, ) -> (u64, Result<(), SimulatorErrorCode>)
count identical fused ticks. The returned count is the
number of iterations completed before a runtime event or error forced a
return to the host. Backends without an in-function loop execute one
iteration so the caller can preserve per-tick observation semantics.Source§fn eval_only_ff_at(
&mut self,
event: TieredEventRef,
) -> Result<(), SimulatorErrorCode>
fn eval_only_ff_at( &mut self, event: TieredEventRef, ) -> Result<(), SimulatorErrorCode>
Source§fn apply_ff_at(
&mut self,
event: TieredEventRef,
) -> Result<(), SimulatorErrorCode>
fn apply_ff_at( &mut self, event: TieredEventRef, ) -> Result<(), SimulatorErrorCode>
fn resolve_signal(&self, addr: &AbsoluteAddr) -> SignalRef
fn resolve_event(&self, addr: &AbsoluteAddr) -> TieredEventRef
fn resolve_event_opt(&self, addr: &AbsoluteAddr) -> Option<TieredEventRef>
fn resolve_eval_only_event(&self, addr: &AbsoluteAddr) -> Option<TieredEventRef>
fn resolve_apply_event(&self, addr: &AbsoluteAddr) -> Option<TieredEventRef>
fn set<T: Copy>(&mut self, signal: SignalRef, value: T)
fn set_wide(&mut self, signal: SignalRef, value: BigUint)
fn set_four_state(&mut self, signal: SignalRef, value: BigUint, mask: BigUint)
fn get(&self, signal: SignalRef) -> BigUint
fn get_as<T: Default + Copy>(&self, signal: SignalRef) -> T
fn get_four_state(&self, signal: SignalRef) -> (BigUint, BigUint)
fn memory_as_ptr(&self) -> (*const u8, usize)
Source§fn memory_as_mut_ptr(&mut self) -> (*mut u8, usize)
fn memory_as_mut_ptr(&mut self) -> (*mut u8, usize)
Source§fn memory_owner(&self) -> Option<Arc<dyn Any + Send + Sync>>
fn memory_owner(&self) -> Option<Arc<dyn Any + Send + Sync>>
Source§fn vcd_tracking_enabled(&self) -> bool
fn vcd_tracking_enabled(&self) -> bool
fn runtime_event_buffer_as_ptr(&self) -> (*const u8, usize)
fn runtime_event_buffer(&self) -> Option<Arc<RuntimeEventBuffer>>
fn set_comb_capture_event_enabled(&mut self, active_sites: &[bool])
fn stable_region_size(&self) -> usize
fn layout(&self) -> &MemoryLayout
fn id_to_addr_slice(&self) -> &[AbsoluteAddr] ⓘ
fn id_to_event_slice(&self) -> &[TieredEventRef]
fn num_events(&self) -> usize
fn clear_triggered_bits(&mut self)
fn mark_triggered_bit(&mut self, id: usize)
fn get_triggered_bits(&self) -> BitSet
Source§fn take_vcd_activity(&mut self, groups: &mut Vec<usize>) -> bool
fn take_vcd_activity(&mut self, groups: &mut Vec<usize>) -> bool
Source§fn mark_vcd_signal(&mut self, signal: SignalRef)
fn mark_vcd_signal(&mut self, signal: SignalRef)
Auto Trait Implementations§
impl !RefUnwindSafe for TieredBackend
impl !Sync for TieredBackend
impl !UnwindSafe for TieredBackend
impl Freeze for TieredBackend
impl Send for TieredBackend
impl Unpin for TieredBackend
impl UnsafeUnpin for TieredBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more