Skip to content

Commit 3f198a5

Browse files
committed
bench: enhance job noise floor calculations to prevent false confidence in metrics
1 parent e6da32f commit 3f198a5

1 file changed

Lines changed: 26 additions & 5 deletions

File tree

.github/scripts/allocator_bench_aggregate.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,25 @@ def job_noise_floors(stats: dict) -> dict[tuple[str, str, str], float]:
199199
pct = abs(100.0 * (series[name].median - b) / b)
200200
slot = (key[0], key[3], name)
201201
floors[slot] = max(floors.get(slot, 0.0), pct)
202+
203+
# Platforms without a dup cell fall back to the worst floor measured
204+
# anywhere for that metric, rather than to zero. Zero would quietly award
205+
# full confidence exactly where the noise is unknown, which is the failure
206+
# this whole mechanism exists to prevent.
207+
for name, _, _ in METRICS:
208+
worst = max(
209+
(v for (_, _, m), v in floors.items() if m == name), default=0.0
210+
)
211+
floors[("*", "*", name)] = worst
202212
return floors
203213

204214

215+
def floor_for(floors: dict, platform: str, workload: str, metric: str) -> float:
216+
if (platform, workload, metric) in floors:
217+
return floors[(platform, workload, metric)]
218+
return floors.get(("*", "*", metric), 0.0)
219+
220+
205221
def delta_cell(x: Cell, b: Cell, floor: float = 0.0) -> str:
206222
"""Median-vs-median delta, qualified by what the reps can actually support.
207223
@@ -279,7 +295,7 @@ def render(stats: dict, out: list[str], floors: dict) -> None:
279295
if baseline is None or key == baseline:
280296
line += " - |"
281297
else:
282-
floor = floors.get((platform, workload, name), 0.0)
298+
floor = floor_for(floors, platform, workload, name)
283299
line += f" {delta_cell(c, stats[baseline][name], floor)} |"
284300
out.append(line)
285301

@@ -295,11 +311,16 @@ def render(stats: dict, out: list[str], floors: dict) -> None:
295311
+ ". Deltas within it are marked `(job-noise)`.\n"
296312
)
297313
else:
314+
borrowed = ", ".join(
315+
f"{label} {floor_for(floors, platform, workload, name):.1f}%"
316+
for name, label, _ in METRICS
317+
)
298318
out.append(
299-
"\nNo `_dup` cell on this platform, so between-job noise is "
300-
"unmeasured here and the deltas above are qualified only by "
301-
"each cell's own repetitions - which understates the "
302-
"uncertainty, badly for jemalloc and mimalloc.\n"
319+
"\nNo `_dup` cell on this platform, so between-job noise was "
320+
"not measured here. The deltas above are held to the worst "
321+
f"floor seen anywhere instead ({borrowed}), which is a guess - "
322+
"add this platform to NOISE_DUPES in allocator_bench_matrix.py "
323+
"if a decision is going to rest on it.\n"
303324
)
304325
out.append("")
305326

0 commit comments

Comments
 (0)