Announcement

Collapse
No announcement yet.

GCC 12 Profile Guided Optimization Benchmarks With The AMD Threadripper 3990X

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GCC 12 Profile Guided Optimization Benchmarks With The AMD Threadripper 3990X

    Phoronix: GCC 12 Profile Guided Optimization Benchmarks With The AMD Threadripper 3990X

    Last month I ran a number of GCC 12 compiler optimization benchmarks for this latest-stable compiler atop an AMD Ryzen Threadripper 3990X workstation. Those tests included various optimization levels as well as link-time optimizations (LTO). Some Phoronix Premium supporters also requested to see some fresh GCC 12 Profile Guided Optimization (PGO) benchmarks, so here in this article are those PGO benchmark results...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    maybe one day we'll see pgo for linux kernel and some amazing benchmarks with lto+pgo

    Comment


    • #3
      That's some nice benefit.

      I do wonder just how much of it could be gained by manually adding a few function attributes[1] and builtin functions[2], like __builtin_expect(), in well-chosen spots. Otherwise, GCC has no idea how hot a loop, function, or condition is.
      1. https://gcc.gnu.org/onlinedocs/gcc-1...ion-Attributes
      2. https://gcc.gnu.org/onlinedocs/gcc-1...Other-Builtins

      Comment


      • #4
        Originally posted by coder View Post
        That's some nice benefit.

        I do wonder just how much of it could be gained by manually adding a few function attributes[1] and builtin functions[2], like __builtin_expect(), in well-chosen spots. Otherwise, GCC has no idea how hot a loop, function, or condition is.
        1. https://gcc.gnu.org/onlinedocs/gcc-1...ion-Attributes
        2. https://gcc.gnu.org/onlinedocs/gcc-1...Other-Builtins
        Lets make a C JIT compiler so that it can find out in real time what code is hot amirite? it could also apply optimizations for the system its running on.

        Comment


        • #5
          Originally posted by espi View Post
          Lets make a C JIT compiler so that it can find out in real time what code is hot amirite? it could also apply optimizations for the system its running on.
          I guess there's a bit of a packaging problem, since you'd need all the build dependencies. Not to mention the lack of buildsystem standards. And how fast a C or C++ codebase compiles is hugely variable, ranging from almost-JIT to not-remotely-close.

          It's not as if you can just concatenate all the source files, either. That would break static, plus various things people do with the preprocessor.

          Comment


          • #6
            Originally posted by polluktus View Post
            maybe one day we'll see pgo for linux kernel and some amazing benchmarks with lto+pgo
            Has anyone ever attempted it recently? I feel like I remember back in the early gcc 9 or 10 days someone tried it and there were problems or it just didn't work.

            Comment


            • #7
              Originally posted by kozman View Post

              Has anyone ever attempted it recently? I feel like I remember back in the early gcc 9 or 10 days someone tried it and there were problems or it just didn't work.
              i was using https://gitlab.com/torvic9/linux513-...pgo-kees.patch with 5.13 and cfi. Didn't do any benchmarks, but it worked. But currently i dont think anyone is still working on it.

              Comment


              • #8
                Originally posted by kozman View Post
                Has anyone ever attempted it recently? I feel like I remember back in the early gcc 9 or 10 days someone tried it and there were problems or it just didn't work.
                We should have LTO with GCC first

                Comment


                • #9
                  Yeah at the moment kernel can only be compiled lto with clang. Which is funny because for a long time clang didnt compile kernel. Also we have gcc extensions being used in the kernel. So they would not work with clang? Weird situation.
                  Anyway.
                  is the primary optimization of pgo perhaps branch prediction? Because c++ supports branch prediction hints now. And C does as well. What other major optimizations would pgo have that cant be done manually. I think pgo is DOA and we just need more standardized attributes to give the compiler hints. Oh theres cache lining hints as well i believe in c++ now.

                  Comment


                  • #10
                    I recently went down this rabbithole with Rust, and it's interesting!

                    See their blog post at https://blog.rust-lang.org/inside-ru...-compiler.html and their documentation https://doc.rust-lang.org/rustc/prof...imization.html

                    Comment

                    Working...
                    X