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
benchmarks-mv / src / svg_chart.rs
| 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 | <g class="bar-row"> |
| 39 | <text x="30" y="{label_y}" class="label-service">{service}</text> |
| 40 | <text x="30" y="{desc_y}" class="label-role">{role} [{arch}]</text> |
| 41 | <rect x="280" y="{rect_y}" width="{w}" height="26" rx="4" fill="{color}" /> |
| 42 | <text x="{val_x}" y="{val_y}" class="label-val">{rss:.2} MB</text> |
| 43 | </g>"#, |
| 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#"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1100 520" width="100%" height="100%"> |
| 60 | <defs> |
| 61 | <style> |
| 62 | .bg {{ fill: #18111f; }} |
| 63 | .title {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 20px; font-weight: 700; fill: #fff8ee; }} |
| 64 | .subtitle {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; fill: #bca9c2; }} |
| 65 | .label-service {{ font-family: ui-monospace, monospace; font-size: 14px; font-weight: 700; fill: #ded3df; }} |
| 66 | .label-role {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; fill: #8eac78; }} |
| 67 | .label-val {{ font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; fill: #fff8ee; }} |
| 68 | .grid {{ stroke: rgba(222, 211, 223, 0.12); stroke-width: 1; }} |
| 69 | </style> |
| 70 | </defs> |
| 71 | <rect width="100%" height="100%" rx="12" class="bg" /> |
| 72 | <text x="30" y="48" class="title">Memory Resident Set Size (RSS): AIEN Services</text> |
| 73 | <text x="30" y="74" class="subtitle">Measured on NVIDIA DGX Spark (Grace Blackwell GB10, aarch64) via /proc/[pid]/status VmRSS</text> |
| 74 | <line x1="280" y1="95" x2="280" y2="480" class="grid" /> |
| 75 | <line x1="580" y1="95" x2="580" y2="480" class="grid" /> |
| 76 | <line x1="880" y1="95" x2="880" y2="480" class="grid" /> |
| 77 | {bars} |
| 78 | </svg>"#, |
| 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 | <g class="bar-row"> |
| 102 | <text x="30" y="{label_y}" class="label-service">{service} {endpoint}</text> |
| 103 | <text x="30" y="{desc_y}" class="label-role">{desc} [{engine}]</text> |
| 104 | <rect x="360" y="{rect_y}" width="{w}" height="28" rx="4" fill="{color}" /> |
| 105 | <text x="{val_x}" y="{val_y}" class="label-val">{p50:.2} ms <tspan class="throughput">({rps:.1} req/s)</tspan></text> |
| 106 | </g>"#, |
| 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#"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1100 500" width="100%" height="100%"> |
| 125 | <defs> |
| 126 | <style> |
| 127 | .bg {{ fill: #18111f; }} |
| 128 | .title {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 20px; font-weight: 700; fill: #fff8ee; }} |
| 129 | .subtitle {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; fill: #bca9c2; }} |
| 130 | .label-service {{ font-family: ui-monospace, monospace; font-size: 14px; font-weight: 700; fill: #ded3df; }} |
| 131 | .label-role {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; fill: #8eac78; }} |
| 132 | .label-val {{ font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; fill: #fff8ee; }} |
| 133 | .throughput {{ font-size: 12px; font-weight: 600; fill: #ef8b67; }} |
| 134 | .grid {{ stroke: rgba(222, 211, 223, 0.12); stroke-width: 1; }} |
| 135 | </style> |
| 136 | </defs> |
| 137 | <rect width="100%" height="100%" rx="12" class="bg" /> |
| 138 | <text x="30" y="48" class="title">HTTP Gateway Latency (p50 TTFB) and Throughput</text> |
| 139 | <text x="30" y="74" class="subtitle">Localhost multi-threaded sweep: concurrency=10, 500 requests per endpoint on Grace Blackwell</text> |
| 140 | <line x1="360" y1="95" x2="360" y2="470" class="grid" /> |
| 141 | <line x1="640" y1="95" x2="640" y2="470" class="grid" /> |
| 142 | <line x1="920" y1="95" x2="920" y2="470" class="grid" /> |
| 143 | {bars} |
| 144 | </svg>"#, |
| 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 | <g class="tier-row"> |
| 165 | <text x="30" y="{y}" class="label-concurrency">Concurrency = {concurrency}</text> |
| 166 | <rect x="220" y="{rect_ttft_y}" width="{ttft_w}" height="14" rx="3" fill="#7fb8a6" /> |
| 167 | <rect x="220" y="{rect_itl_y}" width="{itl_w}" height="14" rx="3" fill="#6ba4d9" /> |
| 168 | <text x="{ttft_val_x}" y="{y_ttft_text}" class="label-stat">TTFT {ttft:.1}ms</text> |
| 169 | <text x="{itl_val_x}" y="{y_itl_text}" class="label-stat">ITL {itl:.1}ms</text> |
| 170 | <text x="760" y="{y}" class="badge-tps">{tps:.0} tok/s</text> |
| 171 | <text x="920" y="{y}" class="badge-power">{power:.1}W ({joules:.4} J/tok)</text> |
| 172 | </g>"##, |
| 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#"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1100 {svg_h}" width="100%" height="100%"> |
| 195 | <defs> |
| 196 | <style> |
| 197 | .bg {{ fill: #18111f; }} |
| 198 | .title {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 20px; font-weight: 700; fill: #fff8ee; }} |
| 199 | .subtitle {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; fill: #bca9c2; }} |
| 200 | .label-concurrency {{ font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; fill: #ded3df; }} |
| 201 | .label-stat {{ font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600; fill: #fff8ee; }} |
| 202 | .badge-tps {{ font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; fill: #7fb8a6; }} |
| 203 | .badge-power {{ font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600; fill: #d3a85b; }} |
| 204 | </style> |
| 205 | </defs> |
| 206 | <rect width="100%" height="100%" rx="12" class="bg" /> |
| 207 | <text x="30" y="48" class="title">Empirical Concurrency Pressure Sweep (C=1 to C=256)</text> |
| 208 | <text x="30" y="74" class="subtitle">AIEN Continuous Batching Scheduler + Paged Unified Memory KV Pool on NVIDIA Grace Blackwell GB10</text> |
| 209 | {rows} |
| 210 | </svg>"#, |
| 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 | <g class="model-row"> |
| 231 | <text x="30" y="{y}" class="label-model">{name}</text> |
| 232 | <text x="30" y="{desc_y}" class="label-topology">{topology} [{quant}]</text> |
| 233 | <rect x="320" y="{rect_ttft_y}" width="{ttft_w}" height="14" rx="3" fill="#7fb8a6" /> |
| 234 | <rect x="320" y="{rect_itl_y}" width="{itl_w}" height="14" rx="3" fill="#6ba4d9" /> |
| 235 | <text x="{ttft_val_x}" y="{y_ttft_text}" class="label-stat">TTFT {ttft:.1}ms</text> |
| 236 | <text x="{itl_val_x}" y="{y_itl_text}" class="label-stat">ITL {itl:.1}ms</text> |
| 237 | <text x="820" y="{y}" class="badge-footprint">KV: {kv:.2} GB</text> |
| 238 | <text x="960" y="{y}" class="badge-status">{status}</text> |
| 239 | </g>"##, |
| 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#"<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1100 {svg_h}" width="100%" height="100%"> |
| 264 | <defs> |
| 265 | <style> |
| 266 | .bg {{ fill: #18111f; }} |
| 267 | .title {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 20px; font-weight: 700; fill: #fff8ee; }} |
| 268 | .subtitle {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 13px; fill: #bca9c2; }} |
| 269 | .label-model {{ font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; fill: #ded3df; }} |
| 270 | .label-topology {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 11px; fill: #bca9c2; }} |
| 271 | .label-stat {{ font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600; fill: #fff8ee; }} |
| 272 | .badge-footprint {{ font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; fill: #d3a85b; }} |
| 273 | .badge-status {{ font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; font-weight: 800; fill: #7fb8a6; }} |
| 274 | </style> |
| 275 | </defs> |
| 276 | <rect width="100%" height="100%" rx="12" class="bg" /> |
| 277 | <text x="30" y="48" class="title">Multi-Model Architecture Breadth & Silicon Scaling</text> |
| 278 | <text x="30" y="74" class="subtitle">Empirical performance comparison across model topologies with pure compiled serving</text> |
| 279 | {rows} |
| 280 | </svg>"#, |
| 281 | svg_h = svg_h, |
| 282 | rows = rows |
| 283 | ) |
| 284 | } |