[Mesa-dev] [PATCH] r600g-llvm: Crude fix for a race in initialization of the llvm backend
Tom Stellard
thomas.stellard at amd.com
Mon Aug 20 09:29:51 PDT 2012
On Sat, Aug 18, 2012 at 11:43:45AM +0200, Mathias Fröhlich wrote:
>
> 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.
>
This will work, but I would like to avoid instantiating the
AMDGPUTargetMachine directly in order to minimize the differences in the
code when the R600 backend is built as part of the LLVM libs.
-Tom
> 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