Skip to main content

BatchEnergyPerImageScenario

Serving scenarios · Implementation: mlsysim/engine/scenario_definitions/serving.py.

Construct this scenario with keyword inputs. The fields below show the types and defaults declared by this class.

Bytes, arithmetic intensity, and energy per image when a batch shares one weight read.

Each image moves the weights divided by the batch plus its own activations activation_passes times (written once, read once), at byte_energy; its arithmetic costs flop_energy per FLOP.

Notes

Equation: The calculation members below define weights, weight_per_image, bytes_per_image, intensity, movement_energy, compute_energy, energy, movement_share.

Assumptions: One weight read is shared by the batch; each image pays the stated activation passes and arithmetic work.

Excludes: Cache retention across batches, leakage, and utilization-dependent device power.

References

Derivation: Bytes, arithmetic intensity, and energy per image when a batch shares one weight read. 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.ResNet50BatchEnergyPerImage
>>> value = case.energy(1)
>>> print(f"{value:.3g~}")
39.2 mJ

Attributes

Name Description
activation_bytes
activation_passes
byte_energy
compute_energy Estimated arithmetic energy per image in mJ from workload FLOPs times FLOP energy.
flop_energy
weight_bytes_per_param
weights Weight footprint quantity from the workload and configured parameter precision.
workload

Methods

Name Description
bytes_per_image Per-image traffic: amortized weight read plus stated activation passes.
energy Total modeled per-image energy in mJ, movement plus arithmetic.
intensity Per-image FLOP/byte under the weight-sharing and activation-traffic assumptions.
movement_energy Estimated data-movement energy per image in mJ from byte traffic times byte energy.
movement_share Fraction of modeled per-image energy due to data movement.
weight_per_image Weight bytes charged per image when a batch shares one full weight read.

bytes_per_image

engine.scenario_types.BatchEnergyPerImageScenario.bytes_per_image(batch_size)

Per-image traffic: amortized weight read plus stated activation passes.

Equation: weight_per_image(batch_size) + activation_passes * activation_bytes.

energy

engine.scenario_types.BatchEnergyPerImageScenario.energy(batch_size)

Total modeled per-image energy in mJ, movement plus arithmetic.

Equation: movement_energy(batch_size) + compute_energy.

intensity

engine.scenario_types.BatchEnergyPerImageScenario.intensity(batch_size)

Per-image FLOP/byte under the weight-sharing and activation-traffic assumptions.

Equation: (workload.inference_flops / bytes_per_image(batch_size)).to('flop/byte').

movement_energy

engine.scenario_types.BatchEnergyPerImageScenario.movement_energy(batch_size)

Estimated data-movement energy per image in mJ from byte traffic times byte energy.

Equation: (bytes_per_image(batch_size) * byte_energy).to('mJ').

movement_share

engine.scenario_types.BatchEnergyPerImageScenario.movement_share(batch_size)

Fraction of modeled per-image energy due to data movement.

Equation: (movement_energy(batch_size) / energy(batch_size)).to('').magnitude.

weight_per_image

engine.scenario_types.BatchEnergyPerImageScenario.weight_per_image(batch_size)

Weight bytes charged per image when a batch shares one full weight read.

Equation: weights / batch_size.

workload

Type: Workload.

Declared default: required.

weight_bytes_per_param

Type: Quantity.

Declared default: required.

activation_bytes

Type: Quantity.

Declared default: required.

activation_passes

Type: int.

Declared default: required.

byte_energy

Type: Quantity.

Declared default: required.

flop_energy

Type: Quantity.

Declared default: required.

weights

engine.scenario_types.BatchEnergyPerImageScenario.weights

Weight footprint quantity from the workload and configured parameter precision.

Equation: workload.size_in_bytes(weight_bytes_per_param).

compute_energy

engine.scenario_types.BatchEnergyPerImageScenario.compute_energy

Estimated arithmetic energy per image in mJ from workload FLOPs times FLOP energy.

Equation: (workload.inference_flops * flop_energy).to('mJ').

Back to top