CompileBreakevenScenario
Optimization scenarios · Implementation: mlsysim/engine/scenario_definitions/optimization.py.
Construct this scenario with keyword inputs. The fields below show the types and defaults declared by this class.
Eager against compiled execution: the work that repays compile_time.
Compiling pays when the time saved per item, summed over items, exceeds the compile time. An experiment of experiment_items items that changes the code recompiles times pays a compile for every change.
Notes
Equation: Compile cost divided by per-item time savings gives the breakeven item count.
Assumptions: Steady item rates and a positive compiled speed advantage; recompilation is charged once per declared code change.
Excludes: Warmup, cache effects, and rate changes during the experiment.
References
Derivation: Compile cost divided by per-item time savings gives the breakeven item count. Individual property contracts identify the exact accounting expression or reusable calculation. Registry entries supply the scenario inputs; this class does not turn them into measured outcomes.
Examples
Evaluate a named scenario using its declared inputs.
>>> from mlsysim import Scenarios
>>> scenario = Scenarios.ResNet50CompileBreakeven
>>> round(float(scenario.eager_item_time.magnitude), 4)
0.6897Attributes
| Name | Description |
|---|---|
| breakeven_items | Item count at which accumulated per-item savings equal the compile time; requires |
| compile_time | |
| compiled_item_time | Time per compiled item in milliseconds, the inverse of the compiled rate. |
| compiled_rate | |
| eager_item_time | Time per eager item in milliseconds, the inverse of the eager item rate. |
| eager_rate | |
| experiment_compiled_running | Seconds executing all experiment items after compilation, excluding compile costs. |
| experiment_compiled_total | Total seconds including one compile charge per declared recompilation. |
| experiment_eager | Seconds for all experiment items at the eager rate, excluding compilation. |
| experiment_items | |
| experiment_slowdown | Dimensionless total compiled-experiment time divided by eager-experiment time. |
| recompiles | |
| saving_per_item | Milliseconds saved per item by compilation; a nonpositive value cannot repay |
| speedup | Dimensionless compiled-to-eager throughput ratio for identical items. |
eager_rate
Type: Quantity.
Declared default: required.
compiled_rate
Type: Quantity.
Declared default: required.
compile_time
Type: Quantity.
Declared default: required.
experiment_items
Type: Optional[int].
Declared default: None.
recompiles
Type: Optional[int].
Declared default: None.
eager_item_time
engine.scenario_types.CompileBreakevenScenario.eager_item_time
Time per eager item in milliseconds, the inverse of the eager item rate.
Equation: (1 / eager_rate).to('ms').
compiled_item_time
engine.scenario_types.CompileBreakevenScenario.compiled_item_time
Time per compiled item in milliseconds, the inverse of the compiled rate.
Equation: (1 / compiled_rate).to('ms').
saving_per_item
engine.scenario_types.CompileBreakevenScenario.saving_per_item
Milliseconds saved per item by compilation; a nonpositive value cannot repay compilation.
Equation: (eager_item_time - compiled_item_time).to('ms').
breakeven_items
engine.scenario_types.CompileBreakevenScenario.breakeven_items
Item count at which accumulated per-item savings equal the compile time; requires positive savings.
Equation: (compile_time / saving_per_item).to('').magnitude.
speedup
engine.scenario_types.CompileBreakevenScenario.speedup
Dimensionless compiled-to-eager throughput ratio for identical items.
Equation: (compiled_rate / eager_rate).to('').magnitude.
experiment_eager
engine.scenario_types.CompileBreakevenScenario.experiment_eager
Seconds for all experiment items at the eager rate, excluding compilation.
Equation: (experiment_items / eager_rate).to('second').
experiment_compiled_running
engine.scenario_types.CompileBreakevenScenario.experiment_compiled_running
Seconds executing all experiment items after compilation, excluding compile costs.
Equation: (experiment_items / compiled_rate).to('second').
experiment_compiled_total
engine.scenario_types.CompileBreakevenScenario.experiment_compiled_total
Total seconds including one compile charge per declared recompilation.
Equation: (recompiles * compile_time + experiment_compiled_running).to('second').
experiment_slowdown
engine.scenario_types.CompileBreakevenScenario.experiment_slowdown
Dimensionless total compiled-experiment time divided by eager-experiment time.
Equation: (experiment_compiled_total / experiment_eager).to('').magnitude.