It actually works just fine (IIRC), but occasionally breaks when people do silly things :)
I believe you just need to enable LLVM_ENABLE_THREADS in the config.
It actually works just fine (IIRC), but occasionally breaks when people do silly things :)
I believe you just need to enable LLVM_ENABLE_THREADS in the config.
The LLVM Context is the unit of isolation between threads. For instance the multi-threaded ThinLTO optimizer/codegen will use one LLVM Context per-thread, and so each thread is processing a single Module / TU.
The issue for concurrency is fairly deep in LLVM (use-lists, constant stored uniquely in context, etc.) that would make it really difficult to address intra-module parallelism.
MLIR for example is designed with this in mind and the pass-manager is already multi-threaded at every level of nesting (function passes would runs on two functions of the same Module in parallel). This is causing other complication/inefficiency in the infrastructure, I'm still not sure how much it is a good tradeoff, we'll see...