The gcc <variable> "may be used uninitialized" gives unpredictable bogus results. I visually inspect each element and then ignore the warnings if there is nothing wrong. Of course, something else may be triggering the warning.syzygy wrote:That higher optimisation levels can turn "minor bugs" into crashes is not a reason not to use optimisation. Such "minor bugs" simply need to be fixed. If use of an uninitialised variable does not crash the program, it will likely make it produce incorrect results (which can be almost impossible to notice in a chess engine, except for a measurable decrease in playing strength).
gcc4.8 outperforming gcc5, gcc6, gcc7
Moderators: hgm, Rebel, chrisw
-
- Posts: 570
- Joined: Mon Jul 20, 2015 5:06 pm
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
-
- Posts: 1756
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Just tried using -std=c11. Results are about the same.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
What if you add -flto to CFLAGS?AndrewGrant wrote:Just tried using -std=c11. Results are about the same.
(It does not do any miracles for me, and I just noticed that even regular Stockfish is faster on my PC if I disable link-time optimisation, but still it is worth a try.)
-
- Posts: 5566
- Joined: Tue Feb 28, 2012 11:56 pm
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Yes, gcc sometimes produces bogus warnings (the most annoying being array out of bounds where no array is accessed out of bounds), but where it is right, the proper solution is to fix it and not to accept it as a "minor bug" and compile without optimisation hoping there is no harmD Sceviour wrote:The gcc <variable> "may be used uninitialized" gives unpredictable bogus results. I visually inspect each element and then ignore the warnings if there is nothing wrong. Of course, something else may be triggering the warning.syzygy wrote:That higher optimisation levels can turn "minor bugs" into crashes is not a reason not to use optimisation. Such "minor bugs" simply need to be fixed. If use of an uninitialised variable does not crash the program, it will likely make it produce incorrect results (which can be almost impossible to notice in a chess engine, except for a measurable decrease in playing strength).
If there is a bug, a crash is the best thing that can happen since it ensures that the bug is detected. The problem with some of these bugs is that the crash (not the bug) goes away when compiling in debug mode. That makes it harder to locate them. But nowadays it is pretty easy to locate them using -fsanitize.
-
- Posts: 1756
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Code: Select all
// Using Linked makefile
BENCH DEPTH | COMP | NPS
20 | GCC4.8 | 3592466
20 | GCC5.4 | 3367175
20 | GCC6.4 | 3366372
20 | GCC7.2 | 3246964
// Using Linked makefile plus -flto
BENCH DEPTH | COMP | NPS
20 | GCC4.8 | 3611056
20 | GCC5.4 | 3498027
20 | GCC6.4 | 3550826
20 | GCC7.2 | 3323299
GCC4.8 with -flto BENCH 22 NPS=3553729
GCC4.8 without -flto BENCH 22 NPS=3587155
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 1756
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Code: Select all
// Using Linked makefile
BENCH DEPTH | COMP | NPS
20 | GCC4.8 | 3592466
20 | GCC5.4 | 3367175
20 | GCC6.4 | 3366372
20 | GCC7.2 | 3246964
// Using Linked makefile plus -flto
BENCH DEPTH | COMP | NPS
20 | GCC4.8 | 3611056
20 | GCC5.4 | 3498027
20 | GCC6.4 | 3550826
20 | GCC7.2 | 3323299
GCC4.8 with -flto BENCH 22 NPS=3553729
GCC4.8 without -flto BENCH 22 NPS=3587155
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
It is well-known that -O3 can produce slower binaries. Should also be compared with what happens with -O2.syzygy wrote:He posted a link to the Makefile (he compiles with -O3).
-
- Posts: 12541
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
I definitely get best performance with gcc 7.2. It beats all my other compilers handily.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
-
- Posts: 1756
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
What OS?
What CPU?
What Flags?
What CPU?
What Flags?
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 12541
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: gcc4.8 outperforming gcc5, gcc6, gcc7
Windows 10, Windows 2012 ServerAndrewGrant wrote:What OS?
Intel and AMD
What CPU?
O3, pgo and the typical flag set. Something I always add that I rarely see others use is:
What Flags?
Code: Select all
ifeq ($(comp),mingw)
CXXFLAGS += -mtune=native
endif
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.