Skip to content

Commit bb15d3a

Browse files
committed
fp_stability: extend control-flow filter to cancellation locs and more patterns
The _CONTROL_FLOW_RE filter was only applied to dd_line results; the cancellation check was passing its locs through unfiltered, producing subroutine declarations, else-if branches, and loop headers in the step summary alongside real arithmetic sites. Changes: - Apply _is_arithmetic_loc filter to cancellation_locs in _run_cancellation_check; log how many control-flow boundaries skipped. - Extend _CONTROL_FLOW_RE to also catch: - else / else if (...) then branches - subroutine declarations (recursive/pure/elemental variants)
1 parent ef7b21c commit bb15d3a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

toolchain/mfc/fp_stability.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
r"^\s*("
8888
r"end\s+(do|if|select|where|forall|subroutine|function|module|program|block)\b"
8989
r"|do\s+\w+\s*=\s*[\w,\s]+" # naked do-loop header (no arithmetic)
90+
r"|else(\s+if\s*\(.*\)\s*then)?\s*$" # else / else if (...) then
91+
r"|(recursive\s+|pure\s+|elemental\s+)*subroutine\s+\w+" # subroutine declaration
9092
r"|\$:END_GPU\w+" # fypp GPU macro closers
9193
r"|#:end\w*" # fypp directive closers (#:endfor, #:enddef, etc.)
9294
r"|\s*!\s*$" # comment-only lines
@@ -621,7 +623,12 @@ def _run_cancellation_check(case: dict, verrou_bin: str, sim_bin: str, work_dir:
621623
_run_simulation_verrou(verrou_bin, sim_bin, work_dir, run_dir, rounding_mode="nearest", extra_flags=flags)
622624
except MFCException:
623625
pass
624-
return _parse_cancel_gen(gen_path)
626+
raw = _parse_cancel_gen(gen_path)
627+
filtered = [(f, ln) for f, ln in raw if _is_arithmetic_loc(f, ln, ln)]
628+
skipped = len(raw) - len(filtered)
629+
if skipped:
630+
cons.print(f" [dim]cancellation: filtered {skipped} control-flow boundary site(s)[/dim]")
631+
return filtered
625632

626633

627634
def _run_mca_samples(

0 commit comments

Comments
 (0)