Determine baseline throughput from the first row in results or from baselines.json.
(df: pd.DataFrame, baselines: dict | None)
| 258 | |
| 259 | |
| 260 | def _get_baseline_throughput(df: pd.DataFrame, baselines: dict | None) -> float | None: |
| 261 | """ |
| 262 | Determine baseline throughput from the first row in results or from |
| 263 | baselines.json. |
| 264 | """ |
| 265 | # Try first row |
| 266 | if df is not None and len(df) > 0 and "throughput_tflops" in df.columns: |
| 267 | first_tp = df.iloc[0]["throughput_tflops"] |
| 268 | if pd.notna(first_tp) and float(first_tp) > 0: |
| 269 | return float(first_tp) |
| 270 | |
| 271 | # Fallback: baselines.json -- pick the best throughput across configs |
| 272 | if baselines: |
| 273 | best = 0.0 |
| 274 | for entry in baselines.values(): |
| 275 | tp = entry.get("throughput_tflops", 0) |
| 276 | if tp > best: |
| 277 | best = tp |
| 278 | if best > 0: |
| 279 | return best |
| 280 | |
| 281 | return None |
| 282 | |
| 283 | |
| 284 | # --------------------------------------------------------------------------- |
no outgoing calls
no test coverage detected