aboutsummaryrefslogtreecommitdiffstats
path: root/cc/pgo.go
Commit message (Collapse)AuthorAgeFilesLines
* 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