Repository navigation
test: observational baseline for wrapped re-export via -open flag (#4572) - #14346
Merged
robinbb merged 2 commits intoApr 29, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an observational blackbox test capturing the rebuild/invalidation baseline for a consumer module that reaches a dependency’s module through a transparent alias inside a wrapped sibling library that is brought into scope via the -open compiler flag (rather than being referenced by name in source). This is intended as a regression guard for upcoming per-module dependency filtering changes.
Changes:
- Add a new cram test that sets up
lib_a→lib_re_export(wrapped, aliasing) →lib_b(opensLib_re_exportvia-open) and records the consumer rebuild count after alib_ainterface change.
Records the rebuild count for a consumer module that reaches a dep library's modules through a transparent alias declared inside a wrapped sibling library, where the wrapped library is opened via the [-open] compiler flag rather than named in source. On trunk the consumer correctly rebuilds when the dep library's interface changes (count = 1) because the cctx-wide compile-rule deps cover every library in the stanza's [(libraries ...)] closure. This is the structural shape of menhir's [base]/[middle] arrangement. Records the count so a future change that narrows compile-rule deps per module either preserves the count or fails the test, surfacing any precision regression in dependency tracking through transparent aliases. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
force-pushed
the
robinbb-test-wrapped-reexport-via-open
branch
from
April 27, 2026 15:41
5311f6f to
5f1e879
Compare
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
Apr 27, 2026
Each of the dep PRs supplying a test in [per-module-lib-deps/] was renamed per Leonidas's review on ocaml#14309: generic [libA]/[modA1]-style names replaced by role-bearing names like [dep_lib]/[spurious_rebuild]. This commit applies the same renames to this PR's local copies of those tests so they stay convergent with the dep PRs' canonical versions. Touches: - single-module-unreferenced-lib.t (ocaml#14308) - sibling-unreferenced-lib.t (ocaml#14309) - unwrapped-tight-deps.t (ocaml#14310) - lib-vs-lib-name-collision.t (ocaml#14324) - opaque-mli-change.t, opaque-cmx-deps-local.t (ocaml#14331) - transitive-unreferenced-lib.t (ocaml#14332) - wrapped-reexport-via-open-flag.t (ocaml#14346) - auto-wrapped-child-reexport.t (ocaml#14347) Pure rename + path/dir adjustments. Count assertions preserved (this PR's promotions to the post-fix counts are unchanged). Test suite passes. Signed-off-by: Robin Bate Boerop <[email protected]>
Alizter
requested changes
Apr 29, 2026
Alizter
added a commit
that referenced
this pull request
Apr 29, 2026
…4572) (#14365) ## Summary Adds a cram test recording the rebuild count when a consumer references a wrapped sibling library whose `Lib.closure` includes a transitively-reached unwrapped library, and an unread module of that transitive library is edited. ## Setup - `dep_lib` is unwrapped with two entry modules: `reached_module` (transitively reached via an alias chain) and `unreached_module` (which no source in the test reaches). - `lib_re_export` is wrapped (dune auto-generates the wrapper) with a single child `pprint` that aliases only `reached_module` of `dep_lib`. - `consumer_lib` writes `Lib_re_export.Pprint.Re.x`, naming `Lib_re_export` in source. ## What the test records Editing `unreached_module.mli` rebuilds the consumer on trunk today: the cctx-wide `-I`/`-H` glob covers `dep_lib`'s objdir, so any `.cmi` content change in `dep_lib` invalidates the consumer regardless of whether the change is to a module the consumer's alias chain actually reaches. A precision-perfect filter could observe that `pprint`'s ocamldep output names only `reached_module` and emit a per-module dep on `reached_module.cmi` alone — leaving the consumer untouched on `unreached_module.mli` changes. The test asserts the current behaviour (consumer rebuilds) so a future filter improvement that closes the precision gap will flip the assertion to `[]`. ## Relationship to #14116 #14116's per-module filter does not close this specific gap. Its conservative wrapped-lib soundness fix globs the entire `Lib.closure` of any wrapped sibling that appears in the consumer's reference set, which covers `dep_lib` here — so `unreached_module` changes still invalidate the consumer through the glob. The deeper filter that walks ocamldep through wrapped libs' children to extract exactly which transitive entry modules are reached is described as follow-on work in `lib_file_deps.ml`. This PR is purely observational; no code change. The test companions the soundness regression guards in [`auto-wrapped-child-reexport.t`](#14347) and [`wrapped-reexport-via-open-flag.t`](#14346): those assert the consumer DOES rebuild on a *reached* transitive module's change (soundness preservation); this one asserts the consumer rebuilds on an *unreached* transitive module's change (precision gap). Related: #4572, #14116
Alizter
added a commit
that referenced
this pull request
Apr 29, 2026
…#14347) Records the rebuild targets for a consumer module that reaches a dep library's modules through a child of an auto-wrapped sibling library. The sibling is opened via the `-open` compiler flag and the child's source exposes the dep library through a transparent module alias. On trunk the consumer correctly rebuilds when the dep library's interface changes (exactly one `consumer`-named rule fires, producing `consumer.cmi` / `.cmo` / `.cmt`) because the cctx-wide compile-rule deps cover every library in the stanza's `(libraries ...)` closure. The structural shape mirrors menhir's `base`/`middle` arrangement: `base` is auto-wrapped (no `base.ml` in source — dune generates the wrapper) with a child module that re-exports a third-party dep; `middle` uses `-open Base` and reaches the dep through that child. Menhir uses `include Vendored_pprint`; this test uses a transparent alias instead, because the alias shape exposes the precision gap a future per-module dep filter (#14116) must handle. The reference chain still crosses library boundaries through the auto-wrapped sibling's child, not through a hand-written wrapper. This is an observational test only; no code change. Pairs with future work on the per-module dep filter (#14116). Distinct from #14346 (where the alias lives in a hand-written wrapper) — the auto-wrapped case has the cross-library reference inside a child module whose ocamldep is not directly read by walks rooted at the wrapper, so a per-module filter must descend into wrapped libs' children to remain sound. See: #14116 See: #14346
Replace [| length] with the actual list of [target_files] arrays, matching the pattern used elsewhere in the cluster (e.g. [single-module-lib.t]). The list spells out which build artifacts get rebuilt when the wrapped re-exporter's transitive dep changes — currently the consumer's [.cmi]/[.cmo]/[.cmt] byte rule — so a future change that flips the behaviour to no-rebuild produces a self-explanatory diff (the array becomes empty) instead of a bare numeric mismatch. Addresses Alizter's review feedback: ocaml#14346 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
Alizter
approved these changes
Apr 29, 2026
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. - [single-module-unreferenced-lib.t]: same — [spurious_rebuild]'s rebuild count drops from 1 to 0. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. - [single-module-unreferenced-lib.t]: same — [spurious_rebuild]'s rebuild count drops from 1 to 0. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. - [single-module-unreferenced-lib.t]: same — [spurious_rebuild]'s rebuild count drops from 1 to 0. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. - [single-module-unreferenced-lib.t]: same — [spurious_rebuild]'s rebuild count drops from 1 to 0. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 4, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 6, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 6, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 6, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 6, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 8, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 8, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 8, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 9, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR ocaml#14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR ocaml#14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-ocaml#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 9, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR #14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR #14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 10, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR #14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR #14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 10, 2026
A module's [.cmi] is produced from [.mli] when one exists; only then. References in [.ml] that are not re-exported through [.mli] never appear in the [.cmi]'s imports — they are sealed. The compiler reads a dep's [.cmx] only for cross-module inlining, which happens only when compiling [Ocaml Cmx] without [-opaque]. In every other case the [.cmx] is unread and any [.ml]-side references it carries do not propagate. The previous filter unconditionally read both [Impl] and [Intf] ocamldep output for every module in the consumer's intra-library transitive closure, which over-approximates the consumer's true inter-library reference set whenever those references are sealed. Skip the [.ml]-side read when: - For the consumer module [m]: [ml_kind = Intf] (compiling [m.cmi] from [m.mli]; [m.ml] is unread by the compiler). - For a transitive intra-library dep [dep_m]: [dep_m] has [.mli] AND the consumer's compilation does not read [dep_m.cmx] for inlining (i.e. [cm_kind <> Ocaml Cmx] or [-opaque] is set). Promotes upstream observational baselines whose rebuild assertions are tightened by this commit: - [opaque-mli-change.t] (imported from PR #14346): the [.cmi]/[.cmti] byte rule is no longer invalidated by the changed dep lib's [.cmi]; only the [.cmx]/[.o] native rule re-runs. - [implicit-transitive-deps-false.t]: under [Disabled_with_hidden_includes], the [-H]-glob is elided from [Main]'s [.cmi]/[.cmti] rule. The [.cmo]/[.cmt] rule still globs over [link_only_lib]'s objdir until the [Lib_index] hidden-libs fix later in this PR. - [transitive-unreferenced-module.t] (imported from PR #14374): the per-module filter, with the [.ml]-side skip in place, no longer pulls the unreferenced sibling into [main]'s deps; [target_files] becomes [[]]. Wall-clock impact, dune-on-dune null build (mean of last 3 of 4 [dune build] invocations, hyperfine, OCaml 5.4.1): before: 2.170 s ± 0.012 s after: 1.904 s ± 0.017 s (-266 ms, -12 %) Brings the post-#14116 null-build regression from +570 ms (+36 %) to a smaller residual; see the per-module-filter perf report for the full attribution. Signed-off-by: Robin Bate Boerop <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Records the rebuild count for a consumer module that reaches a dep
library's modules through a transparent alias declared inside a
wrapped sibling library, where the wrapped library is opened via
the
-opencompiler flag rather than named in source. On trunk theconsumer correctly rebuilds when the dep library's interface
changes (count =
1) because the cctx-wide compile-rule deps coverevery library in the stanza's
(libraries ...)closure.This is the structural shape of menhir's
base/middlearrangement:
basere-exportsVendored_pprintthrough aliases,middleuses-open Basein its compile flags, and modules ofmiddlereferenceVendored_pprint's contents through unqualifiednames brought into scope by the open.
This is an observational test only; no code change. Pairs with
#14116 — its per-module dep-filter narrows compile-rule deps per
module, and on its current state drops
dep_libfrom theconsumer's deps in this scenario, leaving
consumer.cmostalewhen
dep_lib's interface changes (count flips to0). The fixon that PR's BFS will restore the count to
1, and this test actsas the regression guard.
See: #14116
See: #14186