User Tools

Site Tools


using_array_partitioning_pass

Using the Array Partitioning Pass (-legup-array-partition)

The array partitioning pass is a LLVM optimization pass which splits (currently global) arrays within the C program through LLVM IR transformations and redirects accesses to the corresponding sub-arrays created for subsequent read and write accesses.

In order to use the array partitioning pass, you will need to do the following:

1) Add this line to the Makefile

PARTITION=1

2) Create a partition.config file in the test directory

Each line of the partition.config file describes the partitioning scheme for one global array and it has four fields.

<global/local> <function name if local> <array name> <partition spec>

For example, if you want to split a global array named arr which has 10 rows and 10 columns into 10 different sub-arrays each containing one row of the original array:

global - arr *|-|

Can also be achieved using

global - arr b10|-|

But performance might suffer.

These are the possible partitions to create:

  • COMPLETE partitioning in one dimension (*)
  • BLOCK partitioning in one dimension into p partitions (p is integer) (bp)
  • CYCLIC partitioning in one dimension into p partitions (cp)
  • BLOCK CYCLIC partitioning in one dimension into p partitions each with block size s (bcp,s)

For more details refer to this presentation: arraypartition_sep18.pdf

You may also want to do these optional steps for improved performance: 1) Add these options into the config.tcl file

set_parameter REPLICATE_PTHREAD_FUNCTIONS 1
set_parameter REPLICATE_ROMS 1

2) Add loop unrolling directives to the Makefile

  • Array partitioning reduces the memory performance bottleneck and allows for higher memory throughput, to truly get this advantage, unroll loops which access the memory to be partitioned to allow for more parallel accesses
using_array_partitioning_pass.txt · Last modified: 2016/01/27 22:14 by joychen