Author Topic: i686 vs Pentium 4  (Read 14464 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: i686 vs Pentium 4
« Reply #15 on: March 09, 2022, 04:31:58 pm »
Hi Dave!

That is strange, is it repeatable?

Hmm, maybe the approach I took to implementing the various -march and -mtune settings was incorrect: I included those in the main makefile as part of the CFLAGS line.

So now I've re-ran, having cleaned-up the CFLAGS and used the CLI make call with the XCFLAGS instead.

1) AMD optimized
Code: [Select]
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 14098
Total time (secs): 14.098000
Iterations/Sec   : 85118.456519
Iterations       : 1200000
Compiler version : GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)
Compiler flags   : -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=amdfam10 -mtune=amdfam10 -DPERFORMANCE_RUN=1  -lpthread
Parallel PThreads : 6

...crc stuff SNIPPED...

Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 85118.456519 / GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=amdfam10 -mtune=amdfam10 -DPERFORMANCE_RUN=1  -lpthread / Heap / 6:PThreads

2) AMD generic
Code: [Select]
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 18324
Total time (secs): 18.324000
Iterations/Sec   : 98231.827112
Iterations       : 1800000
Compiler version : GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)
Compiler flags   : -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=amdfam10 -mtune=generic -DPERFORMANCE_RUN=1  -lpthread
Parallel PThreads : 6

...crc stuff SNIPPED...

Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 98231.827112 / GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=amdfam10 -mtune=generic -DPERFORMANCE_RUN=1  -lpthread / Heap / 6:PThreads

3) PENTIUM4 optimized
Code: [Select]
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 14391
Total time (secs): 14.391000
Iterations/Sec   : 83385.449239
Iterations       : 1200000
Compiler version : GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)
Compiler flags   : -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=pentium4 -mtune=pentium4 -DPERFORMANCE_RUN=1  -lpthread
Parallel PThreads : 6

...crc stuff SNIPPED...

Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 83385.449239 / GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=pentium4 -mtune=pentium4 -DPERFORMANCE_RUN=1  -lpthread / Heap / 6:PThreads

4) PENTIUM4 generic
Code: [Select]
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 19648
Total time (secs): 19.648000
Iterations/Sec   : 91612.377850
Iterations       : 1800000
Compiler version : GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)
Compiler flags   : -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=pentium4 -mtune=generic -DPERFORMANCE_RUN=1  -lpthread
Parallel PThreads : 6

...crc stuff SNIPPED...

Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 91612.377850 / GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=pentium4 -mtune=generic -DPERFORMANCE_RUN=1  -lpthread / Heap / 6:PThreads

In both architecture cases, the "generic" option produces a better results as compared to CPU specific tune, this is not a good outcome, as you said, maybe a compiler bug?

On my AMD CPU, the AMD -march gives a better result than P4 (which is to be expected).

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: i686 vs Pentium 4
« Reply #16 on: March 09, 2022, 05:57:30 pm »
Does seem like a compiler bug. Try with only -march=amdfam10 as the -mtune=amdfam10 is redundant and might be the problem, -mtune is implied to be the same as -march if it is not stated.
Also try -march=native.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: i686 vs Pentium 4
« Reply #17 on: March 09, 2022, 08:27:54 pm »
Try with only -march=amdfam10 as the -mtune=amdfam10 is redundant and might be the problem, -mtune is implied to be the same as -march if it is not stated.
Also try -march=native.

1) amdfam10
Code: [Select]
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 14149
Total time (secs): 14.149000
Iterations/Sec   : 84811.647466
Iterations       : 1200000
Compiler version : GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)
Compiler flags   : -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=amdfam10 -DPERFORMANCE_RUN=1  -lpthread
Parallel PThreads : 6

Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 84811.647466 / GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=amdfam10 -DPERFORMANCE_RUN=1  -lpthread / Heap / 6:PThreads

2) pentium4
Code: [Select]
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 14515
Total time (secs): 14.515000
Iterations/Sec   : 82673.096796
Iterations       : 1200000
Compiler version : GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)
Compiler flags   : -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=pentium4 -DPERFORMANCE_RUN=1  -lpthread
Parallel PThreads : 6

Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 82673.096796 / GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=pentium4 -DPERFORMANCE_RUN=1  -lpthread / Heap / 6:PThreads

3) native
Code: [Select]
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 15119
Total time (secs): 15.119000
Iterations/Sec   : 79370.328725
Iterations       : 1200000
Compiler version : GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)
Compiler flags   : -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=native -DPERFORMANCE_RUN=1  -lpthread
Parallel PThreads : 6

Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 79370.328725 / GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=native -DPERFORMANCE_RUN=1  -lpthread / Heap / 6:PThreads

Looks to me like -mtune is still doing something...

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: i686 vs Pentium 4
« Reply #18 on: March 10, 2022, 03:13:31 pm »
I hit the GCC bug forum in an attempt to find any known issues with mtune optimization logic for the amdfma10 processors. While nothing obvious jumped out, I did do some pretty extensive reading on a couple of general "optimization logic" bug threads:

1) Bug 81616 - Update -mtune=generic for the current Intel and AMD processors  (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81616)

2) GCC buglist with "amdfam10" filter (https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=amdfam10)

Also came across this decent post on the relationship between march and mtune => https://lemire.me/blog/2018/07/25/it-is-more-complicated-than-i-thought-mtune-march-in-gcc/, great info in the discussion section actually.

So here is the kicker, it would appear (juding by the performance tests these teams were running) that best performance results were obtained when using the mtune=K8 option on the amdfam10 architecture. Hmm....strange I thought, b/c K8 is an older architecture and the Phenom (in my case) really did not introduce new features, other than basically an updated memory controller and L3 cache (more than doubled – from 2MB to 6MB). Not sure if there are any actual instrution set differences.

Anyways, alright, so I'm already trying this out, why not give this new combo a whirl?

Code: [Select]
2K performance run parameters for coremark.
CoreMark Size    : 666
Total ticks      : 18130
Total time (secs): 18.130000
Iterations/Sec   : 99282.956426
Iterations       : 1800000
Compiler version : GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00)
Compiler flags   : -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=amdfam10 -mtune=k8 -DPERFORMANCE_RUN=1  -lpthread
Parallel PThreads : 6

Correct operation validated. See README.md for run and reporting rules.
CoreMark 1.0 : 99282.956426 / GCC9.2.0 20190812 (OS/2 RPM build 9.2.0-5.oc00) -O2 -DMULTITHREAD=6 -DUSE_PTHREAD -march=amdfam10 -mtune=k8 -DPERFORMANCE_RUN=1  -lpthread / Heap / 6:PThreads

Wow...so that's a pretty significant difference: 99282.956426 (mtune=k8) vs 84811.647466 (no mtune).

The differences narrow down significantly when looking at tuned results: 99282.956426 (mtune=k8) vs 98231.827112 (mtune=generic).

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: i686 vs Pentium 4
« Reply #19 on: March 12, 2022, 05:02:20 am »
Some interesting stuff there. Seems the GCC documentation is lacking. Playing more here, I found that -march=sandybridge crashes unless I add -mno-avx, which is not needed for -march=native and I also seem to get the best performance with -mtune=generic though it is only slightly better then native. The output of -Q --help=target is interesting too. Something like,
Code: [Select]
gcc -march=native -Q --help=target > march_native.txt
gcc -march=sandybridge -Q --help=target > march_sandybridge.txt
diff -u march_native.txt march_sandybridge.txt
shows the small differences.
At least we've established that on some (most?) CPU's, the -mtune=generic seems to result in a positive result.
You might want to try the latest Firefox I uploaded to Bitbucket, built with -march=pentium4 -mtune=generic. I have builds of SM and TB but Bitbucket stopped letting me upload. That Firefox has intree NSPR4 and NSS and seems stabler due to it. If you prefer the DLLs can be removed so the system installed ones are used.

Eugene Tucker

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +12/-0
    • View Profile
Re: i686 vs Pentium 4
« Reply #20 on: March 12, 2022, 03:21:05 pm »
Bitbucket will not let one access your Seamonkey and Thunderbird builds as well, The seem to have shut down the page.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: i686 vs Pentium 4
« Reply #21 on: March 12, 2022, 05:00:18 pm »
Did you try at https://bitbucket.org/dryeo/cc-os2/downloads/, it is the page I created when Bitbucket deleted all the repositories using Mercurial.
Also Firefox is at [url]https://bitbucket.org/dryeo/mozilla-os2/downloads//url]
Seems our old builds don't work there anymore, I had to use the simplebrowser to access.

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: i686 vs Pentium 4
« Reply #22 on: March 12, 2022, 06:25:42 pm »
Dave,

...The output of -Q --help=target is interesting too. Something like,
Code: [Select]
gcc -march=native -Q --help=target > march_native.txt
gcc -march=sandybridge -Q --help=target > march_sandybridge.txt
diff -u march_native.txt march_sandybridge.txt

Hmm...OK, this simple gcc call does NOT work on my machine...which perhaps implies I have something else wrong? lol

Here is what I get (I won't post the whole thing, but it's about 200 lines of the same repeated error message until the very end):

Code: [Select]
{standard input}: Assembler messages:
{standard input}:1: Error: no such instruction: `the following options are target specific:'
{standard input}:2: Error: junk at end of line, first unrecognized character is `-'
{standard input}:3: Error: junk at end of line, first unrecognized character is `-'
...
{standard input}:183: Error: no such instruction: `known assembler dialects (for use with the -masm=option):'
{standard input}:184: Error: no such instruction: `att intel'
{standard input}:186: Error: no such instruction: `known ABIs (for use with the -mabi=option):'
{standard input}:187: Error: no such instruction: `ms sysv'
{standard input}:189: Error: no such instruction: `known code models (for use with the -mcmodel=option):'
{standard input}:190: Error: junk at end of line, first unrecognized character is `3'
{standard input}:192: Error: no such instruction: `valid arguments to -mfpmath=:'
{standard input}:193: Error: junk at end of line, first unrecognized character is `3'
{standard input}:195: Error: no such instruction: `known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return=options):'
{standard input}:196: Error: no such instruction: `keep thunk thunk-extern thunk-inline'
{standard input}:198: Error: no such instruction: `known choices for return instrumentation with -minstrument-return=:'
{standard input}:199: Error: junk `nop5' after expression
{standard input}:201: Error: no such instruction: `known data alignment choices (for use with the -malign-data=option):'
{standard input}:202: Error: no such instruction: `abi cacheline compat'
{standard input}:204: Error: no such instruction: `known vectorization library ABIs (for use with the -mveclibabi=option):'
{standard input}:205: Error: no such instruction: `acml svml'
{standard input}:207: Error: no such instruction: `known address mode (for use with the -maddress-mode=option):'
{standard input}:208: Error: no such instruction: `long short'
{standard input}:210: Error: no such instruction: `known preferred register vector length (to use with the -mprefer-vector-width=option):'
{standard input}:211: Error: junk at end of line, first unrecognized character is `1'
{standard input}:213: Error: no such instruction: `known stack protector guard (for use with the -mstack-protector-guard=option):'
{standard input}:214: Error: no such instruction: `global tls'
{standard input}:216: Error: no such instruction: `valid arguments to -mstringop-strategy=:'
{standard input}:217: Error: no such instruction: `byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop'
{standard input}:218: Error: no such instruction: `vector_loop'
{standard input}:220: Error: no such instruction: `known TLS dialects (for use with the -mtls-dialect=option):'
{standard input}:221: Error: no such instruction: `gnu gnu2'
{standard input}:223: Error: no such instruction: `known valid arguments for -march=option:'
{standard input}:224: Error: no such instruction: `i386 i486 i586 pentium lakemont pentium-mmx winchip-c6 winchip2 c3 samuel-2 c3-2 nehemiah c7 esther i686 pentiumpro pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm intel geode k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 generic native'
{standard input}:226: Error: no such instruction: `known valid arguments for -mtune=option:'
{standard input}:227: Error: no such instruction: `generic i386 i486 pentium lakemont pentiumpro pentium4 nocona core2 nehalem sandybridge haswell bonnell silvermont goldmont goldmont-plus tremont knl knm skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake intel geode k6 athlon k8 amdfam10 bdver1 bdver2 bdver3 bdver4 btver1 btver2 znver1 znver2'

At first I thought maybe this was a session related thing...so I even tried bash, but same result.

Any idea what my gcc is choking on here???

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: i686 vs Pentium 4
« Reply #23 on: March 12, 2022, 07:27:09 pm »
Perhaps picking up an OS/2 command instead of a *nix command? My PATH starts with (W: is UNIXROOT) W:\usr\libexec\bin and I also had to move \os2\print.com out of the way. Look in popuplog.os2 for print.com or similar crashes. My output starts with,
Code: [Select]
The following options are target specific:
  -m128bit-long-double                  [disabled]
  -m16                                  [disabled]
  -m32                                  [enabled]
  -m3dnow                               [disabled]
  -m3dnowa                              [disabled]
  -m64                                  [disabled]
  -m80387                               [enabled]
  -m8bit-idiv                           [disabled]
  -m96bit-long-double                   [enabled]
  -mabi=                                sysv
and is about 228 lines, 10095 bytes.