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

Use AOT mode in the Dart SDK binaries #53576

Open
8 of 13 tasks
a-siva opened this issue Sep 20, 2023 · 13 comments
Open
8 of 13 tasks

Use AOT mode in the Dart SDK binaries #53576

a-siva opened this issue Sep 20, 2023 · 13 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team

Comments

@a-siva
Copy link
Contributor

a-siva commented Sep 20, 2023

Use AOT mode in the Dart SDK binaries (faster startup and more predictable performance)
List of items to account for before this task is complete

  • Switch frontend server invoked by dartdev to AOT mode
  • Switch frontend server invoked by flutter tools to AOT mode
  • Switch Analysis server to AOT mode
  • Switch DDS which is launched as a separate process to AOT mode
  • Switch DTD which is launched as a separate process to AOT mode
  • Switch 'dartdev compile kernel' to use an AOT frontend
  • Switch 'dartdev compile exe' to use an AOT frontend
  • Switch 'dartdev compile wasm' to use an AOT frontend
  • Switch dart2js launched from dartdev to use AOT mode
  • Switch dartdevc launched from pkg/dev_compiler to use AOT mode
  • Switch dartdev which includes a number of smaller utilities to AOT mode
  • Switch gen_kernel to use an AOT snapshot when invoked from 'dart compile exe'
  • Remove the kernel isolate from the VM, rename the VM binary to dartvm and have the VM only support running from kernel files
@a-siva a-siva added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Sep 20, 2023
@a-siva
Copy link
Contributor Author

a-siva commented Sep 21, 2023

CL to switch dds to run dds in AOT mode https://dart-review.googlesource.com/c/sdk/+/327140

@a-siva
Copy link
Contributor Author

a-siva commented Sep 22, 2023

CL to switch gen_kerenl to run in AOT mode when invoked from 'dart compile exe' command https://dart-review.googlesource.com/c/sdk/+/327520?tab=checks

@a-siva a-siva added P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team labels Oct 12, 2023
@derekxu16
Copy link
Member

PR to add --frontend-server-starter-path option to flutter run and flutter test: flutter/flutter#135038

PR to modify flutter_tools to start frontend_server from an AOT snapshot: flutter/flutter#136282

@derekxu16
Copy link
Member

PR to make FrontendServerClient start the frontend server from the AOT snapshot in the Dart SDK: dart-lang/webdev#2263

@mraleph
Copy link
Member

mraleph commented Mar 14, 2024

On the topic of AOT compiling our tools:

$ tools/test.py -c dart2analyzer --use-sdk co19/Language
...
[01:20 | 100% | +20451 | -   96]

=== 20451 tests passed, 96 failed ===

________________________________________________________
Executed in   81.51 secs    fish           external
   usr time  560.09 secs  134.00 micros  560.09 secs
   sys time   57.52 secs  769.00 micros   57.52 secs

The same but changing to run from AOT snapshot (which takes ~12s to produce):

$ tools/test.py -c dart2analyzer --use-sdk co19
[00:52 | 100% | +20451 | -   96]

=== 20451 tests passed, 96 failed ===

________________________________________________________
Executed in   54.07 secs    fish           external
   usr time  334.59 secs  124.00 micros  334.59 secs
   sys time   32.50 secs  799.00 micros   32.49 secs

/cc @scheglov @bwilkerson @srawlins

@srawlins
Copy link
Member

Very nice!

@stereotype441
Copy link
Member

@a-siva looking at pkg/dartdev/lib/src/sdk.dart and pkg/dartdev/lib/src/analysis_server.dart, it looks like the analysis server still hasn't been switched over to AoT. But the box "Switch frontend server invoked by Analysis server to AOT mode" is checked above. Am I misreading things, or is it possible that this box got checked by accident?

I'm wondering because discussion at #56454 makes it seem like the analysis server is still being invoked in Jit mode.

@srawlins
Copy link
Member

I think it's still in JIT mode because we don't support running plugins from AOT; we always run them from source (JIT); please forgive any misunderstandings I have here 😅 .

I did some prototyping with AOT-compiled plugins, for our plugins V2; so it's a thing we can do.

@scheglov
Copy link
Contributor

scheglov commented Aug 14, 2024

Note also that the current approach to run macros in analyzer and DAS is to compile them into kernel files, and run in the same process.

@a-siva
Copy link
Contributor Author

a-siva commented Aug 19, 2024

@a-siva looking at pkg/dartdev/lib/src/sdk.dart and pkg/dartdev/lib/src/analysis_server.dart, it looks like the analysis server still hasn't been switched over to AoT. But the box "Switch frontend server invoked by Analysis server to AOT mode" is checked above. Am I misreading things, or is it possible that this box got checked by accident?

I'm wondering because discussion at #56454 makes it seem like the analysis server is still being invoked in Jit mode.

Yes, the analysis server has not yet been switched to AOT yet. Not sure why it had the checked flag above. Fixed it.

@a-siva
Copy link
Contributor Author

a-siva commented Aug 19, 2024

Note also that the current approach to run macros in analyzer and DAS is to compile them into kernel files, and run in the same process.

We have had this discussion with the CFE team too and they have an out of process mode for executing the kernel files generated from macros. maybe the Analyzer should also consider this.

@a-siva
Copy link
Contributor Author

a-siva commented Aug 19, 2024

I think it's still in JIT mode because we don't support running plugins from AOT; we always run them from source (JIT); please forgive any misunderstandings I have here 😅 .

I did some prototyping with AOT-compiled plugins, for our plugins V2; so it's a thing we can do.

Yes, it is still JIT mode, there was some discussion regarding plugins here https://docs.google.com/document/d/1W0JmNwlWD9W8Jf1vzC-W7MSOR-l1XOquVUCaf_7gs3A/edit?resourcekey=0-3fhJDVXmmWr4gLkBcRB9Sg&disco=AAAAwkyH-sY

@mraleph
Copy link
Member

mraleph commented Aug 20, 2024

cc @bwilkerson @mit-mit this is related to our discussions regarding prioritizing efforts which would allow us to switch analyzer to AOT mode targeting next stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team
Projects
None yet
Development

No branches or pull requests

6 participants