[PATCH] [Polly] Compute and print the loop carried dependency distance

Johannes Doerfert doerfert at cs.uni-saarland.de
Fri Sep 12 13:38:39 PDT 2014


Answers

================
Comment at: lib/Analysis/Dependences.cpp:521
@@ +520,3 @@
+  IsParallel = isl_set_is_empty(Distance);
+  if (IsParallel && !isl_set_free(Distance))
+    return true;
----------------
sebpop wrote:
> What happens when the isl_set_free function returns a non-zero error?
> 
isl "guarantees" (with the __isl_null annotation) that we get a nullptr back.

Apperently ppl don't like my shortcut, I can change that.

================
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
----------------
sebpop wrote:
> j++)
thx

================
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++)
----------------
sebpop wrote:
> 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.
> 
> 
> 
We compute the minimal dependence distance, everything else seems not really useful? Am I wrong here?

================
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++)
----------------
sebpop wrote:
> 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.
> 
> 
Again, 1 is the minimal dependence distance

================
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;
+;        }
----------------
sebpop wrote:
> for j < 3, A[i - 3] is a negative access function.
That is totally fine for a subset of possible pointers A.
What is the problem with negative access functions?

================
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++) {
----------------
sebpop wrote:
> 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.
Should again be the minimal dep. distance.

http://reviews.llvm.org/D4987






More information about the llvm-commits mailing list