Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7699 Discussions

enabling -ipo can greatly reduce performance in Linux

tp5
New Contributor I
175 Views
Usually it produces faster code, but I already noticed two programs where it results in very slow binaries.One of them is the following compression program.

http://mattmahoney.net/dc/zp100.zip
[plain]openssl rand 1000000 -out random

icpc -O3 -xSSE3_ATOM -o zp zp.cpp
./zp c3 random.zp random
Elapsed time 20.52 seconds.

icpc -O3 -o zp zp.cpp
./zp c3 random.zp random
Elapsed time 21.34 seconds.

icpc -O3 -xSSE3_ATOM -ipo -o zp zp.cpp
./zp c3 random.zp random
Elapsed time 29.74 seconds.

icpc -O3 -ipo -o zp zp.cpp
./zp c3 random.zp random
Elapsed time 35.08 seconds.[/plain]
This is with 11.1.072 and an Intel Atom processor.
0 Kudos
1 Solution
Hubert_H_Intel
Employee
175 Views
Try -ip (interprocedural optimization within single file) which is more suitable for the example than -ipo (dto. within multiple files). It gives slightly better performance.
Did you try -ipo also with multiple file compilations?
Hubert.

View solution in original post

4 Replies
Hubert_H_Intel
Employee
175 Views
Yes, ipo code is slower. I'll have a look at it.
Regards, Hubert.
Hubert_H_Intel
Employee
176 Views
Try -ip (interprocedural optimization within single file) which is more suitable for the example than -ipo (dto. within multiple files). It gives slightly better performance.
Did you try -ipo also with multiple file compilations?
Hubert.
tp5
New Contributor I
175 Views
Actually I have completely ignored that this is only a single source file for some reason. Probably because I automatically try -fast first which then expands into -ipo and other switches. The other example where -ipo produces much slower code is only one source file as well.

Maybe in the case of -fast with only a single source file the compiler could warn about this to help the user?
In cases with multiple files -ipo produces faster code.
Thanks for you reply.
tp5
New Contributor I
175 Views
I've tried another single source file, and while -ipo obviously didn't produce faster code it wasn't slower either. So this could still be a bug.
Reply