aboutsummaryrefslogtreecommitdiffstats
path: root/cc/pgo.go
Commit message (Collapse)AuthorAgeFilesLines
* Add platform-wide sampling PGO optionYi Kong2020-04-031-14/+19
| | | | | | | | | | | | | This causes the compiler to emit some additional debug infomation that will be used for sampling PGO. These debug infomation will get stripped so it only affects intermediate files. Test: build Bug: 79161490 Bug: 153039105 Change-Id: Ie4d1d5ffbd311ba6e268cb94a618f5272be246ef Merged-In: Ie4d1d5ffbd311ba6e268cb94a618f5272be246ef (cherry picked from commit ceb5b76c91817c90818f0f6700124debc83821de)
* Disable PGO profile use in Clang-based coverage buildsPirama Arumuga Nainar2020-02-121-0/+6
| | | | | | | | | | Bug: http://b/143977934 Clang errors that -fprofile-use and -fprofile-instr-generate are incompatible. Test: m CLANG_COVERAGE=true COVERAGE_PATHS="*" on cf_x86_phone target Change-Id: I584b615639fcef86668b7fa34b7511b4820d9548
* Add -fprofile-sample-accurate flag for sampling PGOYi Kong2020-01-311-1/+1
| | | | | | | | | | | This flag indicates that the sample profile data matches the source and can be fully trusted. The compiler will make aggressive assumption that functions without any samples are cold functions, and will optimize for size for them. Test: binary size reduces to match instr PGO Bug: 79161490 Change-Id: I53d6d05be70c39e5eb28b2f5b0549d9eb6b5cc62
* Add -fdebug-info-for-profiling flag to emit more debug info for sampling pgoYi Kong2020-01-301-1/+1
| | | | | | Test: m Bug: 79161490 Change-Id: I25cfbf78b27d653286dc7f956743f8855b852b35
* Add "-no-warn-sample-unuse=true" to work around AutoFDO issueYi Kong2020-01-161-0/+4
| | | | | | | | | | | | Autofdo generates profile for an instruction even if there is no debug information associated with it or no debug information associated with the function. A bogus offset will be produced in the profile. Add the flag to suppress Clang from generating error for such cases. Test: build with ETM profile Bug: 147844018 Bug: 79161490 Change-Id: I37da1ba3a4962072ccdf01f79fbf2c2b4c77b56b
* Support sampling PGO profilesYi Kong2020-01-021-5/+0
| | | | | | Bug: 79161490 Test: build and flash with ETM generated sampling profile Change-Id: I82bf61ebfc9f1a1c74a370f0421c46862dd470db
* Split local and global cflagsColin Cross2019-11-071-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Native compiler flags are currently applied in approximately: global cflags local cflags local include dirs global include dirs global conlyflags local conlyflags global cppflags local cppflags This means that a flag that is enabled in the global cppflags cannot be disabled in the local cflags, and an Android.bp author must know to disable it in the local cppflags. A better order would be: global cflags global conlyflags global cppflags local cflags local conlyflags local cppflags local include dirs global include dirs We are mixing both the global and local cflags into a single variable, and similar for conlyflags and cppflags, which prevents reordering them. This CL prepares to reorder them by splitting the global and local cflags into separate variables. Bug: 143713277 Test: m native Change-Id: Ic55a8c3516c331dc5f2af9d00e59ceca9d3e6c15
* Remove redundant -fexperimental-new-pass-managerPirama Arumuga Nainar2019-06-141-2/+1
| | | | | | | This is now turned on by default (cc/config/clang.go). Test: N/A Change-Id: I61bcf2049448b4200ca303ebcad555cc24a43c18
* Turn on new pass manager for PGO projectsYi Kong2019-03-211-2/+5
| | | | | | | | | | | With new pass manager, dex2oat benchmark showed 1.61% performance improvement though binary size saw an increase of 3.37%. For Googlers, detailed benchmark results are in go/android-pgo-npm. Test: m checkbuild Bug: 118894695 Change-Id: I1687886acac7f61e67265a9c73997fb241ad31e6
* Prepare for a type-safe OnceKeyColin Cross2019-02-061-2/+3
| | | | | | | | | Add an opaque OnceKey type and use it for all calls to Once in build/soong. A future patch will convert the arguments to Once* to OnceKey once users outside build/soong have been updated. Test: onceper_test.go Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
* Take Enable_profile_use into account when checking if PGO is enabledYi Kong2018-05-071-8/+6
| | | | | Test: m Change-Id: I3c589043af145450d0d97ef354a74845e9fae483
* Use a versioned profile file if availablePirama Arumuga Nainar2018-03-091-1/+24
| | | | | | | | | | | | | | Bug: http://b/74395273 Update profile-search logic to look for profile files named <profile_file>.<arbitrary-version> in the profileProject and use that if available. This works around an issue where ccache serves stale cache entries when the profile file has changed. Test: touch toolchain/pgo-profiles/art/dex2oat.profdata.foo and check it gets used. Change-Id: I3de095c263b952cede25af7d0b63dc7280914d76
* Remove unused intermediates parameter from ExistentPathForSourceColin Cross2018-02-221-1/+1
| | | | | Test: m checkbuild Change-Id: Id2c0a5039c2ec3b3795385c135ffec022ccd691e
* Disable inlining and loop unrolling in LTO without PGO profileYi Kong2018-02-141-2/+9
| | | | | | | | | | | | Such optimisations may significantly increase the binary size when compiler heuristics are off. Disabling these helps cut down the binary sizes with negligible decrease in performance, but allows us to be more comfortable enabling LTO across various projects. Test: m Test: dex2oat, hwui, skia benchmark Bug: 62839002 Change-Id: Id63e8dd295df2972f76ae4e29ee367080fff8429
* Search for PGO profiles in PGO_ADDITIONAL_PROFILE_DIRSPirama Arumuga Nainar2018-02-131-3/+10
| | | | | | | | | | | | | This variable can be set in BoardConfig.mk to specify a list of additional paths that contain PGO profiles. These directories are searched after the predefined paths in soong/cc/pgo.go while finding PGO profiles. Test: Set this variable in a BoardConfig and verify that such profiles are found and that these paths are searched after the predefined paths in soong/cc/pgo.go. Change-Id: I0bb9523de614d0f23aba8d51c887d8fc8f41c993
* Store missing profile files into a Make variablePirama Arumuga Nainar2018-01-291-0/+8
| | | | | | | | | | | | Bug: http://b/72642679 Store missing profile files and the modules that refer to them in the SOONG_MODULES_MISSING_PGO_PROFILE_FILE variable passed to Make. The contents of this variable will be written to $DIST_DIR/pgo_profile_file_missing.txt as part of the 'dist' target. Test: 'm dist' and verify creation of pgo_profile_file_missing.txt. Change-Id: I237cd0398be418be2b7db6fa65ece5ef347ecbc1
* Support instrumenting all PGO-enabled modulesPirama Arumuga Nainar2018-01-221-5/+9
| | | | | | | | | | Bug: http://b/63768402 If ANDROID_PGO_INSTRUMENT has "all" or "ALL", all PGO-enabled modules are built for profile generation. Test: Build with and without 'all' in ANDROID_PGO_INSTRUMENT Change-Id: I3b1a9b562775e80a4ab3965100341d9e8e4ffde9
* Update profile_file discovery rulesPirama Arumuga Nainar2018-01-181-13/+28
| | | | | | | | | | | | | | | | | Bug: http://b/63768402 Profile files are searched in multiple directories in a pre-define list, instead of just one. PGO profile_file enforcement is also removed - profile_file dependency and -fprofile-use are added iff the profile_file is present. Test: Build https://android-review.googlesource.com/c/474805 with .profdata files in vendor/google_data/pgo-profiles and toolchain/pgo-profiles and verify expected behavior. Change-Id: I2604713a8a7a682bd5c6bde569dc32335be5eca9 Merged-In: I2604713a8a7a682bd5c6bde569dc32335be5eca9
* Add cflags sub-property to 'pgo'Pirama Arumuga Nainar2017-12-131-0/+5
| | | | | | | | | This (possibly arch-specific) property adds extra flags while building for profiling. For example, dex2oat requires setting '-Wno-frame-larger-than' when instrumentation is enabled. Test: Build 'pgo' module with the new property and inspect build.ninja Change-Id: Ia36422a400b0e0b87cbb33b1c8e565569475a56d
* Replace ModuleContext.AConfig() with Config()Colin Cross2017-11-301-2/+2
| | | | | | | | | AConfig() now duplicates Config(). Replace the uses of AConfig() with Config(). Leave AConfig() for now until code in other projects is cleaned up. Test: m checkbuild Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
* Add enable_profile_use propertyPirama Arumuga Nainar2017-10-161-4/+10
| | | | | | | | | | | | | | Bug: http://b/65598278 This property defaults to 'true' and setting it to false skips profile use. This escape hatch lets us disable PGO for a module without completely removing the 'pgo' property. Additionally, this also helps selectively disabling PGO for some architectures, if desired. Test: Test that -fprofile-use is not added for a test module if 'enable_profile_use: false' is set. Change-Id: Ifcf1a48c194bc86efd88a529cc2d66a47b7ab080
* Do not use profiles if ANDROID_PGO_NO_PROFILE_USE is setPirama Arumuga Nainar2017-10-101-13/+20
| | | | | | | | | | Bug: http://b/65598278 Non-PGO builds (with this environment variable set) can be used to measure the performance difference induced by PGO. Test: Build PGO modules with ANDROID_PGO_PROFILE_USE set. Change-Id: Ib23bad5208ac7f54894c7768d7532f53b6b91179
* Refactor methods to be on PgoProperties structPirama Arumuga Nainar2017-10-101-10/+10
| | | | | | | | These methods only need the 'PgoProperties' struct. Avoid the extra indirection by directly using this struct. Test: Build modules with PGO property. Change-Id: I1923ebde4b0d546810de8e696514d218b3a4f54b
* Check if "instrumentation" and "sampling" are set togetherPirama Arumuga Nainar2017-10-051-3/+4
| | | | | | | | Setting these simultaneously is an error. Test: Check error generation in a test module Change-Id: I2ee127fa1b7157fa5f4489d2541ff023c64f9ba5
* Explicitly link the profile runtime during PGOPirama Arumuga Nainar2017-10-041-14/+33
| | | | | | | | | | | | | | | | | | Bug: http://b/65598278 The profile runtime depends on libgcc for some symbols (only under some circumstances - armv5, ndk r14, static executables). Since Android build passes -nostdlib and adds libgcc manually, the profile runtime gets passed to the linker later than libgcc. Instead, explicitly add the profile runtime to the linker command (and pass one other flag added by the clang driver to the link). Test: Build a library with profile instrumentation that otherwise fails instrumented build. Change-Id: I24b34cebd2c3bb6a540f8f4c465ace1be4eb90f3 Signed-off-by: Pirama Arumuga Nainar <pirama@google.com>
* Pass -Wno-backend-plugin when using profilesPirama Arumuga Nainar2017-10-031-1/+1
| | | | | | | | | | | Bug: http://b/63768402 Wno-backend-plugin warnings are generated by IR-based PGO when sources evolve and the profiles become stale. Disable these warnings when profiles are passed to the compiler. Test: Build a module with a PGO property when profiles are used. Change-Id: I462bbf55aafd8770a90c2c23462bf71607ac9108
* Add PGO support to soongPirama Arumuga Nainar2017-09-211-0/+190
Bug: http://b/63768402 Bug: http://b/65598278 Add support for the 'pgo' property to specify how a module is processed under PGO. A sample property is below: pgo: { instrumentation: true, // could be "sampling: true" when supported profile_file: "pgo_simple.profdata", benchmarks: ["pgo_simple"], } 1. Runtime profiles can be gathered using "sampling" or "instrumentation". Sampling is not supported initially. 2. If 'toolchain/pgo-profiles' project is found, 'toolchain/pgo-profiles/${profile_file}' is passed to the compiler and linker when building this module. 3. If ANDROID_PGO_INSTRUMENT environment variable is set, and includes a benchmark in the 'benchmarks' list, appropriate flags (for e.g. -fprofile-generate for instrumentation) are passed to the compiler and linker when building this module. Test: Add example modules that specify the pgo property and verify appropriate flags and dependencies in the Ninja file. Some tests/examples are in https://android-review.googlesource.com/474805 Change-Id: I6242e0c904497a115e367dea6927ba1c4b906355