• DevelopmentTooling
  • Call for testers of Ryzen 1000 and 2000 owners to test AVX2 optimized libs

A recent change to glibc in this week's sync allowed AMD Ryzen processors to use the AVX2 (haswell) optimized libs in /usr/lib64/haswell across the system.

So far this has only been tested on zen2 (Ryzen 3000) with results being good. A technical difference in the architecture of zen1 /1+ means that they may not receive the same benefit as the zen2 CPUs.

To test:

  1. Verify you are using the haswell libs: run ldd /usr/bin/id and verify that /usr/lib64/haswell/libc.so is being loaded (as opposed to /usr/lib64/libc.so).

  2. Install the phoronix-test-suite (sudo eopkg it phoronix-test-suite) and run the glibc and R benchmarks. Make sure R is installed if you don't use it (sudo eopkg it r).

phoronix-test-suite run-test pts/glibc-bench
phoronix-test-suite run-test pts/rbenchmark

  1. Install an old version of glibc which does not allow use of the optimized AVX2 libs on Ryzen processors and run the glibc and R benchmarks again.

sudo eopkg it https://packages.getsol.us/shannon/g/glibc/glibc-2.29-59-1-x86_64.eopkg

  1. Upload the results to openbenchmarking.org and link the results here. Reinstall glibc when you are done ( sudo eopkg it --reinstall glibc). sin/cos/sincos/log2 should see the biggest uplift in glibc and R should hopefully see a decent uplift from using the haswell optimized openblas.

The most important thing is to verify that performance is not being regressed on these zen1 CPUs.

    joebonrichie Anyway you could explain to me, a newbie (since i use the first gen ryzen cpu) ,how much can this affect performance for our cpus ? Because i see your point and appreciate it but i am not that experienced to try your suggestions and see the difference myself. Has anyone tried it yet?
    Edit: Only thing i thought i knew was that haswell was intel thing, so its much more confusing 😅

      laky Every X86 CPU supports a subset of all of the possible X86 Instructions. Over time, new instructions are added which perform certain operations more efficiently in hardware. For compatibility sake, all CPUs before AMD Zen and Intel Haswell are guaranteed to be compatible with all of the instructions available on the Core 2 series of CPUs. We compile all software on Solus with the Core 2 instruction sets for compatibility.

      However, Intel submitted a change a few years back to ld, which is responsible for determining which libraries are loaded when you run an application. This change allows ld to use optimized libraries if they are available for your CPU. This allows us to compile some libraries a second time, but for compatibility with the newer instructions included with Haswell CPUs. Conveniently, Zen 1 is compatible with the Haswell-supported instruction sets, and represents the first AMD CPU which is mostly compatible with an Intel CPU since Core 2. @joebonrichie added a further patch to ld which allows these Haswell optimized libraries to also be used by Zen 1 or newer CPUs, even though they aren't detected normally as Haswell-compatible. In certain situations, this allows Zen-based AMD CPUs to perform much faster than when running the default Core 2 libraries.

        DataDrake Actually read all of it and now it makes perfect sense , what would people say to all of this? Hmm.. If it aint broken don't fix it ! 🙂 Tnx for lighting it up !

          Justin The fact that the best game of the last decade was about a man riding his horse and doing business along the way is good enough for me to say yes ! Also horses are good company. 🙂
          Edit: Wait he is not a man, he is a Witcher! ...toss a coin to your witcher...

          Hey ! User of a Ryzen 2600 here. I would like to help you, but when I put the ldd /usr/bin/id in a terminal I got this output :
          linux-vdso.so.1 (0x00007ffff7773000)
          libc.so.6 => /usr/lib/haswell/libc.so.6 (0x00007fc8c638c000)
          /usr/lib64/ld-linux-x86-64.so.2 (0x00007fc8c659e000)

          So as written, my lib64 is no the Haswell one that Joebonrichie talk about, buut if I understood well what Datadrake say after, it's 32 bit stuff so I should read the line above wich mention Haswell, isn't it ? As you can see I'm not quite a power user.
          Thus, if you can confirm that I've got the good configuration, I can run the test for you.

            Flo That's exactly what you should see, one or more libraries from /usr/lib/haswell or /usr/lib64/haswell.

            Flo if I understood well what Datadrake say after, it's 32 bit stuff

            No, Haswell and Core 2 are both 64-bit. Haswell supports newer instruction sets like AVX and AVX2. You won't see that just from ldd or similar.

            • [deleted]

            • Edited

            Output of ldd /usr/bin/id :

            linux-vdso.so.1
            	libc.so.6 => /usr/lib/haswell/libc.so.6
            	/usr/lib64/ld-linux-x86-64.so.2

            Running phoronix-test-suite run-test system/glibc-benchmark gave me an error "[PROBLEM] Invalid Argument: system/glibc-benchmark", found something that looked like it, in the pts/glibc-bench folder which i then ran.

            Ryzen 2700 results:

              [deleted] Thanks for running the benchmark! Looks like results are good and are in-line with my zen2 results. Looks like there is a slight regression for the exp test though? On my system exp was 4.2% faster, could just be an anomaly.

              You're right, it is pts/glibc-benchmark but I can't seem to be able to edit my post.

                • [deleted]

                Ran the exp test again to confirm, and added the log2 test i forgot.

                exp test with glibc-2.29-61: 5.93862
                exp test with glibc-2.29-59: 5.86829

                log2 test with glibc-2.29-61: 5.06039
                log2 test with glibc-2.29-59: 6.83329

                For anyone else who is testing, i had to run: phoronix-test-suite run-test pts/glibc-bench

                i'll have a look into fixing the performance regression for exp on zen1, kind of difficult as it faster for me on zen2. Thanks again for running the tests.

                Hi there,

                Laptop: Huawei Matebook D Ryzen 2500U
                Specs:

                Output of ldd /usr/bin/id :
                linux-vdso.so.1 (0x00007fff216cf000)
                libc.so.6 => /usr/lib/haswell/libc.so.6 (0x00007f78c5d3a000)
                /usr/lib64/ld-linux-x86-64.so.2 (0x00007f78c5f3b000)

                Results using default Solus glibc: https://openbenchmarking.org/result/2003018-VE-GLIBCNEW179

                ** Results using default Solus r-benchmark:** Could not install r-benchmark (rbenchmark).

                ** Results using old glibc:** https://openbenchmarking.org/result/2003017-VE-GLIBCOLD177

                first results w default Solus libs; https://openbenchmarking.org/result/2003036-HU-TESTONE7872
                -r results with default solus libs: would not run

                older lib results: https://openbenchmarking.org/result/2003033-HU-OLDGLIB5124

                so, new libs were worse in exp, modf, sqrt, and moderately better in all others than the older libs.
                if these newer libs were put in in sync with this past Fridays update, can the change be what is causing screen tearing for me since the update when running any video full screen??

                  Hi, using default glibc: here and old glibc here tested on a Ryzen 2700X

                  Thanks guys. Good enough data to be confident that it's working as intended.

                  Made a typo for the r benchmark it should be pts/rbenchmark 😅

                  I can also make some tweaks to the toolchain to hopefully fix the exp, sqrt and modf small performance regressions some people were having.

                  Drewfus unfortunately i can't help you there, the changes to glibc wouldn't cause your screen tearing issues.

                  7 days later

                  A bit late to the party, but here are results for my Ryzen 5 2600X. Seems fairly consistent with the rest of the results.

                  As an aside, I think it is possible to get both benchmarks in the same report with the following:

                  $ phoronix-test-suite run-test pts/glibc-bench pts/rbenchmark
                  ...
                      Enter a name for the result file: glibc
                      Enter a unique name to describe this test run / configuration: glibc61
                  ...
                      Would you like to upload the results to OpenBenchmarking.org (y/n): n
                  
                  $ sudo eopkg it https://packages.getsol.us/shannon/g/glibc/glibc-2.29-59-1-x86_64.eopkg
                  $ phoronix-test-suite run-test pts/glibc-bench pts/rbenchmark
                  ...
                      Enter a name for the result file: glibc
                      Enter a unique name to describe this test run / configuration: glibc59
                  ...
                      Would you like to upload the results to OpenBenchmarking.org (y/n): y
                  $ sudo eopkg it --reinstall glibc

                  Of course, I figured that out after I had already performed, merged and uploaded the benchmarks.