OpenScop's scatter function semantics?
Opened this issue · 1 comments
thisiscam commented
Hi,
I'm generating some OpenScop programs and would like to use the --readscop
flag to compile the programs.
I'm wondering what is the semantics for each output dimension for an OpenScop's scattering function?
In particular, I noticed that I always have to prepend a 0
as the first output dimension of all scattering functions, or otherwise polycc
will not respect the dependencies.
So that makes me wonder, does the first output dimension always indicate a placement on separate processors?
thisiscam commented
As an example, here's the program I have in mind:
for(i = 0; i < N; i++)
C[i] = 0
for(i = 0; i < N; i++)
C[i] = i
Here's the OpenScop program I write for the above program:
<OpenScop>
# =============================================== Global
# Backend Language
C
# Context
CONTEXT
1 3 0 0 0 1
1 1 -1 ## N-1 >= 0
# Parameter names are provided
1
# Parameter names
<strings>
N
</strings>
# Number of statements
2
# =============================================== Statement 1
# Number of relations describing the statement
3
# ---------------------------------------------- 1.1 Domain
DOMAIN
2 4 1 0 0 1
# e/i i N 1
1 1 0 0 ## i >= 0
1 -1 1 -1 ## -i+N-1 >= 0
# ---------------------------------------------- 1.2 Scattering
SCATTERING
2 6 2 1 0 1
# e/i s1 s2 i N 1
0 -1 0 0 0 0 ## s1 = 0
0 0 -1 1 0 0 ## s2 = i
# ---------------------------------------------- 1.3 Access
WRITE
2 6 2 1 0 1
# e/i Arr [1] i N 1
0 -1 0 0 0 1 ## C
0 0 -1 1 0 0 ## [i]
# ---------------------------------------------- 1.4 Body
# Statement body is provided
1
<body>
# Number of original iterators
1
# Original iterator names
i
# Statement body
C[i] = 0.0;
</body>
# =============================================== Statement 2
# Number of relations describing the statement
3
# ---------------------------------------------- 1.1 Domain
DOMAIN
2 4 1 0 0 1
# e/i i N 1
1 1 0 0 ## i >= 0
1 -1 1 -1 ## -i+N-1 >= 0
# ---------------------------------------------- 1.2 Scattering
SCATTERING
2 6 2 1 0 1
# e/i s1 s2 i N 1
0 -1 0 0 0 1 ## s1 = 1
0 0 -1 1 0 0 ## s2 = i
# ---------------------------------------------- 1.3 Access
WRITE
2 6 2 1 0 1
# e/i Arr [1] i N 1
0 -1 0 0 0 1 ## C
0 0 -1 1 0 0 ## [i]
# ---------------------------------------------- 1.4 Body
# Statement body is provided
1
<body>
# Number of original iterators
1
# Original iterator names
i
# Statement body
C[i] = i;
</body>
<arrays>
1
1 C
</arrays>
</OpenScop>
Running
$ polycc --readscop mat.scop --noparallel --nofuse --notile --noprevector --nounrolljam
gets me:
for (t2=0;t2<=N-1;t2++) {
C[t2] = t2;;
}
for (t2=0;t2<=N-1;t2++) {
C[t2] = 0.0;;
}
Note the output's two loops are swapped.