[Mesa-stable] [Mesa-dev] [PATCH 2/2] radeon/llvm: Initialize gallivm targets when initializing the AMDGPU target

Tom Stellard tom at stellard.net
Fri Sep 25 06:43:52 PDT 2015


On Fri, Sep 25, 2015 at 02:19:53PM +0200, Marek Olšák wrote:
> On Thu, Sep 24, 2015 at 6:32 PM, Tom Stellard <thomas.stellard at amd.com> wrote:
> > This fixes a race condition in the glx-multithreaded-shader-compile
> > test.
> >
> > CC: "10.6 11.0" <mesa-stable at lists.freedesktop.org>
> > ---
> >  src/gallium/drivers/radeon/radeon_llvm_emit.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
> > index 0002559..045665a 100644
> > --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
> > +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
> > @@ -25,6 +25,7 @@
> >   */
> >  #include "radeon_llvm_emit.h"
> >  #include "radeon_elf_util.h"
> > +#include "gallivm/lp_bld_misc.h"
> >  #include "util/u_memory.h"
> >  #include "pipe/p_shader_tokens.h"
> >
> > @@ -88,6 +89,7 @@ static void init_r600_target()
> >  {
> >         static unsigned initialized = 0;
> >         if (!initialized) {
> > +               gallivm_init_llvm_begin();
> >  #if HAVE_LLVM < 0x0307
> >                 LLVMInitializeR600TargetInfo();
> >                 LLVMInitializeR600Target();
> > @@ -101,6 +103,7 @@ static void init_r600_target()
> >
> >  #endif
> >                 initialized = 1;
> > +               gallivm_init_llvm_end();
> 
> BTW, this code can call the LLVM initialize functions twice, because 2
> threads can enter the (!initialized) branch at the same time. Perhaps
> gallivm_init_llvm_begin/end should be called outside the branch?
> 

Yes, it should. I will fix this.

> Marek
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list