FrameCompressionScenario
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.
A per-frame model against a camera frame rate: the full model and a channel-pruned variant, run in floating point on the CPU and in integers on the accelerator.
cpu_rate and accelerator_rate are the full model’s frame rates. The pruned model’s frame time scales with its share of the arithmetic, because channel pruning leaves dense tensors that run the same kernels on fewer channels (an upper bound on the saving; measurement decides).
Notes
Equation: frame_budget is the worked quantity; each property below states its equation and units.
Assumptions: Pruning preserves dense kernels and frame time scales ideally with forward FLOP fraction.
Excludes: Predicting accuracy, sparse execution, launch overhead, and empirical latency scaling.
References
Derivation: The equations below follow the stated counts, geometric relations, or accounting definitions; scenario inputs are supplied assumptions or observations, not fitted predictions.
Examples
Execute the registered worked inputs; this is a modeled calculation.
>>> from mlsysim import Scenarios
>>> case = Scenarios.MobileNetV2BlurPipelinePhone
>>> value = case.frame_budget
>>> print(f"{value:.3f~P}")
33.333 msAttributes
| Name | Description |
|---|---|
| accelerator_frame | Full-model accelerator frame duration in milliseconds. |
| accelerator_rate | |
| cpu_frame | Full-model CPU frame duration in milliseconds. |
| cpu_rate | |
| float_bytes | |
| flop_fraction | Dimensionless pruned-to-full forward-FLOP ratio. |
| frame_budget | Available frame duration in milliseconds at the camera cadence. |
| frame_rate | |
| full | |
| full_bytes | Full-model floating-point weight storage in MB. |
| int_bytes | |
| param_fraction | Dimensionless pruned-to-full parameter-count ratio. |
| pruned | |
| pruned_accelerator_frame | Ideal pruned accelerator frame duration in milliseconds, scaled only by FLOP fraction. |
| pruned_bytes | Pruned-model floating-point weight storage in MB. |
| pruned_cpu_frame | Ideal pruned CPU frame duration in milliseconds, scaled only by FLOP fraction. |
| pruned_int_bytes | Pruned-model integer weight storage in MB. |
full
Type: Workload.
Declared default: required.
pruned
Type: Workload.
Declared default: required.
frame_rate
Type: Quantity.
Declared default: required.
cpu_rate
Type: Quantity.
Declared default: required.
accelerator_rate
Type: Quantity.
Declared default: required.
float_bytes
Type: Quantity.
Declared default: required.
int_bytes
Type: Quantity.
Declared default: required.
frame_budget
engine.scenario_types.FrameCompressionScenario.frame_budget
Available frame duration in milliseconds at the camera cadence.
Equation: return (1 / self.frame_rate).to(‘millisecond’)
cpu_frame
engine.scenario_types.FrameCompressionScenario.cpu_frame
Full-model CPU frame duration in milliseconds.
Equation: return (1 / self.cpu_rate).to(‘millisecond’)
accelerator_frame
engine.scenario_types.FrameCompressionScenario.accelerator_frame
Full-model accelerator frame duration in milliseconds.
Equation: return (1 / self.accelerator_rate).to(‘millisecond’)
flop_fraction
engine.scenario_types.FrameCompressionScenario.flop_fraction
Dimensionless pruned-to-full forward-FLOP ratio.
Equation: return (self.pruned.inference_flops / self.full.inference_flops).to(’’).magnitude
param_fraction
engine.scenario_types.FrameCompressionScenario.param_fraction
Dimensionless pruned-to-full parameter-count ratio.
Equation: return (self.pruned.parameters / self.full.parameters).to(’’).magnitude
full_bytes
engine.scenario_types.FrameCompressionScenario.full_bytes
Full-model floating-point weight storage in MB.
Equation: return self.full.size_in_bytes(self.float_bytes).to(‘MB’)
pruned_bytes
engine.scenario_types.FrameCompressionScenario.pruned_bytes
Pruned-model floating-point weight storage in MB.
Equation: return self.pruned.size_in_bytes(self.float_bytes).to(‘MB’)
pruned_int_bytes
engine.scenario_types.FrameCompressionScenario.pruned_int_bytes
Pruned-model integer weight storage in MB.
Equation: return self.pruned.size_in_bytes(self.int_bytes).to(‘MB’)
pruned_cpu_frame
engine.scenario_types.FrameCompressionScenario.pruned_cpu_frame
Ideal pruned CPU frame duration in milliseconds, scaled only by FLOP fraction.
Equation: return (self.cpu_frame * self.flop_fraction).to(‘millisecond’)
pruned_accelerator_frame
engine.scenario_types.FrameCompressionScenario.pruned_accelerator_frame
Ideal pruned accelerator frame duration in milliseconds, scaled only by FLOP fraction.
Equation: return (self.accelerator_frame * self.flop_fraction).to(‘millisecond’)