Announcement

Collapse
No announcement yet.

Benchmarking The Linux 5.19 Kernel Built With "-O3 -march=native"

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

  • #11
    Originally posted by birdie View Post
    Poor Gentoo users who have always insisted on building everything with -march=native. LOL.

    Oh, and the -O3 kernel is so much faster faster than -O2, the whole percent, and that's on a CPU with lavish L2/L3 caches. Wow. So many comments earlier, so much pain.
    Well, -O3 and -march=native don't necessarily jive. 3 will bloat your code up and native will say, "Dude, we live in the APU trailer park so we ain't got much cache", where 3 will go, "I didn't catch that. Did you say call up our dude unroll-loops? Right on, man."

    They can be like the Odd Couple of compiler flags.

    Personally, I compile my stuff with the one that Michael didn't test: -O2 -march=native (or -march=nzver2). I have a low cache 4650G APU so I stick with -O2.

    Michael Can you rerun that test with -O2 -march=native. I suspect it'll have a performance hit just like -O3 native. My speculation is the compiler isn't optimized for the tested CPU so -march=native could be the culprit.

    Comment


    • #12
      Originally posted by S.Pam View Post
      I'd like to see the same tests on slower cpus and especially Ryzens too.
      Since your google seems defect https://www.phoronix.com/scan.php?pa...ber-Zen-3-Perf there you go.

      Comment


      • #13
        Originally posted by phoronix View Post
        Phoronix: Benchmarking The Linux 5.19 Kernel Built With "-O3 -march=native"

        Following the upstream discussions over -O3'ing the Linux kernel last month I ran some fresh benchmarks of the Linux kernel built with -O2 versus -O3. After the -O3 optimized kernel build results weren't too impressive, a number of Phoronix readers were virtually shouting that "-O3 -march=native" is where it's at for fun and performance... To appease those, here are those numbers...

        https://www.phoronix.com/scan.php?pa...3-March-Native
        Would you be able to add -O2 -march=native next time? That's generally what I use (to be on the safe side, but have it optimized for my system). I'm wonder what those results would be like, as for me the results are better in most cases, but not always.

        Comment


        • #14
          The kernel as a project is quite special in regards to code and optimizations, it's written with -O2 in mind and with inline assembly. That it behaves badly with -O3 doesnt mean that every codebase will behave badly with it.

          Comment


          • #15
            Originally posted by blae View Post
            it's written with -O2 in mind
            Thats new, how would I write code with -O2 in mind? Do you have a link or an example?

            Comment


            • #16
              It's what ends up in CFLAGS by default, stop it with the bad faith replies

              Comment


              • #17
                > No other changes were made to the system besides rebuilding the same Linux kernel and same Kconfig otherwise with the different KCFLAGS.

                So imperfect Alder Lake support in GCC 11 even more fucked-up by kernels own assumption about generic tune?
                There is special patch for -march=native https://github.com/graysky2/kernel_compiler_patch

                The article should have title "How badly you can break your kernel build using random compiler optimizations."
                And the conclusion "As you can see FPS didn't changed, so no difference and you shouldn't be triggered if someone else using different compiler options than you do."

                Comment


                • #18
                  Could be interesting to see a follow-up with a Zen3 5950X CPU w/-march=native & -O2/-O3?

                  Comment


                  • #19
                    Originally posted by Anux View Post
                    Thats new, how would I write code with -O2 in mind? Do you have a link or an example?
                    For example, you keep a toy oxygen molecule on your desk and stare at it all the time.

                    Comment


                    • #20
                      Originally posted by skeevy420 View Post

                      Personally, I compile my stuff with the one that Michael didn't test: -O2 -march=native (or -march=nzver2). I have a low cache 4650G APU so I stick with -O2.
                      Coming from a time when a 68020 had a gigantic 256 bytes of instruction cache it is funny to think of 8 MiB LLC as tiny now.

                      btw I own a 4650G, too, and it is a really nice powersaving APU. Experimenting with -Os -O2 -O3 -march=native and both gcc and clang it depends heavily on each of your C functions which option is best. However I start with -O2 -march=native and then looking for bottle necks to optimize.

                      Comment

                      Working...
                      X