summaryrefslogtreecommitdiff
path: root/omegalib/examples/old_test/ts1d-orig0.oc-rt
blob: 775af7e29c5c1b5a0840db7436d1eb8eed73971b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000):
# # This is the file facts.prew, which is prepended to the .prew files
# # for the particular code generation we want, defines things like the
# # iteration space and dependences.  Known facts are inserted by the
# # Makefile.
# #
# # If you're looking at a .w file instead of facts.prew, then you should
# # remember to edit the original .prew files, not the .w files.
# #
# # This facts.prew file describes the program
# #
# # for(i = 0; i <= N-1; i++) {
# #  cur[i]=...
# # }
# # for(t = 0; t < T; t++) {
# #   for(i = 0; i <= N-1; i++) {
# #     old[i]=cur[i];
# #   }
# #   for(i = 1; i <= N-2; i++) {
# #     cur[i] = (old[i-1]+old[i]+old[i]+old[i+1])*0.25;
# #   }
# # }
# 
# 
# 
# # first, the spaces and memory maps
# 
# symbolic T, N;
# 
# 
# IS_INIT := { [1,i,1,0,0]          :           0<=i<=N-1 };
# 
# MM_INIT := { [1,i,1,0,0] -> [0,i] :           0<=i<=N-1 };
# 
# 
# IS_COPY := { [2,t,0,i,1]            : 0<=t<T && 0<=i<=N-1 };
# 
# MM_COPY := { [2,t,0,i,1] -> [t+1,i] : 0<=t<T && 0<=i<=N-1 };
# 
# 
# IS_CALC := { [2,t,1,i,1]            : 0<=t<T && 0< i< N-1 };
# 
# MM_CALC := { [2,t,1,i,1] -> [t+1,i] : 0<=t<T && 0< i< N-1 };
# 
# 
# RESULTS := { [3,0,0,0,0] };
# 
# 
# 
# # memory-based Output and Flow/anti-dependences (among Assign (copy), and Calc)
# 
# FWD5 := {[x,t,y,i,z] -> [x',t',y',i',z'] :
# 	(x'>x) or
# 	(x'=x and t'>t) or
# 	(x'=x and t'=t and y'>y) or
# 	(x'=x and t'=t and y'=y and i'>i) or
# 	(x'=x and t'=t and y'=y and i'=i and z'>z) };
# 
# FWD7 := {[x,t,y,i,z,a,b] -> [x',t',y',i',z',a',b'] :
# 	(x'>x) or
# 	(x'=x and t'>t) or
# 	(x'=x and t'=t and y'>y) or
# 	(x'=x and t'=t and y'=y and i'>i) or
# 	(x'=x and t'=t and y'=y and i'=i and z'>z) or
# 	(x'=x and t'=t and y'=y and i'=i and z'=z and a'>a) or
# 	(x'=x and t'=t and y'=y and i'=i and z'=z and a'=a and b'>b) };
# 
# BWD5 := inverse FWD5;
# 
# BWD7 := inverse FWD7;
# 
# EQi := {[x,t,y,i,z] -> [x',t',y',i',z'] : i'=i };
# 
# 
# # output deps
# 
# OAA := (IS_COPY * IS_COPY) intersection FWD5 intersection EQi;
# 
# OCC := (IS_CALC * IS_CALC) intersection FWD5 intersection EQi;
# 
# 
# # combined flow/anti deps
# 
# FAC := (IS_COPY * IS_CALC) intersection FWD5 intersection {[2,t,0,i,1] -> [2,t',1,i',1]  : (i'-1<=i<=i'+1)};
# 
# FCA := (IS_CALC * IS_COPY) intersection FWD5 intersection {[2,t,1,i,1] -> [2,t',0,i',1]  : (i-1<=i'<=i+1)};
# 
# 
# # total memory deps in the "core"
# 
# COREMEMDEPS := OAA union OCC union FAC union FCA;
# 
# 
# 
# 
# # data flow for original code:
# 
# DF_12p1 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,0,0,i,1] : 0<i<N-1 };
# 
# DF_12p2 := ( IS_INIT * IS_COPY ) intersection {[1,0,1,0,0] -> [2,t,0,0,1] };
# 
# DF_12p3 := ( IS_INIT * IS_COPY ) intersection {[1,i,1,0,0] -> [2,t,0,i,1] : i=N-1 && N>1 };
# 
# DF_32   := ( IS_CALC * IS_COPY ) intersection {[2,t,1,i,1] -> [2,t+1,0,i,1]};
# 
# 
# DF_23a := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i+1,1] };
# 
# DF_23b := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i,1] };
# 
# DF_23c := ( IS_COPY * IS_CALC ) intersection {[2,t,0,i,1] -> [2,t,1,i-1,1] };
# 
# 
# 
# # data flow for array expanded code,
# # after forward substitution of "old[i] = cur[i]"
# 
# DF1Ia := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC;
# 
# DF1Ib := { [1,i,1,0,0] -> [2,t,1,i+1,1] : t>0 && i=0 } restrictDomain IS_INIT restrictRange IS_CALC;
# 
# DF1C  := { [2,t,1,i,1] -> [2,t+1,1,i+1,1] } restrictDomain IS_CALC restrictRange IS_CALC;
# 
# DF2I  := { [1,i,1,0,0] -> [2,t,1,i,1] :   t=0 } restrictDomain IS_INIT restrictRange IS_CALC;
# 
# DF2C  := { [2,t,1,i,1] -> [2,t+1,1,i+0,1] } restrictDomain IS_CALC restrictRange IS_CALC;
# 
# DF3Ia := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t=0 } restrictDomain IS_INIT restrictRange IS_CALC;
# 
# DF3Ib := { [1,i,1,0,0] -> [2,t,1,i-1,1] : t>0 && i=N-1 } restrictDomain IS_INIT restrictRange IS_CALC;
# 
# DF3C  := { [2,t,1,i,1] -> [2,t+1,1,i-1,1] } restrictDomain IS_CALC restrictRange IS_CALC;
# 
# 
# # total data flow
# 
# COREDATAFLOW := DF1C union DF2C union DF3C;
# 
# 
# 
# # arity expansion relations
# ex_0_5v := {             [] -> [a,b,c,d,e]     };
# 
# ex_0_7v := {             [] -> [a,b,c,d,e,f,g] };
# 
# ex_3_5 := {         [a,b,c] -> [a,b,c,0,0]     };
# 
# ex_3_7 := {         [a,b,c] -> [a,b,c,0,0,0,0] };
# 
# ex_5_7 := {     [a,b,c,d,e] -> [a,b,c,d,e,0,0] };
# 
# 
# ex_5_3 := {     [a,b,c,0,0] -> [a,b,c]         };
# 
# ex_7_3 := { [a,b,c,0,0,0,0] -> [a,b,c]         };
# 
# ex_7_5 := { [a,b,c,d,e,0,0] -> [a,b,c,d,e]     };
# 
# 
# 
# # stuff used in skew and tskew
# 
# # Here is the description of time skewing from the current draft of the paper.
# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,s,1,tt,1] :
# 	0<=tt<1000 && s=i+1*t && t=1000*tb+tt };
# 
# 
# IS_Tinv := inverse IS_Trans;
# 
# 
# # We use it to transform the iteration spaces
# TS_IS_CALC := IS_CALC join IS_Trans;
# 
# # for some reason OC refuses do to this "join" but will do the reverse:
# # TS_IS_INIT := ex_7_5 join IS_INIT;
# TS_IS_INIT := IS_INIT  join (inverse ex_7_5);
# 
# 
# # Now we can update the data flow relations to correspond to the new I.S.'s
# TS_DF1Ia := ex_7_5  join DF1Ia join IS_Trans;
# 
# TS_DF1Ib := ex_7_5  join DF1Ib join IS_Trans;
# 
# TS_DF1C  := IS_Tinv join DF1C  join IS_Trans;
# 
# TS_DF2I  := ex_7_5  join DF2I  join IS_Trans;
# 
# TS_DF2C  := IS_Tinv join DF2C  join IS_Trans;
# 
# TS_DF3Ia := ex_7_5  join DF3Ia join IS_Trans;
# 
# TS_DF3Ib := ex_7_5  join DF3Ib join IS_Trans;
# 
# TS_DF3C  := IS_Tinv join DF3C  join IS_Trans;
# 
# 
#  
# KNOWN := { [] : T >= 0 and N >= 4 };
# 
#  
# # original code without mmap
# #
# 
# codegen
# 	IS_INIT, IS_COPY, IS_CALC
# given	(KNOWN join ex_0_5v);
for(t2 = 0; t2 <= N-1; t2++) {
  s1(1,t2,1,0,0);
}
for(t2 = 0; t2 <= T-1; t2++) {
  for(t4 = 0; t4 <= N-1; t4++) {
    s2(2,t2,0,t4,1);
  }
  for(t4 = 1; t4 <= N-2; t4++) {
    s3(2,t2,1,t4,1);
  }
}

# 
#