Skip to main content

SparseFlashFitScenario

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.

workload pruned until its surviving values total surviving_bytes, stored with one index_bytes position index per value, against a flash_budget.

Notes

Equation: fits is the worked quantity; each property below states its equation and units.

Assumptions: Each nonzero stores one value and one index; surviving_bytes counts only surviving values.

Excludes: Sparse row pointers, alignment, runtime workspaces, and execution-speed prediction.

References

Derivation: The scenario binds declared inputs to calc_sparse_bytes_per_nonzero. Those implementations document their derivations and sources.

Examples

Execute the registered worked inputs; this is a modeled calculation.

>>> from mlsysim import Scenarios
>>> case = Scenarios.WearableMobileNetV2SparseFlash
>>> value = case.fits
>>> value
False

Attributes

Name Description
bytes_per_nonzero Stored bytes per surviving nonzero, value plus index width.
dense_bytes Original dense checkpoint size in MB.
fits Whether indexed sparse storage fits within the declared flash budget.
flash_budget
index_bytes
pruned_share Fraction of dense value storage removed before accounting for sparse indices.
stored_bytes Sparse checkpoint size in MB including one index per surviving value.
surviving_bytes
value_bytes
workload

workload

Type: Workload.

Declared default: required.

value_bytes

Type: Quantity.

Declared default: required.

index_bytes

Type: Quantity.

Declared default: required.

surviving_bytes

Type: Quantity.

Declared default: required.

flash_budget

Type: Quantity.

Declared default: required.

dense_bytes

engine.scenario_types.SparseFlashFitScenario.dense_bytes

Original dense checkpoint size in MB.

Equation: return self.workload.size_in_bytes(self.value_bytes).to(‘MB’)

pruned_share

engine.scenario_types.SparseFlashFitScenario.pruned_share

Fraction of dense value storage removed before accounting for sparse indices.

Equation: return 1 - (self.surviving_bytes / self.dense_bytes).to(’’).magnitude

bytes_per_nonzero

engine.scenario_types.SparseFlashFitScenario.bytes_per_nonzero

Stored bytes per surviving nonzero, value plus index width.

Equation: return calc_sparse_bytes_per_nonzero(self.value_bytes, self.index_bytes)

stored_bytes

engine.scenario_types.SparseFlashFitScenario.stored_bytes

Sparse checkpoint size in MB including one index per surviving value.

Equation: return (self.surviving_bytes * (self.bytes_per_nonzero / self.value_bytes)).to(‘MB’)

fits

engine.scenario_types.SparseFlashFitScenario.fits

Whether indexed sparse storage fits within the declared flash budget.

Equation: return self.stored_bytes <= self.flash_budget

Back to top