ANDROID: Move AutoFDO profile to gki/aarch64/afdo

Relocate AutoFDO profiles from toolchain/pgo-profiles/kernel
to common/gki/aarch64/afdo for better organization within
each release branch.

Also update the AutoFDO profile for kernel version 6.12.18.

Bug: 404538865
Test: build
Change-Id: Idf167e5393339fe3ce79a946ec381725b093c3b9
Signed-off-by: Yabin Cui <yabinc@google.com>
This commit is contained in:
Yabin Cui
2025-04-11 11:08:28 -07:00
committed by Matthias Männich
parent 014430f3dc
commit 7336415016
4 changed files with 55 additions and 3 deletions
+1 -2
View File
@@ -4,7 +4,6 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@kernel_toolchain_info//:dict.bzl", "BRANCH")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_pkg//pkg:install.bzl", "pkg_install")
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
@@ -328,7 +327,7 @@ common_kernel(
additional_kmi_symbol_lists = [":aarch64_additional_kmi_symbol_lists"],
arch = "arm64",
build_gki_artifacts = True,
clang_autofdo_profile = "//toolchain/pgo-profiles/kernel:aarch64/" + BRANCH + "/kernel.afdo",
clang_autofdo_profile = ":gki/aarch64/afdo/kernel.afdo",
ddk_headers_archive = ":kernel_aarch64_ddk_headers_archive",
ddk_module_headers = [":all_headers_aarch64"],
defconfig = "arch/arm64/configs/gki_defconfig",
+3 -1
View File
@@ -13,7 +13,8 @@ gki
| | +-- ...
| |-- protected_exports
| |-- abi.stg
| +-- abi.stg.allowed_breaks
| |-- abi.stg.allowed_breaks
| +-- afdo
+-- ...
```
@@ -35,3 +36,4 @@ architecture. Within each such subdirectory:
* e.g. `tools/bazel run //common:kernel_aarch64_abi_update`
* `abi.stg.allowed_breaks` - a list of allowed ABI differences
* for use by Gerrit ABI monitoring
* `afdo` - [AutoFDO profile for building kernel for the architecture](aarch64/afdo/README.md)
+51
View File
@@ -0,0 +1,51 @@
# AutoFDO profiles for Android common kernels
This directory contains AutoFDO profiles for Android common kernels. These profiles can be used to
optimize kernel builds for specific architectures and kernel versions.
## kernel.afdo
kernel.afdo is an AArch64 kernel profile collected on kernel version 6.12.18 (
SHA fbd1fef4d7283d210845f8609599efd53c0905a4, build server ID 13287522) using Pixel 6.
### Performance improvements
| Benchmark | Improvement |
| --------------------- | ----------- |
| Boot time | 2.6% |
| Cold App launch time | 3.7% |
| Binder-rpc | 9.4% |
| Binder-addints | 31.9% |
| Hwbinder | 16.5% |
| Bionic (syscall_mmap) | 7.1% |
| Bionic (pthread) | 3.3% |
| Bionic (stdio) | 3.7% |
| Bionic (all) | 3.4% |
Benchmark results were tested on Pixel 6.
To test a kernel prebuilt with the AutoFDO profile, navigate to [Android build server](
https://ci.android.com/builds/branches/aosp_kernel-common-android16-6.12/grid) and download
the kernel prebuilts under the `kernel_aarch64_autofdo` target.
## Steps to reproduce the profile
A kernel profile is generated by running app crawling and app launching for top 100 apps from Google
Play Store. While running, we collect ETM data for the kernel, which records executed instruction
stream. Finally, we merge and convert ETM data to one AutoFDO profile.
1. Build a kernel image and flash it on an Android device
* The source code and test device used to generate each profile are described above.
* We use a Pixel device. But using other real devices should get a similar profile.
2. Run app crawling and app launching for top 100 apps
* Add a gmail account on the test device. Because app crawler can use the account to automatically
login some of the apps.
* We run [App Crawler](https://developer.android.com/studio/test/other-testing-tools/app-crawler)
for one app for 3 minutes, and run it twice.
* We run app launching for one app for 3 seconds, and run it 15 times. After each running, the
app is killed and cache is cleared. So we get profile for cold app startups.
3. Record ETM data while running app crawling and app launching.
* We use cmdline `simpleperf record -e cs-etm:k -a` to [record ETM data for the kernel](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/collect_etm_data_for_autofdo.md).
Binary file not shown.