Skip to content

Commit eea0c8d

Browse files
committed
fp-stability: drop the MCA pass (redundant with the random-rounding sig-bits gate)
MCA (--backend=mcaquad) reported a significant-bits estimate that duplicated the metric the core random-rounding suite already produces for PASS/FAIL; on well-conditioned cases the two agree, so it added a slower second opinion without a distinct capability. Removed _run_mca_samples, the MCA pass + --no-mca flag + result keys + summary column. Cancellation/vprec/float-proxy/float-max and the PASS/FAIL core are unchanged. ~50 lines off; it was also the slowest pass (N extra mcaquad runs/case).
1 parent 1f10f31 commit eea0c8d

4 files changed

Lines changed: 6 additions & 75 deletions

File tree

toolchain/mfc/cli/commands.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,6 @@
917917
" float proxy One run with --rounding-mode=float (single-precision sensitivity)\n"
918918
" vprec sweep Runs at mantissa bits [52, 23, 16, 10] (precision floor curve)\n"
919919
" cancellation --check-cancellation origins, ranked by significant digits lost\n"
920-
" mca-sigbits Monte Carlo Arithmetic (mcaquad) significant-bits lower bound\n"
921920
" float-max --check-max-float detection of double→float overflow sites\n"
922921
),
923922
include_common=["mfc_config", "verbose", "debug_log"],
@@ -977,13 +976,6 @@
977976
default=False,
978977
dest="no_cancellation",
979978
),
980-
Argument(
981-
name="no-mca",
982-
help="Skip Monte Carlo Arithmetic (mcaquad) significant-bits estimate.",
983-
action=ArgAction.STORE_TRUE,
984-
default=False,
985-
dest="no_mca",
986-
),
987979
Argument(
988980
name="no-float-max",
989981
help="Skip --check-max-float float32 overflow detection.",
@@ -1001,7 +993,7 @@
1001993
),
1002994
Example("./mfc.sh fp-stability -N 10", "Run 10 random-rounding samples per case"),
1003995
Example("./mfc.sh fp-stability --no-vprec --no-cancellation", "Skip VPREC sweep and cancellation detection"),
1004-
Example("./mfc.sh fp-stability --no-cancellation --no-mca --no-float-max", "Skip new analysis passes"),
996+
Example("./mfc.sh fp-stability --no-cancellation --no-float-max", "Skip analysis passes"),
1005997
],
1006998
key_options=[
1007999
("--sim-binary PATH", "Serial simulation binary (debug, no-MPI)"),
@@ -1011,7 +1003,6 @@
10111003
("--no-float-proxy", "Skip float-rounding proxy run"),
10121004
("--no-vprec", "Skip VPREC mantissa-bit sweep"),
10131005
("--no-cancellation", "Skip cancellation detection"),
1014-
("--no-mca", "Skip MCA significant-bits estimate"),
10151006
("--no-float-max", "Skip float32 overflow detection"),
10161007
],
10171008
)

toolchain/mfc/fp_stability.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@
2222
.fpp line sits inside a #:for/#:def expansion is flagged as instance-ambiguous
2323
(the line maps to multiple generated instances).
2424
25-
E. MCA significant-bits estimate (--no-mca to skip)
26-
N runs with --backend=mcaquad; max deviation vs nearest-rounding
27-
reference gives a lower bound on significant bits: s = -log2(dev/scale).
28-
29-
F. Float-max overflow detection (--no-float-max to skip)
25+
E. Float-max overflow detection (--no-float-max to skip)
3026
One run with --check-max-float=yes; reports locations where a
3127
double→float conversion would overflow to ±Inf.
3228
@@ -80,7 +76,6 @@
8076
_run_cancellation_check,
8177
_run_float_max_check,
8278
_run_float_proxy,
83-
_run_mca_samples,
8479
_run_preprocess,
8580
_run_simulation_verrou,
8681
_run_vprec_sweep,
@@ -372,8 +367,6 @@ def _blank_result(name: str) -> dict:
372367
"cancellation_locs": [],
373368
"cancellation_bits": {},
374369
"cancellation_macro": {},
375-
"mca_dev": None,
376-
"mca_sigbits": None,
377370
"float_max_locs": [],
378371
}
379372

@@ -387,7 +380,6 @@ def _run_case(
387380
run_float: bool,
388381
run_vprec: bool,
389382
run_cancellation: bool,
390-
run_mca: bool,
391383
run_float_max: bool,
392384
) -> dict:
393385
name = case["name"]
@@ -494,22 +486,7 @@ def _run_case(
494486
except Exception as exc:
495487
cons.print(f" [bold yellow]cancellation check error[/bold yellow]: {exc}")
496488

497-
# --- E: MCA significant-bits estimate ---
498-
if run_mca:
499-
cons.print(f" [dim]MCA significant-bits estimate (N={n_samples})...[/dim]")
500-
try:
501-
mca_dev, mca_sigbits, n_ok = _run_mca_samples(case, verrou_bin, sim_bin, work_dir, ref_dir, n_samples)
502-
if n_ok == 0:
503-
cons.print(f" [bold yellow]MCA: no samples completed (0/{n_samples}; see logs)[/bold yellow]")
504-
else:
505-
result["mca_dev"] = mca_dev
506-
result["mca_sigbits"] = mca_sigbits
507-
bits_str = f"~{mca_sigbits} sig bits" if mca_sigbits is not None else "n/a"
508-
cons.print(f" MCA: dev={mca_dev:.3e} ({bits_str}) [{n_ok}/{n_samples} samples]")
509-
except Exception as exc:
510-
cons.print(f" [bold yellow]MCA error[/bold yellow]: {exc}")
511-
512-
# --- F: float-max overflow detection ---
489+
# --- E: float-max overflow detection ---
513490
if run_float_max:
514491
cons.print(" [dim]float-max overflow check...[/dim]")
515492
try:
@@ -610,7 +587,6 @@ def fp_stability():
610587
run_float = not ARG("no_float_proxy")
611588
run_vprec = not ARG("no_vprec")
612589
run_cancellation = not ARG("no_cancellation")
613-
run_mca = not ARG("no_mca")
614590
run_float_max = not ARG("no_float_max")
615591

616592
cases_to_run = [_load_user_case(ARG("input"))] if ARG("input") else CASES
@@ -633,8 +609,6 @@ def fp_stability():
633609
features.append("vprec-sweep")
634610
if run_cancellation:
635611
features.append("cancellation")
636-
if run_mca:
637-
features.append("mca-sigbits")
638612
if run_float_max:
639613
features.append("float-max")
640614
cons.print(f" features: {', '.join(features) if features else 'stability only'}")
@@ -654,7 +628,6 @@ def fp_stability():
654628
run_float,
655629
run_vprec,
656630
run_cancellation,
657-
run_mca,
658631
run_float_max,
659632
)
660633
except MFCException as exc:

toolchain/mfc/fp_stability_report.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,13 @@ def _emit_github_summary(results: list, n_samples: int):
8080

8181
# Main results table — pass/fail is scale-free: bits retained vs a single floor
8282
md.append(f"_Pass = at least **{MIN_SIG_BITS} significant bits** retained under random rounding (scale-free; no per-case threshold)._\n")
83-
md.append("| Case | Status | bits retained | max\\_dev | Float proxy | MCA sig bits |")
84-
md.append("|------|:------:|:------:|--------:|--------:|:------:|")
83+
md.append("| Case | Status | bits retained | max\\_dev | Float proxy |")
84+
md.append("|------|:------:|:------:|--------:|--------:|")
8585
for r in results:
8686
status = "✅" if r["passed"] else "❌"
8787
bits = f"{r['sig_bits']:.1f}" if r.get("sig_bits") is not None else "—"
8888
fp = f"{r['float_proxy']:.2e}" if r["float_proxy"] is not None else "—"
89-
sb = str(r["mca_sigbits"]) if r.get("mca_sigbits") is not None else "—"
90-
md.append(f"| `{r['name']}` | {status} | {bits} / {MIN_SIG_BITS} | {r['max_dev']:.2e} | {fp} | {sb} |")
89+
md.append(f"| `{r['name']}` | {status} | {bits} / {MIN_SIG_BITS} | {r['max_dev']:.2e} | {fp} |")
9190
md.append("")
9291

9392
# Cancellation ORIGINS — where ill-conditioning actually arises, led with the

toolchain/mfc/fp_stability_runners.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66

77
import glob
8-
import math
98
import os
109
import shutil
1110
import subprocess
@@ -14,7 +13,6 @@
1413
from .common import MFC_ROOT_DIR, MFCException
1514
from .fp_stability_metrics import (
1615
VPREC_MANTISSA_BITS,
17-
_max_abs_np,
1816
_max_diff_np,
1917
_parse_cancel_gen,
2018
_parse_vg_error_locs,
@@ -147,36 +145,6 @@ def _run_cancellation_check(verrou_bin: str, sim_bin: str, work_dir: str, thresh
147145
return _parse_cancel_gen(gen_path)
148146

149147

150-
def _run_mca_samples(
151-
case: dict,
152-
verrou_bin: str,
153-
sim_bin: str,
154-
work_dir: str,
155-
ref_dir: str,
156-
n_mca: int,
157-
) -> tuple:
158-
"""Run N mcaquad samples; return (max_dev, sig_bits_lower_bound, n_ok) where
159-
n_ok is how many samples actually completed (0 => no usable measurement)."""
160-
compare = case["compare"]
161-
ref_scale = _max_abs_np(ref_dir, compare)
162-
max_dev = 0.0
163-
n_ok = 0
164-
flags = ["--backend=mcaquad", "--mca-mode=mca"]
165-
for i in range(n_mca):
166-
run_dir = os.path.join(work_dir, f"mca_{i:02d}")
167-
os.makedirs(run_dir, exist_ok=True)
168-
try:
169-
_run_simulation_verrou(verrou_bin, sim_bin, work_dir, run_dir, extra_flags=flags)
170-
max_dev = max(max_dev, _max_diff_np(ref_dir, run_dir, compare))
171-
n_ok += 1
172-
except MFCException as exc:
173-
cons.print(f" [dim]MCA sample {i} failed: {exc}[/dim]")
174-
sig_bits = None
175-
if n_ok and max_dev > 0.0 and ref_scale > 0.0:
176-
sig_bits = max(0, int(math.floor(-math.log2(max_dev / ref_scale))))
177-
return max_dev, sig_bits, n_ok
178-
179-
180148
def _run_float_max_check(verrou_bin: str, sim_bin: str, work_dir: str):
181149
"""Run with --check-max-float=yes; return [(fname, line)] of overflow sites,
182150
or None if the run failed (distinct from [] = ran and found none)."""

0 commit comments

Comments
 (0)