solvers.TransformationModel
solvers.TransformationModel()Quantifies the CPU preprocessing bottleneck (Wall 9: Transformation).
This model simulates the ‘Transformation Wall’ — the gap between CPU-bound data preprocessing (JPEG decode, tokenization, augmentation) and accelerator step time. When preprocessing cannot keep up, the accelerator starves and utilization drops.
Literature Source: 1. Mohan et al. (2022), “Analyzing and Mitigating Data Bottlenecks in Deep Learning Training.” 2. Murray et al. (2021), “tf.data: A Machine Learning Data Processing Framework.” (Pipeline stall analysis.) 3. NVIDIA DALI Documentation (2024). (GPU-accelerated preprocessing.)
Methods
| Name | Description |
|---|---|
| solve | Compare batch preprocessing time with accelerator step time. |
solve
solvers.TransformationModel.solve(
batch_size,
sample_size_bytes,
cpu_throughput,
accelerator_step_time,
)Compare batch preprocessing time with accelerator step time.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| batch_size | int | Positive number of samples in one batch. | required |
| sample_size_bytes | Quantity | Nonnegative encoded or transformed byte size per sample, as appropriate for the supplied CPU throughput measurement. | required |
| cpu_throughput | Quantity | Positive aggregate preprocessing throughput, convertible to byte/s. | required |
| accelerator_step_time | Quantity | Positive time for the accelerator to process that same batch. | required |
Returns
| Name | Type | Description |
|---|---|---|
| TransformationResult | Preprocessing and accelerator times in ms, bottleneck flag, dimensionless utilization, and slowdown relative to the accelerator alone. |
Notes
Equation: T_cpu = batch_size * sample_size_bytes / cpu_throughput; T_step = max(T_cpu, T_accelerator), utilization = T_accelerator/T_step.
Assumptions: steady-state prefetch perfectly overlaps the CPU and accelerator stages; CPU throughput is already aggregate across its workers.
Excludes: pipeline fill/drain, transfer latency, storage stalls, and contention. The maximum describes overlap, not serial execution.
References
Derivation: byte volume divided by byte rate gives stage service time; the slower of two fully overlapped stages determines steady-state cadence.
Examples
>>> from mlsysim import Q_
>>> result = TransformationModel().solve(2, Q_("1 MB"), Q_("1 MB/s"), Q_("1 s"))
>>> result.accelerator_utilization == 0.5
True