solvers.SynthesisSolver
solvers.SynthesisSolver()Given an SLA, synthesizes the required hardware specs (Wall 22: Inverse Solve).
This solver inverts the Roofline model to derive minimum hardware specifications required to meet a target latency SLA.
Literature Source: 1. Williams et al. (2009), “Roofline Model.” 2. Jouppi et al. (2017), “In-Datacenter Performance Analysis of a TPU.”
Methods
| Name | Description |
|---|---|
| solve | Synthesize minimum hardware requirements from a latency SLA. |
solve
solvers.SynthesisSolver.solve(
model,
target_latency,
precision='fp16',
efficiency=0.5,
)Synthesize minimum hardware requirements from a latency SLA.
Inverts the Roofline model: instead of asking “how fast does this hardware run the model?”, asks “what hardware would run the model in target_latency?”. Assumes a single full pass that streams every weight once (batch size 1, no weight reuse), so:
required_bw = weight_bytes / T_target[GB/s] — the bandwidth needed if the workload is memory-bound;required_flops = total_ops / (T_target * efficiency)[TFLOP/s] — the compute rate needed if it is compute-bound;compute_memory_ratio = required_flops / required_bw[FLOP/byte] — the hardware balance point a matching part should sit near.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| model | Workload | The workload to serve; sets weight bytes and operation count. | required |
| target_latency | Quantity | The SLA latency target (any time unit; converted to seconds). | required |
| precision | str | Numerical precision; sets bytes per parameter. | 'fp16' |
| efficiency | float | Expected software efficiency in (0, 1]; lower values inflate the required FLOPS to compensate. | 0.5 |
Returns
| Name | Type | Description |
|---|---|---|
| SynthesisResult | Required bandwidth, FLOPS, memory capacity, and the compute:memory balance ratio. |
Notes
Equation: BW_required = weight_bytes / T; peak_required = F / (T*eta). Required capacity is weight storage alone and the reported balance is peak_required / BW_required.
Assumptions: positive target time and efficiency in (0, 1], batch one, one full weight read, and the workload’s lowered forward operation count. Excludes: activations, KV cache, dispatch overhead, and communication. These are screening requirements, not a sufficient deployment specification.
References
Williams, Waterman, and Patterson (2009), “Roofline.” https://doi.org/10.1145/1498765.1498785 (bibliography key: williams2009). Derivation: solve each resource-time inequality for its required rate.
Examples
>>> from mlsysim import Models, Q_
>>> from mlsysim.solvers import SynthesisSolver
>>> r = SynthesisSolver().solve(Models.Language.Llama3_8B, Q_("50 ms"))
>>> bool(r.required_bw.m_as("GB/s") > 0 and r.required_memory.m_as("GB") > 0)
True