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

Mathias Fröhlich Mathias.Froehlich at gmx.net
Thu Aug 16 10:44:53 PDT 2012


Hi,

> This is likely caused by the fact that the same LLVM Context is used
> for all threads.  Take a look at the comment starting at
> src/gallium/auxilary/gallivm/lp_bld_init.c:314
>
> You should be able to reproduce this error on llvmpipe as well.
> Creating a new LLVM Context for each thread should fix this.

I checked the suggestion, but: Are you sure?
I think we are using a new context for r* even per compile.
See radeon_setup_tgsi_llvm.c:1009.

I have spent some time now to look into this a little closer:
The observation is that some pass manager stuff is crashing usually.
Its from the addPassesToEmitFile call while setting up 
AMDGPUTargetMachine but if you lock just this it crashes mostly in 
LLVMAddPromoteMemoryToRegisterPass called from radeon_llvm_finalize_module.
Locking both with the same mutex appears to work for a few short tests.

Does this ring an other bell at the llvm guys?

Greetings

Mathias




More information about the mesa-dev mailing list