crit-eval 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {crit_eval-0.7.0 → crit_eval-0.7.2}/PKG-INFO +3 -3
- {crit_eval-0.7.0 → crit_eval-0.7.2}/README.md +1 -1
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/__init__.py +6 -2
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/cli.py +10 -5
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/batched.py +39 -7
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/ceiling.py +12 -7
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/context.py +14 -2
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/headroom.py +74 -6
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/probe.py +7 -2
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/probe/device_probe.cu +30 -2
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/protocol.json +3 -2
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/reports/compare.py +10 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/reports/status.py +133 -8
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/chat.py +15 -4
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/concurrency.py +39 -3
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/history.py +14 -2
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/precheck.py +50 -29
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/quality_checks.py +37 -5
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/runner.py +5 -1
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/speed.py +7 -2
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/timing.py +14 -1
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval.egg-info/PKG-INFO +3 -3
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval.egg-info/SOURCES.txt +1 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval.egg-info/requires.txt +1 -1
- {crit_eval-0.7.0 → crit_eval-0.7.2}/pyproject.toml +4 -3
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval.py +83 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_concurrency.py +93 -0
- crit_eval-0.7.2/tests/test_eval_followup.py +258 -0
- crit_eval-0.7.2/tests/test_eval_precheck_lower.py +75 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_server.py +16 -0
- crit_eval-0.7.0/tests/test_eval_followup.py +0 -106
- {crit_eval-0.7.0 → crit_eval-0.7.2}/LICENSE +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/__main__.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/architectures/__init__.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/architectures/gguf_config.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/architectures/gguf_deepseek4.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/architectures/gguf_gemma4.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/architectures/gguf_layout.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/architectures/gguf_qwen4exp.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/architectures/indexers.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/architectures/templates/deepseek-v4.jinja +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/examples/mock_adapter.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/__init__.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/devices.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/kernels.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/schemes.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/tensors.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/limits/tiers.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/probe/device_probe_hip.cpp +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/probe/kernel_trace.cpp +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/probe/kernel_trace_rocm.cpp +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/probe/logprob_compare.cu +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/probe/logprob_compare.h +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/__init__.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/attention.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/checkpoints.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/fixed.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/logprob.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/packages.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/prepare.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/prompt_state.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/quality/reference.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/reports/__init__.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/reports/metrics.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/__init__.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/ab.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/adapters.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/deadline.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/estimate.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/forks.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/host.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/hostload.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/jitter.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/journal.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/long_context.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/outcomes.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/pin.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/stages.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/tool_calls.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/run/tracks.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/README.md.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/cli.py.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/headroom.py.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/metrics.py.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/prepare.py.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/reference.py.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/report.py.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/runner.py.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/agent/tools.json +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/followup.json +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/heldout.json +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/long.json +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/long_document.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/quality.json +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/suite/speed.json +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/workbench/__init__.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval/workbench/harness.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval.egg-info/dependency_links.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval.egg-info/entry_points.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/crit_eval.egg-info/top_level.txt +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/setup.cfg +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_chat_template.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_deadline.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_deepseek4_template.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_devices.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_distributions.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_estimate.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_exl3.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_forks.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_formats.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_gguf.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_gguf_deepseek4.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_gguf_gemma4.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_gguf_qwen4exp.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_indexers.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_jitter.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_journal.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_kernels.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_packages.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_quality_modes.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_settings.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_stages.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_tensors.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_tiers.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_tracks.py +0 -0
- {crit_eval-0.7.0 → crit_eval-0.7.2}/tests/test_eval_workbench.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crit-eval
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: crit-eval: one speed, quality and exactness suite that every inference engine runs the same way
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Repository, https://github.com/crit-labs/crit-eval
|
|
7
7
|
Requires-Python: >=3.11
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
License-File: LICENSE
|
|
10
|
-
Requires-Dist: crit-core>=0.
|
|
10
|
+
Requires-Dist: crit-core>=0.21.0
|
|
11
11
|
Provides-Extra: reference
|
|
12
12
|
Requires-Dist: torch; extra == "reference"
|
|
13
13
|
Requires-Dist: transformers>=5.20; extra == "reference"
|
|
@@ -134,7 +134,7 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
134
134
|
| exactness | `exactness` | Whether speculative output equals plain greedy, case by case |
|
|
135
135
|
| sampling | `sampling_check` | Whether sampled tokens follow the model's distribution |
|
|
136
136
|
| request history | `history` | Whether the same greedy requests give the same tokens after a long request history |
|
|
137
|
-
| prompt cache | `followup` | Follow-up turns answered from a prompt cache: the same answer,
|
|
137
|
+
| prompt cache | `followup`, `headroom.followup` | Follow-up turns answered from a prompt cache: the same answer, their prefill and ttft, and the ttft against its floor with a prompt cache, one read of the weights where a turn adds a few tokens (the goal `followup_ttft`) |
|
|
138
138
|
| held-out prompts | `heldout` | Speed on ten prompts in other languages and styles, never used for tuning |
|
|
139
139
|
| hardware | `host`, `device` | OS, CPU, RAM and GPUs (name, VRAM, driver, PCIe link), and the measured GPU bandwidth and matmul rates, PCIe transfer rates, host memory bandwidth and CPU throughput |
|
|
140
140
|
| engine | `engine` | What the engine reported: name, configuration, max context, drafting, bytes read per pass |
|
|
@@ -117,7 +117,7 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
117
117
|
| exactness | `exactness` | Whether speculative output equals plain greedy, case by case |
|
|
118
118
|
| sampling | `sampling_check` | Whether sampled tokens follow the model's distribution |
|
|
119
119
|
| request history | `history` | Whether the same greedy requests give the same tokens after a long request history |
|
|
120
|
-
| prompt cache | `followup` | Follow-up turns answered from a prompt cache: the same answer,
|
|
120
|
+
| prompt cache | `followup`, `headroom.followup` | Follow-up turns answered from a prompt cache: the same answer, their prefill and ttft, and the ttft against its floor with a prompt cache, one read of the weights where a turn adds a few tokens (the goal `followup_ttft`) |
|
|
121
121
|
| held-out prompts | `heldout` | Speed on ten prompts in other languages and styles, never used for tuning |
|
|
122
122
|
| hardware | `host`, `device` | OS, CPU, RAM and GPUs (name, VRAM, driver, PCIe link), and the measured GPU bandwidth and matmul rates, PCIe transfer rates, host memory bandwidth and CPU throughput |
|
|
123
123
|
| engine | `engine` | What the engine reported: name, configuration, max context, drafting, bytes read per pass |
|
|
@@ -18,7 +18,7 @@ if _registry is not None:
|
|
|
18
18
|
# The package holds its suite, protocol, probes and examples; a checkout of crit-eval is its parent.
|
|
19
19
|
EVAL_DIR = Path(__file__).resolve().parent
|
|
20
20
|
SUITE_DIR = EVAL_DIR / "suite"
|
|
21
|
-
__version__ = "0.7.
|
|
21
|
+
__version__ = "0.7.2"
|
|
22
22
|
CONTRACT = "eval-v1"
|
|
23
23
|
PROTOCOL_ID = re.compile(r"crit-eval-v(\d+)\.(\d+)\.(\d+)")
|
|
24
24
|
# The ids before crit-eval had its own repository (crit-eval-v4, crit-eval-v4.1, ... crit-eval-v8): major and minor.
|
|
@@ -47,6 +47,10 @@ def protocol_series(identifier):
|
|
|
47
47
|
# The context a user wants engines built for, unless settings.toml's context_tokens says otherwise; the model's
|
|
48
48
|
# positions and the device's memory may allow less.
|
|
49
49
|
DEFAULT_CONTEXT_TOKENS = 200_000
|
|
50
|
+
# The device memory an engine leaves free at its peak, unless settings.toml's vram_headroom_gib says otherwise: what
|
|
51
|
+
# keeps a desktop's own use of the device from pushing the engine's memory into host memory. It is the user's
|
|
52
|
+
# knob: every GiB of it is a GiB the engine's weights, KV cache or expert cache do not get.
|
|
53
|
+
VRAM_HEADROOM_GIB = 0.25
|
|
50
54
|
# The crit project whose settings.toml holds the machine's settings, when crit names it: crit run and crit eval set it to
|
|
51
55
|
# the project they use (crit run's --project; crit's checkout, or for a crit installed without one the folder it runs
|
|
52
56
|
# in), so an installed crit's Eval reads the same settings as its runs.
|
|
@@ -66,7 +70,7 @@ def machine_settings():
|
|
|
66
70
|
"""Memory thresholds from settings.toml (vram_headroom_gib, ram_headroom_gib, context_reserve_gib), the wanted context
|
|
67
71
|
(context_tokens) and the reference package source (eval_packages, crit_eval.quality.packages): the crit project's
|
|
68
72
|
that crit names (PROJECT_VARIABLE), else crit-eval's checkout's, else the crit checkout's (checkouts); without one
|
|
69
|
-
crit-eval uses the protocol's defaults and DEFAULT_CONTEXT_TOKENS."""
|
|
73
|
+
crit-eval uses the protocol's defaults, VRAM_HEADROOM_GIB and DEFAULT_CONTEXT_TOKENS."""
|
|
70
74
|
named = os.environ.get(PROJECT_VARIABLE)
|
|
71
75
|
roots = [Path(named)] if named else checkouts()
|
|
72
76
|
path = next((root / "settings.toml" for root in roots if (root / "settings.toml").is_file()), None)
|
|
@@ -8,6 +8,7 @@ import sys
|
|
|
8
8
|
PARTS = ("speed", "quality", "exactness", "context", "heldout", "history", "followup", "concurrency")
|
|
9
9
|
# The quality modes and the default, defined once (crit_eval.quality.fixed imports nothing outside the standard library).
|
|
10
10
|
from .quality.fixed import DEFAULT_QUALITY_MODE, QUALITY_MODES # noqa: E402
|
|
11
|
+
from . import VRAM_HEADROOM_GIB # noqa: E402
|
|
11
12
|
QUALITY_MODE_HELP = ("how much output drift from the checkpoint the engine may trade for speed, whatever format the "
|
|
12
13
|
"checkpoint is stored in; both modes judge against the same reference (its stored weights, exact "
|
|
13
14
|
f"activations). {DEFAULT_QUALITY_MODE} (the default): a budget eight times "
|
|
@@ -135,7 +136,8 @@ def main(argv=None):
|
|
|
135
136
|
"activations, workspaces, graphs and speed techniques (default: settings.toml "
|
|
136
137
|
"context_reserve_gib, else the protocol's reserve_gib)")
|
|
137
138
|
run.add_argument("--vram-headroom-gib", type=float, default=None,
|
|
138
|
-
help="Device memory left free when crit-eval computes the max context (default
|
|
139
|
+
help="Device memory left free when crit-eval computes the max context (default: settings.toml "
|
|
140
|
+
f"vram_headroom_gib, else {VRAM_HEADROOM_GIB})")
|
|
139
141
|
run.add_argument("--adaptive-sampled", action=argparse.BooleanOptionalAction, default=False,
|
|
140
142
|
help="Repeat each sampled speed case at further seeds until its relative standard error reaches "
|
|
141
143
|
"the protocol's target or its repetition cap (protocol sampled_speed.adaptive), recorded in "
|
|
@@ -180,7 +182,7 @@ def main(argv=None):
|
|
|
180
182
|
precheck.add_argument("--no-lower", action="store_true", help="Skip the lower-context reopen")
|
|
181
183
|
precheck.add_argument("--vram-headroom-gib", type=float, default=None,
|
|
182
184
|
help="Device memory to find free after the load (default: settings.toml vram_headroom_gib, "
|
|
183
|
-
"else
|
|
185
|
+
f"else {VRAM_HEADROOM_GIB})")
|
|
184
186
|
precheck.add_argument("--chat-template", metavar="FILE", help=CHAT_TEMPLATE_HELP)
|
|
185
187
|
precheck.add_argument("--out", help="Write the items as JSON here")
|
|
186
188
|
|
|
@@ -189,7 +191,8 @@ def main(argv=None):
|
|
|
189
191
|
context.add_argument("--model", required=True, help="Model directory")
|
|
190
192
|
context.add_argument("--device", required=True, metavar="JSON", help="Device file from `crit eval probe`")
|
|
191
193
|
context.add_argument("--vram-headroom-gib", type=float, default=None,
|
|
192
|
-
help="Device memory left free (default: settings.toml vram_headroom_gib, else
|
|
194
|
+
help="Device memory left free (default: settings.toml vram_headroom_gib, else "
|
|
195
|
+
f"{VRAM_HEADROOM_GIB})")
|
|
193
196
|
context.add_argument("--ram-headroom-gib", type=float, default=None,
|
|
194
197
|
help="Host memory left free, for the placement scenario (default: settings.toml "
|
|
195
198
|
"ram_headroom_gib, else 2)")
|
|
@@ -535,9 +538,11 @@ def _command(args):
|
|
|
535
538
|
|
|
536
539
|
|
|
537
540
|
def headroom_gib(args):
|
|
538
|
-
"""--vram-headroom-gib, else settings.toml's vram_headroom_gib, else
|
|
541
|
+
"""--vram-headroom-gib, else settings.toml's vram_headroom_gib, else VRAM_HEADROOM_GIB."""
|
|
539
542
|
from . import machine_settings
|
|
540
|
-
|
|
543
|
+
if args.vram_headroom_gib is not None:
|
|
544
|
+
return args.vram_headroom_gib
|
|
545
|
+
return machine_settings().get("vram_headroom_gib", VRAM_HEADROOM_GIB)
|
|
541
546
|
|
|
542
547
|
|
|
543
548
|
def reserve_gib(args):
|
|
@@ -77,19 +77,22 @@ def touched(experts, per_token, rows):
|
|
|
77
77
|
return 1.0 - (1.0 - min(1.0, per_token / experts)) ** rows
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
def step_floor(terms, rows, context, bandwidth_gbs, tflops, host=None):
|
|
80
|
+
def step_floor(terms, rows, context, bandwidth_gbs, tflops, host=None, columns=1):
|
|
81
81
|
"""The floor of one decode step of `rows` rows at `context` tokens each: {"rows", "memory_ms", "compute_ms",
|
|
82
82
|
"step_ms", "bound", "ceiling_tps" (rows over the step), "expert_share" (experts touched)}, or (None, missing).
|
|
83
83
|
host: what a model whose weights the device cannot all hold reads from host memory ({"tiers": the run's memory
|
|
84
84
|
tiers (crit_eval.limits.tiers.derive, with their link and host memory rates and the CPU's), "hit_rate": the expert
|
|
85
85
|
cache's hit rate, measured or declared by host_bytes_per_pass, or None, "hit_rate_source"}); the step then records
|
|
86
86
|
"host_ms" on its "host_path" (link or cpu; "host_paths_ms" both), "host_bytes", "hit_rate", "hit_rate_source" and,
|
|
87
|
-
without a hit rate, "unmeasured" (the misses beyond the capacity bound).
|
|
87
|
+
without a hit rate, "unmeasured" (the misses beyond the capacity bound). columns: the tokens each row computes in
|
|
88
|
+
the step, a verify pass's drafts and its pending token (drafted_floor): every column multiplies and attends, and
|
|
89
|
+
routes its own experts, while a row's KV and fixed state are read once for all its columns."""
|
|
88
90
|
missing = [name for name, value in (("model weight headers", terms), ("device bandwidth (--device)", bandwidth_gbs),
|
|
89
91
|
("device GEMM rates (--device)", tflops)) if not value]
|
|
90
92
|
if missing:
|
|
91
93
|
return None, missing
|
|
92
|
-
|
|
94
|
+
columns = max(1, int(columns))
|
|
95
|
+
share = touched(terms["experts"], terms["experts_per_token"], rows * columns)
|
|
93
96
|
active = min(1.0, terms["experts_per_token"] / terms["experts"]) if terms["experts"] else 0.0
|
|
94
97
|
tiers = host["tiers"] if host else None
|
|
95
98
|
if tiers:
|
|
@@ -115,7 +118,8 @@ def step_floor(terms, rows, context, bandwidth_gbs, tflops, host=None):
|
|
|
115
118
|
# Each row's arithmetic on its share of the host bytes: the resident ones off the device and its own
|
|
116
119
|
# experts' misses, at the step's miss share.
|
|
117
120
|
per_row = resident_off + terms["expert_bytes"] * active * miss_share
|
|
118
|
-
cpu = max(cpu, rows * per_row * tiers["flops_per_weight_byte"] / (tiers["cpu_gflops"] * 1e9)
|
|
121
|
+
cpu = max(cpu, rows * columns * per_row * tiers["flops_per_weight_byte"] / (tiers["cpu_gflops"] * 1e9)
|
|
122
|
+
* 1000)
|
|
119
123
|
paths["cpu"] = cpu
|
|
120
124
|
if not paths:
|
|
121
125
|
return None, ["host link and host memory rates (re-run crit eval probe)"]
|
|
@@ -127,17 +131,18 @@ def step_floor(terms, rows, context, bandwidth_gbs, tflops, host=None):
|
|
|
127
131
|
if not rate:
|
|
128
132
|
unpriced.append(f"{fmt} GEMM rate")
|
|
129
133
|
continue
|
|
130
|
-
compute += rows * flops / (rate * 1e12) * 1000
|
|
134
|
+
compute += rows * columns * flops / (rate * 1e12) * 1000
|
|
131
135
|
attention_rate = max((tflops or {}).get("bf16") or 0, (tflops or {}).get("fp8") or 0)
|
|
132
136
|
if terms["attention_flops_per_pair"] and attention_rate:
|
|
133
|
-
compute += rows * context * terms["attention_flops_per_pair"] / (attention_rate * 1e12) * 1000
|
|
137
|
+
compute += rows * columns * context * terms["attention_flops_per_pair"] / (attention_rate * 1e12) * 1000
|
|
134
138
|
if unpriced:
|
|
135
139
|
return None, unpriced
|
|
136
140
|
parts = {"memory": memory, "compute": compute, **({path: paths[path]} if path else {})}
|
|
137
141
|
bound = max(parts, key=parts.get)
|
|
138
142
|
step = parts[bound]
|
|
139
143
|
out = {"rows": rows, "memory_ms": memory, "compute_ms": compute, "step_ms": step, "bound": bound,
|
|
140
|
-
"ceiling_tps": rows / step * 1000 if step else None, "expert_share": share if terms["experts"] else None
|
|
144
|
+
"ceiling_tps": rows / step * 1000 if step else None, "expert_share": share if terms["experts"] else None,
|
|
145
|
+
**({"columns": columns} if columns > 1 else {})}
|
|
141
146
|
if tiers:
|
|
142
147
|
out.update(host_ms=paths[path] if path else 0.0, host_path=path, host_paths_ms=paths,
|
|
143
148
|
host_bytes=int(from_host), hit_rate=None if source == "unmeasured" else 1.0 - miss_share,
|
|
@@ -145,3 +150,30 @@ def step_floor(terms, rows, context, bandwidth_gbs, tflops, host=None):
|
|
|
145
150
|
if source == "unmeasured":
|
|
146
151
|
out["unmeasured"] = UNMEASURED
|
|
147
152
|
return out, []
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def drafted_floor(terms, rows, context, bandwidth_gbs, tflops, host=None, width=0, tokens_per_round=None,
|
|
156
|
+
draft_bytes_per_step=None):
|
|
157
|
+
"""The floor of one batched round of an engine that drafts (protocol concurrency.ceiling, the goal's limit): width
|
|
158
|
+
draft steps, each reading the draft layers' bytes once for every row, then a verify pass of `rows` rows of width + 1
|
|
159
|
+
columns each (step_floor with columns), every row emitting tokens_per_round tokens, the run's own measured count
|
|
160
|
+
(as the single-stream decode ceiling takes this drafter's acceptance). {**step_floor's, "draft_ms", "round_ms",
|
|
161
|
+
"tokens_per_round", "ceiling_tps" (rows x tokens per round over the round), "basis"}, or (None, missing). An engine
|
|
162
|
+
that does not draft (width 0) is step_floor's one token per row per step; a drafting engine that states no width
|
|
163
|
+
(None) has no such floor."""
|
|
164
|
+
if width is None:
|
|
165
|
+
return None, ["draft_width from the adapter (a drafting engine's batched round)"]
|
|
166
|
+
if not width:
|
|
167
|
+
found, missing = step_floor(terms, rows, context, bandwidth_gbs, tflops, host)
|
|
168
|
+
return ({**found, "basis": "one token per row per step"} if found else None), missing
|
|
169
|
+
lacking = [name for name, value in (("tokens per round from the speed cases", tokens_per_round),
|
|
170
|
+
("draft_bytes_per_step from the adapter or the model's draft layers",
|
|
171
|
+
draft_bytes_per_step)) if not value]
|
|
172
|
+
found, missing = step_floor(terms, rows, context, bandwidth_gbs, tflops, host, columns=width + 1)
|
|
173
|
+
if missing or lacking:
|
|
174
|
+
return None, missing + lacking
|
|
175
|
+
draft = width * draft_bytes_per_step / (bandwidth_gbs * 1e9) * 1000
|
|
176
|
+
round_ms = found["step_ms"] + draft
|
|
177
|
+
return {**found, "draft_ms": draft, "round_ms": round_ms, "tokens_per_round": tokens_per_round, "width": width,
|
|
178
|
+
"ceiling_tps": rows * tokens_per_round / round_ms * 1000 if round_ms else None,
|
|
179
|
+
"basis": "the run's tokens per round, width + 1 columns per row"}, []
|
|
@@ -250,13 +250,16 @@ def matmul_rate(tflops, stored, activation=None):
|
|
|
250
250
|
return max(found) if found else (None, keys)
|
|
251
251
|
|
|
252
252
|
|
|
253
|
-
def prefill_floor_ms(ceiling, tflops, prompt_tokens, activations=None):
|
|
253
|
+
def prefill_floor_ms(ceiling, tflops, prompt_tokens, activations=None, cached_tokens=0):
|
|
254
254
|
"""Floor of one prefill in ms with its parts (matmul_by_format: each stored format's matmul ms), or (None,
|
|
255
255
|
missing rates). activations: {stored format: {activation: share}} (activation_shares) for the quantized
|
|
256
|
-
formats' prompt GEMMs; without it each format multiplies at its own rate.
|
|
256
|
+
formats' prompt GEMMs; without it each format multiplies at its own rate. cached_tokens: the prompt's leading
|
|
257
|
+
tokens a prompt cache holds (a follow-up turn's earlier turns): only the tokens after them are computed, each
|
|
258
|
+
attending the cached ones too."""
|
|
257
259
|
if not ceiling or not tflops:
|
|
258
260
|
return None, ["device GEMM rates (--device)"] if not tflops else ["model arithmetic (re-run prepare)"]
|
|
259
|
-
|
|
261
|
+
cached = min(max(0, int(cached_tokens or 0)), prompt_tokens)
|
|
262
|
+
missing, by_format, n = [], {}, prompt_tokens - cached
|
|
260
263
|
for f, flops in ceiling["matmul_flops_per_token"].items():
|
|
261
264
|
ms = 0.0
|
|
262
265
|
for activation, share in ((activations or {}).get(f) or {None: 1.0}).items():
|
|
@@ -271,7 +274,7 @@ def prefill_floor_ms(ceiling, tflops, prompt_tokens, activations=None):
|
|
|
271
274
|
if missing:
|
|
272
275
|
return None, [f"{f} GEMM rate" for f in sorted(set(missing))]
|
|
273
276
|
matmul = sum(by_format.values())
|
|
274
|
-
pairs = n * (n + 1) / 2
|
|
277
|
+
pairs = n * cached + n * (n + 1) / 2
|
|
275
278
|
# Attention at the faster of the BF16 and FP8 rates: engines run Q K^T and P V on FP8 tensor cores within
|
|
276
279
|
# the quality budget, so a BF16-only floor is one they beat.
|
|
277
280
|
attention_rate = max(tflops["bf16"], tflops.get("fp8") or 0)
|
|
@@ -291,14 +294,16 @@ def prefill_floor_ms(ceiling, tflops, prompt_tokens, activations=None):
|
|
|
291
294
|
|
|
292
295
|
|
|
293
296
|
def ttft_floor_ms(ceiling, tflops, bandwidth_gbs, prompt_tokens, bytes_per_pass=None, activations=None,
|
|
294
|
-
kv_bytes_per_token=None):
|
|
297
|
+
kv_bytes_per_token=None, cached_tokens=0):
|
|
295
298
|
"""Floor of the time to first token: the larger of the prompt's compute floor (with the quantized formats'
|
|
296
299
|
activations, prefill_floor_ms) and one read of the weights (bytes_per_pass when the adapter declares it) plus the
|
|
297
300
|
prompt's KV writes at the engine's kv_bytes_per_token. Without that count the KV writes are left out, still a floor:
|
|
298
301
|
the model's geometry does not say the precision the engine stores its KV at (the callers ask for it, headroom
|
|
299
302
|
KV_BYTES). With the ceiling's tiers (protocol headroom.tiers) the weights off the device are read from host memory
|
|
300
|
-
instead, on their faster path (tiers.prompt_host), and the floor takes the longest of the three.
|
|
301
|
-
compute
|
|
303
|
+
instead, on their faster path (tiers.prompt_host), and the floor takes the longest of the three. cached_tokens:
|
|
304
|
+
the prompt's leading tokens a prompt cache holds: the compute floor is the other tokens' (prefill_floor_ms), and
|
|
305
|
+
the KV bytes stay the whole prompt's, the cached tokens' read where the others' are written."""
|
|
306
|
+
compute, missing = prefill_floor_ms(ceiling, tflops, prompt_tokens, activations, cached_tokens)
|
|
302
307
|
weights = bytes_per_pass or (ceiling or {}).get("weight_bytes")
|
|
303
308
|
if not weights or not bandwidth_gbs:
|
|
304
309
|
missing = missing + ["device bandwidth (--device)" if not bandwidth_gbs else "model weight bytes (re-run prepare)"]
|
|
@@ -301,13 +301,18 @@ def placement(model, device, vram_headroom_bytes, ram_headroom_bytes, settings,
|
|
|
301
301
|
# The CPU computes misses at its expert lane's measured rate (one token an expert, a plain pass), never above
|
|
302
302
|
# host memory's read rate; a probe without the lane prices them at the read rate, an upper bound.
|
|
303
303
|
cpu_rate = min(memory, lane["tokens_1"]) if memory and lane.get("tokens_1") else memory
|
|
304
|
+
# A layer whose misses the CPU computes hands its rows to the host and waits for the answer: one turn a
|
|
305
|
+
# routed layer of the pass (at even routing every routed layer misses), beside whatever the CPU computes.
|
|
306
|
+
# A probe that measured no turn prices none: the CPU's floors are then lower bounds on a device reached
|
|
307
|
+
# through a virtual machine, where a turn is most of a millisecond.
|
|
308
|
+
turns = len(config.routed_layers()) * ((device or {}).get("host_turn_us") or 0.0) / 1000 if missed else 0.0
|
|
304
309
|
if missed and cpu_rate:
|
|
305
|
-
floors["cpu"] = max(own, missed / (cpu_rate * 1e9) * 1000)
|
|
310
|
+
floors["cpu"] = max(own, missed / (cpu_rate * 1e9) * 1000) + turns
|
|
306
311
|
if missed and link and cpu_rate:
|
|
307
312
|
# A link copy reads host memory as the CPU's arithmetic does: split so both finish together. With the lane
|
|
308
313
|
# measured beside link copies, the split runs at those two rates' sum; else at most host memory's read rate.
|
|
309
314
|
both = lane.get("with_link_cpu", 0) + lane.get("with_link_link", 0)
|
|
310
|
-
floors["split"] = max(own, missed / ((both if both else min(link + cpu_rate, memory)) * 1e9) * 1000)
|
|
315
|
+
floors["split"] = max(own, missed / ((both if both else min(link + cpu_rate, memory)) * 1e9) * 1000) + turns
|
|
311
316
|
# A device cache over host experts (scenario 2's starting design) copies its slots from host memory, so the host
|
|
312
317
|
# holds every expert, those the device also caches included; where only the off-device share fits, the device's
|
|
313
318
|
# experts must be its own (a static split), not cached copies.
|
|
@@ -326,6 +331,8 @@ def placement(model, device, vram_headroom_bytes, ram_headroom_bytes, settings,
|
|
|
326
331
|
**({"cpu_expert_lane": {k: lane[k] for k in ("tokens_1", "tokens_3", "tokens_8", "with_link_cpu",
|
|
327
332
|
"with_link_link") if k in lane}} if lane else {})},
|
|
328
333
|
"cpu_gflops": ((device or {}).get("cpu_gflops") or {}).get("fp32"),
|
|
334
|
+
"host_turn_us": (device or {}).get("host_turn_us"),
|
|
335
|
+
"host_turns_ms": round(turns, 3) if floors.get("cpu") is not None else None,
|
|
329
336
|
"plain_pass_floor_ms": floors,
|
|
330
337
|
"plain_pass_ceiling_tps": {k: round(1000 / v, 1) for k, v in floors.items() if v}}
|
|
331
338
|
|
|
@@ -368,8 +375,13 @@ def render_placement(value):
|
|
|
368
375
|
lines.append(f" CPU expert lane (integer block rows): {lane.get('tokens_1', 0):g} / {lane.get('tokens_3', 0):g} / "
|
|
369
376
|
f"{lane.get('tokens_8', 0):g} GB/s at 1 / 3 / 8 tokens an expert; beside link copies "
|
|
370
377
|
f"{lane.get('with_link_cpu', 0):g} GB/s with the link at {lane.get('with_link_link', 0):g}")
|
|
378
|
+
turned = value.get("host_turns_ms")
|
|
371
379
|
for key, tps in value["plain_pass_ceiling_tps"].items():
|
|
372
380
|
lines.append(f" plain pass, {names[key]}: {value['plain_pass_floor_ms'][key]:.2f} ms floor, {tps:,.1f} tok/s"
|
|
381
|
+
+ (f" ({turned:.2f} ms of it the routed layers' turns to the host and back, "
|
|
382
|
+
f"{value['host_turn_us']:g} us each)" if key in ("cpu", "split") and turned else
|
|
383
|
+
" (no turn to the host priced: the probe measured none; probe again)"
|
|
384
|
+
if key in ("cpu", "split") and turned is not None and not value.get("host_turn_us") else "")
|
|
373
385
|
+ ((" (the CPU lane and the link measured together, both reading host memory)" if lane else
|
|
374
386
|
f" (both read host memory, together at most its {value['rates_gbs']['host_memory_read']:g} GB/s "
|
|
375
387
|
"read; probe again for the CPU lane's own rates)") if key == "split" else ""))
|
|
@@ -434,11 +434,12 @@ def quality_mode(result):
|
|
|
434
434
|
|
|
435
435
|
|
|
436
436
|
def mode_limits(result):
|
|
437
|
-
"""The prefill ceiling, time-to-first-token floor
|
|
438
|
-
{"activations": label, "prefill": tok/s, "ttft": ms, "context_ttft": ms or None
|
|
439
|
-
limits stand. A mode's limits take the fastest of
|
|
440
|
-
|
|
441
|
-
|
|
437
|
+
"""The prefill ceiling, time-to-first-token floor, long-context first-token floor and follow-up turns' floor of the
|
|
438
|
+
result's quality mode: {"activations": label, "prefill": tok/s, "ttft": ms, "context_ttft": ms or None,
|
|
439
|
+
"followup_ttft": ms or None}, or None where the stored-format limits stand. A mode's limits take the fastest of
|
|
440
|
+
the prompt activations it admits (MODE_ACTIVATIONS) and of any arithmetic quality shows passing
|
|
441
|
+
(activation_ceilings' reachable one), priced on the same cases, points and turns as the stored ones. preserve
|
|
442
|
+
keeps the activations in 16 bits; the speed mode admits the stored
|
|
442
443
|
format's too, so its limits are the stored format's (None) wherever that is the fastest priced (a device with the
|
|
443
444
|
format's tensor cores), and a faster one's elsewhere (FP8 for 4-bit matrices on a device without 4-bit ones).
|
|
444
445
|
None too while the ceilings by activation are not priced (a checkpoint with no FP8 or NVFP4 matrices)."""
|
|
@@ -473,7 +474,10 @@ def mode_limits(result):
|
|
|
473
474
|
if floor:
|
|
474
475
|
floors.append(floor["total_ms"])
|
|
475
476
|
context = metrics.geometric_mean(floors) if points and len(floors) == len(points) else None
|
|
476
|
-
|
|
477
|
+
# The follow-up turns' floor with a prompt cache at the same activations (followup_summary).
|
|
478
|
+
follow = followup_summary(result, rates, shares)
|
|
479
|
+
return {"activations": label, "prefill": score, "ttft": ttft_floor, "context_ttft": context,
|
|
480
|
+
FOLLOWUP_KPI: follow["floor_ms"] if follow else None}
|
|
477
481
|
|
|
478
482
|
|
|
479
483
|
def reachable_gap(prefill, activations):
|
|
@@ -530,6 +534,65 @@ def ttft_summary(info, speed, ceiling, tflops, bandwidth_gbs):
|
|
|
530
534
|
"missing": missing}
|
|
531
535
|
|
|
532
536
|
|
|
537
|
+
# The follow-up turns' goal and gap (followup_summary): crit-eval states them; the run's priority rule does not rank them.
|
|
538
|
+
FOLLOWUP_KPI = "followup_ttft"
|
|
539
|
+
FOLLOWUP_GAP = "follow-up turns' first token at its floor with a prompt cache"
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
def followup_summary(result, rates=None, shares=None):
|
|
543
|
+
"""The follow-up turns' time to first token against its floor with a prompt cache (protocol followup's turns; a
|
|
544
|
+
goal crit-eval states, not a gate): a turn after the first prefills only what a cache holding the turn before it
|
|
545
|
+
leaves, its new_tokens (the prompt past the prefix the two turns' prompts share; in a result measured before the
|
|
546
|
+
run counted them, its prompt tokens less the earlier turn's), and fewer where the engine reports more cached, over
|
|
547
|
+
the whole conversation's KV (ceiling.ttft_floor_ms with cached_tokens). So the floor is one read of the weights
|
|
548
|
+
and that KV, or the new tokens' arithmetic where that is longer, whatever the engine built. {"score_ms" (the
|
|
549
|
+
followup KPI: the geometric mean over the turns after the first), "floor_ms" (the same mean of their floors),
|
|
550
|
+
"fraction_of_floor", "turns", "missing", "gap"}; None when the turns were not measured. rates: the GEMM rates the
|
|
551
|
+
floors take (default the headroom's); shares: the quantized matrices' prompt activations, where a quality mode
|
|
552
|
+
prices its own (mode_limits)."""
|
|
553
|
+
follow = result.get("followup") or {}
|
|
554
|
+
if follow.get("status") != "measured":
|
|
555
|
+
return None
|
|
556
|
+
room, info = result.get("headroom") or {}, result.get("engine") or {}
|
|
557
|
+
rates = rates or (room.get("rates") or {}).get("tflops")
|
|
558
|
+
bandwidth_gbs = room.get("bandwidth_gbs") or result.get("bandwidth_gbs")
|
|
559
|
+
ceiling = tiered_ceiling(result)
|
|
560
|
+
rows = sorted(follow.get("turns") or [], key=lambda row: row["turn"])
|
|
561
|
+
turns, missing, measured, floors = {}, [], [], []
|
|
562
|
+
for before, row in zip(rows, rows[1:]):
|
|
563
|
+
if not row.get("ttft_ms"):
|
|
564
|
+
continue
|
|
565
|
+
prompt = row["prompt_tokens"]
|
|
566
|
+
new = row["new_tokens"] if row.get("new_tokens") is not None else prompt - before["prompt_tokens"]
|
|
567
|
+
# Never more than the engine computed: a cache that held more than the earlier turn's prompt left less.
|
|
568
|
+
new = min(new, prompt - (row.get("cached_tokens") or 0))
|
|
569
|
+
found = {"prompt_tokens": prompt, "new_tokens": new, "cached_tokens": row.get("cached_tokens"),
|
|
570
|
+
"ttft_ms": row["ttft_ms"]}
|
|
571
|
+
if new > 0: # a turn served whole from a cache needs no pass: it has no floor
|
|
572
|
+
floor, lacking = model_ceiling.ttft_floor_ms(ceiling, rates, bandwidth_gbs, prompt, info.get("bytes_per_pass"),
|
|
573
|
+
shares, info.get("kv_bytes_per_token"), cached_tokens=prompt - new)
|
|
574
|
+
missing += [m for m in lacking if m not in missing]
|
|
575
|
+
if floor:
|
|
576
|
+
found["floor"] = floor
|
|
577
|
+
found["efficiency"] = floor["total_ms"] / row["ttft_ms"]
|
|
578
|
+
floors.append(floor["total_ms"])
|
|
579
|
+
measured.append(row["ttft_ms"])
|
|
580
|
+
turns[str(row["turn"])] = found
|
|
581
|
+
score = metrics.geometric_mean(measured)
|
|
582
|
+
floor_score = metrics.geometric_mean(floors) if floors and len(floors) == len(measured) else None
|
|
583
|
+
gap = None
|
|
584
|
+
if score and floor_score and score > floor_score:
|
|
585
|
+
gap = {"kpi": FOLLOWUP_KPI, "name": FOLLOWUP_GAP, "projected_gain": score / floor_score - 1,
|
|
586
|
+
"detail": ", ".join(
|
|
587
|
+
f"turn {turn}: {row['ttft_ms']:,.0f} vs {row['floor']['total_ms']:,.1f} ms "
|
|
588
|
+
f"({row['new_tokens']:,} of {row['prompt_tokens']:,} prompt tokens new, "
|
|
589
|
+
f"{row['cached_tokens'] or 0:,} served from a cache; {row['floor']['bound']} bound)"
|
|
590
|
+
for turn, row in turns.items() if row.get("floor"))}
|
|
591
|
+
return {"score_ms": score, "floor_ms": floor_score,
|
|
592
|
+
"fraction_of_floor": floor_score / score if score and floor_score else None,
|
|
593
|
+
"turns": turns, "missing": missing, "gap": gap}
|
|
594
|
+
|
|
595
|
+
|
|
533
596
|
def prompt_gaps(prefill, ttft, activations=None):
|
|
534
597
|
"""The prefill gaps (at its stored-format ceiling, then at its reachable ceiling when quality evidence names one,
|
|
535
598
|
activation_ceilings) and the TTFT gap, with the warnings that state them."""
|
|
@@ -704,6 +767,11 @@ def price_prompts(result, rates, sources, prefill_cases, evidence=()):
|
|
|
704
767
|
if m not in room["missing"]]
|
|
705
768
|
room.update(prefill=prefill, ttft=ttft, activations=activations,
|
|
706
769
|
rates={"tflops": rates, "sources": sources} if rates else None)
|
|
770
|
+
# The follow-up turns' floor with a prompt cache at the same rates (followup_summary), its gap after every other.
|
|
771
|
+
follow = followup_summary({**result, "headroom": room}, tflops)
|
|
772
|
+
room["gaps"] = ([g for g in room["gaps"] if g.get("kpi") != FOLLOWUP_KPI]
|
|
773
|
+
+ ([follow["gap"]] if follow and follow["gap"] else []))
|
|
774
|
+
room["followup"] = {key: value for key, value in follow.items() if key != "gap"} if follow else None
|
|
707
775
|
room["end_to_end"] = end_to_end_summary(decode_suite(result)[1], ttft, (decode_suite(result)[1]).get("decode_score"),
|
|
708
776
|
(room.get("projection") or {}).get("ceiling_score"))
|
|
709
777
|
return room
|
|
@@ -194,6 +194,10 @@ def combine(samples):
|
|
|
194
194
|
# The CPU expert lane: crit's integer block rows at 1, 3 and 8 tokens an expert on one thread per core, and at
|
|
195
195
|
# 3 beside expert-sized link copies (both rates over the same window): what a CPU tier computing misses reaches.
|
|
196
196
|
"host_expert_gbs": medians(samples, "host_expert_gbs"), "host_expert_isa": first.get("host_expert_isa"),
|
|
197
|
+
# One turn from the device to the host and back in microseconds: what each layer of a pass pays whose
|
|
198
|
+
# missed experts the CPU computes.
|
|
199
|
+
"host_turn_us": (metrics.median([s["host_turn_us"] for s in samples if s.get("host_turn_us")])
|
|
200
|
+
if any(s.get("host_turn_us") for s in samples) else None),
|
|
197
201
|
"memory_total_bytes": max((s["memory_total_bytes"] for s in samples if s.get("memory_total_bytes")), default=None),
|
|
198
202
|
# The least free memory any run saw: the max context must fit the device as it is shared.
|
|
199
203
|
"memory_free_bytes": min((s["memory_free_bytes"] for s in samples if s.get("memory_free_bytes")), default=None),
|
|
@@ -296,7 +300,8 @@ def probe_device(binary, device, repeats, log):
|
|
|
296
300
|
MEASURED = {"mma_tflops": "raw tensor-core rates (fp16_acc, fp4_fp8 prompt activations)",
|
|
297
301
|
"host_to_device_gbs": "host-to-device rates (weights kept in host memory)",
|
|
298
302
|
"host_memory_gbs": "host memory rates", "cpu_gflops": "CPU rates",
|
|
299
|
-
"host_expert_gbs": "the CPU expert lane (integer block rows, alone and beside link copies)"
|
|
303
|
+
"host_expert_gbs": "the CPU expert lane (integer block rows, alone and beside link copies)",
|
|
304
|
+
"host_turn_us": "the turn from the device to the host and back (a layer's rows to the CPU tier)"}
|
|
300
305
|
|
|
301
306
|
|
|
302
307
|
def outdated(device):
|
|
@@ -308,7 +313,7 @@ def outdated(device):
|
|
|
308
313
|
backend = ceiling.device_backend(device)
|
|
309
314
|
# A HIP probe measures no raw matrix-instruction rates (probe/device_probe_hip.cpp).
|
|
310
315
|
reasons = [f"no {what}" for key, what in MEASURED.items() if not device.get(key)
|
|
311
|
-
and not (backend == "hip" and key
|
|
316
|
+
and not (backend == "hip" and key in ("mma_tflops", "host_turn_us"))]
|
|
312
317
|
source = SOURCES.get(backend, SOURCE)
|
|
313
318
|
if device.get("probe_sha256") != hashlib.sha256(source.read_bytes()).hexdigest():
|
|
314
319
|
reasons.append("measured by another probe source" if device.get("probe_sha256") else "no probe_sha256")
|
|
@@ -441,6 +441,33 @@ void host_expert_with_link(int threads, size_t bytes, double* cpu, double* link)
|
|
|
441
441
|
cudaFreeHost(host);
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
+
// One turn from the device to the host and back, in microseconds: a layer whose missed experts the CPU computes
|
|
445
|
+
// hands its rows to the host and waits for the answer, once a layer of a pass, whatever the CPU's own rate. A row
|
|
446
|
+
// written on the device, copied to pageable host memory as a framework's tensor is (a blocking copy: the device's
|
|
447
|
+
// work so far is done), copied back and synchronized; the median of `turns` after 8 that are not counted. Tens of
|
|
448
|
+
// microseconds where the device is the machine's own, most of a millisecond where it is reached through a virtual
|
|
449
|
+
// machine.
|
|
450
|
+
double host_turn_us(int turns) {
|
|
451
|
+
const size_t bytes = 16384; // a row of a few thousand floats
|
|
452
|
+
void* device = nullptr;
|
|
453
|
+
if (cudaMalloc(&device, bytes) != cudaSuccess) return 0.0;
|
|
454
|
+
std::vector<char> host(bytes);
|
|
455
|
+
std::vector<double> found;
|
|
456
|
+
for (int i = 0; i < turns + 8; ++i) {
|
|
457
|
+
cudaDeviceSynchronize();
|
|
458
|
+
const auto start = Clock::now();
|
|
459
|
+
cudaMemset(device, i & 255, bytes);
|
|
460
|
+
cudaMemcpy(host.data(), device, bytes, cudaMemcpyDeviceToHost);
|
|
461
|
+
host[0] = static_cast<char>(host[0] + 1);
|
|
462
|
+
cudaMemcpy(device, host.data(), bytes, cudaMemcpyHostToDevice);
|
|
463
|
+
cudaDeviceSynchronize();
|
|
464
|
+
if (i >= 8) found.push_back(std::chrono::duration<double, std::micro>(Clock::now() - start).count());
|
|
465
|
+
}
|
|
466
|
+
cudaFree(device);
|
|
467
|
+
std::sort(found.begin(), found.end());
|
|
468
|
+
return found.empty() ? 0.0 : found[found.size() / 2];
|
|
469
|
+
}
|
|
470
|
+
|
|
444
471
|
// Raw tensor-core rates: mma.sync throughput per input and accumulator format, every SM busy, operands in registers.
|
|
445
472
|
// Kinds: 0 bf16->f32, 1 f16->f32, 2 f16->f16, 3 e4m3->f32, 4 e2m1 x e2m1 block-scaled (nvfp4) -> f32,
|
|
446
473
|
// 5 e2m1 x e4m3 (kind::f8f6f4) -> f32.
|
|
@@ -702,12 +729,13 @@ int main(int argc, char** argv) {
|
|
|
702
729
|
"\"host_threads\": %d, \"host_memory_gbs\": {\"read\": %.1f, \"write\": %.1f, \"copy\": %.1f, "
|
|
703
730
|
"\"read_one_thread\": %.1f}, \"cpu_gflops\": {\"fp32\": %.1f, \"fp32_one_thread\": %.1f}, \"cpu_isa\": \"%s\", "
|
|
704
731
|
"\"host_expert_gbs\": {\"tokens_1\": %.1f, \"tokens_3\": %.1f, \"tokens_8\": %.1f, \"threads\": %d, "
|
|
705
|
-
"\"with_link_cpu\": %.1f, \"with_link_link\": %.1f}, \"host_expert_isa\": \"%s\""
|
|
732
|
+
"\"with_link_cpu\": %.1f, \"with_link_link\": %.1f}, \"host_expert_isa\": \"%s\", "
|
|
733
|
+
"\"host_turn_us\": %.1f",
|
|
706
734
|
threads, host_memory_gbs(0, host_bytes, threads, 5), host_memory_gbs(1, host_bytes, threads, 5),
|
|
707
735
|
host_memory_gbs(2, host_bytes, threads, 5), host_memory_gbs(0, host_bytes, 1, 5),
|
|
708
736
|
cpu_gflops(threads, 3), cpu_gflops(1, 3), kIsa,
|
|
709
737
|
host_expert_gbs(1, cores, lane_bytes, 3), host_expert_gbs(3, cores, lane_bytes, 3),
|
|
710
|
-
host_expert_gbs(8, cores, lane_bytes, 3), cores, with_cpu, with_link, kIntIsa);
|
|
738
|
+
host_expert_gbs(8, cores, lane_bytes, 3), cores, with_cpu, with_link, kIntIsa, host_turn_us(64));
|
|
711
739
|
cublasLtHandle_t lt;
|
|
712
740
|
if (cublasLtCreate(<)) {
|
|
713
741
|
std::printf("{\"error\": \"cublasLtCreate failed\"}\n");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"protocol": "crit-eval-v0.7.
|
|
2
|
+
"protocol": "crit-eval-v0.7.1",
|
|
3
3
|
"requests": {
|
|
4
4
|
"timeout": {
|
|
5
5
|
"rule": "an engine behind a server gets no fixed time budget: each request may take floor_seconds plus slack times its expected time from the requests the engine served in this Eval (a prompt of n tokens at most t * max(1, n/m)^2 for a prompt of m tokens that prefilled in t; an output token at context c at most d * max(1, c/k) for one that decoded in d at context k; the tightest bound counts), floor_seconds alone before any; a request past it stops the Eval as hung",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"tolerance": 0.05
|
|
16
16
|
},
|
|
17
17
|
"steady_state": {
|
|
18
|
-
"rule": "a case is measured at the speed it settles to: after its warmup_runs, a request that would be the case's first measured repetition stands as one more warmup when its decode tok/s and the request's before it spread (max - min over the median) by more than tolerance, until a request agrees with the one before it or the case has had max_warmup_runs warmups and decoded at least max_warmup_tokens tokens in them (at most max_warmup_requests warmups: an engine that adapts per decode window adapts by the tokens it decodes, so a short reply gets more requests to settle); that request is the first measured repetition, and extra_repetition and disturbed apply from it on. An engine that adapts to what it serves (a device cache filling with a case's experts, a profile settling) then has its adaptation measured as its speed instead of as a disturbed device; one still varying after max_warmup_runs is judged as before. Requests shorter than 100 ms, which vary with timer and scheduler jitter, and a case's first request, which has none before it, stand as measured. Each case records steady_state: its warmup_runs, how many the drift added, whether its first measured repetition agreed with the request before it (steady) and the drift, its decode tok/s over the case's first request's, less one. An engine whose warmup already agrees with its first repetition measures as before",
|
|
18
|
+
"rule": "a case is measured at the speed it settles to: after its warmup_runs, a request that would be the case's first measured repetition stands as one more warmup when its decode tok/s and the request's before it spread (max - min over the median) by more than tolerance, until a request agrees with the one before it or the case has had max_warmup_runs warmups and decoded at least max_warmup_tokens tokens in them (at most max_warmup_requests warmups: an engine that adapts per decode window adapts by the tokens it decodes, so a short reply gets more requests to settle); that request is the first measured repetition, and extra_repetition and disturbed apply from it on. In a staged run a case's warmup is its first stage's request, and the other cases ran between it and this stage's requests: a first measured repetition that agreed only with that warmup is provisional, and when the request after it spreads from it by more than tolerance it stands as one more warmup and that request is judged against it as above. An engine that adapts to what it serves (a device cache filling with a case's experts, a profile settling) then has its adaptation measured as its speed instead of as a disturbed device; one still varying after max_warmup_runs is judged as before. Requests shorter than 100 ms, which vary with timer and scheduler jitter, and a case's first request, which has none before it, stand as measured. Each case records steady_state: its warmup_runs, how many the drift added, whether its first measured repetition agreed with the request before it (steady) and the drift, its decode tok/s over the case's first request's, less one. An engine whose warmup already agrees with its first repetition measures as before",
|
|
19
19
|
"tolerance": 0.1,
|
|
20
20
|
"max_warmup_runs": 4,
|
|
21
21
|
"max_warmup_tokens": 1024,
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"reply_tokens": 256,
|
|
94
94
|
"tolerance": 0.001,
|
|
95
95
|
"modes": {"speed": {"tolerance": 2.0, "mean_tolerance": 0.1, "rule": "the served and the scored paths may round apart where the engine's arithmetic depends on what it served before (forks), so the check bounds them instead of asking for the same values: each reply token's and alternative's log-probability within tolerance (forks.margin), each reply's mean difference of its tokens' log-probabilities within mean_tolerance, and a token in only one top_k list within tolerance of that list's edge. The served path then stays within that of the path quality judged"}},
|
|
96
|
+
"levels": {"exact": ["exact", "declared"], "decode": ["row-exact", "exact", "declared"], "bound": {"tolerance": 2.0, "mean_tolerance": 0.1}, "rule": "an engine that states the exactness it asks of its rows (the adapter's info exactness.asked: a level for its decode rows and one for its prompt rows, each one of repeatable, row-exact, exact or declared, from the least exact) is judged by that instead of by the quality mode. Prompt rows asked at one of exact, beside decode rows asked at one of decode, have the bits of the same token decoded, so the served and the scored paths agree within tolerance, in either quality mode; at any lower level the two paths may round apart and bound judges them as modes.speed's does, in either quality mode. An engine that states none is judged by its quality mode. The verdict's judged_by records which decided", "since": "crit-eval-v0.7.1"},
|
|
96
97
|
"rule": "the engine's greedy reply to each prompt of these sets over the chat API (logprobs and top_logprobs top_k; the server must render the prompt to its prompt_ids count, prefill it without a prompt cache and name every reply token by its bytes), then the same reply tokens scored as the continuation through chat-score-v1: every reply token's log-probability and every alternative in both top_k lists must agree within tolerance (natural log), and the top_k lists must hold the same tokens but those within tolerance of the k-th; it shows the scores come from the serving path. A set skipped for its context is not checked",
|
|
97
98
|
"long_reply": "the long serving path is checked on the long-context curve's first point (context.curve_from): its request asks for logprobs and top_logprobs top_k, and its reply tokens are scored once as the continuation of the prompt the server rendered (the model's chat template applied to the messages sent, which may tokenize the decoded document to other ids than the frame's), judged as above (the reply curve@POINT); unmeasured when the curve did not measure that point or the server names a reply token by no bytes. One long prefill instead of the two a reply of its own would cost"
|
|
98
99
|
},
|
|
@@ -78,6 +78,16 @@ def compare(paths):
|
|
|
78
78
|
cell += f" ({t['fraction_of_floor']:.0%} of {t['floor_ms']:,.0f} ms floor)"
|
|
79
79
|
cells.append(cell)
|
|
80
80
|
rows.append(("**TTFT** (geomean ms)", cells))
|
|
81
|
+
if any((r.get("followup") or {}).get("status") == "measured" for r in results):
|
|
82
|
+
# The follow-up turns' first token against its floor with a prompt cache (headroom.followup_summary).
|
|
83
|
+
cells = []
|
|
84
|
+
for r in results:
|
|
85
|
+
f = (r.get("headroom") or {}).get("followup") or headroom.followup_summary(r) or {}
|
|
86
|
+
cell = _fmt(f.get("score_ms"), ",.0f")
|
|
87
|
+
if f.get("floor_ms"):
|
|
88
|
+
cell += f" ({f['fraction_of_floor']:.1%} of {f['floor_ms']:,.1f} ms floor with a prompt cache)"
|
|
89
|
+
cells.append(cell)
|
|
90
|
+
rows.append(("Follow-up TTFT (geomean ms)", cells))
|
|
81
91
|
for case in case_ids:
|
|
82
92
|
cells = []
|
|
83
93
|
for r in results:
|