Hope you are doing well in the first two parts of loop parallelization term project. In this assignment, you are going to do dependence analysis based on the previous implementation (if you failed to implement the previous two parts, please email me firstname.lastname@example.org).
The deadline is 11:59pm Tuesday midnight, 11th April 2017.
Read Chapter 2 and 3 in Optimizing compilers for modern architectures.
1. List all references (load/store) to the same array in the loop, assign a unique ID to each reference along with the type of operation that performed (load or store).
2. Pair all the references (load-load, load-store, store-load, store-store) to the same array in the loop.
3. Calculate distance vector and direction vector for each reference pair.
4. Output the classification, whether there is a dependence, whether the dependence is loop carried or loop independent, and whether the dependence is True, Anti, Ouput dependence.
5. Write README.txt file to briefly describe your code and list the testing result for the tests we provided in the course materials.
For (i …)
a[i] = a[i] + a[i+1]
In LLVM IR form
An example loop with induction variable i:
References to a: a[i], a[i+1], a[i]; ID assigned & operation: <a0, load>, <a1, load>, <a2, store>;
Reference pairs in loop i: (a0, a1), (a0, a2), (a1, a0), (a1, a2), (a2, a0) , (a2, a1)
Distance and direction vector:
(a0, a1): (1), (<)
(a0, a2): (0), (=)
(a0, a1): No dependence
(a0, a2): Loop independent, True dependence
Note that in this assignment you are only required to handle single loop with accesses to 1 dimensional array (no nested loops, no multi-dimensional array accesses). Be sure to finish the basic requirement before you start to think about the extra part which handles nested loops.
Extra part reminder: A compiler that supports and can parallelize nested loops (and multi-dimensional arrays) will receive up to 30% extra credit for the project. The extra credit part is graded only at the last phase, after the compiler is completed and can generate parallelized code.