add read-only capture diagnostic for the 4096-cap parity bug
Browse files- diag/diagnose_parity_capture.py +29 -18
diag/diagnose_parity_capture.py
CHANGED
|
@@ -462,30 +462,41 @@ def main() -> None:
|
|
| 462 |
report["row_fresh_raw_vs_behavior"] = stats(
|
| 463 |
[abs(a - b) for a, b in zip(fresh_raw, behavior)])
|
| 464 |
print("\n== which stored array does each recomputation reproduce? ==")
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
print(f" {key:36s} mean={r_['mean']:.6f} p99={r_['p99']:.4f} "
|
| 475 |
f"max={r_['max']:.4f} >0.5={r_['above_0p5']}")
|
| 476 |
print(" temperature probe on the TRAINER side (raw reference):")
|
| 477 |
for key in ("row_fresh_raw_vs_stored_trainer", "padded_fresh_raw_vs_stored_trainer"):
|
| 478 |
-
r_ = report
|
|
|
|
|
|
|
| 479 |
print(f" {key:34s} mean={r_['mean']:.6f} p99={r_['p99']:.4f} "
|
| 480 |
f"max={r_['max']:.4f} >0.5={r_['above_0p5']}")
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
"
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
|
|
|
|
|
|
|
|
|
| 489 |
d_raw = [abs(a - b) for a, b in zip(fresh_raw, behavior)]
|
| 490 |
d_trainer = [abs(a - b) for a, b in zip(fresh_T, trainer)]
|
| 491 |
d_trainer_raw = [abs(a - b) for a, b in zip(fresh_raw, trainer)]
|
|
|
|
| 462 |
report["row_fresh_raw_vs_behavior"] = stats(
|
| 463 |
[abs(a - b) for a, b in zip(fresh_raw, behavior)])
|
| 464 |
print("\n== which stored array does each recomputation reproduce? ==")
|
| 465 |
+
# Tolerant lookup: the guard comparisons are built further down, and an earlier
|
| 466 |
+
# build of this block indexed them directly and crashed before printing the
|
| 467 |
+
# engine cross-check (the padded numbers had already printed, so the root cause
|
| 468 |
+
# was still visible -- but a crash must not truncate the report).
|
| 469 |
+
for key, alias in (("padded_vs_row_fresh_T", None),
|
| 470 |
+
("padded_fresh_T_vs_behavior", None),
|
| 471 |
+
("padded_fresh_T_vs_stored_trainer", None),
|
| 472 |
+
("row_fresh_T_vs_behavior", "guard_fresh_T_vs_behavior"),
|
| 473 |
+
("row_fresh_T_vs_stored_trainer",
|
| 474 |
+
"trainer_fresh_T_vs_stored_trainer")):
|
| 475 |
+
r_ = report.get(key) or (report.get(alias) if alias else None)
|
| 476 |
+
if not r_:
|
| 477 |
+
print(f" {key:36s} (not available yet in this build)")
|
| 478 |
+
continue
|
| 479 |
+
report.setdefault(key, r_)
|
| 480 |
print(f" {key:36s} mean={r_['mean']:.6f} p99={r_['p99']:.4f} "
|
| 481 |
f"max={r_['max']:.4f} >0.5={r_['above_0p5']}")
|
| 482 |
print(" temperature probe on the TRAINER side (raw reference):")
|
| 483 |
for key in ("row_fresh_raw_vs_stored_trainer", "padded_fresh_raw_vs_stored_trainer"):
|
| 484 |
+
r_ = report.get(key)
|
| 485 |
+
if not r_:
|
| 486 |
+
continue
|
| 487 |
print(f" {key:34s} mean={r_['mean']:.6f} p99={r_['p99']:.4f} "
|
| 488 |
f"max={r_['max']:.4f} >0.5={r_['above_0p5']}")
|
| 489 |
+
padded_ref = report.get("padded_fresh_T_vs_stored_trainer")
|
| 490 |
+
row_ref = report.get("row_fresh_T_vs_stored_trainer") or report.get(
|
| 491 |
+
"trainer_fresh_T_vs_stored_trainer")
|
| 492 |
+
if padded_ref and row_ref:
|
| 493 |
+
close = {"padded": padded_ref["max"], "row": row_ref["max"]}
|
| 494 |
+
report["which_recomputation_matches_the_trainer_array"] = (
|
| 495 |
+
"padded_batch" if close["padded"] < close["row"] / 3 else
|
| 496 |
+
"per_row" if close["row"] < close["padded"] / 3 else "neither_clearly")
|
| 497 |
+
print(f" => the trainer's stored array is reproduced by: "
|
| 498 |
+
f"{report['which_recomputation_matches_the_trainer_array']}"
|
| 499 |
+
f" (padded max={close['padded']:.4f}, row max={close['row']:.4f})")
|
| 500 |
d_raw = [abs(a - b) for a, b in zip(fresh_raw, behavior)]
|
| 501 |
d_trainer = [abs(a - b) for a, b in zip(fresh_T, trainer)]
|
| 502 |
d_trainer_raw = [abs(a - b) for a, b in zip(fresh_raw, trainer)]
|