-
Notifications
You must be signed in to change notification settings - Fork 29.7k
support passing the arm cpu variant to the build system #176917
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
support passing the arm cpu variant to the build system #176917
Conversation
|
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. |
There was a problem hiding this 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.
engine/src/flutter/tools/gn
Outdated
| if args.arm_cpu_variant: | ||
| gn_args['arm_tune'] = args.arm_cpu_variant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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 |
engine/src/flutter/tools/gn
Outdated
| 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', |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
The linter errors are real. Can you address them so we can push this along? |
3dd7ccb to
2a43f82
Compare
|
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. |
|
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. |
<!-- 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 `///`).
<!-- 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 `///`).
<!-- 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 `///`).
Support passing the ARM cpu variant through to the engine build from the
tools/gnfront end.Fixes #176870
Pre-launch Checklist
///).