[LLVMdev] Running Pool Allocated programs
xavier
llvmdev at yahoo.com
Sat Apr 2 17:58:44 PST 2005
Thanks Chris! That was causing me some confusion. Now it's producing a more meaningful output:
poolinit((&l2_GlobalPool), 4u, 4u);
poolinit((&l2_GlobalPool1), 4u, 4u);
l5_tmp_2E_0_2E_i = poolalloc((&l2_GlobalPool), 4u);
l6_tmp_2E_7_2E_i2 = l1_makeList((&l2_GlobalPool1), 0);
*(&((struct l_struct_2E_list *)l5_tmp_2E_0_2E_i)->field0) = l6_tmp_2E_7_2E_i2;
However, if I am understanding correctly, the first node is being allocated in one pool (that was
malloc with the other heuristic) and the rest are being allocated in a differente pool. But why?
Why not all the nodes are being allocated in one pool?
Also, in your other response you said:
>> The AllNodes heuristic is the only one that is substantially tested. I
>> would recommend it, none of the others have any significant performance
>> benefit anyway.
Is that still right or you meant that only SelectivePA is the only substantially tested?
--Ricardo
P.S. BTW, SelectivePA does not appear as an option when you do
opt -load ~/llvmdbg/installed/lib/libpoolalloc.so --help
and I could not find any reference in the source code (Heuristic.{h,cpp})
May I assume that is a new heuristic or you are referring to one of the current ones?
-poolalloc-heuristic - Heuristic to choose which nodes to pool allocate
=AllNodes - Pool allocate all nodes
=AllButUnreachableFromMemory - Pool allocate all reachable from memory objects
=CyclicNodes - Pool allocate nodes with cycles
=SmartCoallesceNodes - Use the smart node merging heuristic
=AllInOneGlobalPool - Use pool library as replacement for malloc/free
=OnlyOverhead - Do not pool allocate anything, but induce all
overhead from it
=NoNodes - Do not pool allocate anything
--- Chris Lattner <sabre at nondot.org> wrote:
> On Sat, 2 Apr 2005, Ricardo wrote:
> > After applying the PA to it, the output is something like this:
> ...
>
> > My question is: why is this malloc necessary?
> > ltmp_2_5 = malloc(4u);
>
> > Shouldn't be the result a program with this malloc replaced by poolalloc?
> > Should I include a special flag to achieve this?
>
> Ah, sorry, my memory was wrong. The default is to perform the
> "SelectivePA" optimization. Since pool allocation detected that there is
> no point in putting a single allocation into a pool, it left it a malloc.
> If you really want it to be a in a pool, pass
> -poolalloc-heuristic=AllNodes to opt.
>
> Sorry for the confusion!
>
> -Chris
>
> > I am using this line:
> > opt -load ~/llvm/install/lib/libpoolalloc.so -poolalloc
> > and also with -pooloptimize
> >
> > Thanks in advance
> >
> >
> >
> >
> > --- Chris Lattner <sabre at nondot.org> wrote:
> >
> >> On Sat, 2 Apr 2005, Ricardo wrote:
> >>> Hello,
> >>> I am trying to run a program optimized with the Pool Allocation, but I am receiving this
> >> error:
> >>>
> >>> ====================
> >>>
> >>> *** 4 DYNAMIC POOLS INITIALIZED ***
> >>>
> >>> *** 4 DYNAMIC POOLS ALLOCATED FROM ***
> >>>
> >>> MaxHeapSize = 0.062500KB HeapSizeAtExit = 0.062500KB NOTE: only valid if using
> >>> Heuristic=AllPools and no bumpptr/realloc!
> >>> ====================
> >>
> >> This output is what happens when you link with the debug version of the
> >> runtime library. If you rebuild the FL2Allocator with 'make
> >> ENABLE_OPTIMIZED=1' and link with the result, you shouldn't get this.
> >>
> >>> I have tried to link the program with the Analysis and with Datastructure libs:
> >>> llvm-gcc -o test test.opt.bc -lpoolalloc -lpoolalloc_rt -lLLVMDataStructure -lLLVMAnalysis
> >>> But I am still receiving the error.
> >>
> >> You should only need -lpoolalloc_rt.
> >>
> >> For the record, I usually do (effectively) this to test the pool
> >> allocator:
> >>
> >> llvm-gcc *.c -o program # compile&link whole prog with LLVM
> >> opt -load ... -poolalloc program.bc ... -o program.pa.bc
> >> llc program.pa.bc -march=c -o program.pa.cbe.c
> >> gcc -fno-strict-aliasing -O2 program.pa.cbe.c -o program.pa
> >> -L~/llvm/projects/llvm-poolalloc/Release/lib/ -lpoolalloc_rt
> >>
> >> Alternatively, if you want a quick test, you can do the first two steps,
> >> then:
> >>
> >> lli -load ~/llvm/projects/llvm-poolalloc/Release/lib/libpoolalloc_rt.so program.pa.bc
> >>
> >> If you're on a target that supports the JIT.
> >>
> >>> Another question, I do not want to use the bump ptr optimization, and I suppose that the
> right
> >>> heuristic for that is AllNodes? But if I want to use it, what is the right heuristic?
> >>
> >> The AllNodes heuristic is the only one that is substantially tested. I
> >> would recommend it, none of the others have any significant performance
> >> benefit anyway.
> >>
> >> The bump pointer and other opts are a seperate option -pooloptimize, which
> >> can be run after -poolalloc. It does not work with -pointercompress
> >> though.
> >>
> >>> Also, if I want to use the Pointer Compression, I suppose that I have to
> >>> use the -pointercompress switch with opt or what?
> >>
> >> Yes, if you use it, don't specify -poolalloc manually.
> >>
> >> -Chris
> >>
> >> --
> >> http://nondot.org/sabre/
> >> http://llvm.cs.uiuc.edu/
> >>
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
>
> -Chris
>
> --
> http://nondot.org/sabre/
> http://llvm.cs.uiuc.edu/
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
More information about the llvm-dev
mailing list