Repository navigation
[impeller] parallelize opengles shader compiles - #194022
Conversation
13c8a98 to
34071c7
Compare
cae54e2 to
8a3b00e
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the OpenGL ES pipeline compilation queue (PipelineCompileQueueGLES) to support multi-step compilation jobs (Start and Finish) and limits the number of concurrent active compilation jobs. It also updates PipelineLibraryGLES to split pipeline creation into start and finish phases, utilizing the new compile job structure, and adds corresponding unit tests. A critical review comment points out a deadlock risk in PerformJobEagerly when called on the reactor thread for an already active job, as the reactor thread blocks waiting for the job to finish while the job itself requires the reactor thread to process its completion.
| static std::shared_ptr<PipelineCompileQueueGLES> Create( | ||
| std::shared_ptr<fml::BasicTaskRunner> worker_task_runner); | ||
| std::shared_ptr<fml::BasicTaskRunner> worker_task_runner, | ||
| size_t max_active_jobs = kDefaultMaxActiveJobs); |
There was a problem hiding this comment.
We'll get this set as a better value in a followup.
walley892
left a comment
There was a problem hiding this comment.
Mostly LGTM from a code perspective with a few nits.
Have you run any benchmarks locally to verify the performance gain here?
| if (!active_job->second.job->Start().ok()) { | ||
| RemoveActiveJob(active_job); | ||
| } |
There was a problem hiding this comment.
Do we want to bubble up or log the status in this case?
There was a problem hiding this comment.
The only time this practically happens is when jobs are canceled because of shutdown. If we start doing some error handling we should reconsider.
| if (ActiveJobMap::iterator awaited_job = FindAwaitedActiveJob(); | ||
| awaited_job != active_jobs_.end()) { | ||
| active_job = awaited_job; | ||
| } else if (active_jobs_.size() < max_active_jobs_ && | ||
| !inactive_jobs_.empty()) { | ||
| active_job = ActivateOldestInactiveJob(); | ||
| should_start = true; | ||
| } else if (!active_jobs_.empty()) { | ||
| active_job = active_jobs_.begin(); | ||
| } else { | ||
| is_processing_ = false; | ||
| return; | ||
| } |
There was a problem hiding this comment.
Can you add comments to each case explaining the situation?
-
Someone is waiting on a job that we've already started - finish it immediately
-
Room for more jobs!
-
active job queue is full - finish the oldest
-
No more jobs!
| ActiveJobMap::iterator active_job; | ||
| bool should_start = false; |
There was a problem hiding this comment.
Nit maybe: Why have these variables when we can just
FinishActiveJob(awaited_job)
StartJob(ActivateOldestInactiveJob())
FinishActiveJob(active_jobs_.begin())
I think it makes the logic easier to follow if we inline
There was a problem hiding this comment.
it's for the mutex, we want it out of scope.
| if (!job.Start().ok()) { | ||
| return; |
There was a problem hiding this comment.
Same comment about bubbling up or logging the error
|
Looks like there is a race here in cleanup. I'll revisit it. It passed previously before the comment PR so was thinking we were good. |
|
Ran |
flutter/flutter@5c7e45a...a3d71d8 2026-10-16 [email protected] 0 Initialize variables in the DlComplexityPathReceiver helper (flutter/flutter#194540) 2026-10-16 [email protected] Roll Fuchsia Test Scripts from V-qQL4158Nw6L-QLi... to 2T18KC7-LDQtmQiLP... (flutter/flutter#194527) 2026-10-16 [email protected] Remove BorderMaskBlur (flutter/flutter#194508) 2026-10-16 [email protected] Roll Skia from a577264dc087 to 470b8816a261 (1 revision) (flutter/flutter#194526) 2026-10-16 [email protected] [ios] Use DFS traversal to find engines of a scene automatically (rather than manually manage the engines list) (flutter/flutter#192457) 2026-10-16 [email protected] [Skia][DisplayList] Map local bounds through the local matrix in DlLocalMatrixImageFilter (flutter/flutter#193963) 2026-10-16 [email protected] [framework] Fix avoid_setters_without_getters warnings on mixin declarations (flutter/flutter#193856) 2026-10-16 [email protected] Roll Dart SDK from 84686ea04815 to 55a734a01fb1 (3 revisions) (flutter/flutter#194522) 2026-10-16 [email protected] Roll Skia from d131b7789482 to a577264dc087 (7 revisions) (flutter/flutter#194514) 2026-10-16 [email protected] Roll Fuchsia GN SDK from PDJz3b3CL31uoLOkD... to kFdyRnojbVy0cxvRZ... (flutter/flutter#194510) 2026-10-16 [email protected] Roll GN to f9eca75ae554 (flutter/flutter#194471) 2026-10-16 [email protected] refactor(flutter_tools): migrate RunCommand and RunCommandBase to OptionDescriptor and OptionBundle (flutter/flutter#194362) 2026-10-15 [email protected] refactor(flutter_tools): finish TestCommand OptionDescriptor and OptionBundle migration (flutter/flutter#194361) 2026-10-15 [email protected] [iOS][a11y] Fix VoiceOver announcement for unfocused password fields (flutter/flutter#192851) 2026-10-15 [email protected] Roll pub packages (flutter/flutter#194477) 2026-10-15 [email protected] refactor(flutter_tools): finish DriveCommand OptionDescriptor migration (flutter/flutter#194360) 2026-10-15 [email protected] [flutter_tools] Roll package:vm_service to 15.4.0 (flutter/flutter#194467) 2026-10-15 [email protected] refactor(flutter_tools): migrate AttachCommand to OptionDescriptor and OptionBundle (flutter/flutter#194359) 2026-10-15 [email protected] [flutter_tools] Inject dependencies into update-packages and package_map (flutter/flutter#194046) 2026-10-15 [email protected] [impeller] parallelize opengles shader compiles (flutter/flutter#194022) 2026-10-15 [email protected] Roll pub packages (flutter/flutter#194469) 2026-10-15 [email protected] Restrict web dev server to loopback by default (flutter/flutter#187595) 2026-10-15 [email protected] Roll Packages from a1ed23c to da40eaf (33 revisions) (flutter/flutter#194459) 2026-10-15 [email protected] [web] Render soft hyphens on Skwasm (flutter/flutter#193850) 2026-10-15 [email protected] refactor(flutter_tools): migrate AssembleCommand to OptionDescriptor (flutter/flutter#194358) 2026-10-15 [email protected] [windows] Add OpenGL golden test against ANGLE at D3D11 feature level 10_0 (flutter/flutter#194321) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
|
There is a regression in startup time on android in this test, @gaaclarke we should follow up and set the number of parallel workers more intelligently. |
|
Here is the gallery startup process for android demonstrating no change: https://flutter-flutter-perf.luci.app/e/?begin=1791586458&enable_chart_tooltip=true&end=1792436444&plotSummary=true&queries=sub_result%3DtimeToFirstFrameRasterizedMicros%26test%3Dflutter_gallery__start_up&use_titles=true Maybe the x factor is the shaders used. |
Only the complex_layout is the only one testing startup with opengles forced. |
> [!NOTE] > This PR depended on flutter#193985 which refactored code to make way for this change. This PR was authored in lieu of flutter#193066 and was informed by @krll-kov's great investigative work. design doc: https://github.com/flutter/rfc/blob/main/rfc/210.0001-parallel-gles-linking.md issue: flutter#191860 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant in-code documentation (doc comments with `///`). - [x] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

Note
This PR depended on #193985 which refactored code to make way for this change.
This PR was authored in lieu of #193066 and was informed by @krll-kov's great investigative work.
design doc: https://github.com/flutter/rfc/blob/main/rfc/210.0001-parallel-gles-linking.md
issue: #191860
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.