You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fp-stability: per-instance disambiguation of fypp-expanded hotspots (Tier 2)
dd_line attributes to .fpp source lines, but a #:for/#:def expansion collapses many generated computations onto one line, so a macro-ambiguous hotspot cannot be pinned to a single runtime instance. This adds an opt-in precision path that resolves it.
Mechanism (validated against gfortran+Verrou): a new build flag --fp-precision-lines strips the fypp line markers from each generated .f90 so the compiler attributes every expanded instance to a distinct physical line, emitting a .linemap.json sidecar mapping each line back to (.fpp file, line, instance). Marker renumbering was tried first but hit gfortran's DWARF line-number ceiling (~300k) and 700-line shadow runs; stripping avoids both and survives the cpp #if layer.
fp-stability gains --precision-sim-binary: for the most flagrant macro-ambiguous hotspot, each expanded instance is perturbed alone (Verrou --source) on the precision binary and ranked, naming the responsible instance and showing its concrete generated code. The strip is gated to the simulation target only (pre/post run on CPU).
Validated end-to-end: m_weno.fpp:238 (3 #:for instances) resolved to instance #0 = s_cb(i+3)-s_cb(i+1). toolchain/mfc/fp_precision_lines.py is pure + TDD'd (12 tests); normal build path is byte-identical and unaffected.
Copy file name to clipboardExpand all lines: toolchain/mfc/cli/commands.py
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,13 @@
141
141
default=False,
142
142
dest="deps_only",
143
143
),
144
+
Argument(
145
+
name="fp-precision-lines",
146
+
help="(fp-stability) Strip fypp line markers so each expanded instance gets a distinct line; emits sidecars for per-instance attribution.",
147
+
action=ArgAction.STORE_TRUE,
148
+
default=False,
149
+
dest="fp_precision_lines",
150
+
),
144
151
],
145
152
examples=[
146
153
Example("./mfc.sh build", "Build all default targets (CPU)"),
@@ -938,6 +945,13 @@
938
945
default=None,
939
946
metavar="PATH",
940
947
),
948
+
Argument(
949
+
name="precision-sim-binary",
950
+
help="Path to a simulation binary built with --fp-precision-lines. When given, macro-ambiguous hotspots are disambiguated to the individual fypp-expanded instance.",
0 commit comments