Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate arity between compilation units #1594

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Propagate arity between compilation units #1594

wants to merge 2 commits into from

Conversation

hhugo
Copy link
Member

@hhugo hhugo commented Apr 8, 2024

PoC for #550

  • Store immutability property of blocks
  • Try to recover some immutability info from debug events. (currently assuming modules are immutable, need to check what happens with recursive modules
  • Use this info to compute an approximated shape for registered globals.
  • Use shape info to compute function arity across compilation units (this is currently only done when compiling cma files as we know the shape of previously compiled units inside the library)

TODOs/Questions:

  • check the behavior with recursive modules
  • fix with effects
  • update global_flow ?
  • better mechanism for shape propagation ?-
  • store shape in a different file ? yes
  • should the "shape" file be given jsoo on the command line or should it look for it on the file system ? both
  • update dune rules with additional deps (WIP Jsoo shapes ocaml/dune#10767)

@hhugo hhugo requested a review from vouillon April 8, 2024 09:59
@hhugo
Copy link
Member Author

hhugo commented Apr 8, 2024

@vouillon, feel free to comment, review and even commit the branch.

compiler/lib/flow.ml Outdated Show resolved Hide resolved
compiler/lib/flow.ml Outdated Show resolved Hide resolved
compiler/lib/flow.ml Outdated Show resolved Hide resolved
compiler/lib/shape.ml Outdated Show resolved Hide resolved
@hhugo hhugo force-pushed the shapes branch 2 times, most recently from ffe3e43 to c7c009b Compare April 18, 2024 07:58
@hhugo hhugo force-pushed the shapes branch 3 times, most recently from ce02188 to f8138d0 Compare July 26, 2024 12:12
@hhugo hhugo mentioned this pull request Jul 26, 2024
@hhugo hhugo force-pushed the shapes branch 3 times, most recently from b17b2f0 to 1ed2368 Compare October 26, 2024 06:45
@hhugo hhugo force-pushed the shapes branch 2 times, most recently from 14fe546 to 3821d45 Compare November 7, 2024 09:37
@hhugo hhugo marked this pull request as ready for review November 19, 2024 14:35
@hhugo hhugo changed the title PoC: Propagate arity between compilation units Propagate arity between compilation units Nov 19, 2024
@hhugo
Copy link
Member Author

hhugo commented Nov 19, 2024

@vouillon, I think we could merge this before we have the support merged inside dune.
Would you want to give it another round of review ?

@hhugo hhugo force-pushed the shapes branch 2 times, most recently from a160212 to 53d94b5 Compare November 21, 2024 16:24
@hhugo
Copy link
Member Author

hhugo commented Nov 22, 2024

It increases to the time to build the toplevel in whole program compilation by ~10%. But we don't benefit from shapes in such case.

@vouillon
Copy link
Member

The following command spends a lot of time in Flow.the_shape_of (called from Specialize.function_arity).

js_of_ocaml `which ocamlc.byte` 

Propagate shape information through the flow analysis

Function arity from shapes: take advantage of flow analysis

control write-shape
@smorimoto smorimoto requested a review from Copilot December 29, 2024 20:11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 10 out of 29 changed files in this pull request and generated no comments.

Files not reviewed (19)
  • compiler/bin-js_of_ocaml/build_fs.ml: Language not supported
  • compiler/bin-js_of_ocaml/cmd_arg.ml: Language not supported
  • compiler/bin-js_of_ocaml/cmd_arg.mli: Language not supported
  • compiler/bin-js_of_ocaml/compile.ml: Language not supported
  • compiler/lib/code.ml: Language not supported
  • compiler/lib/code.mli: Language not supported
  • compiler/lib/config.ml: Language not supported
  • compiler/lib/config.mli: Language not supported
  • compiler/lib/driver.ml: Language not supported
  • compiler/lib/driver.mli: Language not supported
  • compiler/lib/flow.ml: Language not supported
  • compiler/lib/flow.mli: Language not supported
  • compiler/lib/global_flow.ml: Language not supported
  • compiler/lib/ocaml_compiler.ml: Language not supported
  • compiler/lib/ocaml_compiler.mli: Language not supported
  • compiler/lib/parse_bytecode.ml: Language not supported
  • compiler/lib/pure_fun.ml: Language not supported
  • compiler/lib/shape.ml: Language not supported
  • compiler/lib/shape.mli: Language not supported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants