[Mesa-dev] [PATCH 05/12] gallivm: Use LLVM global context.

Mathias Fröhlich Mathias.Froehlich at gmx.net
Tue May 13 21:57:04 PDT 2014


Hi Jose,

On Tuesday, May 13, 2014 08:16:34 Jose Fonseca wrote:
> I tweaked the comment (was below) but indeed did a poor job.  I think I'll just put the original back:
> 
>    "We must never free LLVM contexts, because LLVM has several global caches
>    which pointing/derived from objects owned by the context, causing false
>    memory leaks and false cache hits when these objects are destroyed."

I have not actually tested your current patch series,
but I am wondering if you expect this to be thread safe then
in the sense that multiple compilations from disjoint OpenGL
contexts running in the same application in different but
concurrent threads are run?

Up to now this is a problem that strikes me with an application here.
For example every openscenegraph viewer based application driving
multiple contexts from a single program suffers from this problem
as they are just crashing on startup when multiple contexts
in their threads compile their shaders. Flightgear is one such example.
Also I know a guy who is working in medical visualization who is
frequently asking me about llvmpipe getting thread safe in this sense.

Given the documentation about LLVM contexts I would expect this to
crash?

I have provided a patch some time ago that uses a struct gallivm_state
private allocated LLVM context. That one runs fine with the applications
in question and also it survived a piglit run without regressions.
Did you see this review request?

So, I really would like to have this problem solved.

thanks

Mathias



More information about the mesa-dev mailing list