Running Pool Allocated programs

Hello,

I am trying to run a program optimized with the Pool Allocation, but I am receiving this error:

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

Thanks for the answer

I am trying to test the PA with a program very similar to the one used as an example in the paper
located here:

http://llvm.cs.uiuc.edu/pubs/2003-04-29-DataStructureAnalysisTR.html

The program is as follows:

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

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

--
Chris Lattner's Homepage
http://llvm.cs.uiuc.edu/

_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris

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

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?

The reason is that there is no pointer in the program that points at both the first node and any of the rest. DSA decides they don't alias and APA puts them in different pools. If you write a loop to traverse the list (for example), they will end up in the same 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?

Sorry, I was confused/wrong. AllNodes and "AllButUnreachableFromMemory" heuristics are both well tested. The other heuristics will probably work but no guarantees :slight_smile:

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})

It is the "AllButUnreachableFromMemory" heuristic (the default). Terse names are overrated. :slight_smile:

-Chris

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

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

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

--
Chris Lattner's Homepage
http://llvm.cs.uiuc.edu/

_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris

--
Chris Lattner's Homepage
http://llvm.cs.uiuc.edu/

_______________________________________________
LLVM Developers mailing list
LLVMdev@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!
Domain Names, Website Builder, Web hosting & More | Turbify

_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris