From 6aed5b4e1e64ee4da49b4fa2cbe7bb266a2857e2 Mon Sep 17 00:00:00 2001 From: Vijay Janapa Reddi Date: Sat, 6 Jun 2026 11:36:23 -0400 Subject: [PATCH] Migrate the last core.constants stragglers (examples, paper validator) Five references outside the gate scopes: the two runnable examples, the paper's anchor validator, book/tests/test_registry.py, and a LEGO_CELLS.md prose mention. All verified executable post-migration (examples 03/04 run; validate_anchors: all 7 anchors match). --- book/docs/LEGO_CELLS.md | 2 +- book/tests/test_registry.py | 4 ++-- mlsysim/examples/03_heterogeneous_cluster.py | 2 +- mlsysim/examples/04_data_wall.py | 2 +- mlsysim/paper/scripts/validate_anchors.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/book/docs/LEGO_CELLS.md b/book/docs/LEGO_CELLS.md index 6e3a49be63..4a9e843af9 100644 --- a/book/docs/LEGO_CELLS.md +++ b/book/docs/LEGO_CELLS.md @@ -50,7 +50,7 @@ The A100 ridge is `{python} A100RidgeExample.ridge_str` FLOP/byte. - Keep **≤ 5–8 exports** per cell when possible. - Use **registry paths** for shared specs — `Hardware.Cloud.H100`, `Models.Vision.ResNet50`, `Systems.Reliability.Gpu.mttf_hours`, `Literature.Training.MfuHigh`, and - `mlsysim.physics.calc_*` for architecture formulas. Reserve `mlsysim.core.constants` + `mlsysim.physics.calc_*` for architecture formulas. Reserve `mlsysim.core.units` for physics/units only (`HOURS_PER_DAY`, `BYTES_FP16`, latency stack). - Put `#| echo: false` as the **first line** after ` ```{python}` (required by `book-check-code`). diff --git a/book/tests/test_registry.py b/book/tests/test_registry.py index e7c01f1521..42d7a16df5 100644 --- a/book/tests/test_registry.py +++ b/book/tests/test_registry.py @@ -3,7 +3,7 @@ import unittest from mlsysim import Hardware, Models -from mlsysim.core.constants import ureg +from mlsysim.core.units import ureg class TestMLSysRegistry(unittest.TestCase): def test_hardware_ridge_points(self): @@ -21,7 +21,7 @@ class TestMLSysRegistry(unittest.TestCase): def test_model_size(self): """Test model weight storage calculations.""" gpt3 = Models.Language.GPT3 - from mlsysim.core.constants import BYTES_FP16, BYTES_INT4 + from mlsysim.core.units import BYTES_FP16, BYTES_INT4 # GPT-3 175B @ FP16 (2 bytes) = 350 GB size_fp16 = gpt3.size_in_bytes(BYTES_FP16) diff --git a/mlsysim/examples/03_heterogeneous_cluster.py b/mlsysim/examples/03_heterogeneous_cluster.py index 391f76ea38..2fb7496835 100644 --- a/mlsysim/examples/03_heterogeneous_cluster.py +++ b/mlsysim/examples/03_heterogeneous_cluster.py @@ -7,7 +7,7 @@ from mlsysim.systems.types import Fleet, Node, NetworkFabric from mlsysim.hardware.registry import Hardware from mlsysim.models.registry import Models from mlsysim.solvers import DistributedModel, EconomicsModel -from mlsysim.core.constants import Q_ +from mlsysim.core.units import Q_ # 1. Define the Workload model = Models.Language.Llama3_8B diff --git a/mlsysim/examples/04_data_wall.py b/mlsysim/examples/04_data_wall.py index 708567e814..1bcec27178 100644 --- a/mlsysim/examples/04_data_wall.py +++ b/mlsysim/examples/04_data_wall.py @@ -6,7 +6,7 @@ It shows how faster GPUs can actually result in lower utilization if the storage bandwidth cannot keep up with the compute demand. """ import mlsysim -from mlsysim.core.constants import Q_ +from mlsysim.core.units import Q_ def main(): print("Evaluating ResNet-50 Training Data Pipeline...\n") diff --git a/mlsysim/paper/scripts/validate_anchors.py b/mlsysim/paper/scripts/validate_anchors.py index 984f08a67e..83d2f6d9f8 100644 --- a/mlsysim/paper/scripts/validate_anchors.py +++ b/mlsysim/paper/scripts/validate_anchors.py @@ -17,7 +17,7 @@ project_root = Path(__file__).resolve().parent.parent.parent sys.path.insert(0, str(project_root)) import mlsysim # noqa: E402 -from mlsysim.core.constants import Q_ # noqa: E402 +from mlsysim.core.units import Q_ # noqa: E402 from mlsysim.solvers import ( # noqa: E402 DistributedModel, ScalingModel,