OperationEnergyComparisonScenario
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 wide and a narrow format’s energy per add, multiply, and multiply-accumulate, and one memory read against the narrow multiply-accumulate. The narrow MAC accumulates in a wider integer, so its add is accumulate_add.
Notes
Equation: The calculation members below define wide_mac, narrow_mac, add_ratio, mul_ratio, mac_ratio, read_over_narrow_mac.
Assumptions: Per-operation energies refer to compatible operations; one MAC includes the stated multiply and accumulation add.
Excludes: Data reuse, clock gating, and whole-device energy.
References
Derivation: A wide and a narrow format’s energy per add, multiply, and multiply-accumulate, and one memory read against the narrow multiply-accumulate. The narrow MAC accumulates in a wider integer, so its add is accumulate_add. Each member records the corresponding algebra or named physics function.
Examples
Evaluate the named configuration and display a modeled result.
>>> from mlsysim import Scenarios
>>> case = Scenarios.Int8VsFp32OperationEnergy45nm
>>> value = case.mac_ratio
>>> print(f"{value:.3g}")
15.3Attributes
| Name | Description |
|---|---|
| accumulate_add | |
| add_ratio | Dimensionless wide-to-narrow add-energy ratio. |
| mac_ratio | Dimensionless wide-to-narrow multiply-accumulate energy ratio. |
| memory_read | |
| mul_ratio | Dimensionless wide-to-narrow multiply-energy ratio. |
| narrow_add | |
| narrow_mac | Narrow multiply plus the stated accumulation-add energy. |
| narrow_mul | |
| read_over_narrow_mac | Number of narrow MAC energy budgets equivalent to one memory read under the stated per-operation convention. |
| wide_add | |
| wide_mac | Wide-format multiply plus add energy per arithmetic operation pair. |
| wide_mul |
wide_add
Type: Quantity.
Declared default: required.
wide_mul
Type: Quantity.
Declared default: required.
narrow_add
Type: Quantity.
Declared default: required.
narrow_mul
Type: Quantity.
Declared default: required.
accumulate_add
Type: Quantity.
Declared default: required.
memory_read
Type: Quantity.
Declared default: required.
wide_mac
engine.scenario_types.OperationEnergyComparisonScenario.wide_mac
Wide-format multiply plus add energy per arithmetic operation pair.
Equation: wide_mul + wide_add.
narrow_mac
engine.scenario_types.OperationEnergyComparisonScenario.narrow_mac
Narrow multiply plus the stated accumulation-add energy.
Equation: narrow_mul + accumulate_add.
add_ratio
engine.scenario_types.OperationEnergyComparisonScenario.add_ratio
Dimensionless wide-to-narrow add-energy ratio.
Equation: (wide_add / narrow_add).to('').magnitude.
mul_ratio
engine.scenario_types.OperationEnergyComparisonScenario.mul_ratio
Dimensionless wide-to-narrow multiply-energy ratio.
Equation: (wide_mul / narrow_mul).to('').magnitude.
mac_ratio
engine.scenario_types.OperationEnergyComparisonScenario.mac_ratio
Dimensionless wide-to-narrow multiply-accumulate energy ratio.
Equation: (wide_mac / narrow_mac).to('').magnitude.
read_over_narrow_mac
engine.scenario_types.OperationEnergyComparisonScenario.read_over_narrow_mac
Number of narrow MAC energy budgets equivalent to one memory read under the stated per-operation convention.
The memory read in narrow multiply-accumulates (per-operation energies, one op each).
Equation: memory_read.to('pJ').magnitude / narrow_mac.to('pJ/flop').magnitude.