current development tree no longer builds with GCC and PGO
Categories
(Firefox Build System :: General, defect)
Tracking
(Not tracked)
People
(Reporter: jh, Assigned: stransky)
References
Details
(Keywords: in-triage)
Attachments
(3 obsolete files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0
Steps to reproduce:
I built revision 505761:10160518ddc8 with GCC 9 and PGO.
Actual results:
It fials to find profdata and fails after porfiling. This is because GCC uses different format (gcda). This seems to be due to fact that build machinery was changed to keep both instrumented and non-instrumented tree.
I suppose Makefiles needs minor update to get gcda located correctly via -fprofile-generate=<dir> -fprofile-use=<dir> and to look for files in that directory.
Expected results:
It should have built
| Reporter | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Updated•5 years ago
|
Comment 2•5 years ago
|
||
Now that the instrumented build is in a separated objdir from the
profile-use build, we need to point gcc to the correct directory to find
the gcda files. This is most easily done with a variable that gets
expanded by make to point to the instrumented objdir during the
profile-use build. Additionally, we have a separate cleanup routine in
profileserver.py to remove old *.gcda files.
Comment 3•5 years ago
|
||
Jan, can you try the attached patch please and let me know if you run into any issues? One odd thing I saw is way more -Wcoverage-mismatch errors during the build. I'm not sure yet why that is, but I'm still looking into it.
| Reporter | ||
Comment 4•5 years ago
|
||
I am runing some tests on older tree but will try it soon.
-Wcoverage-mismatch warnings are usually caused by fact that profile collection was having race conditions. So reasonable quantity of those are expected (that is why we have -fprofile-correction). I will take a look if they got any worse than before.
| Reporter | ||
Comment 5•5 years ago
|
||
I apologize for taking a while. I now have setup with top of tree and can do testing easily. However the approach with -fprofile-generate=<dir> -fprofile-use=<samedir> does not work with GCC9+. GCC8 used relative paths to name files in the profile directory and that was updated to use absolute paths in funny # mangling in GCC9+. This means that the -fprofile-feedback=<samedir> compilation is not able to find the gcda files produced at runtime because the absolute path of object file produced is different.
I will implement flag in GCC, but until that happens I think it is best to use -fprofile-generate and -fprofile-use and before starting -fprofile-use just copy gcda files to new location. Somehting like
cd <instrumentbuilddir>
tar cf <profdata> `find . -name "*.gcda"'
cd <feedbackbuildir>
tar xf <profdata>
Sorry for suggesting a wrong direction originally.
Comment 6•5 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:mshal, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•5 years ago
|
Comment 7•5 years ago
|
||
I abandoned the rev in phabricator because the -fprofile-use=<instrumented-dir> doesn't work as advertised. I also tried -fprofile-generate=<use-dir>, as well as the suggestion in #c5 to copy the *.gcda files in the instrumented build directory to the profile-use build directory. However, in all cases the profile-use build generates excessive -Wcoverage-mismatch warnings as compared to before the 3-tier local PGO changes. For example, compiling xpcom/threads/Unified_cpp_xpcom_threads0.o produces 337 warnings, while the original 1-tier gcc PGO build doesn't produce any for that file.
Jan, do you have any other suggestions to try? I'm unsure how to proceed.
Updated•5 years ago
|
Updated•4 years ago
|
| Assignee | ||
Comment 8•4 years ago
|
||
I managed to do the PGO GCC build and seems to be functional despite the -Wcoverage-mismatch flood.
Comment 9•4 years ago
|
||
It's failing for me with the same error (gcc 10.2.1, Fedora 32 ppc64le). I do see the .gcda files having been generated.
Updated•2 years ago
|
Updated•2 years ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 10•1 year ago
•
|
||
Right now with plain trunk GCC/PGO/LTO builds pass but code is not optimized.
When local patches are applied (and coverage warnings are disabled), gcc build is fine and performance/size is better than a clang build (PGO/LTO/GCC 13.1/Fedora 38 speedometer 188 vs. 177 and libxul size 2.8 GB vs. 2.9 GB).
| Assignee | ||
Comment 11•1 year ago
|
||
Looks like Bug 1516803 is not needed any more, checking.
Comment 12•1 year ago
|
||
That's interesting, thanks Martin! Maybe we want to check why is that... My understanding is that GCC cannot do stuff like cross-language inlining which we benefit a bit from in the style system...
Btw, I wonder how hard it is to do windows/macOS cross builds with gcc rather than clang... It'd be interesting if our speedometer numbers are similar if so...
Comment 13•1 year ago
|
||
AFAIK GCC doesn't support the MSVC ABI. I'm not sure how well macOS is supported these days.
Comment 14•1 year ago
|
||
(In reply to Mike Hommey [:glandium] from comment #13)
AFAIK GCC doesn't support the MSVC ABI.
Do we need the MSVC ABI? Don't we have a MinGW build? (Talking from ignorance)
| Assignee | ||
Comment 15•1 year ago
|
||
I just tested latest Mozilla nightly binaries and speedometer gives me 200 points. Local clang builds seems to be slower (wrong config?).
Comment 16•1 year ago
|
||
Hey Martin, from a config point of view, you should at least have the following flags : --enable-release MOZ_PGO=1 --enable-lto=cross. Hope it helps.
| Assignee | ||
Comment 17•1 year ago
•
|
||
(In reply to Martin Stránský [:stransky] (ni? me) from comment #15)
I just tested latest Mozilla nightly binaries and speedometer gives me 200 points. Local clang builds seems to be slower (wrong config?).
Looks like as was mistaken. Mozilla binaries and local clang builds give me 190-200 speedometer points while GCC PGO/LTO builds give me 160-180 points in speedometer.
Comment 18•1 year ago
|
||
Do we need the MSVC ABI?
AFAIK, for e.g. a11y and other stuff, yes.
| Assignee | ||
Comment 19•1 year ago
|
||
Looks like GCOV_PREFIX_STRIP/GCOV_PREFIX does the trick here with GCC. I used:
GCOV_PREFIX_STRIP=3
GCOV_PREFIX=/src/objdir-pgo-gcc
as gcov files are in '/src/objdir-pgo-gcc/instrumented' and that generates GCOV files directly in build dir without need of copy.
With such build GCC gives me 195 points in speedometer (5 points less than clang).
| Assignee | ||
Comment 20•1 year ago
|
||
Updated•1 year ago
|
| Assignee | ||
Comment 21•1 year ago
|
||
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Description
•