Skip to main content

Module cutask_anytime

Module cutask_anytime 

Source
Expand description

Trait and types to implement an anytime Copper task.

An anytime task splits its work into a mandatory minimum (CuAnytimeTask::base) plus optional bounded improvements (CuAnytimeTask::refine). The task reports what each quantum achieved through AnytimeStatus; the runtime decides whether to schedule another quantum from that status stream and its configured time budget and quality target. The task never sees the policy, so implementations stay reusable under any policy.

Enums§

AnytimeStatus
Returned by CuAnytimeTask::base and CuAnytimeTask::refine; drives the runtime’s refinement scheduling.

Traits§

AnytimeQuality
Bound on CuAnytimeTask::Quality: comparability for the policy checks, plus how a quality reads back for the status stamp. A custom quality type needs only impl AnytimeQuality for MyQuality {} (unscored in stamps) or an override of ratio.
CuAnytimeTask
A task producing a valid result from the bare-minimum compute, then improving it in bounded quanta for as long as the runtime allows.

Functions§

quality_from_f32
Converts a normalized f32 (e.g. a RON policy knob) into a Quality.
quality_to_f32
Reads a Quality back as a normalized f32.

Type Aliases§

Quality
Normalized quality of a published result: a dimensionless Ratio in 0.0..=1.0, higher is better and 1.0 means no further improvement is meaningful. Sharing one scale across tasks keeps a configured quality target portable.