[webkit-changes] [WebKit/WebKit] 37dab5: [Xcode] Support multiple PGO profiles by matching ...

Elliott Williams noreply at github.com
Mon Mar 13 15:31:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 37dab5e553f6d157683732b971b5ea7ae830ec66
      https://github.com/WebKit/WebKit/commit/37dab5e553f6d157683732b971b5ea7ae830ec66
  Author: Elliott Williams <emw at apple.com>
  Date:   2023-03-13 (Mon, 13 Mar 2023)

  Changed paths:
    M Configurations/WebKitProjectPaths.xcconfig
    M Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Scripts/copy-profiling-data.sh
    M Source/WebCore/Configurations/WebCore.xcconfig
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebKit/Configurations/BaseTarget.xcconfig
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/Scripts/build-and-collect-pgo-profiles
    M Tools/Scripts/pgo-profile

  Log Message:
  -----------
  [Xcode] Support multiple PGO profiles by matching the platform target triple
https://bugs.webkit.org/show_bug.cgi?id=253691
rdar://106459115

Reviewed by Alexey Proskuryakov.

Change copy-profiling-data to find a profile to use based on the active
target triple. Using different profiles for different targets is
valuable for making future performance improvements and addressing
backwards compatibility.

Since we may not have a profile checked in for an exact target triple,
at build time, we pick the profile for the closest triple we can find.
For example, for the target triple arm64e-apple-ios16.4:

1. If profiles are available for arm64e-apple-ios16.4, use them.
2. Otherwise, find a profile for a prior version of the same platform
   (e.g. arm64e-apple-ios16.0).
3. If nothing is available for the platform, use the latest macOS
   profile.
4. If WebKitAdditions is unavailable, fall back to the empty profile.

The existing behavior (where all targets using profiles generated for
macOS) falls under case 3. Compatibility issues with downlevels are
handled by cases 1 and 2. And the open-source build (with no profiling
data) is case 4.

* Configurations/WebKitProjectPaths.xcconfig: Fix
  WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH to work correctly in
  engineering builds. Add WK_PROFILING_DATA_FOLDER_PATH to refer to the
  Profiles directory. This needs to be a discrete build setting so that
  it can be unset in open-source builds, to satisfy XCBuild's dependency
  validation.
* Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig: Remove
  PROFILE_DATA_PATH variable.
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: Change
  "Copy Profiling Data" build phase to depend on the entire Profiling/
  directory node. WebKitAdditions is changing to declare a directory
  reference for this path, rather than declaring individual file
  references for the profiles. Any change to the recursive contents of
  the directory will re-run the script.

  Note that Xcode currently has no way of knowing that the (copied)
  profile is an input of all compiler tasks, so a latent incremental
  build bug remains. We should adopt the CLANG_USE_OPTIMIZATION_PROFILE
  setting in a follow-up.
* Source/JavaScriptCore/Scripts/copy-profiling-data.sh: The search logic
  described above.
* Source/WebCore/Configurations/WebCore.xcconfig: Ditto xcconfig
  changes.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj: Ditto pbxproj
  changes.
* Source/WebKit/Configurations/BaseTarget.xcconfig: Ditto xcconfig
  changes.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj: Ditto pbxproj changes.
* Tools/Scripts/build-and-collect-pgo-profiles: Approximate the target
  triple we built for by analyzing the build products being tested. This
  is currently very Mac-specific, but this whole script woudl need to be
  changed dramatically to support collection on embedded platforms.

Canonical link: https://commits.webkit.org/261593@main




More information about the webkit-changes mailing list