Add support for individual loop unroll bounds#1300
Conversation
|
I think it would be useful. |
There was a problem hiding this comment.
this seems fine but you need to add test cases demonstrating the in complex situations, the correct loop always gets unrolled
we also need some sort of documentations telling users how to perform this mapping. not sure where this goes, maybe @nunoplopes has a good idea
we support many src/tgt pairs as src1/tgt1, src2/tgt2, etc. how does this interact with these new unroll bounds?
I think you've changed the behavior of alive2 for the unroll=0 case. probably that needs to be fixed.
otherwise this LGTM and seems like a useful change!
|
|
||
| void Function::unroll(unsigned k) { | ||
| if (k == 0) | ||
| void Function::unroll(vector<unsigned> unroll_bounds) { |
| llvm::cl::desc("Unrolling factor for src function (default=0)"), | ||
| llvm::cl::init(0), llvm::cl::cat(alive_cmdargs)); | ||
| llvm::cl::list<unsigned> opt_src_unrolling_factor(LLVM_ARGS_PREFIX "src-unroll", | ||
| llvm::cl::desc("Unrolling factors for src function (default=0)"), |
There was a problem hiding this comment.
don't add spurious whitespace at the end of a line
These changes allow setting individual loop unroll bounds from the command line. This is useful if we want to check a property for a single loop in a multi-loop function, where a single loop unroll bound may lead to code blow-up.
Usage: If
srcandtgthave two loops each then individual loop unroll bounds can be used as follows:alive-tv test.ll --src-unroll=1,2 --tgt-unroll=1,2The unroll bounds are applied to loops in the order they appear in code. These changes preserve backwards compatability; if a single loop unroll bound is provided then it is applied to all loops in the function.
-Alborz