Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/changes/changed/16198.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Remove the experimental OCamlFDO integration, including the `(fdo ...)`
workspace field (#16198, @rgrinberg)
13 changes: 0 additions & 13 deletions doc/reference/dune-workspace/context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,6 @@ regular build context, or ``(opam ...)`` to use an opam switch.
Relative paths are interpreted with respect to the workspace root. See
:ref:`finding-root`.

- ``(fdo <target_exe>)`` builds this context with feedback-directed
optimizations. It requires `OCamlFDO
<https://github.com/gretay-js/ocamlfdo>`__. ``<target_exe>`` is a path
interpreted relative to the workspace root (see :ref:`finding-root`).
``<target_exe>`` specifies which executable to optimize. Users should define a
different context for each target executable built with FDO. The context name
is derived automatically from the default name and ``<target-exe>``, unless
explicitly specified using the ``(name ...)`` field. For example, if
``<target_exe>`` is *src/foo.exe* in a default context, then the name of the
context is *default-fdo-foo* and the filename that contains execution counters
is *src/fdo.exe.fdo-profile*. This feature is **experimental** and no
backward compatibility is implied.

- ``(instrument_with <instrumentation_backend>)`` turns on instrumentation for
the context. See :doc:`/instrumentation` for more information.

Expand Down
2 changes: 0 additions & 2 deletions otherlibs/stdune/src/filename.ml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ let dune_file = "dune-file"
let dune_project = "dune-project"
let dune_workspace = "dune-workspace"
let expected = Extension.to_filename Extension.expected
let fdo_profile = ".fdo-profile"
let generated = ".generated"
let git_dir_basename = ".git"
let gmake = "gmake"
Expand All @@ -190,7 +189,6 @@ let jbuild = "jbuild"
let json = Extension.to_filename Extension.json
let js_dir_basename = Extension.to_filename Extension.js
let lock_dune = "lock.dune"
let linker_script = ".linker-script"
let lock_dir_basename = ".lock"
let make = "make"
let merlin_conf_dir_basename = ".merlin-conf"
Expand Down
2 changes: 0 additions & 2 deletions otherlibs/stdune/src/filename.mli
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ val dune_file : t
val dune_project : t
val dune_workspace : t
val expected : t
val fdo_profile : t
val generated : t
val git_dir_basename : t
val gmake : t
Expand All @@ -137,7 +136,6 @@ val jbuild : t
val json : t
val js_dir_basename : t
val lock_dune : t
val linker_script : t
val lock_dir_basename : t
val make : t
val merlin_conf_dir_basename : t
Expand Down
9 changes: 0 additions & 9 deletions src/dune_rules/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ type builder =
{ profile : Profile.t
; merlin : bool
; instrument_with : Lib_name.t list
; fdo_target_exe : Path.t option
; dynamically_linked_foreign_archives : bool
; env_nodes : Env_nodes.t
; name : Context_name.t
Expand Down Expand Up @@ -107,7 +106,6 @@ module Builder = struct
{ profile = Profile.Dev
; merlin = false
; instrument_with = []
; fdo_target_exe = None
; dynamically_linked_foreign_archives = false
; env_nodes = Env_nodes.empty
; name = Context_name.default
Expand Down Expand Up @@ -150,7 +148,6 @@ module Builder = struct
; toolchain
; paths
; loc = _
; fdo_target_exe
; dynamically_linked_foreign_archives
; instrument_with
; merlin
Expand All @@ -169,7 +166,6 @@ module Builder = struct
; profile
; dynamically_linked_foreign_archives
; instrument_with
; fdo_target_exe
; name
; env = Memo.return env
; findlib_toolchain = toolchain
Expand Down Expand Up @@ -197,7 +193,6 @@ let dynamically_linked_foreign_archives t =
Ocaml_config.supports_shared_libraries ocaml.ocaml_config
;;

let fdo_target_exe t = t.builder.fdo_target_exe
let instrument_with t = t.builder.instrument_with
let merlin t = t.builder.merlin
let profile t = t.builder.profile
Expand All @@ -220,13 +215,11 @@ let host t =

let to_dyn t : Dyn.t =
let open Dyn in
let path = Path.to_dyn in
record
[ "name", Context_name.to_dyn t.builder.name
; "kind", Kind.to_dyn t.kind
; "profile", Profile.to_dyn t.builder.profile
; "merlin", Bool t.builder.merlin
; "fdo_target_exe", option path t.builder.fdo_target_exe
; "build_dir", Path.Build.to_dyn t.build_dir
; "instrument_with", (list Lib_name.to_dyn) t.builder.instrument_with
]
Expand Down Expand Up @@ -509,8 +502,6 @@ let create (builder : Builder.t) ~(kind : Kind.t) =
toolchain, `Lock)
in
Ocaml_toolchain.register_response_file_support ocaml;
if Option.is_some builder.fdo_target_exe
then Ocaml_toolchain.check_fdo_support ocaml builder.name;
ocaml, env)
in
let default_ocamlpath =
Expand Down
4 changes: 0 additions & 4 deletions src/dune_rules/context.mli
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ val to_dyn_concise : t -> Dyn.t
val name : t -> Context_name.t
val which : t -> Filename.t -> Path.t option Memo.t

(** [Some path/to/foo.exe] if this contexts is for feedback-directed
optimization of target path/to/foo.exe *)
val fdo_target_exe : t -> Path.t option

(** By default Dune builds and installs dynamically linked foreign
archives (usually named [dll*.so]). It is possible to disable this by
adding (disable_dynamically_linked_foreign_archives true) to the workspace
Expand Down
9 changes: 2 additions & 7 deletions src/dune_rules/ctypes/ctypes_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,11 @@ let build_c_program
let+ ocaml = Action_builder.of_memo ocaml in
let use_standard_flags = Dune_project.use_standard_c_and_cxx_flags project in
let cfg = ocaml.ocaml_config in
let fdo_flags = Command.Args.As (Fdo.c_flags ctx) in
match use_standard_flags with
| Some true -> fdo_flags
| Some true -> Command.Args.empty
| None | Some false ->
(* In dune < 2.8 flags from ocamlc_config are always added *)
S
[ As (Ocaml_config.ocamlc_cflags cfg)
; As (Ocaml_config.ocamlc_cppflags cfg)
; fdo_flags
]
S [ As (Ocaml_config.ocamlc_cflags cfg); As (Ocaml_config.ocamlc_cppflags cfg) ]
in
let open Action_builder.O in
let* expander = Action_builder.of_memo (Super_context.expander sctx ~dir) in
Expand Down
10 changes: 3 additions & 7 deletions src/dune_rules/exe.ml
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,11 @@ let link_exe
let dir = Compilation_context.dir cctx in
let mode = Link_mode.mode linkage_mode in
let exe = exe_path_from_name cctx ~name ~linkage in
let* action_with_targets =
let action_with_targets =
let ocaml_flags = Ocaml_flags.get (Compilation_context.flags cctx) (Ocaml mode) in
let prefix =
Cm_files.top_sorted_objects_and_cms cm_files ~mode |> Action_builder.dyn_paths_unit
in
let+ fdo_linker_script_flags =
let fdo_linker_script = Fdo.Linker_script.create cctx (Path.build exe) in
Fdo.Linker_script.flags fdo_linker_script
in
let open Action_builder.With_targets.O in
(* NB. Below we take care to pass [link_args] last on the command-line for
the following reason: [link_args] contains the list of foreign libraries
Expand Down Expand Up @@ -236,10 +232,10 @@ let link_exe
; Dyn
(let top_sorted_cms = Cm_files.top_sorted_cms cm_files ~mode in
Action_builder.map top_sorted_cms ~f:(fun x -> Command.Args.Deps x))
; fdo_linker_script_flags
; Dyn link_args
]
and* mode =
in
let* mode =
let sctx = Compilation_context.super_context cctx in
let* expander = Super_context.expander sctx ~dir in
Rule_mode_expand.expand_optional_promote ~expander ~dir promote
Expand Down
218 changes: 0 additions & 218 deletions src/dune_rules/fdo.ml

This file was deleted.

Loading
Loading