Bug #73111 [Opn]: make prof-use don't work -> still profiling code

From: Date: Thu, 29 Sep 2016 23:15:35 +0000
Subject: Bug #73111 [Opn]: make prof-use don't work -> still profiling code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204351@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73111&edit=1

 ID:                 73111
 User updated by:    spam2 at rhsoft dot net
 Reported by:        spam2 at rhsoft dot net
 Summary:            make prof-use don't work -> still profiling code
 Status:             Open
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Linux
 PHP Version:        7.0.12 RC1
 Block user comment: N
 Private report:     N

 New Comment:

back at home - that sequence works:
________________________________________

make %{?_smp_mflags} prof-gen
/usr/bin/bash /rpmbuild/PHP-PGO/profile.sh $PWD
make prof-clean
make %{?_smp_mflags} prof-use
________________________________________

the size difference of the resulting binaries with no other changes is dramatically

-rwxr-xr-x 1 root root 5,8M 2016-09-29 17:20 /usr/bin/php
-rwxr-xr-x 1 root root 4,9M 2016-09-29 18:19 /usr/bin/php
________________________________________

after thinking again about "--always-make forces a regeneration of the lexer and you have a
different re2c version installed which was used to generate the lexer in the repo, so you end up
with minor differences in control flow" i tried ot add "--always-make" to the
"make prof-gen" call

that seems to make some differnce BUT the reduced binary size is completly gone (retried 2 times,
with --always-make only in the first and also in both calls)

it's not really related to this bugreport, but given that bison/re2c are seem to do something
but the binaries end as large as with the missing "make prof-clean" maybe it's better
to leave --always-make completly out of the game

+/home/builduser/rpmbuild/BUILD/php-7.0.12/Zend/zend_ini_parser.y:264.1-12: warning: deprecated
directive, use '%pure-parser' [-Wdeprecated]
+ %pure_parser
+ ^^^^^^^^^+bison -y --defines -l /home/builduser/rpmbuild/BUILD/php-7.0.12/ext/json/json_parser.y
-o /home/builduser/rpmbuild/BUILD/php-7.0.12/ext/json/json_parser.tab.c^^^


Previous Comments:
------------------------------------------------------------------------
[2016-09-29 17:14:52] spam2 at rhsoft dot net

That indeed seems to work, but when you Google for build php with pgo "make prof-clean" is
nowhere (Intel pages and others) mentioned and looking at the rm-calls it's pretty obvious that
"make prof-use" should fire them implicit

------------------------------------------------------------------------
[2016-09-29 15:54:44] nikic@php.net

Just checked the makefile, it seems pretty clear that the intended command sequence is

    make prof-gen
    # train
    make prof-clean
    make prof-use

Your invocation is missing the "make prof-clean", which is what removes the compiler
artifacts so that "make prof-use" will actually recompile.

------------------------------------------------------------------------
[2016-09-29 14:59:37] spam2 at rhsoft dot net

7.0.12 RC1 does the same nonsense and skip the "make -j8 prof-use" completly which leads
in steop over to "make install" and in fact installs binaries with the profile-code
leading in overhead error messages at runtime without the "--always-make" hack 
______________________________________

./configure
make -j8 prof-gen
<run application code>
make -j8 prof-use
make install
______________________________________

+ make -j8 prof-use
CCACHE_DISABLE=1 make PROF_FLAGS=-fprofile-use all
make[1]: Entering directory '/home/builduser/rpmbuild/BUILD/php-7.0.12'

Build complete.
Don't forget to run 'make test'.

make[1]: Leaving directory '/home/builduser/rpmbuild/BUILD/php-7.0.12'
+ exit 0
Ausführung(%install): /bin/sh -e /var/tmp/rpm-tmp.F1EgEt
+ umask 022
+ cd /home/builduser/rpmbuild/BUILD
+ '[' /home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
'!=' / ']'
+ rm -rf /home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
++ dirname /home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
+ mkdir -p /home/builduser/rpmbuild/BUILDROOT
+ mkdir /home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
+ cd php-7.0.12
+ install -m 0755 -d
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/etc
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/etc/httpd/conf
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/usr/lib64/httpd/modules
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/usr/share/php
+ install -m 0644 /home/builduser/rpmbuild/SOURCES/opcache-zendoptimizer.php
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/usr/share/php/zendoptimizer.php
+ install -m 0644 /home/builduser/rpmbuild/SOURCES/php-httpd-dummy.conf
/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64/etc/httpd/conf/httpd.conf
+ INSTALL_ROOT=/home/builduser/rpmbuild/BUILDROOT/php-7.0.12-1.fc24.20160929.1647.rh.x86_64
+ make install

------------------------------------------------------------------------
[2016-09-19 19:04:46] spam2 at rhsoft dot net

BTW:

pleae take a look at "-fprofile-generate leads in root-owned files"
https://bugzilla.redhat.com/show_bug.cgi?id=1377249

i had a fight the whole last night including some hours at moring in the office without understand
what happens, it seems now disappeared but running "rpmbuild" as restrcited user and
ending in root-owned files and all sorts of errors when other things are still running as the
correct restricted user is very strange

finally i had 10 successful builds with PGO, the perofrmance of our own CMS system is increased by
7% with PHP 7.0.11 compared to normal builds - really great but the root-thing and need of
"make --always-make" don't make me terrible happy while i can only explain the
"make prof-use" NOOP which is topic of this bugreport
_______________________

currently PGO is done with that snippet while "profile.sh" first starts CLI-autotests with
the temporary binary and after that starts a webserver on port 9000, fetching a URL-list and fetch
all URLs known by the cms 10 times to fill up the profiledata for "make prof-use"

# build php with 'profile-guided-optimization' when enabled
%if %pgo_build
 echo "PROFILE-GUIDED-OPTIMIZATION: Stage 1"
 make %{?_smp_mflags} prof-gen
 /rpmbuild/PHP-PGO/profile.sh $PWD
 echo "PROFILE-GUIDED-OPTIMIZATION: Stage 2"
 make --always-make %{?_smp_mflags} prof-use
%else
 make %{?_smp_mflags}
%endif
_______________________

comment from GCC maintainers

The *.gcda files aren't written by gcc, but by the application you're testing (when
compiled/linked with -fprofile-generate).  It uses whatever uid the process has.  Perhaps you are
dlopening your -fprofile-generate built library into some suid app or something similar?
In any case, there is nothing that can be done about it on the gcc side

------------------------------------------------------------------------
[2016-09-19 12:20:39] spam2 at rhsoft dot net

the problem is that "make prof-use" don't do anything while
"-Wno-coverage-mismatch" is a dirty workaround for now - "-always-make" should
not be needed

that sequence should work out-of-the-box instead "make prof-use" thingink "oh,
already built, nothing to do"

make prof-gen
make test
make prof-use

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=73111


--
Edit this bug report at https://bugs.php.net/bug.php?id=73111&edit=1


Thread (15 messages)

« previous php.bugs (#204351) next »