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

Made clang tidy use arm64 if on an arm64 mac. #47494

Merged
merged 9 commits into from
Oct 31, 2023

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Oct 30, 2023

fixes flutter/flutter#137260

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 and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke gaaclarke marked this pull request as ready for review October 30, 2023 23:38
Copy link
Contributor

@matanlurey matanlurey left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, though it's unfortunate this is yet another divergence between the tool and the CI script to run the tool (sure, you could pass the path manually, but exactly nobody will remember to do that).

If we could have the tool find the right binary, instead of relying on the CI script, I would prefer that, but this seems stricly better than the status quo.

@gaaclarke
Copy link
Member Author

Yea, fair point. Plus the less code in bash the better. I think people just run the bash script for the most point locally. I don't think there is a reason to use the tool directly.

I'm interested to see what this does to our cpu usage numbers. Maybe we can bring everything back to presubmit.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 30, 2023

auto label is removed for flutter/engine/47494, due to - The status or check suite Mac mac_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

  • The status or check suite Linux linux_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

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

I think an easier solution might be to put --force-mac-arm64 on the right gn commands in the build config .json files.

ETA: It's already there: https://github.com/flutter/engine/blob/main/ci/builders/mac_clang_tidy.json#L17, so at least on CI, this CL will be a no-op.

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
@gaaclarke
Copy link
Member Author

I think an easier solution might be to put --force-mac-arm64 on the right gn commands in the build config .json files.

ETA: It's already there: https://github.com/flutter/engine/blob/main/ci/builders/mac_clang_tidy.json#L17, so at least on CI, this CL will be a no-op.

Ahh yea, a no-op on ci. I commented in that other issue, we should get rid of --force-mac-arm64. This PR will only make the execution faster locally. Being able to override the clang-tidy executable is a sound design outside of this problem since deriving the clang-tidy location from build_commands.json is built on assumptions of the build environment.

So, considering this speeds up local execution, won't break when the ill-conceived force-mac-arm64 is deleted and has value beyond the problem it addresses, I recommend still landing it.

ci/clang_tidy.sh Outdated
CLANG_TIDY_PATH="buildtools/mac-arm64/clang/bin/clang-tidy"
fi

COMPILE_COMMANDS="$SRC_DIR/out/$BUILD_DIR/compile_commands.json"
Copy link
Member

Choose a reason for hiding this comment

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

How is $BUILD_DIR defined?

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't. This effectively makes gn get called every time which isn't an error. In fact it might be desired. It's quick to execute (1704ms) and means you'll get coverage from newly added files. I'm going to delete the check.

Copy link
Member

Choose a reason for hiding this comment

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

gn run time can vary a lot. Some runs on my M1 take >10s. Here's a run on CI taking >4s: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20Production%20Engine%20Drone/194351/overview.

Sorry to nitpick, but would it be okay to just fix the arm vs. intel issue in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea, no problem. I brought back the check. What is it doing in all that 10s? In CI we should have just run gn... Oh I guess it won't match though because of the --force-mac-arm64. How I loathe that flag.

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually for a moment considered making that check smarter. It should be doing a timestamp check against the repository. That will take a fair bit of work though so I left it for a future exercise. The indiscriminate gn doesn't have that bug.

Copy link
Member

Choose a reason for hiding this comment

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

The clang_tidy script depends on engine_repo_tools, which already has a way of finding the most recently generated out/ directory: https://github.com/flutter/engine/blob/main/tools/pkg/engine_repo_tools/lib/engine_repo_tools.dart#L159, so that could be a good way to avoid adding similar logic in the shell script.

@gaaclarke gaaclarke merged commit 34dfd26 into flutter:main Oct 31, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 1, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Nov 1, 2023
…137651)

flutter/engine@406b7d7...db06c2e

2023-10-31 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from rg_Ici1tgAVF93cn9... to x2NzYMNhyodIwDl0I... (flutter/engine#47528)
2023-10-31 30870216+gaaclarke@users.noreply.github.com [Impeller] updated ios benchmark link (flutter/engine#47515)
2023-10-31 30870216+gaaclarke@users.noreply.github.com Made clang tidy use arm64 if on an arm64 mac. (flutter/engine#47494)
2023-10-31 bdero@google.com [Impeller] Allow 3D scenes to render when MSAA is not supported. (flutter/engine#47217)
2023-10-31 matanlurey@users.noreply.github.com Surgically remove `.*dither.*` from the Engine (flutter/engine#46750)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from rg_Ici1tgAVF to x2NzYMNhyodI

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clang-tidy is running intel executable on arm64 mac
3 participants