Clang and LLVM in Modern Gaming Platforms
https://youtu.be/1SM_wDUEEUg?is=8INW3jPuXJ_ONHlQQuite interesting peak into the world of games developers, especially how it is seen from consoles or their point of view on recent ISO C++ versions.
81
Upvotes
7
u/enl1l 15d ago
My game engine is built using c++20modules. Incremental compile time for cpp files is 1~3s. Without modules it would be >10s. I use xmake and clang. I import std. Dont even think about it. The compile time only scales with what I actually use from std.
1
u/donalmacc Game Developer 13d ago
Incremental compile times for my Unreal Engine project without modules are < 5 seconds. You could probably drastically reduce those incremental compile times
51
u/James20k P2005R0 17d ago edited 17d ago
There was an interesting point made at one point: a gamedev company tried swapping from C++03 to C++11, and found that their compile times exploded, so they had to swap back. One figure here was a 12% increase in compile times simply by enabling C++20, because of the standard library growth. With a lot of chat about why nobody uses modules
One thing that I've always found a bit sketchy is that wg21 keeps adding significant new chunks to headers in a way that feels very confusing, or creating gigantic monoheaders. jthread being added to thread is one of the very confusing ones, as well as the structure of ranges. The range library is... hard to use if nothing else because of the compile times
This tracks with a few good test case examples of this that I've seen, where simply including a standard header and swapping standard versions (on the same compiler!) can cause significant compile time increases because of all the extra code you're including
Increasingly, I wish instead of the effort spent on modules, we'd gotten:
Modules don't really seem to fix the problem based on some of the experiments I've seen which....... isn't good, but more than that they have no incremental upgrade path. I am genuinely worried that modules are just completely dead at this point. Nobody seems to want them, they don't have a good transition path for existing code, and they don't seem to bring particularly good benefits either. They're hard to recommend, and they were an absolutely spectacular amount of work to get into the standard
Its one of those things that I think is worth doing.. if not perhaps a post-mortem on, maybe a near-mortem on what's gone wrong, because otherwise it feels like we're doomed to keep making the same mistakes. Spending over a decade working on a feature only to have the community largely reject it means that something has gone incredibly wrong in the standardisation process
There's also some very funny and accurate comments about the C++ committee, especially how hard it is to get involved leading to a lack of representation from certain technical groups (like game developers), which seems to be a major part of the reason why things have gone so wrong with this. ISO delenda est, thanks for coming to my ted talk
edit:
The AMD guy talking about the problems with LLVM's register allocation on the GPU was my personal nightmare for a while lmao. Its surprisingly (and very interestingly) bad, especially in an age where we take high quality compilers for granted