陳韋任 (Wei-Ren Chen)
2012-Oct-09 07:55 UTC
[LLVMdev] "Multithreaded LLVM" in "Writing an LLVM Pass"
On Tue, Oct 09, 2012 at 08:35:57AM +0100, David Chisnall wrote:> On 8 Oct 2012, at 18:26, Lu Mitnick wrote: > > > 1. Multiple threads handle different modules (Thread : Module = 1 : 1) > > or > > For ModulePasses, yes. > > > 2. Multiple threads handle one module (Thread : Module = N : 1) > > For FunctionPasses, yes. > > Note that this part is in the future work section, meaning that no one has done it yet. FunctionPasses are independent of each other when running on different functions, so it would be fairly simple to use something like libdispatch to optimise every function within a module independently. FunctionPasses are not (in theory) allowed to modify any module state outside of a function, so they should be able to be run concurrently.No one has done it yet? From [1], it seems parallel JIT is workable. Or I just misread the question? Regards, chenwj [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-January/046901.html -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
David Chisnall
2012-Oct-09 08:02 UTC
[LLVMdev] "Multithreaded LLVM" in "Writing an LLVM Pass"
On 9 Oct 2012, at 08:55, 陳韋任 (Wei-Ren Chen) wrote:> No one has done it yet? From [1], it seems parallel JIT is workable. > Or I just misread the question?Your citation refers to a proprietary program that was presented at EuroLLVM - their changes are not upstream. They are running multiple MCJIT instances in parallel, but they are completely independent - different modules and different LLVMContexts, and so passes are completely independent (unless they do something silly like have some mutable static variables). This is a completely unrelated problem. David
NAKAMURA Takumi
2012-Oct-09 08:04 UTC
[LLVMdev] "Multithreaded LLVM" in "Writing an LLVM Pass"
2012/10/9 陳韋任 (Wei-Ren Chen) <chenwj at iis.sinica.edu.tw>:> On Tue, Oct 09, 2012 at 08:35:57AM +0100, David Chisnall wrote: >> On 8 Oct 2012, at 18:26, Lu Mitnick wrote: >> >> > 1. Multiple threads handle different modules (Thread : Module = 1 : 1) >> > or >> >> For ModulePasses, yes. >> >> > 2. Multiple threads handle one module (Thread : Module = N : 1) >> >> For FunctionPasses, yes. >> >> Note that this part is in the future work section, meaning that no one has done it yet. FunctionPasses are independent of each other when running on different functions, so it would be fairly simple to use something like libdispatch to optimise every function within a module independently. FunctionPasses are not (in theory) allowed to modify any module state outside of a function, so they should be able to be run concurrently. > > No one has done it yet? From [1], it seems parallel JIT is workable. > Or I just misread the question?MachinePasses don't change llvm::Module nor llvm::Function. I think CodeGen could be prallelized. In contrast, as Chandler mentions, Modifying Instruction(s) might affect *hidden* state of globals, use-ref chain and refcount. I think "transaction" might be useful here, too. See also http://llvm.org/bugs/show_bug.cgi?id=2116
Tobias von Koch
2012-Oct-09 14:23 UTC
[LLVMdev] "Multithreaded LLVM" in "Writing an LLVM Pass"
Hi David, On 09/10/2012 09:02, David Chisnall wrote:> On 9 Oct 2012, at 08:55, 陳韋任 (Wei-Ren Chen) wrote: > >> No one has done it yet? From [1], it seems parallel JIT is workable. >> Or I just misread the question? > > Your citation refers to a proprietary program that was presented at EuroLLVM - their changes are not upstream. They are running multiple MCJIT instances in parallel, but they are completely independent - different modules and different LLVMContexts, and so passes are completely independent (unless they do something silly like have some mutable static variables). This is a completely unrelated problem.As one of the authors of that paper, I'd just like to add a few points here. We didn't make any changes to the LLVM code base, so the idea can be implemented with the standard LLVM infrastructure. But you're right, we are exploiting parallelism on a higher level than Lu suggested: we are indeed using completely separate JIT instances (of the old JIT, in fact) so the problem of dependences between passes doesn't occur. Tobias
Maybe Matching Threads
- [LLVMdev] "Multithreaded LLVM" in "Writing an LLVM Pass"
- [LLVMdev] "Multithreaded LLVM" in "Writing an LLVM Pass"
- [LLVMdev] "Multithreaded LLVM" in "Writing an LLVM Pass"
- Writing loop transformations on the right representation is more productive
- EuroLLVM'20 cancellation notice