

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The goal for this homework is to implement a heuristic hyperblock formation algorithm that performs selective if-conversion for inner-most loops. On the surface, this requires a large amount of code to accomplish this task. However, the bulk of the code will be provided to you (tail duplication, if-conversion). Your main task is to first implement a simple control flow optimization, backedge coalescing, to convert any multi-backedge loop into a single backedge loop. Second, implement a heuristic block selection algorithm to “intelligently” choose the set of basic blocks that will be if-converted. You are free to define any heuristic that you wish and are encouraged to be creative here. Please try to avoid just blindly using the BSV algorithm discussed in class. Your algorithm should operate on an inner-most loop, where you wish to perform selective if-conversion of the loop body. You should create at most 1 hyperblock for the loop, so you do not need to worry about making other HBs out of basic blocks that you do not choose for your primary HB. The algorithm should be applied to all the inner most loops in the program. Your algorithm should consist of the following 5 steps:
loops in a Procedure. All innermost loops are used for subsequent processing.
all backedges into a single backedge using the technique described in class.
if-convert using whatever means you wish. The goal is to produce the fastest code possible as compared with the original basic block implementation.
edges such that the selected blocks contain no side entrances. This code will be provided to you, see elcor/src/Control/el_tail_duplication.cpp
by using predicated execution. This code will be provided to you, see elcor/src/ Control/el_if_converter.cpp
This will obviously require some thought. You should start with the lecture on Hyperblocks that discusses two previous techniques, block selection value and path selection. Think about the cost/benefits of if-conversion. On the benefit side, you eliminate branches, mispredictions and allow for more instruction overlap. On the negative side, you may increase resource utilization, dependence height, and possibly
restrict the ordering of operations. So, the trick is to come up with a heuristic that does a good balancing job. This is left as an open problem without any prescribed solutions. There are several tools available that may be useful to defining a good heuristic for block selection. Sample uses of these can be found in hyperblock.cpp provided to you:
To evaluate the quality of your hyperblocks, you will need to turn on the Elcor scheduler. For simplicity, we will assume infinite registers, so register allocation will be turned off. Use the cycle stats obtained in ELCOR_STATS as you did for homework 0 as your performance.
You should submit a single .tgz file via anonymous ftp to www.eecs.umich.edu, log in as anonymous, cd /groups/eecs583, put your tar file named uniquename_hw1.tgz. Your tar file should contain:
The person with the best performance (benchmark(s) and machine model TBD) will be crowned EECS 583 W06 Hyperblock Formation Champion and win a huge Hershey chocolate bar.