2024-02-19 10:00:46 +00:00
|
|
|
diff -up firefox-123.0/build/moz.configure/lto-pgo.configure.pgo firefox-123.0/build/moz.configure/lto-pgo.configure
|
2024-02-23 18:31:52 +00:00
|
|
|
--- firefox-123.0/build/moz.configure/lto-pgo.configure.pgo 2024-02-22 10:53:12.608509264 +0100
|
|
|
|
+++ firefox-123.0/build/moz.configure/lto-pgo.configure 2024-02-22 10:56:14.911881765 +0100
|
|
|
|
@@ -90,12 +90,16 @@ set_config("PGO_PROFILE_PATH", pgo_profi
|
|
|
|
|
|
|
|
@depends(
|
|
|
|
"--enable-profile-use",
|
|
|
|
+ c_compiler,
|
|
|
|
pgo_profile_path,
|
|
|
|
llvm_profdata,
|
|
|
|
llvm_profdata_order,
|
|
|
|
build_environment,
|
|
|
|
)
|
|
|
|
-def orderfile_path(profile_use, path, profdata, profdata_order, build_env):
|
|
|
|
+def orderfile_path(profile_use, compiler, path, profdata, profdata_order, build_env):
|
|
|
|
+ if compiler.type == "gcc":
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
if not profile_use:
|
|
|
|
return None
|
|
|
|
|
|
|
|
@@ -130,7 +134,7 @@ def pgo_flags(compiler, linker, profdata
|
2023-07-17 11:24:28 +00:00
|
|
|
return namespace(
|
|
|
|
gen_cflags=["-fprofile-generate"],
|
|
|
|
gen_ldflags=["-fprofile-generate"],
|
|
|
|
- use_cflags=["-fprofile-use", "-fprofile-correction", "-Wcoverage-mismatch"],
|
|
|
|
+ use_cflags=["-fprofile-use", "-fprofile-correction", "-Wno-coverage-mismatch"],
|
|
|
|
use_ldflags=["-fprofile-use"],
|
|
|
|
)
|
|
|
|
|
2024-02-19 10:00:46 +00:00
|
|
|
diff -up firefox-123.0/build/pgo/profileserver.py.pgo firefox-123.0/build/pgo/profileserver.py
|
|
|
|
--- firefox-123.0/build/pgo/profileserver.py.pgo 2024-02-14 08:18:40.000000000 +0100
|
2024-02-23 18:31:52 +00:00
|
|
|
+++ firefox-123.0/build/pgo/profileserver.py 2024-02-22 10:06:42.665963053 +0100
|
2023-04-11 10:57:42 +00:00
|
|
|
@@ -11,7 +11,7 @@ import subprocess
|
|
|
|
import sys
|
2020-06-23 13:05:19 +00:00
|
|
|
|
|
|
|
import mozcrash
|
2023-04-11 10:57:42 +00:00
|
|
|
-from mozbuild.base import BinaryNotFoundException, MozbuildObject
|
|
|
|
+from mozbuild.base import BinaryNotFoundException, MozbuildObject, BuildEnvironmentNotFoundException
|
2020-06-23 13:05:19 +00:00
|
|
|
from mozfile import TemporaryDirectory
|
|
|
|
from mozhttpd import MozHttpd
|
|
|
|
from mozprofile import FirefoxProfile, Preferences
|
2024-01-22 15:52:36 +00:00
|
|
|
@@ -98,9 +98,22 @@ if __name__ == "__main__":
|
2020-12-10 19:02:09 +00:00
|
|
|
locations = ServerLocations()
|
|
|
|
locations.add_host(host="127.0.0.1", port=PORT, options="primary,privileged")
|
2020-06-23 13:05:19 +00:00
|
|
|
|
2020-12-10 19:02:09 +00:00
|
|
|
- old_profraw_files = glob.glob("*.profraw")
|
2020-06-23 13:05:19 +00:00
|
|
|
- for f in old_profraw_files:
|
|
|
|
- os.remove(f)
|
|
|
|
+ using_gcc = False
|
|
|
|
+ try:
|
|
|
|
+ if build.config_environment.substs.get('CC_TYPE') == 'gcc':
|
|
|
|
+ using_gcc = True
|
|
|
|
+ except BuildEnvironmentNotFoundException:
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+ if using_gcc:
|
|
|
|
+ for dirpath, _, filenames in os.walk('.'):
|
|
|
|
+ for f in filenames:
|
|
|
|
+ if f.endswith('.gcda'):
|
|
|
|
+ os.remove(os.path.join(dirpath, f))
|
|
|
|
+ else:
|
|
|
|
+ old_profraw_files = glob.glob('*.profraw')
|
|
|
|
+ for f in old_profraw_files:
|
|
|
|
+ os.remove(f)
|
|
|
|
|
|
|
|
with TemporaryDirectory() as profilePath:
|
|
|
|
# TODO: refactor this into mozprofile
|
2024-02-19 10:00:46 +00:00
|
|
|
diff -up firefox-123.0/gfx/2d/moz.build.pgo firefox-123.0/gfx/2d/moz.build
|
2024-02-23 18:31:52 +00:00
|
|
|
--- firefox-123.0/gfx/2d/moz.build.pgo 2024-02-14 08:18:41.000000000 +0100
|
|
|
|
+++ firefox-123.0/gfx/2d/moz.build 2024-02-22 10:06:42.665963053 +0100
|
2024-02-19 10:00:46 +00:00
|
|
|
@@ -134,11 +134,11 @@ if CONFIG["INTEL_ARCHITECTURE"]:
|
2023-07-17 11:24:28 +00:00
|
|
|
# The file uses SSE2 intrinsics, so it needs special compile flags on some
|
|
|
|
# compilers.
|
|
|
|
SOURCES["BlurSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
|
|
|
|
- SOURCES["ConvolutionFilterAVX2.cpp"].flags += ["-mavx2"]
|
|
|
|
+ SOURCES["ConvolutionFilterAVX2.cpp"].flags += ["-mavx2", "-fno-lto"]
|
|
|
|
SOURCES["ConvolutionFilterSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
|
|
|
|
SOURCES["FilterProcessingSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
|
|
|
|
SOURCES["ImageScalingSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
|
|
|
|
- SOURCES["SwizzleAVX2.cpp"].flags += ["-mavx2"]
|
|
|
|
+ SOURCES["SwizzleAVX2.cpp"].flags += ["-mavx2", "-fno-lto"]
|
|
|
|
SOURCES["SwizzleSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
|
|
|
|
SOURCES["SwizzleSSSE3.cpp"].flags += CONFIG["SSSE3_FLAGS"]
|
2024-02-19 10:00:46 +00:00
|
|
|
elif CONFIG["TARGET_CPU"].startswith("mips"):
|
|
|
|
diff -up firefox-123.0/gfx/skia/generate_mozbuild.py.pgo firefox-123.0/gfx/skia/generate_mozbuild.py
|
|
|
|
--- firefox-123.0/gfx/skia/generate_mozbuild.py.pgo 2024-02-14 08:18:42.000000000 +0100
|
2024-02-23 18:31:52 +00:00
|
|
|
+++ firefox-123.0/gfx/skia/generate_mozbuild.py 2024-02-22 10:06:42.665963053 +0100
|
2023-07-17 11:24:28 +00:00
|
|
|
@@ -54,10 +54,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
|
|
|
|
if CONFIG['INTEL_ARCHITECTURE']:
|
2023-07-26 12:27:10 +00:00
|
|
|
SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-Dskvx=skvx_ssse3', '-mssse3']
|
|
|
|
SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-Dskvx=skvx_sse42', '-msse4.2']
|
|
|
|
- SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx', '-mavx']
|
|
|
|
- SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma']
|
|
|
|
+ SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx', '-mavx', '-fno-lto']
|
|
|
|
+ SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma', '-fno-lto']
|
2023-07-17 11:24:28 +00:00
|
|
|
if not CONFIG["MOZ_CODE_COVERAGE"]:
|
2023-07-26 12:27:10 +00:00
|
|
|
- SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags += ['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw', '-mavx512vl']
|
|
|
|
+ SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags += ['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw', '-mavx512vl', '-fno-lto']
|
2024-01-22 15:52:36 +00:00
|
|
|
elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
2023-07-26 12:27:10 +00:00
|
|
|
SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags += ['-Dskvx=skvx_crc32', '-march=armv8-a+crc']
|
2023-07-17 11:24:28 +00:00
|
|
|
|
2024-02-19 10:00:46 +00:00
|
|
|
diff -up firefox-123.0/gfx/skia/moz.build.pgo firefox-123.0/gfx/skia/moz.build
|
|
|
|
--- firefox-123.0/gfx/skia/moz.build.pgo 2024-02-14 08:18:42.000000000 +0100
|
2024-02-23 18:31:52 +00:00
|
|
|
+++ firefox-123.0/gfx/skia/moz.build 2024-02-22 10:06:42.666963088 +0100
|
2023-07-26 12:27:10 +00:00
|
|
|
@@ -564,10 +564,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
|
2023-07-17 11:24:28 +00:00
|
|
|
if CONFIG['INTEL_ARCHITECTURE']:
|
2023-07-26 12:27:10 +00:00
|
|
|
SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-Dskvx=skvx_ssse3', '-mssse3']
|
|
|
|
SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-Dskvx=skvx_sse42', '-msse4.2']
|
|
|
|
- SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx', '-mavx']
|
|
|
|
- SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma']
|
|
|
|
+ SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-Dskvx=skvx_avx', '-mavx', '-fno-lto']
|
|
|
|
+ SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-Dskvx=skvx_hsw', '-mavx2', '-mf16c', '-mfma', '-fno-lto']
|
2023-07-17 11:24:28 +00:00
|
|
|
if not CONFIG["MOZ_CODE_COVERAGE"]:
|
2023-07-26 12:27:10 +00:00
|
|
|
- SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags += ['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw', '-mavx512vl']
|
|
|
|
+ SOURCES['skia/src/opts/SkOpts_skx.cpp'].flags += ['-Dskvx=skvx_skx', '-mavx512f', '-mavx512dq', '-mavx512cd', '-mavx512bw', '-mavx512vl', '-fno-lto']
|
2024-01-22 15:52:36 +00:00
|
|
|
elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
2023-07-26 12:27:10 +00:00
|
|
|
SOURCES['skia/src/opts/SkOpts_crc32.cpp'].flags += ['-Dskvx=skvx_crc32', '-march=armv8-a+crc']
|
2023-07-17 11:24:28 +00:00
|
|
|
|
2024-02-19 10:00:46 +00:00
|
|
|
diff -up firefox-123.0/toolkit/components/terminator/nsTerminator.cpp.pgo firefox-123.0/toolkit/components/terminator/nsTerminator.cpp
|
|
|
|
--- firefox-123.0/toolkit/components/terminator/nsTerminator.cpp.pgo 2024-02-14 08:18:56.000000000 +0100
|
2024-02-23 18:31:52 +00:00
|
|
|
+++ firefox-123.0/toolkit/components/terminator/nsTerminator.cpp 2024-02-22 10:06:42.666963088 +0100
|
2023-04-11 10:57:42 +00:00
|
|
|
@@ -460,6 +460,11 @@ void nsTerminator::StartWatchdog() {
|
2020-10-07 08:22:49 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ // Disable watchdog for PGO train builds - writting profile information at
|
|
|
|
+ // exit may take time and it is better to make build hang rather than
|
|
|
|
+ // silently produce poorly performing binary.
|
|
|
|
+ crashAfterMS = INT32_MAX;
|
|
|
|
+
|
|
|
|
UniquePtr<Options> options(new Options());
|
2022-04-06 08:36:00 +00:00
|
|
|
// crashAfterTicks is guaranteed to be > 0 as
|
|
|
|
// crashAfterMS >= ADDITIONAL_WAIT_BEFORE_CRASH_MS >> HEARTBEAT_INTERVAL_MS
|