Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@rmacnak-google
Copy link
Contributor

@rmacnak-google rmacnak-google commented Nov 18, 2021

This limits the number of threads that can be contending for cores.

Bug: dart-lang/sdk#44228

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@chinmaygarde
Copy link
Member

The approach looks good to me. cc @iskakaushik

@iskakaushik
Copy link
Contributor

I had a PR that essentially does the same and was waiting for the dart roll to get done :)

@rmacnak-google rmacnak-google force-pushed the provide-dart-task-runner branch from 7620b7c to 7dcfb30 Compare November 22, 2021 18:02
@rmacnak-google rmacnak-google changed the title WIP: Run Dart VM tasks on the engine's ConcurrentMessageLoop instead the V… Run Dart VM tasks on the engine's ConcurrentMessageLoop instead the VM's separate thread pool. Nov 22, 2021
Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

LGTM but a test for this would be nice. Here is how to test this:

  1. In one of the unit-test harnesses (say a variant of DartIsolateTest::RootIsolateCreationAndShutdown in dart_isolate_unittests.cc), launch a VM.
  2. From the vm_ref, get a reference to the concurrent message loop via DartVM::GetConcurrentMessageLoop.
  3. Post a task to all worker threads via fml::ConcurrentMessageLoop::PostTaskToAllWorkers. In the task, set a thread local variable using the portable container in fml/thread_local.h.
  4. Create a new Dart fixture and from its entrypoint, launch a new isolate.
  5. In the new isolate, define a native entrypoint.
  6. Once back in native code, seek the thread local you just set set in the earlier steps.
  7. Add a test assertion that checks that we are running on one of the concurrent pools workers.

I suppose a native entrypoint directly from the root isolate would be fine as the UI thread is not part of the concurrent workers. But the above steps just prove that the engine now hosts background isolates.

Thanks!

@chinmaygarde
Copy link
Member

Oh, I forgot to mention, to ensure your TLS slots on the workers are filled, you will need an fml::CountDownLatch initialized to ConcurrentMessageLoop::GetWorkerCount awaited upon before you launch the Dart fixture.

@rmacnak-google rmacnak-google force-pushed the provide-dart-task-runner branch 2 times, most recently from 1e50986 to 8566967 Compare November 23, 2021 00:35
Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

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

LGTM

@rmacnak-google rmacnak-google force-pushed the provide-dart-task-runner branch from 8566967 to af8ff78 Compare November 29, 2021 21:17
@rmacnak-google rmacnak-google force-pushed the provide-dart-task-runner branch from af8ff78 to 0abd87e Compare December 1, 2021 19:07
@rmacnak-google rmacnak-google merged commit 69be405 into flutter:main Dec 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2021
rmacnak-google added a commit that referenced this pull request Dec 1, 2021
…ad the VM's separate thread pool. (#29819)"

This reverts commit 69be405.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 1, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 2, 2021
zanderso pushed a commit to flutter/flutter that referenced this pull request Dec 2, 2021
* 9b200e1 Roll Dart SDK from 9f61c2487bbd to 3a963ff14181 (7 revisions) (flutter/engine#30011)

* fada035 Use WindowInfoTracker.Companion.getOrCreate instead of the short version (flutter/engine#30012)

* d280475 Non painting platform views (flutter/engine#30003)

* b420c16 [macOS] MacOS Keyboard properly handles multi-char characters (flutter/engine#30005)

* 0a6098b [Win32, keyboard] Fix dead key events that don't have the dead key mask (flutter/engine#30004)

* 8ac9366 Fix sceneElement analysis error (flutter/engine#30038)

* 5ad06c2 Share the io_manager between parent and spawn engine (flutter/engine#29915)

* 69be405 Run Dart VM tasks on the engine's ConcurrentMessageLoop instead the VM's separate thread pool. (flutter/engine#29819)

* c85a129 Roll Dart SDK from 3a963ff14181 to 8bb2e56ec900 (4 revisions) (flutter/engine#30045)

* abf6c34 Eliminate hardcoded scale factor in a11y scroll (flutter/engine#30013)

* d184d9b Roll Skia from fa183572bfd3 to d3399178196e (17 revisions) (flutter/engine#30047)

* 476ed30 Roll web_installers simulators package (flutter/engine#30035)

* 62113c4 Revert dart to 9f61c2487bbd (flutter/engine#30056)
rmacnak-google added a commit to rmacnak-google/engine that referenced this pull request Dec 14, 2021
…ad the VM's separate thread pool. (flutter#29819)"

This reverts commit 69be405.
fluttergithubbot pushed a commit that referenced this pull request Dec 15, 2021
@rmacnak-google rmacnak-google deleted the provide-dart-task-runner branch August 16, 2022 21:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants