Generate the scatter plot and save to progress.png.
(df: pd.DataFrame, baselines: dict | None)
| 155 | # --------------------------------------------------------------------------- |
| 156 | |
| 157 | def make_progress_plot(df: pd.DataFrame, baselines: dict | None) -> None: |
| 158 | """Generate the scatter plot and save to progress.png.""" |
| 159 | |
| 160 | fig, ax = plt.subplots(figsize=(12, 6)) |
| 161 | |
| 162 | # We plot all kernel types on one chart; if there's only one type that's fine |
| 163 | xs_kept, ys_kept = [], [] |
| 164 | xs_failed, ys_failed = [], [] |
| 165 | xs_reverted, ys_reverted = [], [] |
| 166 | |
| 167 | experiment_nums = [] |
| 168 | throughputs = [] |
| 169 | |
| 170 | for i, row in df.iterrows(): |
| 171 | exp_num = row.get("experiment", i + 1) |
| 172 | if pd.isna(exp_num): |
| 173 | exp_num = i + 1 |
| 174 | exp_num = float(exp_num) |
| 175 | |
| 176 | tp = row.get("throughput_tflops", 0) |
| 177 | if pd.isna(tp): |
| 178 | tp = 0.0 |
| 179 | tp = float(tp) |
| 180 | |
| 181 | experiment_nums.append(exp_num) |
| 182 | throughputs.append(tp) |
| 183 | |
| 184 | cat = classify_row(row) |
| 185 | if cat == "kept": |
| 186 | xs_kept.append(exp_num) |
| 187 | ys_kept.append(tp) |
| 188 | elif cat == "failed": |
| 189 | xs_failed.append(exp_num) |
| 190 | ys_failed.append(tp) |
| 191 | else: |
| 192 | xs_reverted.append(exp_num) |
| 193 | ys_reverted.append(tp) |
| 194 | |
| 195 | # Scatter dots |
| 196 | if xs_reverted: |
| 197 | ax.scatter(xs_reverted, ys_reverted, c="#999999", s=40, alpha=0.6, |
| 198 | label="Reverted (correct, slower)", zorder=3, edgecolors="none") |
| 199 | if xs_failed: |
| 200 | ax.scatter(xs_failed, ys_failed, c="#e74c3c", s=40, alpha=0.7, |
| 201 | label="Failed (FAIL/crash)", zorder=3, edgecolors="none") |
| 202 | if xs_kept: |
| 203 | ax.scatter(xs_kept, ys_kept, c="#2ecc71", s=50, alpha=0.85, |
| 204 | label="Kept (improved)", zorder=4, edgecolors="none") |
| 205 | |
| 206 | # Running maximum line (research frontier) -- based on kept experiments |
| 207 | if experiment_nums: |
| 208 | sorted_pairs = sorted(zip(experiment_nums, throughputs)) |
| 209 | frontier_x, frontier_y = [], [] |
| 210 | running_max = float("-inf") |
| 211 | for x, y in sorted_pairs: |
| 212 | if y > running_max: |
| 213 | running_max = y |
| 214 | frontier_x.append(x) |
no test coverage detected