Skip to content

Instantly share code, notes, and snippets.

@classilla
Last active May 31, 2022
Embed
What would you like to do?
PGO fixes and livability improvements for LTO in Firefox on ppc64le Linux. Read web page first! -- https://www.talospace.com/2022/05/firefox-101-on-power.html
diff -r b22cb12f611c build/moz.configure/lto-pgo.configure
--- a/build/moz.configure/lto-pgo.configure Thu Oct 07 08:11:19 2021 +0000
+++ b/build/moz.configure/lto-pgo.configure Sun Oct 10 20:36:46 2021 -0700
@@ -81,17 +81,17 @@
@depends(c_compiler, pgo_profile_path, target_is_windows)
@imports("multiprocessing")
def pgo_flags(compiler, profdata, target_is_windows):
if compiler.type == "gcc":
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"],
)
if compiler.type in ("clang-cl", "clang"):
prefix = ""
if compiler.type == "clang-cl":
prefix = "/clang:"
gen_ldflags = None
diff -r b22cb12f611c build/pgo/profileserver.py
--- a/build/pgo/profileserver.py Thu Oct 07 08:11:19 2021 +0000
+++ b/build/pgo/profileserver.py Sun Oct 10 20:36:46 2021 -0700
@@ -82,19 +82,32 @@
docroot=os.path.join(build.topsrcdir, "build", "pgo"),
path_mappings=path_mappings,
)
httpd.start(block=False)
locations = ServerLocations()
locations.add_host(host="127.0.0.1", port=PORT, options="primary,privileged")
- old_profraw_files = glob.glob("*.profraw")
- 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
profile_data_dir = os.path.join(build.topsrcdir, "testing", "profiles")
with open(os.path.join(profile_data_dir, "profiles.json"), "r") as fh:
base_profiles = json.load(fh)["profileserver"]
prefpaths = [
@@ -207,16 +220,20 @@
# Try to move the crash reports to the artifacts even if Firefox appears
# to exit successfully, in case there's a crash that doesn't set the
# return code to non-zero for some reason.
if get_crashreports(profilePath, name="Firefox exited successfully?") != 0:
print("Firefox exited successfully, but produced a crashreport")
sys.exit(1)
+ print('Copying profile data....')
+ os.system('pwd');
+ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd ..; tar xf instrumented/profdata.tar.gz;');
+
llvm_profdata = env.get("LLVM_PROFDATA")
if llvm_profdata:
profraw_files = glob.glob("*.profraw")
if not profraw_files:
print(
"Could not find profraw files in the current directory: %s"
% os.getcwd()
)
diff -r b22cb12f611c mfbt/tests/moz.build
--- a/mfbt/tests/moz.build Thu Oct 07 08:11:19 2021 +0000
+++ b/mfbt/tests/moz.build Sun Oct 10 20:36:46 2021 -0700
@@ -80,21 +80,21 @@
"TestSPSCQueue",
"TestThreadSafeWeakPtr",
]
)
# Not to be unified with the rest, because this test
# sets MOZ_PRETEND_NO_JSRUST, which changes the behavior
# of the included headers.
-CppUnitTests(
- [
- "TestUtf8",
- ]
-)
+#CppUnitTests(
+# [
+# "TestUtf8",
+# ]
+#)
# Wasi doesn't support <signal> yet so skip this test.
if not CONFIG["MOZ_ASAN"] and CONFIG["OS_ARCH"] != "WASI":
CppUnitTests(
[
"TestPoisonArea",
]
)
diff -r b22cb12f611c toolkit/components/terminator/nsTerminator.cpp
--- a/toolkit/components/terminator/nsTerminator.cpp Thu Apr 07 15:11:19 2022 +0000
+++ b/toolkit/components/terminator/nsTerminator.cpp Thu Apr 07 20:44:28 2022 -0700
@@ -461,16 +461,21 @@
// Defend against overflow
crashAfterMS = INT32_MAX;
} else {
crashAfterMS *= scaleUp;
}
}
#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());
// crashAfterTicks is guaranteed to be > 0 as
// crashAfterMS >= ADDITIONAL_WAIT_BEFORE_CRASH_MS >> HEARTBEAT_INTERVAL_MS
options->crashAfterTicks = crashAfterMS / HEARTBEAT_INTERVAL_MS;
DebugOnly<PRThread*> watchdogThread =
CreateSystemThread(RunWatchdog, options.release());
MOZ_ASSERT(watchdogThread);
diff -r b22cb12f611c python/mach/mach/site.py
--- a/python/mach/mach/site.py Mon May 30 21:13:27 2022 -0700
+++ b/python/mach/mach/site.py Mon May 30 21:15:24 2022 -0700
@@ -548,21 +548,21 @@
If using a virtualenv Python binary directly, it's useful to call this function
first to ensure that the virtualenv doesn't have obsolete references or packages.
"""
result = self._up_to_date()
if not result.is_up_to_date:
active_site = MozSiteMetadata.from_runtime()
if active_site.site_name == self._site_name:
print(result.reason, file=sys.stderr)
- raise Exception(
- f'The "{self._site_name}" site is out-of-date, even though it has '
- f"already been activated. Was it modified while this Mach process "
- f"was running?"
- )
+# raise Exception(
+# f'The "{self._site_name}" site is out-of-date, even though it has '
+# f"already been activated. Was it modified while this Mach process "
+# f"was running?"
+# )
_create_venv_with_pthfile(
self._topsrcdir,
self._virtualenv,
self._pthfile_lines(),
self._populate_virtualenv,
self._requirements,
self._metadata,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment