[Mesa-dev] [PATCH] r600g-llvm: Crude fix for a race in initialization of the llvm backend

Mathias Fröhlich Mathias.Froehlich at gmx.net
Sat Aug 18 02:43:45 PDT 2012


Tom,

On Thursday, August 16, 2012 14:50:57 you wrote:
> Actually, I just noticed that the LLVM docs say that only one thread can
> access the target registry at a time:
> http://llvm.org/docs/doxygen/html/structllvm_1_1TargetRegistry.html#a0b078b4
> 68553a84ec2b9fd70e93f7b43
> 
> Also, I think we should be doing the target registry once per
> context rather than once per compile.
Yep, I think so too.

For the problem you mentioned, we can even avoid using the target registry 
here. This registry just only calls the usual constructor as far as I could 
see now. I have, during debugging this, now also tested just directly 
instantiating an AMDGPUTargetMachine instance directly on the stack without 
querying the target registry. this workes fine too.

So, when cleaning this up a little more, it might be an option to just 
instanciate our required target machine in context initialization.

But for today, this does not affect the problem I observe!
I have found a race that we trigger inside llvm's pass registry and that is 
the reason of the problem I observe at least.
I will post a patch for that in the next minutes.

Greetings

Mathias




More information about the mesa-dev mailing list