Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them.
Page: /drakestapleton/benchmarks-mv/blob/main/src/svg_chart.rs
# benchmarks-mv
Measurement harnesses and evidence bundles for AIEN on the NVIDIA DGX Spark GB10. Speed is reported against the machine's physical limit and my own previous run. Attachment of AienOS.
Brought by drakestapleton
Sign in to star 0 stars 0 watching
About Files History Releases Proposed changes Issues For developers
branch `main` Branches Tags History
`benchmarks-mv / src / svg_chart.rs`
284 lines ยท 12390 bytes Raw Blame History
1 // SPDX-License-Identifier: Apache-2.0
2 // Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15
16 use crate::models::BenchmarkData;
17
18 pub fn generate_memory_chart(data: &BenchmarkData) -> String {
19 let mut bars = String::new();
20 let max_val = 3800.0f64;
21 let chart_w = 600.0f64;
22 let start_y = 120.0f64;
23 let row_h = 58.0f64;
24
25 for (i, m) in data.memory_rss.iter().enumerate() {
26 let y = start_y + (i as f64) * row_h;
27 let bar_len = ((m.rss_mb / max_val) * chart_w).max(4.0);
28 let color = if m.rss_mb > 500.0 {
29 "#d7755d"
30 } else if m.rss_mb > 40.0 {
31 "#d3a85b"
32 } else {
33 "#7fb8a6"
34 };
35
36 bars.push_str(&format!(
37 r#"
38
39 {service}
40 {role} [{arch}]
41
42 {rss:.2} MB
43 "#,
44 label_y = y,
45 desc_y = y + 15.0,
46 rect_y = y - 16.0,
47 w = bar_len,
48 color = color,
49 val_x = 290.0 + bar_len + 12.0,
50 val_y = y + 2.0,
51 service = m.service,
52 role = m.role,
53 arch = m.architecture,
54 rss = m.rss_mb,
55 ));
56 }
57
58 format!(
59 r#""#,
79 bars = bars
80 )
81 }
82
83 pub fn generate_latency_chart(data: &BenchmarkData) -> String {
84 let mut bars = String::new();
85 let max_val = 45.0f64;
86 let chart_w = 560.0f64;
87 let start_y = 120.0f64;
88 let row_h = 68.0f64;
89
90 for (i, m) in data.latency_concurrency.iter().enumerate() {
91 let y = start_y + (i as f64) * row_h;
92 let bar_len = ((m.p50_ms / max_val) * chart_w).max(6.0);
93 let color = if m.p50_ms > 20.0 {
94 "#d7755d"
95 } else {
96 "#7fb8a6"
97 };
98
99 bars.push_str(&format!(
100 r#"
101
102 {service} {endpoint}
103 {desc} [{engine}]
104
105 {p50:.2} ms ({rps:.1} req/s)
106 "#,
107 label_y = y,
108 desc_y = y + 16.0,
109 rect_y = y - 16.0,
110 w = bar_len,
111 color = color,
112 val_x = 370.0 + bar_len + 12.0,
113 val_y = y + 3.0,
114 service = m.service,
115 endpoint = m.endpoint,
116 desc = m.description,
117 engine = m.engine,
118 p50 = m.p50_ms,
119 rps = m.requests_per_sec,
120 ));
121 }
122
123 format!(
124 r#""#,
145 bars = bars
146 )
147 }
148
149 #[allow(dead_code)]
150 pub fn generate_pressure_chart(data: &BenchmarkData) -> String {
151 let mut rows = String::new();
152 let start_y = 120.0f64;
153 let row_h = 44.0f64;
154 let chart_w = 450.0f64;
155 let max_ttft = 45.0f64;
156
157 for (i, c) in data.concurrency_pressure.iter().enumerate() {
158 let y = start_y + (i as f64) * row_h;
159 let ttft_bar = ((c.aien_ttft_p50_ms / max_ttft) * chart_w).max(4.0);
160 let itl_bar = ((c.aien_itl_p50_ms / max_ttft) * chart_w).max(4.0);
161
162 rows.push_str(&format!(
163 r##"
164
165 Concurrency = {concurrency}
166
167
168 TTFT {ttft:.1}ms
169 ITL {itl:.1}ms
170 {tps:.0} tok/s
171 {power:.1}W ({joules:.4} J/tok)
172 "##,
173 y = y,
174 concurrency = c.concurrency,
175 rect_ttft_y = y - 14.0,
176 rect_itl_y = y + 2.0,
177 ttft_w = ttft_bar,
178 itl_w = itl_bar,
179 ttft_val_x = 230.0 + ttft_bar,
180 itl_val_x = 230.0 + itl_bar,
181 y_ttft_text = y - 3.0,
182 y_itl_text = y + 13.0,
183 ttft = c.aien_ttft_p50_ms,
184 itl = c.aien_itl_p50_ms,
185 tps = c.tokens_per_sec,
186 power = c.power_watts,
187 joules = c.joules_per_token,
188 ));
189 }
190
191 let svg_h = (start_y + (data.concurrency_pressure.len() as f64) * row_h + 30.0) as u32;
192
193 format!(
194 r#""#,
211 svg_h = svg_h,
212 rows = rows
213 )
214 }
215 #[allow(dead_code)]
216 pub fn generate_multi_model_chart(data: &BenchmarkData) -> String {
217 let mut rows = String::new();
218 let start_y = 120.0f64;
219 let row_h = 58.0f64;
220 let chart_w = 400.0f64;
221 let max_ttft = 25.0f64;
222
223 for (i, m) in data.multi_model_breadth.iter().enumerate() {
224 let y = start_y + (i as f64) * row_h;
225 let ttft_bar = ((m.ttft_p50_ms / max_ttft) * chart_w).max(4.0);
226 let itl_bar = ((m.itl_p50_ms / max_ttft) * chart_w).max(4.0);
227
228 rows.push_str(&format!(
229 r##"
230
231 {name}
232 {topology} [{quant}]
233
234
235 TTFT {ttft:.1}ms
236 ITL {itl:.1}ms
237
238 {status}
239 "##,
240 y = y,
241 desc_y = y + 16.0,
242 rect_ttft_y = y - 14.0,
243 rect_itl_y = y + 2.0,
244 ttft_w = ttft_bar,
245 itl_w = itl_bar,
246 ttft_val_x = 330.0 + ttft_bar,
247 itl_val_x = 330.0 + itl_bar,
248 y_ttft_text = y - 3.0,
249 y_itl_text = y + 13.0,
250 name = m.model_name,
251 topology = m.architectural_topology,
252 quant = m.quantization,
253 ttft = m.ttft_p50_ms,
254 itl = m.itl_p50_ms,
255 kv = m.kv_footprint_gb,
256 status = m.status,
257 ));
258 }
259
260 let svg_h = (start_y + (data.multi_model_breadth.len() as f64) * row_h + 30.0) as u32;
261
262 format!(
263 r#""#,
281 svg_h = svg_h,
282 rows = rows
283 )
284 }