Skip to content

Conversation

@planetmarshall
Copy link
Contributor

Support passing the ARM cpu variant through to the engine build from the tools/gn front end.

Fixes #176870

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

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. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions bot added the engine flutter/engine related. See also e: labels. label Oct 13, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new command-line option, --arm-cpu-variant, to the gn tool. This allows developers to specify a CPU variant for ARM builds, which is then passed to the compiler's -mtune flag. My feedback includes a suggestion to add a validation check to ensure this option is used exclusively for ARM targets, which would improve the tool's robustness and provide clearer error messages to the user.

Comment on lines 681 to 682
if args.arm_cpu_variant:
gn_args['arm_tune'] = args.arm_cpu_variant
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The help text for --arm-cpu-variant correctly states that it's "currently only supported for ARM". To improve robustness and provide clearer feedback to users, it would be beneficial to enforce this constraint within the script. This would prevent passing the arm_tune argument to non-ARM builds, which could either be ignored or cause confusing build errors.

I suggest adding a check for the target CPU architecture before setting the arm_tune argument.

Suggested change
if args.arm_cpu_variant:
gn_args['arm_tune'] = args.arm_cpu_variant
if args.arm_cpu_variant:
if 'arm' not in gn_args.get('target_cpu', ''):
raise Exception('--arm-cpu-variant is only supported for ARM targets.')
gn_args['arm_tune'] = args.arm_cpu_variant

parser.add_argument('--simulator-cpu', type=str, choices=['x64', 'arm64'], default='x64')
parser.add_argument('--arm-float-abi', type=str, choices=['hard', 'soft', 'softfp'])
parser.add_argument(
'--arm-cpu-variant',
Copy link
Member

Choose a reason for hiding this comment

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

Can this just be --arm-tune?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I used cpu-variant as it's more obvious to me what that means but since it's just being passed through to arm_tune, that makes sense.

@chinmaygarde
Copy link
Member

The linter errors are real. Can you address them so we can push this along?

@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Nov 10, 2025

autosubmit label was removed for flutter/flutter/176917, because - The status or check suite Linux_android_emu android_engine_opengles_tests has failed. Please fix the issues identified (or deflake) before re-applying this label.

@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Nov 10, 2025

autosubmit label was removed for flutter/flutter/176917, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 10, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Nov 10, 2025
Merged via the queue into flutter:master with commit aa9dc9a Nov 11, 2025
187 of 188 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 11, 2025
IvoneDjaja pushed a commit to IvoneDjaja/flutter that referenced this pull request Nov 22, 2025
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

Support passing the ARM cpu variant through to the engine build from the
`tools/gn` front end.

Fixes flutter#176870 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [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 documentation (doc comments with `///`).
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

Support passing the ARM cpu variant through to the engine build from the
`tools/gn` front end.

Fixes flutter#176870 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [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 documentation (doc comments with `///`).
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

Support passing the ARM cpu variant through to the engine build from the
`tools/gn` front end.

Fixes flutter#176870 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [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 documentation (doc comments with `///`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request (build): add option to tune for specific CPU

3 participants