crit-eval 0.7.2__tar.gz → 0.7.3__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.2 → crit_eval-0.7.3}/PKG-INFO +5 -20
- {crit_eval-0.7.2 → crit_eval-0.7.3}/README.md +4 -19
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/__init__.py +9 -3
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/architectures/indexers.py +25 -6
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/cli.py +9 -2
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/context.py +20 -2
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/headroom.py +7 -1
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/kernels.py +79 -13
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/probe/kernel_trace.cpp +11 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/checkpoints.py +3 -2
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/fixed.py +6 -2
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/prompt_state.py +68 -23
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/reference.py +17 -9
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/reports/status.py +45 -5
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/ab.py +46 -19
- crit_eval-0.7.3/crit_eval/run/energy.py +352 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/journal.py +4 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/precheck.py +50 -5
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/quality_checks.py +11 -5
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/runner.py +10 -1
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/speed.py +26 -10
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/timing.py +57 -5
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval.egg-info/PKG-INFO +5 -20
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval.egg-info/SOURCES.txt +2 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/pyproject.toml +1 -1
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval.py +114 -4
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_distributions.py +5 -0
- crit_eval-0.7.3/tests/test_eval_energy.py +256 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_formats.py +4 -1
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_indexers.py +4 -4
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_journal.py +59 -33
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_kernels.py +30 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_quality_modes.py +4 -2
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_server.py +23 -1
- {crit_eval-0.7.2 → crit_eval-0.7.3}/LICENSE +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/__main__.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/architectures/__init__.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/architectures/gguf_config.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/architectures/gguf_deepseek4.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/architectures/gguf_gemma4.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/architectures/gguf_layout.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/architectures/gguf_qwen4exp.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/architectures/templates/deepseek-v4.jinja +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/examples/mock_adapter.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/__init__.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/batched.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/ceiling.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/devices.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/probe.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/schemes.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/tensors.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/limits/tiers.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/probe/device_probe.cu +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/probe/device_probe_hip.cpp +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/probe/kernel_trace_rocm.cpp +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/probe/logprob_compare.cu +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/probe/logprob_compare.h +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/protocol.json +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/__init__.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/attention.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/logprob.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/packages.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/quality/prepare.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/reports/__init__.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/reports/compare.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/reports/metrics.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/__init__.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/adapters.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/chat.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/concurrency.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/deadline.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/estimate.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/forks.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/history.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/host.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/hostload.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/jitter.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/long_context.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/outcomes.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/pin.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/stages.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/tool_calls.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/run/tracks.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/README.md.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/cli.py.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/headroom.py.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/metrics.py.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/prepare.py.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/reference.py.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/report.py.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/runner.py.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/agent/tools.json +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/followup.json +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/heldout.json +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/long.json +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/long_document.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/quality.json +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/suite/speed.json +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/workbench/__init__.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval/workbench/harness.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval.egg-info/dependency_links.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval.egg-info/entry_points.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval.egg-info/requires.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/crit_eval.egg-info/top_level.txt +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/setup.cfg +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_chat_template.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_concurrency.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_deadline.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_deepseek4_template.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_devices.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_estimate.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_exl3.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_followup.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_forks.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_gguf.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_gguf_deepseek4.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_gguf_gemma4.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_gguf_qwen4exp.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_jitter.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_packages.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_precheck_lower.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_settings.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_stages.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_tensors.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_tiers.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_tracks.py +0 -0
- {crit_eval-0.7.2 → crit_eval-0.7.3}/tests/test_eval_workbench.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crit-eval
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
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
|
|
@@ -22,8 +22,6 @@ Dynamic: license-file
|
|
|
22
22
|
crit-eval
|
|
23
23
|
</h1>
|
|
24
24
|
|
|
25
|
-
---
|
|
26
|
-
|
|
27
25
|
### Speed and quality measurement tool to compare inference engines honestly.
|
|
28
26
|
|
|
29
27
|
<p align="center">
|
|
@@ -34,15 +32,13 @@ Dynamic: license-file
|
|
|
34
32
|
<a href="https://github.com/crit-labs/crit-eval/blob/main/LICENSE"><img src="https://raw.githubusercontent.com/crit-labs/.github/main/brand/button-license.svg" alt="License" height="34" /></a>
|
|
35
33
|
</p>
|
|
36
34
|
|
|
37
|
-
[Summary](#summary) • [Quick start](#quick-start) • [What `crit-eval` solves](#what-crit-eval-solves) •
|
|
38
|
-
[What `crit-eval` measures](#what-eval-measures) • [Commands](#commands) •
|
|
39
|
-
[Limitations](#limitations) • [Documentation](#documentation)
|
|
40
|
-
|
|
41
35
|
</div>
|
|
42
36
|
|
|
43
37
|
---
|
|
44
38
|
|
|
45
|
-
<
|
|
39
|
+
<br>
|
|
40
|
+
<br>
|
|
41
|
+
<br>
|
|
46
42
|
|
|
47
43
|
## Summary
|
|
48
44
|
|
|
@@ -56,8 +52,6 @@ Dynamic: license-file
|
|
|
56
52
|
|
|
57
53
|
---
|
|
58
54
|
|
|
59
|
-
<a id="quick-start"></a>
|
|
60
|
-
|
|
61
55
|
## Quick start
|
|
62
56
|
|
|
63
57
|
```sh
|
|
@@ -84,8 +78,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
84
78
|
|
|
85
79
|
---
|
|
86
80
|
|
|
87
|
-
<a id="what-crit-eval-solves"></a>
|
|
88
|
-
|
|
89
81
|
## What `crit-eval` solves
|
|
90
82
|
|
|
91
83
|
**There is no shared way to measure a bespoke inference engine.**
|
|
@@ -107,8 +99,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
107
99
|
|
|
108
100
|
---
|
|
109
101
|
|
|
110
|
-
<a id="what-eval-measures"></a>
|
|
111
|
-
|
|
112
102
|
## What `crit-eval` measures
|
|
113
103
|
|
|
114
104
|
| KPI or record | In the result | What it records |
|
|
@@ -126,6 +116,7 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
126
116
|
| prefill by term | `crit-eval status --kernels` | With a kernel trace, each prefill term (matmul per weight format, attention, recurrence, other kernels, host) against its floor, a gap per term, and a speculative round split into verify pass and draft steps |
|
|
127
117
|
| time to first token by part | `headroom.ttft` | Each case's time to first token split into the engine's own prefill and first token and the rest (server, tokenizer, HTTP) |
|
|
128
118
|
| stalls | `status.kpis.stalls` | Each speed case's longest and p99 gap between streamed chunks after the first token, in ms and in decode rounds (reported, not judged) |
|
|
119
|
+
| energy | `status.kpis.energy`, `energy`, each speed case's `energy` | Joules per prompt token and per output token, average and peak watts per speed case from NVML's energy counter (or power readings), and the device's idle draw before the suite; unmeasured without NVML (reported, not judged) |
|
|
129
120
|
| tool calls | `status.kpis.tool_calls` | Tool calls in the agent cases' output up to the first end token, in the chat template's format: valid, invalid, and truncated by the output limit (reported, not judged) |
|
|
130
121
|
| quality noise and attribution | `quality.sets.*.budget_spread`, `quality.attribution` | Each set's share of the drift budget with its spread over its positions; with `--attribute-drift`, each matrix group's share of the budget |
|
|
131
122
|
| free device memory | `context.device_memory` | Device memory left free with the engine built for the required context, beside the capacity gate |
|
|
@@ -144,8 +135,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
144
135
|
|
|
145
136
|
---
|
|
146
137
|
|
|
147
|
-
<a id="commands"></a>
|
|
148
|
-
|
|
149
138
|
## Commands
|
|
150
139
|
|
|
151
140
|
| Command | Does |
|
|
@@ -163,8 +152,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
163
152
|
|
|
164
153
|
---
|
|
165
154
|
|
|
166
|
-
<a id="limitations"></a>
|
|
167
|
-
|
|
168
155
|
## Limitations
|
|
169
156
|
|
|
170
157
|
| Area | Current status |
|
|
@@ -180,8 +167,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
180
167
|
|
|
181
168
|
---
|
|
182
169
|
|
|
183
|
-
<a id="documentation"></a>
|
|
184
|
-
|
|
185
170
|
## Documentation
|
|
186
171
|
|
|
187
172
|
| To… | Read |
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
crit-eval
|
|
6
6
|
</h1>
|
|
7
7
|
|
|
8
|
-
---
|
|
9
|
-
|
|
10
8
|
### Speed and quality measurement tool to compare inference engines honestly.
|
|
11
9
|
|
|
12
10
|
<p align="center">
|
|
@@ -17,15 +15,13 @@
|
|
|
17
15
|
<a href="https://github.com/crit-labs/crit-eval/blob/main/LICENSE"><img src="https://raw.githubusercontent.com/crit-labs/.github/main/brand/button-license.svg" alt="License" height="34" /></a>
|
|
18
16
|
</p>
|
|
19
17
|
|
|
20
|
-
[Summary](#summary) • [Quick start](#quick-start) • [What `crit-eval` solves](#what-crit-eval-solves) •
|
|
21
|
-
[What `crit-eval` measures](#what-eval-measures) • [Commands](#commands) •
|
|
22
|
-
[Limitations](#limitations) • [Documentation](#documentation)
|
|
23
|
-
|
|
24
18
|
</div>
|
|
25
19
|
|
|
26
20
|
---
|
|
27
21
|
|
|
28
|
-
<
|
|
22
|
+
<br>
|
|
23
|
+
<br>
|
|
24
|
+
<br>
|
|
29
25
|
|
|
30
26
|
## Summary
|
|
31
27
|
|
|
@@ -39,8 +35,6 @@
|
|
|
39
35
|
|
|
40
36
|
---
|
|
41
37
|
|
|
42
|
-
<a id="quick-start"></a>
|
|
43
|
-
|
|
44
38
|
## Quick start
|
|
45
39
|
|
|
46
40
|
```sh
|
|
@@ -67,8 +61,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
67
61
|
|
|
68
62
|
---
|
|
69
63
|
|
|
70
|
-
<a id="what-crit-eval-solves"></a>
|
|
71
|
-
|
|
72
64
|
## What `crit-eval` solves
|
|
73
65
|
|
|
74
66
|
**There is no shared way to measure a bespoke inference engine.**
|
|
@@ -90,8 +82,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
90
82
|
|
|
91
83
|
---
|
|
92
84
|
|
|
93
|
-
<a id="what-eval-measures"></a>
|
|
94
|
-
|
|
95
85
|
## What `crit-eval` measures
|
|
96
86
|
|
|
97
87
|
| KPI or record | In the result | What it records |
|
|
@@ -109,6 +99,7 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
109
99
|
| prefill by term | `crit-eval status --kernels` | With a kernel trace, each prefill term (matmul per weight format, attention, recurrence, other kernels, host) against its floor, a gap per term, and a speculative round split into verify pass and draft steps |
|
|
110
100
|
| time to first token by part | `headroom.ttft` | Each case's time to first token split into the engine's own prefill and first token and the rest (server, tokenizer, HTTP) |
|
|
111
101
|
| stalls | `status.kpis.stalls` | Each speed case's longest and p99 gap between streamed chunks after the first token, in ms and in decode rounds (reported, not judged) |
|
|
102
|
+
| energy | `status.kpis.energy`, `energy`, each speed case's `energy` | Joules per prompt token and per output token, average and peak watts per speed case from NVML's energy counter (or power readings), and the device's idle draw before the suite; unmeasured without NVML (reported, not judged) |
|
|
112
103
|
| tool calls | `status.kpis.tool_calls` | Tool calls in the agent cases' output up to the first end token, in the chat template's format: valid, invalid, and truncated by the output limit (reported, not judged) |
|
|
113
104
|
| quality noise and attribution | `quality.sets.*.budget_spread`, `quality.attribution` | Each set's share of the drift budget with its spread over its positions; with `--attribute-drift`, each matrix group's share of the budget |
|
|
114
105
|
| free device memory | `context.device_memory` | Device memory left free with the engine built for the required context, beside the capacity gate |
|
|
@@ -127,8 +118,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
127
118
|
|
|
128
119
|
---
|
|
129
120
|
|
|
130
|
-
<a id="commands"></a>
|
|
131
|
-
|
|
132
121
|
## Commands
|
|
133
122
|
|
|
134
123
|
| Command | Does |
|
|
@@ -146,8 +135,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
146
135
|
|
|
147
136
|
---
|
|
148
137
|
|
|
149
|
-
<a id="limitations"></a>
|
|
150
|
-
|
|
151
138
|
## Limitations
|
|
152
139
|
|
|
153
140
|
| Area | Current status |
|
|
@@ -163,8 +150,6 @@ with `--package DIR`, through Core's own adapter; another engine without a serve
|
|
|
163
150
|
|
|
164
151
|
---
|
|
165
152
|
|
|
166
|
-
<a id="documentation"></a>
|
|
167
|
-
|
|
168
153
|
## Documentation
|
|
169
154
|
|
|
170
155
|
| To… | Read |
|
|
@@ -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.3"
|
|
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.
|
|
@@ -49,8 +49,14 @@ def protocol_series(identifier):
|
|
|
49
49
|
DEFAULT_CONTEXT_TOKENS = 200_000
|
|
50
50
|
# The device memory an engine leaves free at its peak, unless settings.toml's vram_headroom_gib says otherwise: what
|
|
51
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
|
-
|
|
52
|
+
# knob: every GiB of it is a GiB the engine's weights, KV cache or expert cache do not get. The default is crit Core's
|
|
53
|
+
# (crit_plugins.memory.HEADROOM, which its loader leaves free); a crit-core from before it held the one default gives
|
|
54
|
+
# the same 0.25 GiB here.
|
|
55
|
+
try:
|
|
56
|
+
from crit_plugins.memory import HEADROOM as _HEADROOM
|
|
57
|
+
VRAM_HEADROOM_GIB = _HEADROOM / (1 << 30)
|
|
58
|
+
except ImportError:
|
|
59
|
+
VRAM_HEADROOM_GIB = 0.25
|
|
54
60
|
# The crit project whose settings.toml holds the machine's settings, when crit names it: crit run and crit eval set it to
|
|
55
61
|
# the project they use (crit run's --project; crit's checkout, or for a crit installed without one the folder it runs
|
|
56
62
|
# in), so an installed crit's Eval reads the same settings as its runs.
|
|
@@ -38,12 +38,20 @@ import math
|
|
|
38
38
|
import sys
|
|
39
39
|
import types
|
|
40
40
|
|
|
41
|
-
# sha256 of the source of each forward a form replaces, as
|
|
42
|
-
# (tests/test_eval_indexers.py) has it.
|
|
41
|
+
# sha256 of the source of each forward a form replaces, as each transformers release the form was checked against
|
|
42
|
+
# (tests/test_eval_indexers.py) has it, and that release.
|
|
43
43
|
CHECKED = {
|
|
44
|
-
"Qwen4ExpTextQSAIndexer":
|
|
45
|
-
|
|
44
|
+
"Qwen4ExpTextQSAIndexer": {
|
|
45
|
+
"cc3b0347832752a530a86a4b69e5147daea9b58d29f756e8f60a580bf519f093": "5.20.2",
|
|
46
|
+
"5b998d399ae7028c935532f744ce948f86648efef846a384aa5256af2c852a67": "5.23.0",
|
|
47
|
+
},
|
|
48
|
+
"DeepseekV4IndexerScorer": {
|
|
49
|
+
"7e1489dad5000d0243a37d6d2bb97a4ee1017d13a63a01d7b941c947dcd4b092": "5.20.2", # 5.23.0 the same
|
|
50
|
+
},
|
|
46
51
|
}
|
|
52
|
+
# The indexer sources whose loop returns its selection as a boolean mask whatever the attention mask (from 5.23); the
|
|
53
|
+
# earlier one gives an additive float mask for a float attention mask.
|
|
54
|
+
BOOLEAN_SELECTION = {"5b998d399ae7028c935532f744ce948f86648efef846a384aa5256af2c852a67"}
|
|
47
55
|
# Bytes of one block's FP32 scores in indexer_scorer_forward (three such tensors are alive at once).
|
|
48
56
|
SCORER_BYTES = 1 << 30
|
|
49
57
|
|
|
@@ -52,6 +60,16 @@ def source_hash(function):
|
|
|
52
60
|
return hashlib.sha256(inspect.getsource(function).encode()).hexdigest()
|
|
53
61
|
|
|
54
62
|
|
|
63
|
+
_BOOLEAN = {}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def boolean_selection(cls):
|
|
67
|
+
"""Whether `cls`'s own forward returns a boolean selection whatever the attention mask (BOOLEAN_SELECTION)."""
|
|
68
|
+
if cls not in _BOOLEAN:
|
|
69
|
+
_BOOLEAN[cls] = source_hash(cls.forward) in BOOLEAN_SELECTION
|
|
70
|
+
return _BOOLEAN[cls]
|
|
71
|
+
|
|
72
|
+
|
|
55
73
|
def qsa_indexer_forward(self, hidden_states, position_embeddings, attention_mask, past_key_values):
|
|
56
74
|
"""Qwen4ExpTextQSAIndexer.forward without its per-query pooling and host reads, selecting exactly as it does
|
|
57
75
|
(module docstring)."""
|
|
@@ -112,7 +130,7 @@ def qsa_indexer_forward(self, hidden_states, position_embeddings, attention_mask
|
|
|
112
130
|
selected_block_indices = scores.topk(min(self.block_topk, n), dim=0).indices
|
|
113
131
|
selected[batch, query, block_token_indices.index_select(0, selected_block_indices).flatten()] = True
|
|
114
132
|
selected_token_mask = selected.unsqueeze(1)
|
|
115
|
-
if attention_mask.is_floating_point():
|
|
133
|
+
if attention_mask.is_floating_point() and not boolean_selection(type(self)):
|
|
116
134
|
min_dtype = torch.finfo(attention_mask.dtype).min
|
|
117
135
|
selected_token_mask = torch.where(selected_token_mask, attention_mask.new_zeros(()), min_dtype)
|
|
118
136
|
return selected_token_mask
|
|
@@ -149,7 +167,8 @@ def exact_forms(model):
|
|
|
149
167
|
bound = set()
|
|
150
168
|
for module in model.modules():
|
|
151
169
|
name = type(module).__name__
|
|
152
|
-
|
|
170
|
+
found = source_hash(type(module).forward) if name in FORMS else None
|
|
171
|
+
if found in CHECKED.get(name, ()):
|
|
153
172
|
module.forward = types.MethodType(FORMS[name], module)
|
|
154
173
|
bound.add(name)
|
|
155
174
|
return sorted(bound)
|
|
@@ -164,7 +164,8 @@ def main(argv=None):
|
|
|
164
164
|
|
|
165
165
|
precheck = subs.add_parser("precheck", help="In minutes, the gates a candidate most often fails a whole round on: "
|
|
166
166
|
"honesty of short replies and of one long reply, the request history "
|
|
167
|
-
"around them,
|
|
167
|
+
"around them, drift of every quality text from the reference, device "
|
|
168
|
+
"memory and (with an adapter) the lower context")
|
|
168
169
|
engine = precheck.add_mutually_exclusive_group(required=True)
|
|
169
170
|
engine.add_argument("--package", help="A crit engine package, opened through Core's loader")
|
|
170
171
|
engine.add_argument("--adapter", help="Python file exporting create_eval_engine(context)")
|
|
@@ -179,6 +180,10 @@ def main(argv=None):
|
|
|
179
180
|
precheck.add_argument("--quality-mode", choices=QUALITY_MODES, default=DEFAULT_QUALITY_MODE,
|
|
180
181
|
help=f"The run's quality mode (default {DEFAULT_QUALITY_MODE}): "
|
|
181
182
|
"speed bounds honesty as Eval does and lets history part at near-ties; preserve does neither")
|
|
183
|
+
precheck.add_argument("--quality-budget", metavar="JSON",
|
|
184
|
+
help="The run's drift limits over the mode's, as crit eval run takes them")
|
|
185
|
+
precheck.add_argument("--no-drift", action="store_true",
|
|
186
|
+
help="Skip scoring the quality texts against the reference (the quality item)")
|
|
182
187
|
precheck.add_argument("--no-lower", action="store_true", help="Skip the lower-context reopen")
|
|
183
188
|
precheck.add_argument("--vram-headroom-gib", type=float, default=None,
|
|
184
189
|
help="Device memory to find free after the load (default: settings.toml vram_headroom_gib, "
|
|
@@ -481,7 +486,9 @@ def _command(args):
|
|
|
481
486
|
config=adapter_config(args.adapter, args.config, "--config") if args.adapter else {},
|
|
482
487
|
url=args.url, served_model=args.served_model,
|
|
483
488
|
chat_template=read_template(args.chat_template), lower=not args.no_lower,
|
|
484
|
-
vram_headroom_bytes=round(headroom_gib(args) * (1 << 30))
|
|
489
|
+
vram_headroom_bytes=round(headroom_gib(args) * (1 << 30)),
|
|
490
|
+
quality_budget=(json_option(args.quality_budget, "--quality-budget")
|
|
491
|
+
if args.quality_budget else None), drift=not args.no_drift)
|
|
485
492
|
if args.out:
|
|
486
493
|
Path(args.out).write_text(json.dumps({"items": items}, indent=1), encoding="utf-8")
|
|
487
494
|
failed = [item["name"] for item in items if item["state"] == "failed"]
|
|
@@ -35,6 +35,22 @@ GIB = 1 << 30
|
|
|
35
35
|
DRAFT_HEAD = re.compile(r"(^|\.)head\.weight$") # a draft layer's own output head (shared_head.head)
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
def _kv_fit(free_bytes, kv_bytes_per_token, *, headroom, reserve, held, granularity):
|
|
39
|
+
"""The KV cache that fits the device: crit Core's arithmetic (crit_plugins.memory.kv_fit), which the engine it
|
|
40
|
+
loads is sized by too; a crit-core from before Core held it computes the same here."""
|
|
41
|
+
try:
|
|
42
|
+
from crit_plugins.memory import kv_fit
|
|
43
|
+
except ImportError:
|
|
44
|
+
budget = free_bytes - headroom - reserve
|
|
45
|
+
for amount in held:
|
|
46
|
+
budget -= amount
|
|
47
|
+
if not kv_bytes_per_token:
|
|
48
|
+
return {"budget": budget, "tokens": None}
|
|
49
|
+
return {"budget": budget, "tokens": 0 if budget <= 0 else budget // kv_bytes_per_token // granularity * granularity}
|
|
50
|
+
return kv_fit(free_bytes, kv_bytes_per_token, headroom=headroom, reserve=reserve, held=held,
|
|
51
|
+
granularity=granularity)
|
|
52
|
+
|
|
53
|
+
|
|
38
54
|
def weight_split(model, config):
|
|
39
55
|
"""Stored bytes by where they have to live: `resident` (read on every pass, kept in device memory),
|
|
40
56
|
`experts` (read sparsely, may move to host memory or disk), `draft` (part of resident), `embedding`
|
|
@@ -184,7 +200,9 @@ def max_context(model, device, vram_headroom_bytes, settings, requested=None, dr
|
|
|
184
200
|
fixed = config.fixed_state_bytes(element)
|
|
185
201
|
reserve = int(float(settings["reserve_gib"]) * GIB)
|
|
186
202
|
drafter_bytes = sum(row["weight_bytes"] for row in companions)
|
|
187
|
-
|
|
203
|
+
fit = _kv_fit(free, kv, headroom=int(vram_headroom_bytes), reserve=reserve,
|
|
204
|
+
held=(split["resident"], fixed, drafter_bytes), granularity=granularity)
|
|
205
|
+
budget = fit["budget"]
|
|
188
206
|
out["basis"] = {"device": (device or {}).get("device"), "memory_free_bytes": free,
|
|
189
207
|
"memory_total_bytes": (device or {}).get("memory_total_bytes"),
|
|
190
208
|
"vram_headroom_bytes": int(vram_headroom_bytes), "reserve_bytes": reserve,
|
|
@@ -201,7 +219,7 @@ def max_context(model, device, vram_headroom_bytes, settings, requested=None, dr
|
|
|
201
219
|
f"and a {reserve / 1e9:.1f} GB reserve")
|
|
202
220
|
return out
|
|
203
221
|
if kv:
|
|
204
|
-
out["device_limit"] =
|
|
222
|
+
out["device_limit"] = fit["tokens"]
|
|
205
223
|
tokens, bound = min((limit, "model"), (out["device_limit"], "device"))
|
|
206
224
|
else:
|
|
207
225
|
tokens, bound = limit, "model" # no cache grows with the context
|
|
@@ -665,7 +665,12 @@ def prefill_terms(result, trace, rates, prefill_cases):
|
|
|
665
665
|
rows["draft"] = (spent["draft"], 0.0)
|
|
666
666
|
first = entry.get("first_token_ms")
|
|
667
667
|
if first is not None and entry.get("gpu_before_first_ms") is not None:
|
|
668
|
-
|
|
668
|
+
# The time the device only copied (weights over the link) is the link's, not the host's: a trace from
|
|
669
|
+
# before copies were recorded files it under host.
|
|
670
|
+
link = entry.get("link_before_first_ms") or 0.0
|
|
671
|
+
if link:
|
|
672
|
+
rows["link"] = (link, 0.0)
|
|
673
|
+
rows["host"] = (max(0.0, first - entry["gpu_before_first_ms"] - link), 0.0)
|
|
669
674
|
total = first if first is not None else entry.get("wall_ms")
|
|
670
675
|
cases[case_id] = {"prompt_tokens": case["prompt_tokens"], "trace_ms": total,
|
|
671
676
|
"named_ms": (entry.get("classified_ms") or {}).get("names", 0.0),
|
|
@@ -696,6 +701,7 @@ def prefill_terms(result, trace, rates, prefill_cases):
|
|
|
696
701
|
if speedups and len(speedups) == len(prefill_cases):
|
|
697
702
|
names = {"other": "other kernels at zero", "draft": "draft work in the prefill at zero",
|
|
698
703
|
"host": "the host's share of the first token at zero",
|
|
704
|
+
"link": "the first token's copies while no kernel ran at zero",
|
|
699
705
|
"matmul:unknown": "matmul kernels of no known format at zero"}
|
|
700
706
|
for term in dict.fromkeys(k for s in speedups.values() for k in s):
|
|
701
707
|
gain = metrics.geometric_mean([s.get(term, 1.0) for s in speedups.values()]) - 1
|
|
@@ -182,12 +182,14 @@ def _child(spec):
|
|
|
182
182
|
|
|
183
183
|
# --- analysis -------------------------------------------------------------------------------------------------
|
|
184
184
|
|
|
185
|
-
def read_traces(directory, clock="realtime"):
|
|
185
|
+
def read_traces(directory, clock="realtime", copies=False):
|
|
186
186
|
"""Kernels from every traced process: (start_ns, end_ns, blocks, threads, name), on the host realtime clock, or as
|
|
187
|
-
recorded with clock "cupti" or "rocprofiler" (phase marks taken on the tracer's clock, tracer_clock).
|
|
188
|
-
|
|
187
|
+
recorded with clock "cupti" or "rocprofiler" (phase marks taken on the tracer's clock, tracer_clock). copies:
|
|
188
|
+
also the memory copies the CUDA tracer records, (start_ns, end_ns, bytes, kind) on the same clock, as a third
|
|
189
|
+
item (kind CUpti_ActivityMemcpyKind's: COPY_KINDS)."""
|
|
190
|
+
kernels, moved, device = [], [], {"sms": None, "name": None}
|
|
189
191
|
for path in sorted(Path(directory).glob("trace-*.txt")):
|
|
190
|
-
clocks, rows = [], []
|
|
192
|
+
clocks, rows, copied = [], [], []
|
|
191
193
|
for line in path.read_text(errors="replace").splitlines():
|
|
192
194
|
if line.startswith("#clock "):
|
|
193
195
|
cupti, real = map(int, line.split()[1:3])
|
|
@@ -196,15 +198,67 @@ def read_traces(directory, clock="realtime"):
|
|
|
196
198
|
parts = line.split(" ", 2)
|
|
197
199
|
if int(parts[1]) > 0:
|
|
198
200
|
device = {"sms": int(parts[1]), "name": parts[2] if len(parts) > 2 else None}
|
|
201
|
+
elif line.startswith("#copy "):
|
|
202
|
+
parts = line.split()
|
|
203
|
+
if len(parts) == 5:
|
|
204
|
+
copied.append(tuple(int(p) for p in parts[1:]))
|
|
199
205
|
elif line and not line.startswith("#"):
|
|
200
206
|
parts = line.split(" ", 4)
|
|
201
207
|
if len(parts) == 5:
|
|
202
208
|
rows.append((int(parts[0]), int(parts[1]), int(parts[2]), int(parts[3]), parts[4]))
|
|
203
|
-
if rows and (clocks or clock != "realtime"):
|
|
209
|
+
if (rows or copied) and (clocks or clock != "realtime"):
|
|
204
210
|
offset = 0 if clock != "realtime" else round(statistics.mean(clocks))
|
|
205
211
|
kernels += [(s + offset, e + offset, b, t, n) for s, e, b, t, n in rows]
|
|
212
|
+
moved += [(s + offset, e + offset, n, kind) for s, e, n, kind in copied]
|
|
206
213
|
kernels.sort()
|
|
207
|
-
|
|
214
|
+
moved.sort()
|
|
215
|
+
return (kernels, device, moved) if copies else (kernels, device)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
# CUpti_ActivityMemcpyKind: the copies a trace names by direction.
|
|
219
|
+
COPY_KINDS = {1: "host_to_device", 2: "device_to_host", 3: "host_to_array", 4: "array_to_host", 5: "array_to_array",
|
|
220
|
+
6: "array_to_device", 7: "device_to_array", 8: "device_to_device", 9: "host_to_host", 10: "peer"}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def _union(spans):
|
|
224
|
+
"""[(start, end)] merged where they overlap, in start order."""
|
|
225
|
+
out = []
|
|
226
|
+
for start, end in sorted(spans):
|
|
227
|
+
if out and start <= out[-1][1]:
|
|
228
|
+
out[-1] = (out[-1][0], max(out[-1][1], end))
|
|
229
|
+
else:
|
|
230
|
+
out.append((start, end))
|
|
231
|
+
return out
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def _uncovered(spans, cover):
|
|
235
|
+
"""ns of `spans` (merged) that no span of `cover` overlaps: a copy's time while no kernel ran."""
|
|
236
|
+
total, cover = 0, _union(cover)
|
|
237
|
+
for start, end in _union(spans):
|
|
238
|
+
left = end - start
|
|
239
|
+
for c0, c1 in cover:
|
|
240
|
+
if c1 <= start or c0 >= end:
|
|
241
|
+
continue
|
|
242
|
+
left -= min(end, c1) - max(start, c0)
|
|
243
|
+
total += max(0, left)
|
|
244
|
+
return total
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def copy_terms(copies, kernels, lo, hi):
|
|
248
|
+
"""The copies that start inside [lo, hi): their count, bytes by direction, the time any copy ran and the time a
|
|
249
|
+
copy ran while no kernel did (the device waiting on the link, which the time between kernels otherwise files as
|
|
250
|
+
host work)."""
|
|
251
|
+
inside = [c for c in copies if lo <= c[0] < hi]
|
|
252
|
+
if not inside:
|
|
253
|
+
return {}
|
|
254
|
+
by = {}
|
|
255
|
+
for _, _, n, kind in inside:
|
|
256
|
+
name = COPY_KINDS.get(kind, f"kind_{kind}")
|
|
257
|
+
by[name] = by.get(name, 0) + n
|
|
258
|
+
spans = [(s, min(e, hi)) for s, e, _, _ in inside]
|
|
259
|
+
busy = sum(e - s for s, e in _union(spans))
|
|
260
|
+
alone = _uncovered(spans, [(k[0], k[1]) for k in kernels if k[0] < hi and k[1] > lo])
|
|
261
|
+
return {"count": len(inside), "bytes": by, "ms": busy / 1e6, "alone_ms": alone / 1e6}
|
|
208
262
|
|
|
209
263
|
|
|
210
264
|
def _mangled(name):
|
|
@@ -297,7 +351,10 @@ def exclusive(inside):
|
|
|
297
351
|
return out
|
|
298
352
|
|
|
299
353
|
|
|
300
|
-
def analyze(kernels, device, marks, device_ceilings=None):
|
|
354
|
+
def analyze(kernels, device, marks, device_ceilings=None, copies=()):
|
|
355
|
+
"""The traced kernels by phase and case. copies: the trace's memory copies (read_traces copies=True): each case
|
|
356
|
+
phase's copies (copy_terms), and before a prefill's first token the time the device only copied
|
|
357
|
+
(link_before_first_ms), which is not the host's."""
|
|
301
358
|
names = demangle(k[4] for k in kernels)
|
|
302
359
|
rules = (marks.get("info") or {}).get("kernel_work")
|
|
303
360
|
peaks = best_rates(device_ceilings)[0] # each format's best probed rate, GEMM or raw tensor cores
|
|
@@ -332,12 +389,19 @@ def analyze(kernels, device, marks, device_ceilings=None):
|
|
|
332
389
|
# The largest kernels neither a rule nor a name classes: candidates for rules.
|
|
333
390
|
"unclassed": [{"kernel": short_name(n), "ms": t} for n, t in
|
|
334
391
|
sorted(unclassed.items(), key=lambda x: -x[1])[:UNCLASSED]]}
|
|
392
|
+
moved = copy_terms(copies, kernels, lo, hi)
|
|
393
|
+
if moved:
|
|
394
|
+
cases[case["id"]][phase]["copies"] = moved
|
|
335
395
|
if phase == "prefill" and "prefill_first" in case:
|
|
336
|
-
# The fresh request's time to its first token,
|
|
337
|
-
# engine's host work, launches and synchronization
|
|
396
|
+
# The fresh request's time to its first token, the GPU's busy time inside it and the time it only
|
|
397
|
+
# copied (weights over the link): the rest is the engine's host work, launches and synchronization
|
|
398
|
+
# (crit_eval.reports.status: the TTFT breakdown).
|
|
338
399
|
first_ms = (case["prefill_first"] - lo) / 1e6
|
|
339
|
-
gpu = sum(ns for k, ns in inside if k[0] < case["prefill_first"]) / 1e6
|
|
340
|
-
cases[case["id"]][phase].update(first_token_ms=first_ms, gpu_before_first_ms=
|
|
400
|
+
gpu = min(sum(ns for k, ns in inside if k[0] < case["prefill_first"]) / 1e6, first_ms)
|
|
401
|
+
cases[case["id"]][phase].update(first_token_ms=first_ms, gpu_before_first_ms=gpu)
|
|
402
|
+
if copies:
|
|
403
|
+
link = (copy_terms(copies, kernels, lo, case["prefill_first"]) or {}).get("alone_ms", 0.0)
|
|
404
|
+
cases[case["id"]][phase]["link_before_first_ms"] = min(link, first_ms - gpu)
|
|
341
405
|
agg = phases[phase]
|
|
342
406
|
agg["wall_ms"] += wall
|
|
343
407
|
agg["kernel_ms"] += busy
|
|
@@ -426,6 +490,8 @@ def render(result, top=TOP):
|
|
|
426
490
|
+ (f" ({named:.1f} ms classed by name)" if named else "")
|
|
427
491
|
+ (f"; first token {entry['first_token_ms']:.1f} ms, GPU busy {entry['gpu_before_first_ms']:.1f} ms"
|
|
428
492
|
" of it" if entry.get("first_token_ms") is not None else "")
|
|
493
|
+
+ (f", copying alone {entry['link_before_first_ms']:.1f} ms"
|
|
494
|
+
if entry.get("link_before_first_ms") else "")
|
|
429
495
|
+ unclassed_note(entry.get("unclassed")))
|
|
430
496
|
lines.append("by case, top kernels per phase:")
|
|
431
497
|
for case, phases in result["cases"].items():
|
|
@@ -461,12 +527,12 @@ def trace(adapter, model, data, out, config=None, cases=None, nvcc=None, device=
|
|
|
461
527
|
marks = load_json(Path(directory) / "marks.json")
|
|
462
528
|
if work:
|
|
463
529
|
marks["info"]["kernel_work"] = list(work) + list(marks["info"].get("kernel_work") or [])
|
|
464
|
-
kernels, device_info = read_traces(directory, marks.get("clock", "realtime"))
|
|
530
|
+
kernels, device_info, copies = read_traces(directory, marks.get("clock", "realtime"), copies=True)
|
|
465
531
|
if not kernels:
|
|
466
532
|
raise SystemExit(f"no kernels were recorded: the engine may not run on {backend}, or the tracer could not attach")
|
|
467
533
|
result = {"contract": CONTRACT, "kind": "kernels", "engine": marks["info"], "toolkit": portable_path(compiler),
|
|
468
534
|
**({"backend": backend} if backend != "cuda" else {}),
|
|
469
|
-
**analyze(kernels, device_info, marks, device)}
|
|
535
|
+
**analyze(kernels, device_info, marks, device, copies)}
|
|
470
536
|
write_json(out, result)
|
|
471
537
|
return result
|
|
472
538
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
// #clock <cupti_ns> <realtime_ns> pairs CUPTI's clock with CLOCK_REALTIME (at start and at exit)
|
|
5
5
|
// #device <sm_count> <name>
|
|
6
6
|
// <start_ns> <end_ns> <grid_x*grid_y*grid_z> <block_threads> <name>
|
|
7
|
+
// #copy <start_ns> <end_ns> <bytes> <kind> a memory copy (CUpti_ActivityMemcpyKind: 1 host to device, 2 device
|
|
8
|
+
// to host, 8 device to device, ...), which no kernel record shows
|
|
7
9
|
// Timestamps are CUPTI's. The driver takes its phase marks on the same clock, through crit_ktrace_timestamp(); the
|
|
8
10
|
// clock lines convert them to the host's realtime clock for marks taken on it (which drifts against CUPTI's by tens
|
|
9
11
|
// of milliseconds over a trace under WSL). Linux only.
|
|
@@ -41,6 +43,14 @@ void CUPTIAPI buffer_completed(CUcontext, uint32_t, uint8_t* buffer, size_t, siz
|
|
|
41
43
|
CUpti_Activity* record = nullptr;
|
|
42
44
|
std::lock_guard<std::mutex> lock(g_mu);
|
|
43
45
|
while (cuptiActivityGetNextRecord(buffer, valid, &record) == CUPTI_SUCCESS) {
|
|
46
|
+
if (record->kind == CUPTI_ACTIVITY_KIND_MEMCPY) {
|
|
47
|
+
const auto* c = reinterpret_cast<const CUpti_ActivityMemcpy6*>(record);
|
|
48
|
+
if (g_out)
|
|
49
|
+
fprintf(g_out, "#copy %llu %llu %llu %u\n", static_cast<unsigned long long>(c->start),
|
|
50
|
+
static_cast<unsigned long long>(c->end), static_cast<unsigned long long>(c->bytes),
|
|
51
|
+
static_cast<unsigned>(c->copyKind));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
44
54
|
if (record->kind != CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL && record->kind != CUPTI_ACTIVITY_KIND_KERNEL) continue;
|
|
45
55
|
const auto* k = reinterpret_cast<const CUpti_ActivityKernel11*>(record);
|
|
46
56
|
if (g_out)
|
|
@@ -87,6 +97,7 @@ extern "C" int InitializeInjection() {
|
|
|
87
97
|
clock_line();
|
|
88
98
|
cuptiActivityRegisterCallbacks(buffer_requested, buffer_completed);
|
|
89
99
|
cuptiActivityEnable(CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL);
|
|
100
|
+
cuptiActivityEnable(CUPTI_ACTIVITY_KIND_MEMCPY);
|
|
90
101
|
atexit(finish);
|
|
91
102
|
return 1;
|
|
92
103
|
}
|
|
@@ -277,8 +277,9 @@ class Checkpoint(TensorCheckpoint):
|
|
|
277
277
|
if not len(index):
|
|
278
278
|
found.append(torch.empty((0, *shape[1:]), dtype=getattr(torch, name)))
|
|
279
279
|
continue
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
# Gathered as bytes, then read as the tensor's type: torch indexes no FP8 tensor on the CPU (index_cpu).
|
|
281
|
+
picked = torch.from_numpy(out)[torch.from_numpy(inverse.reshape(-1))]
|
|
282
|
+
found.append(picked.view(getattr(torch, name)).reshape(len(index), *shape[1:]))
|
|
282
283
|
return found
|
|
283
284
|
|
|
284
285
|
def header(self, key):
|
|
@@ -19,8 +19,12 @@ STORE = "reference"
|
|
|
19
19
|
# selected an engine may trade for speed, never how that checkpoint is quantized or stored. Both judge against the
|
|
20
20
|
# same scores, the checkpoint's stored weights decoded exactly with FP32 activations. speed: a
|
|
21
21
|
# budget eight times preserve's (quality.mode_thresholds), near-tie output differences allowed (forks); preserve: a
|
|
22
|
-
# budget that keeps the output close to the checkpoint's.
|
|
23
|
-
|
|
22
|
+
# budget that keeps the output close to the checkpoint's. The modes are crit Core's (crit_plugins.exactness), which every
|
|
23
|
+
# engine and run states; a crit-core from before Core held them gives the same two here.
|
|
24
|
+
try:
|
|
25
|
+
from crit_plugins.exactness import QUALITY_MODES
|
|
26
|
+
except ImportError:
|
|
27
|
+
QUALITY_MODES = ("preserve", "speed")
|
|
24
28
|
# The mode a run judges in when it names none.
|
|
25
29
|
DEFAULT_QUALITY_MODE = "speed"
|
|
26
30
|
|