RobRich999 / Chromium_Clang

Chromium browser compiled with the Clang/LLVM compiler.
157 stars 10 forks source link

linux avx2 build fine tuning #18

Closed Paukan777 closed 2 years ago

Paukan777 commented 2 years ago

Hi! I just downloaded modified_files_avx2.zip and can't understand why do you turn off optimization for some third-party libs. Are these settings applicable for Linux builds?

RobRich999 commented 2 years ago

For Linux there will be a few changes in the compiler config.

depot_tools\chromium\src\build\config\compiler\BUILD.gn

Search for "-msse3" and modify the SIMD level accordingly. You could even just comment out the SIMD level and set your desired architecture via the "-march=" right above it. The minimum baseline archs for proper AVX2 support are haswell or x86-64-v3. Either will produce similar results.

Polly (if used) will have to be moved down a few lines. You want into under the else conditional instead of directly under if_win.

common_optimize_on_ldflags += [ "-Wl,-mllvm,-polly", "-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40", "-Wl,-mllvm,-polly-ignore-aliasing", "-Wl,-mllvm,-polly-invariant-load-hoisting", "-Wl,-mllvm,-polly-vectorizer=stripmine",

"-Wl,-mllvm,-pass-remarks-analysis=polly",

]

Likewise with the optimization cflags regarding Linux being under else instead of if_win.

The changes in libgav1 and zlib shunt back to default optimization level, so no big deal. Actually, you likely can ignore those two. I had to do those edits to circumvent a "common_optimize_on_cflags" duplication issue when setting additional specific cflags. I did not include those low-level LLVM tweaks as they can be a YMMV on performance or even successfully building Chromium.

The tflite library has certain SIMD code that currently fails to compile with AVX and higher, so those SIMD levels need to be explicitly disabled to build when modifying the project's overall SIMD levels.

Alex313031 commented 2 years ago

Oof this is kinda what I asked but for win