Repository navigation
Revert: [Android] Let the raster thread use every core of a chip without little cores - #195838
Conversation
…out little cores (flutter#195071)" This reverts commit e65eafa.
There was a problem hiding this comment.
Code Review
This pull request refactors CPU affinity tracking by removing the concept of "little cores" and its capacity-based detection, replacing it with an efficiency-core-based classification. It removes cpu_capacity parsing, the HasNoLittleCores helper, and the kNotLittle affinity option, introducing kNotEfficiency instead. Unit tests and Android platform implementations are updated to reflect these changes. The review feedback suggests simplifying the documentation for kPerformance to avoid misleading statements regarding thread usage.
| /// @brief Request CPU affinity for the performance cores. | ||
| /// | ||
| /// Generally speaking, only the UI and Raster thread should | ||
| /// use this option. | ||
| kPerformance, |
There was a problem hiding this comment.
The comment for kPerformance states that only the UI and Raster threads should use this option. However, in android_shell_holder.cc, both the UI thread (kDisplay) and the Raster thread (kRaster) are configured to use kNotEfficiency (previously kNotLittle). This makes the comment misleading. We should simplify the comment to avoid confusion.
| /// @brief Request CPU affinity for the performance cores. | |
| /// | |
| /// Generally speaking, only the UI and Raster thread should | |
| /// use this option. | |
| kPerformance, | |
| /// @brief Request CPU affinity for the performance cores.\n kPerformance, |
…out little cores (flutter#195838) Reverts: [[Android] Let the raster thread use every core of a chip without little cores](flutter#195071) Initiated by: @gaaclarke Reason for reverting: 1) we address the problem where the energy measurement shows the tradeoff Original PR Author: @Lopution Reviewed By: @gaaclarke The original PR description is provided below: `CPUSpeedTracker` counts the CPUs with the lowest `cpuinfo_max_freq` as efficiency cores, and the raster thread is set to the other cores (`kNotEfficiency`, renamed `kNotLittle` in this PR). On a chip without little cores, those are full-size cores. On the Snapdragon 8 Elite and 8 Elite Gen 5 (two prime and six performance Oryon cores) the raster thread only gets the two prime cores. They are mostly idle, so raster frames start at the cluster's lowest frequency. See flutter#195070 for measurements. This change also reads `/sys/devices/system/cpu/cpuN/cpu_capacity`, the kernel's rating of each CPU, scaled so that the fastest is 1024. When every CPU has a capacity and none is below half of the fastest, the chip has no little cores, and `kNotLittle` is every core. - Why half: little cores rate well below it. Upstream SM8650 device trees put the Cortex-A520 at about 37% of the X4 at their top frequencies. The SM8850's performance cores are at 762 of 1024. - Equal capacities, or a CPU without one, change nothing. A kernel without capacity data reports 1024 for every CPU. - Other affinities do not change. `kEfficiency` is still the slowest group, so background threads stay off the prime cores. - `kNotEfficiency` is renamed `kNotLittle`, since on these chips it includes the efficiency cores. Each `CpuAffinity` value's doc says which cores it covers, and that performance and efficiency there are speed groups, not the industry's core types. - Chips with little cores (Snapdragon 8 Gen 1–3, Tensor, Exynos 2400) should keep the current set. I have only read the capacities of the SM8850. - Other chips without little cores also get every core. Examples: Dimensity 9300/9400 (the slowest group is four Cortex-A720), Snapdragon 8s Gen 4, and Snapdragon 8 Elite Gen 6. On the 8 Elite Gen 6 the six performance cores report two top frequencies (4.03 and 3.74 GHz), so today three of them count as efficiency cores. I have not measured these chips. - On the Dimensity 9600 Pro (2 × C2-Ultra at 4.55 GHz, 3 × C2-Pro at 4.35 GHz, 3 × C2-Pro at 3.1 GHz), the 3.1 GHz cores should rate near half, so it may go either way. Either way the raster thread keeps at least the five cores it gets today. This keeps the current design and only widens it where the capacities are clear. A chip whose performance cores rate below half of its prime cores would still leave the raster thread on the prime cores. The more general fix would be to stop pinning the raster thread, as Android does not pin a native app's RenderThread. That needs measurements on the devices that flutter-team-archive/engine#45673 and flutter#153690 were about, so this change leaves it out. Tests: three new `CpuAffinity` tests in `fml_unittests`. `NoLittleCores` fails without this change. I ran the `CpuAffinity` tests against the changed files in a standalone build with clang++ and g++, not in a full engine build. On an SM8850 phone, setting the raster threads to every core from the app (the same result as this change) gave the numbers in flutter#195070. I have not tested a custom engine build on the device. Fixes flutter#195070 ## 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. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- 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/CONTRIBUTING.ai.md [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
Roll Flutter from fcfb4f203eae to 934720261be0 (38 revisions) flutter/flutter@fcfb4f2...9347202 2026-11-03 [email protected] Roll Skia from 5bceaa033999 to c733ad3e37cb (5 revisions) (flutter/flutter#195872) 2026-11-03 [email protected] Roll Skia from 34d2bf479385 to 5bceaa033999 (9 revisions) (flutter/flutter#195864) 2026-11-03 [email protected] fix: prefer pointer events over semantics tap for mouse clicks on web (flutter/flutter#191529) 2026-11-03 [email protected] [VPAT] Expose a semantics text field value while it is not being edited (flutter/flutter#195445) 2026-11-03 [email protected] [Impeller] Make a GL context current before constructing an AiksContext without a surface (flutter/flutter#195629) 2026-11-03 [email protected] [flutter_tools] Eliminate globals.dart from project.dart (flutter/flutter#194066) 2026-11-03 [email protected] [tool] Complete context runner elimination and migrate AppContext usages to ToolContext (flutter/flutter#190797) 2026-11-03 [email protected] [web] Unify font collections between CanvasKit and Skwasm (flutter/flutter#195539) 2026-11-03 [email protected] [Android] Replay predictive back state for retained engines (flutter/flutter#192286) 2026-11-03 [email protected] [vulkan]: Adds depth/stencil synchronization for subpasses (flutter/flutter#195689) 2026-11-03 [email protected] [web] Honor requested upscaling in instantiateImageCodecWithSize and ImageDescriptor.instantiateCodec (flutter/flutter#195836) 2026-11-03 [email protected] Roll Skia from 866b61ca92c9 to 34d2bf479385 (9 revisions) (flutter/flutter#195848) 2026-11-03 [email protected] Roll Fuchsia Test Scripts from xl1LWBuppzu-BnOzV... to B6zarykZp6PKWRueg... (flutter/flutter#195847) 2026-11-03 [email protected] Remove unused ffi (flutter/flutter#195710) 2026-11-02 [email protected] Revert: [Android] Let the raster thread use every core of a chip without little cores (flutter/flutter#195838) 2026-11-02 [email protected] Run 10 impeller iOS benchmarks as one devicelab task (flutter/flutter#195661) 2026-11-02 [email protected] Use named uniforms instead of setFloat in StretchEffect (flutter/flutter#195372) 2026-11-02 [email protected] [flutter_tools] Report when the browser disconnects during a web test run (flutter/flutter#192198) 2026-11-02 [email protected] fix: Resolve memory leak in image_list example (flutter/flutter#189526) 2026-11-02 [email protected] Only run the common local engine configurations in presubmit (flutter/flutter#195688) 2026-11-02 [email protected] Update gcloud_version to version [email protected] (flutter/flutter#195769) 2026-11-02 [email protected] [Impeller] Order the Vulkan copy-texture-to-texture layout transition after the copy (flutter/flutter#195814) 2026-11-02 [email protected] [Impeller] Order the Vulkan ResizeTexture layout transition after its blit (flutter/flutter#195721) 2026-11-02 [email protected] [web] Fix CanvasKit fragment shader uniforms being freed or mutated after recording (flutter/flutter#195718) 2026-11-02 [email protected] Roll Fuchsia Linux SDK from MqypI6RNyVZ_FLUE-... to T_-6-6X1lDMghhAvX... (flutter/flutter#195809) 2026-11-02 [email protected] [Android] Log why Impeller falls back to OpenGLES (flutter/flutter#194764) 2026-11-02 [email protected] Roll Skia from 3f35fb6e591b to 866b61ca92c9 (11 revisions) (flutter/flutter#195802) 2026-11-02 [email protected] Roll Skia from 3f35fb6e591b to 866b61ca92c9 (11 revisions) (flutter/flutter#195802) 2026-11-02 [email protected] Only run the common local engine configurations in presubmit (flutter/flutter#195688) 2026-11-02 [email protected] Balance tool_integration_tests subshards by expected duration (flutter/flutter#195628) 2026-11-02 [email protected] [web_paragraph] Map code units without a cluster to a cluster (flutter/flutter#195384) 2026-11-02 [email protected] [web] Hide synthetic autofill inputs from assistive technology (flutter/flutter#195618) 2026-11-02 [email protected] Roll Packages from 3742a4e to 3f34a6f (8 revisions) (flutter/flutter#195795) 2026-11-02 [email protected] [web] Unskip web tests that pass on CanvasKit and Skwasm: platform_view_test, route_notification_messages_test (flutter/flutter#195605) 2026-11-02 [email protected] Roll Skia from e5ad3868b8db to 3f35fb6e591b (1 revision) (flutter/flutter#195789) 2026-11-02 [email protected] Roll Skia from f5215e74aa16 to e5ad3868b8db (3 revisions) (flutter/flutter#195779) 2026-11-02 [email protected] Roll Skia from e43478a2f9f8 to f5215e74aa16 (1 revision) (flutter/flutter#195776) 2026-11-01 [email protected] Roll Fuchsia Linux SDK from kW0A0xxNkqf38ljm4... to MqypI6RNyVZ_FLUE-... (flutter/flutter#195768) 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 ...
Reverts: [Android] Let the raster thread use every core of a chip without little cores
Initiated by: @gaaclarke
Reason for reverting: 1) we address the problem where the energy measurement shows the tradeoff
Original PR Author: @Lopution
Reviewed By: @gaaclarke
The original PR description is provided below:
CPUSpeedTrackercounts the CPUs with the lowestcpuinfo_max_freqas efficiency cores, and the raster thread is set to the other cores (kNotEfficiency, renamedkNotLittlein this PR). On a chip without little cores, those are full-size cores. On the Snapdragon 8 Elite and 8 Elite Gen 5 (two prime and six performance Oryon cores) the raster thread only gets the two prime cores. They are mostly idle, so raster frames start at the cluster's lowest frequency. See #195070 for measurements.This change also reads
/sys/devices/system/cpu/cpuN/cpu_capacity, the kernel's rating of each CPU, scaled so that the fastest is 1024. When every CPU has a capacity and none is below half of the fastest, the chip has no little cores, andkNotLittleis every core.kEfficiencyis still the slowest group, so background threads stay off the prime cores.kNotEfficiencyis renamedkNotLittle, since on these chips it includes the efficiency cores. EachCpuAffinityvalue's doc says which cores it covers, and that performance and efficiency there are speed groups, not the industry's core types.This keeps the current design and only widens it where the capacities are clear. A chip whose performance cores rate below half of its prime cores would still leave the raster thread on the prime cores. The more general fix would be to stop pinning the raster thread, as Android does not pin a native app's RenderThread. That needs measurements on the devices that flutter-team-archive/engine#45673 and #153690 were about, so this change leaves it out.
Tests: three new
CpuAffinitytests infml_unittests.NoLittleCoresfails without this change. I ran theCpuAffinitytests against the changed files in a standalone build with clang++ and g++, not in a full engine build. On an SM8850 phone, setting the raster threads to every core from the app (the same result as this change) gave the numbers in #195070. I have not tested a custom engine build on the device.Fixes #195070
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.