[issue24915] Profile Guided Optimization active by-default

2015-08-24 Thread Alecsandru Patrascu

Changes by Alecsandru Patrascu alecsandru.patra...@intel.com:


Added file: http://bugs.python.org/file40238/python2.7-pgo-v02-mac.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-24 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

I modified the patches after the review made by Brett (python2.7-pgo-v02.patch 
and python3.6-pgo-v02.patch):
- removed the call to pybench
- left the PGO steps as optional. To use it we run make profile-opt
- in the initial patches, I left out test_hashlib  because in our benchmarks we 
did not see any gain by applying PGO to the hash functions. It is not harmful 
and we can let it there or skip it. Nevertheless, in order not to create 
confusions about it, I removed that parameter from the patch.


I also added the patches for Mac exclusively (python2.7-pgo-v02-mac.patch and 
python3.6-pgo-v02-mac.patch). You must have llvm-profdata installed and in your 
path (in /Library/Developer/CommandLineTools/usr/bin/) to use it. I tested on 
Yosemite and it compiles fine with clang. I am working on a generic version 
(configure and Makefile patches) to merge all these platforms and will post 
them as soon as it is done.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-24 Thread Stefan Krah

Stefan Krah added the comment:

My initial reaction is that the default should be optimized for
short build times. I would not want to type disable-profile-opt
every time I'm running the tests.

--
nosy: +skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-24 Thread Alecsandru Patrascu

Changes by Alecsandru Patrascu alecsandru.patra...@intel.com:


Added file: http://bugs.python.org/file40237/python3.6-pgo-v02.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-24 Thread Alecsandru Patrascu

Changes by Alecsandru Patrascu alecsandru.patra...@intel.com:


Added file: http://bugs.python.org/file40236/python2.7-pgo-v02.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-24 Thread Alecsandru Patrascu

Changes by Alecsandru Patrascu alecsandru.patra...@intel.com:


Added file: http://bugs.python.org/file40239/python3.6-pgo-v02-mac.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-24 Thread Brett Cannon

Brett Cannon added the comment:

the v02 patches LGTM. I'm fine with seeing those committed as-is knowing 
Alecsandru is actively working towards Clang support.

--
stage: patch review - commit review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Brett Cannon

Brett Cannon added the comment:

I did an initial code review on the 3.6 patch.

What would it take to add clang support for PGO? Is it simply using different 
flags that configure can set in the generated Makefile? Or is it more involved 
and would require maintaining two separate compile lines in the Makefile?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

I received the review and will post new patch versions as soon as I update 
them. 

Regarding PGO on clang, I will need a bit more time to edit the Makefile and 
will post it just for clang, to be easier for us to see the differences.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Alecsandru Patrascu

Changes by Alecsandru Patrascu alecsandru.patra...@intel.com:


Removed file: http://bugs.python.org/file40226/python2.7-3.6-pgo.zip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Alecsandru Patrascu

Changes by Alecsandru Patrascu alecsandru.patra...@intel.com:


--
keywords: +patch
Added file: http://bugs.python.org/file40231/python2.7-pgo.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Alecsandru Patrascu

Changes by Alecsandru Patrascu alecsandru.patra...@intel.com:


Added file: http://bugs.python.org/file40232/python3.6-pgo.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

The patches are tested on Linux machines, with GNU GCC 4.8.3. From your output 
I see that you are using the CLANG compiler. CLANG uses a different set of 
flags for PGO that are not compatible with GCC's, therefore the compilation 
will fail. Can you please use the GNU GCC compiler to test the patches?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

I added the patches as individual files and removed the zip file.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Skip Montanaro

Skip Montanaro added the comment:

Is this supposed to work on Macs using Apple's version of gcc? I've got the 
latest version of Yosemite and XCode, and am getting these warnings when trying 
to build 2.7:

clang: warning: argument unused during compilation: '-fprofile-generate'

Should this be enabled using a configure check? Perhaps gcc/clang supports this 
but spells the feature differently. gcc --help tells me:

% gcc --help | egrep profile
  -fprofile-instr-generate
  -fprofile-instr-use=value
  Use instrumentation data for profile-guided 
optimization
  -fprofile-sample-use=value
  Enable sample-based profile guided optimizations

--
nosy: +skip.montanaro

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-23 Thread Skip Montanaro

Skip Montanaro added the comment:

It is executed using the gcc command:

% gcc -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes  -fprofile-generate -I. -IInclude -I./Include   
-DPy_BUILD_CORE -o Modules/gcmodule.o Modules/gcmodule.c
clang: warning: argument unused during compilation: '-fprofile-generate'
% type gcc
gcc is /usr/bin/gcc

I have no idea if you can even use something other than clang on Macs now. In 
any case, the default compiler should work to build Python out of the box, if 
necessary, by checking things during configure.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-22 Thread Alecsandru Patrascu

New submission from Alecsandru Patrascu:

Hi All,

This is Alecsandru from Server Scripting Languages Optimization team at Intel 
Corporation.

I would like to submit a request to turn-on Profile Guided Optimization or PGO 
as the default build option for Python (both 2.7 and 3.6), given its 
performance benefits on a wide variety of workloads and hardware.  For 
instance, as shown from attached sample performance results from the Grand 
Unified Python Benchmark, 20% speed up was observed.  In addition, we are 
seeing 2-9% performance boost from OpenStack/Swift where more than 60% of the 
codes are in Python 2.7. Our analysis indicates the performance gain was mainly 
due to reduction of icache misses and CPU front-end stalls.

Attached is the Makefile patches that modify the all build target and adds a 
new one called disable-profile-opt. We built and tested this patch for Python 
2.7 and 3.6 on our Linux machines (CentOS 7/Ubuntu Server 14.04, Intel Xeon 
Haswell/Broadwell with 18/8 cores).  We use regrtest suite for training as it 
provides the best performance improvement.  Some of the test programs in the 
suite may fail which leads to build fail.  One solution is to disable the 
specific failed test using the -x  flag (as shown in the patch)

Steps to apply the patch: 
1.  hg clone https://hg.python.org/cpython cpython 
2.  cd cpython 
3.  hg update 2.7 (needed for 2.7 only) 
4.  Copy *.patch to the current directory 
5.  patch  python2.7-pgo.patch (or patch  python3.6-pgo.patch)
6.  ./configure 
7.  make

To disable PGO
7b. make disable-profile-opt

In the following, please find our sample performance results from latest XEON 
machine, XEON Broadwell EP.  
Hardware (HW):  Intel XEON (Broadwell) 8 Cores

BIOS settings:  Intel Turbo Boost Technology: false
Hyper-Threading: false

Operating System:   Ubuntu 14.04.3 LTS trusty

OS configuration:   CPU freq set at fixed: 2.6GHz by
echo 260  
/sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
echo 260  
/sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
Address Space Layout Randomization (ASLR) disabled (to 
reduce run to run variation) by
echo 0  /proc/sys/kernel/randomize_va_space

GCC version:gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)

Benchmark:  Grand Unified Python Benchmark (GUPB)
GUPB Source: https://hg.python.org/benchmarks/  
  

Python2.7 results:
Python source: hg clone https://hg.python.org/cpython cpython
Python Source: hg update 2.7
hg id: 0511b1165bb6 (2.7)
hg id -r 'ancestors(.) and tag()': 15c95b7d81dc (2.7) v2.7.10
hg --debug id -i: 0511b1165bb6cf40ada0768a7efc7ba89316f6a5

Benchmarks  Speedup(%)
simple_logging  20
raytrace20
silent_logging  19
richards19
chaos   16
formatted_logging   16
json_dump   15
hexiom2 13
pidigits12
slowunpickle12
django_v2   12
unpack_sequence 11
float   11
mako11
slowpickle  11
fastpickle  11
django  11
go  10
json_dump_v210
pathlib 10
regex_compile   10
pybench 9.9
etree_process   9
regex_v88
bzr_startup 8
2to38
slowspitfire8
telco   8
pickle_list 8
fannkuch8
etree_iterparse 8
nqueens 8
mako_v2 8
etree_generate  8
call_method_slots   7
html5lib_warmup 7
html5lib7
nbody   7
spectral_norm   7
spambayes   7
fastunpickle6
meteor_contest  6
chameleon   6
rietveld6
tornado_http5
unpickle_list   5
pickle_dict 4
regex_effbot3
normal_startup  3
startup_nosite  3
etree_parse 2
call_method_unknown 2
call_simple 1
json_load   1
call_method 1

Python3.6 results
Python source: hg clone https://hg.python.org/cpython cpython
hg id: 96d016f78726 tip
hg id -r 'ancestors(.) and tag()': 1a58b1227501 (3.5) v3.5.0rc1
hg --debug id -i: 96d016f78726afbf66d396f084b291ea43792af1


Benchmark   Speedup(%)
fastunpickle22.94
fastpickle  21.67
json_load   17.64

[issue24915] Profile Guided Optimization active by-default

2015-08-22 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy: +brett.cannon
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24915] Profile Guided Optimization active by-default

2015-08-22 Thread Stefan Behnel

Stefan Behnel added the comment:

Please upload your patches as separate, uncompressed files for review.

PGO was already proposed here, but nothing came out of it:

https://bugs.python.org/issue17781

I suggest rejecting that old ticket and sticking with this one since it has an 
actual patch.

--
nosy: +scoder

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com