[Mesa-dev] [PATCH] gallivm: fix build for LLVM 3.2

Jose Fonseca jfonseca at vmware.com
Tue Sep 30 14:25:54 PDT 2014


Brian,

Your patch looks good AFAICT.

Not sure why the crash, and I'm afraid I won't have time to look into it.

I think it might help to '#define USE_MCJIT 1' for now, ie, enable MCJIT for all LLVM versions .  We were avoiding it on old LLVM versions, but AFAICT there's no longer any reason to avoid it now, and it might simplify get things working again.

If things still don't work, then I think we should revert the recent LLVM changes, move them into a branch so we can investigate the issues with old LLVM more carefuly without blocking builds/tests on master.

Jose 


________________________________________
From: Brian Paul <brianp at vmware.com>
Sent: 30 September 2014 21:47
To: Mathias Fröhlich; mesa-dev at lists.freedesktop.org
Cc: Jose Fonseca
Subject: Re: [Mesa-dev] [PATCH] gallivm: fix build for LLVM 3.2

On 09/30/2014 02:40 PM, Mathias Fröhlich wrote:
>
> Hi Brian,
>
> On Tuesday, September 30, 2014 13:30:21 Brian Paul wrote:
>> Move the USE_MCJIT / HAVE_AVX determination logic to lp_bld.h.  If we
>> don't have MCJIT define a dummy LLVMMCJITMemoryManagerRef type to avoid
>> excessive #ifdef testing elsewhere.
> [...]
>> @@ -219,7 +188,7 @@ gallivm_free_code(struct gallivm_state *gallivm)
>>      assert(!gallivm->engine);
>>      lp_free_generated_code(gallivm->code);
>>      gallivm->code = NULL;
>> -#if HAVE_LLVM < 0x0306
>> +#if USE_MCJIT
> We will probably still need the < 0x0306 check:
> #if HAVE_LLVM < 0x0306 && USE_MCJIT
> since this memorymanager stuff just vanished in the way 3.5 implemented
> this with version 3.6.
>
>>      LLVMDisposeMCJITMemoryManager(gallivm->memorymgr);
>>      gallivm->memorymgr = NULL;
>>   #endif
>>
>
> Also, we will probably fail to compile the LLVMDisposeMCJITMemoryManager
> call under some configurations with MCJIT and older llvm.
> So, additionally to what you had, how about the attached one?
> I am still trying to verify this change against 3.5 and 3.6.
> I am not sure about 3.2 since it did not build out of the box with
> my configure line.

It compiles, but I get a segfault when I try to run anything:


Program received signal SIGSEGV, Segmentation fault.
0x00007ffff797a579 in DelegatingJITMemoryManager::setMemoryWritable
(this=0x6f5cb0) at gallivm/lp_bld_misc.cpp:165
165              mgr()->setMemoryWritable();
(gdb) where
#0  0x00007ffff797a579 in DelegatingJITMemoryManager::setMemoryWritable
(this=0x6f5cb0) at gallivm/lp_bld_misc.cpp:165
#1  0x00007ffff51579cc in (anonymous
namespace)::JITEmitter::startFunction (this=0x727b20, F=...) at
/build/buildd/llvm-3.2-3.2/lib/ExecutionEngine/JIT/JITEmitter.cpp:782
#2  0x00007ffff567e595 in (anonymous
namespace)::Emitter<llvm::JITCodeEmitter>::runOnMachineFunction
(this=0x75dd50, MF=...) at
/build/buildd/llvm-3.2-3.2/lib/Target/X86/X86CodeEmitter.cpp:145
#3  0x00007ffff501bbbf in runOnFunction (F=..., this=0x727980) at
/build/buildd/llvm-3.2-3.2/lib/VMCore/PassManager.cpp:1498
#4  llvm::FPPassManager::runOnFunction (this=0x727980, F=...) at
/build/buildd/llvm-3.2-3.2/lib/VMCore/PassManager.cpp:1476
#5  0x00007ffff501f2bb in llvm::FunctionPassManagerImpl::run
(this=0x6fc950, F=...) at
/build/buildd/llvm-3.2-3.2/lib/VMCore/PassManager.cpp:1449
#6  0x00007ffff501f396 in llvm::FunctionPassManager::run (this=0x6f5d20,
F=...) at /build/buildd/llvm-3.2-3.2/lib/VMCore/PassManager.cpp:1379
#7  0x00007ffff514e637 in llvm::JIT::jitTheFunction
(this=this at entry=0x6fc800, F=F at entry=0x769720, locked=...) at
/build/buildd/llvm-3.2-3.2/lib/ExecutionEngine/JIT/JIT.cpp:645
#8  0x00007ffff514ec2f in llvm::JIT::runJITOnFunctionUnlocked
(this=this at entry=0x6fc800, F=F at entry=0x769720, locked=...) at
/build/buildd/llvm-3.2-3.2/lib/ExecutionEngine/JIT/JIT.cpp:624
#9  0x00007ffff514ed89 in llvm::JIT::getPointerToFunction
(this=0x6fc800, F=0x769720) at
/build/buildd/llvm-3.2-3.2/lib/ExecutionEngine/JIT/JIT.cpp:681
#10 0x00007ffff7941c04 in gallivm_jit_function (gallivm=0x6f5a90,
func=0x769720) at gallivm/lp_bld_init.c:586
#11 0x00007ffff79b54d2 in generate_variant (lp=0x61f750,
shader=0x6fdd10, key=0x7fffffffd9a0) at lp_state_fs.c:2634
#12 0x00007ffff79b6a77 in llvmpipe_update_fs (lp=0x61f750) at
lp_state_fs.c:3166
#13 0x00007ffff79ac7bb in llvmpipe_update_derived (llvmpipe=0x61f750) at
lp_state_derived.c:186
#14 0x00007ffff7984562 in llvmpipe_draw_vbo (pipe=0x61f750,
info=0x7fffffffdcc0) at lp_draw_arrays.c:70
#15 0x00007ffff785c1d3 in cso_draw_vbo (cso=0x6b9260,
info=0x7fffffffdcc0) at cso_cache/cso_context.c:1418
#16 0x00007ffff771a373 in st_draw_vbo (ctx=0x7ffff7ec4010,
prims=0x6ab7c0, nr_prims=2, ib=0x0, index_bounds_valid=1 '\001',
min_index=0, max_index=161, tfb_vertcount=0x0, indirect=0x0) at
../../src/mesa/state_tracker/st_draw.c:285
#17 0x00007ffff76f7e3f in vbo_save_playback_vertex_list
(ctx=0x7ffff7ec4010, data=0x6ab3ec) at
../../src/mesa/vbo/vbo_save_draw.c:310
#18 0x00007ffff7524e18 in ext_opcode_execute (ctx=0x7ffff7ec4010,
node=0x6ab3e8) at ../../src/mesa/main/dlist.c:658
#19 0x00007ffff753b5db in execute_list (ctx=0x7ffff7ec4010, list=1) at
../../src/mesa/main/dlist.c:7692
#20 0x00007ffff7541f2b in _mesa_CallList (list=1) at
../../src/mesa/main/dlist.c:9121
#21 0x0000000000402e2d in draw () at gears.c:196
#22 0x00007ffff6ee1376 in processWindowWorkList (window=0x61b180) at
glut_event.c:1307
#23 0x00007ffff6ee232c in __glutProcessWindowWorkLists () at
glut_event.c:1358
#24 glutMainLoop () at glut_event.c:1379
#25 0x00000000004036ea in main (argc=1, argv=0x7fffffffe658) at gears.c:405

-Brian



More information about the mesa-dev mailing list