Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenScop's scatter function semantics? #88

Open
thisiscam opened this issue Nov 16, 2021 · 1 comment
Open

OpenScop's scatter function semantics? #88

thisiscam opened this issue Nov 16, 2021 · 1 comment

Comments

@thisiscam
Copy link
Contributor

thisiscam commented Nov 16, 2021

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
Copy link
Contributor Author

thisiscam commented Nov 16, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant