[PATCH] [Polly] Compute and print the loop carried dependency distance
Sebastian Pop
sebpop at gmail.com
Fri Sep 12 13:09:01 PDT 2014
================
Comment at: lib/Analysis/Dependences.cpp:521
@@ +520,3 @@
+ IsParallel = isl_set_is_empty(Distance);
+ if (IsParallel && !isl_set_free(Distance))
+ return true;
----------------
What happens when the isl_set_free function returns a non-zero error?
================
Comment at: test/Isl/Ast/dependence_distance_parametric.ll:5
@@ +4,3 @@
+; CHECK: #pragma dependence distance: 1
+; for (int j = 0; j < N; j+++
+; CHECK: #pragma dependence distance: (-1 + c >= 0) ? (c) : -c
----------------
j++)
================
Comment at: test/Isl/Ast/dependence_distance_varying.ll:4
@@ +3,3 @@
+; void f(int *A, int N) {
+; CHECK: #pragma dependence distance: ((N - 1) % 2) + 1
+; for (int i = 0; i < N; i++)
----------------
I am not sure I understand what "((N - 1) % 2) + 1" means: for a given N, say 100, this expression is equal to 2,
```
for (int i = 0; i < N; i++)
A[i] = A[N - i] + 1;
```
and the dependence distance in this loop is not constant:
- A[1] is written at iteration i=1 and is read at iteration i=99 -> distance 98
- A[2] is written at iteration i=2 and is read at iteration i=98 -> distance 96
- etc.
================
Comment at: test/Isl/Ast/dependence_distance_varying_in_outer_loop.ll:6
@@ +5,3 @@
+; for (int j = 0; j < 1024; j++)
+; CHECK: #pragma dependence distance: 1
+; for (int i = j; i < 1024; i++)
----------------
Is the distance carried by the inner loop equal to 1?
Say we fix the outer loop j to iteration 5, then in the inner loop
- first iteration i=5, A[2] is written and A[5] is read,
- third iteration i=8, A[5] is written and A[5] is read.
I think that the dependence distance is not constant in this case.
================
Comment at: test/Isl/Ast/dependence_distance_varying_in_outer_loop.ll:8
@@ +7,3 @@
+; for (int i = j; i < 1024; i++)
+; A[i - 3] = A[j] * 2 + A[j] + 2;
+; }
----------------
for j < 3, A[i - 3] is a negative access function.
================
Comment at: test/Isl/Ast/dependence_distance_varying_multiple.ll:5
@@ +4,3 @@
+; int *restrict E, int N) {
+; CHECK: #pragma dependence distance: (-35 + N >= 0) ? (1) : (-17 + N >= 0 && 34 - N >= 0) ? (2) : 5
+; for (int i = 0; i < N; i++) {
----------------
The difference between A[i] and A[100 - 2*i] is not constant.
This loop does not carry a constant dependence distance of 1, 2, or 5.
http://reviews.llvm.org/D4987
More information about the llvm-commits
mailing list