Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create toolset optimized for quick compiling Godot (SIMD, PGO, LTO and etc) #11431

Open
dustdfg opened this issue Dec 27, 2024 · 3 comments
Open

Comments

@dustdfg
Copy link

dustdfg commented Dec 27, 2024

This proposal is created mainly to store all my findings during testing my mvp but also discuss with others

Describe the project you are working on

Godot itself

Describe the problem or limitation you are having in your project

Slow compilation times

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I am proposing to compile LLVM version sharpened for compiling Godot

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I've already wrote first automated mvp: https://github.com/dustdfg/godot-devkit. But in short:

  1. Compile instrumented LLVM version
  2. Compile Godot with instrumented LLVM version (to gather profiling data)
  3. Compile optimized LLVM (for building Godot) using profiling data from previous step

Pre-compiled binary version, please test

  1. mvp-1.0 compiled in fedora 41. Should work if you install all packages required for building godot and additionally clang + lld
@dustdfg
Copy link
Author

dustdfg commented Dec 27, 2024

DISCLAIMER: All the facts stored here had place in reality but should be checked more thoroughly

Fact database:

  1. Full LTO + IR + CSIR gives roughly the same results as Thin LTO + IR + CSIR
  2. Full LTO + IR gives roughly the same results as Full LTO + IR + CSIR
  3. Max achieved performance gain 30.3%
  4. As I heard Android NDK is already compiled with PGO (not targeting Godot but general purpose) + BOLT. (It is unlike that without BOLT we can achieve the same performance as pre-compiled llvm which is also should be hard to build)
  5. LLVM's Polly is doing bad. Polly + Full LTO + IR + CSIR is worse than Full LTO + IR + CSIR :(
    (If you are reading this you should also know it didn't improve Godot's performance too)

@dustdfg
Copy link
Author

dustdfg commented Dec 27, 2024

TODO:

  • BOLT
    • I don't have enough RAM (70GB) and cpu time
  • Google propeller
    • In comparison to BOLT it is something like Thin LTO in comparison to Full LTO. It requires to build custom llvm provided by google
  • Other host architectures support
    • Main problem is that you need to run Instrumented LLVM for gathering profile which is possible only on the same architecture)
  • Other target architectures
    • Compiling LLVM with support for another target arch is relatively easy just adding one string to options. The problem is that you won't be able to successfully compile Godot then without sysroot. We can try godots buildroot for sysroot but I am not sure...
    • It should be easy for web so its currently WIP
  • Investigate performance impact of compiling several optimized target architectures (in one clang build) on each other
  • Other tools
    • python, ninja, mold)
  • Make it work in other distros
    • We need sysroot here?

...

@dustdfg
Copy link
Author

dustdfg commented Dec 27, 2024

Other target architectures
* Compiling LLVM with support for another target arch is relatively easy just adding one string to options. The problem is that you won't be able to successfully compile Godot then without sysroot. We can try godots buildroot for sysroot but I am not sure...

@hpvb What do you think about? buildroot is enough complete to be used as sysroot?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants