diff options
author | Derick Huth <derickhuth@gmail.com> | 2014-10-06 12:42:34 -0600 |
---|---|---|
committer | Derick Huth <derickhuth@gmail.com> | 2014-10-06 12:42:34 -0600 |
commit | 8d73c8fcc75556c1df71dd39dd99783f8f86fc3e (patch) | |
tree | 157d627863d76a4c256a27cae27ce2e8566c7ea0 /omega/examples/old_test | |
parent | e87b55ad69f0ac6211daae741b32c8ee9dcbe470 (diff) | |
parent | 8c646f24570079eac53e58fcf42d0d4fbc437ee3 (diff) | |
download | chill-8d73c8fcc75556c1df71dd39dd99783f8f86fc3e.tar.gz chill-8d73c8fcc75556c1df71dd39dd99783f8f86fc3e.tar.bz2 chill-8d73c8fcc75556c1df71dd39dd99783f8f86fc3e.zip |
Merge pull request #2 from dhuth/master
Moved omega into chill.
Diffstat (limited to 'omega/examples/old_test')
279 files changed, 8926 insertions, 0 deletions
diff --git a/omega/examples/old_test/affineClosure b/omega/examples/old_test/affineClosure new file mode 100644 index 0000000..1039856 --- /dev/null +++ b/omega/examples/old_test/affineClosure @@ -0,0 +1,19 @@ + +symbolic n; +symbolic c; + +R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +R; +ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : + 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 + && c = lambda0-lambda1+ 10 lambda2 - lambda3 + && i = lambda1-lambda2 + && j = lambda3-lambda4 + && n = lambda4)}; +ac; + +#ac intersection {[i,j] : i = 1 && c = -1} ; +#ac intersection {[i,j] : i = -1 && c = 10} ; +#ac intersection {[i,j] : j = 1 && c = -1 } ; +#ac intersection {[i,j] : j = -1 && n = 1} ; + diff --git a/omega/examples/old_test/affineClosure.oc-rt b/omega/examples/old_test/affineClosure.oc-rt new file mode 100644 index 0000000..fbf8bf9 --- /dev/null +++ b/omega/examples/old_test/affineClosure.oc-rt @@ -0,0 +1,32 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# symbolic n; +# +# symbolic c; +# +# +# R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +# +# R; + +{[i,j]: 1 <= i <= 10 && 1 <= j <= n} + +# +# ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 +# && c = lambda0-lambda1+ 10 lambda2 - lambda3 +# && i = lambda1-lambda2 +# && j = lambda3-lambda4 +# && n = lambda4)}; +# +# ac; + +{[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} + +# +# +# #ac intersection {[i,j] : i = 1 && c = -1} ; +# #ac intersection {[i,j] : i = -1 && c = 10} ; +# #ac intersection {[i,j] : j = 1 && c = -1 } ; +# #ac intersection {[i,j] : j = -1 && n = 1} ; +# diff --git a/omega/examples/old_test/affineClosure2 b/omega/examples/old_test/affineClosure2 new file mode 100644 index 0000000..35ae0e1 --- /dev/null +++ b/omega/examples/old_test/affineClosure2 @@ -0,0 +1,55 @@ +symbolic n; +symbolic c; +# # Omega Calculator [v1.00, Mar 96]: +# # +# # +# # +# # R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +# # +# # R; +# +# {[i,j]: 1 <= i <= 10 && 1 <= j <= n} +# +# # +# # ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# # 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 +# # && c = lambda0-lambda1+ 10 lambda2 - lambda3 +# # && i = lambda1-lambda2 +# # && j = lambda3-lambda4 +# # && n = lambda4)}; +# # +# # ac; +# +# {[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} +# +# # +# # +# # #ac intersection {[i,j] : i = 1 && c = -1} ; +# # #ac intersection {[i,j] : i = -1 && c = 10} ; +# # #ac intersection {[i,j] : j = 1 && c = -1 } ; +# # #ac intersection {[i,j] : j = -1 && n = 1} ; +# # + +approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : + 0 <= lambda0,lambda1,lambda2,lambda3,lambda4 + && n = lambda1+lambda2+lambda3+lambda4 + && i = lambda2+10lambda3 + && j = lambda2+lambda3+lambda4 + && c = lambda0+lambda2+lambda3 + && c = 1 + )}; +approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : + 0 <= lambda1,lambda2,lambda3,lambda4 + && n = lambda1+lambda2+lambda3+lambda4 + && i = lambda2+10lambda3 + && j = lambda2+lambda3+lambda4 + && c = lambda2+lambda3 + && c = 1 + )}; +approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : + 0 <= lambda1,lambda2,lambda3,lambda4 + && n = lambda1+lambda2+lambda3+lambda4 + && i = lambda2+10lambda3 + && j = lambda2+lambda3+lambda4 + && c = lambda2+lambda3 + )}; diff --git a/omega/examples/old_test/affineClosure2.oc-rt b/omega/examples/old_test/affineClosure2.oc-rt new file mode 100644 index 0000000..b4c1fd7 --- /dev/null +++ b/omega/examples/old_test/affineClosure2.oc-rt @@ -0,0 +1,70 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# symbolic c; +# +# # # Omega Calculator [v1.00, Mar 96]: +# # # +# # # +# # # +# # # R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +# # # +# # # R; +# # +# # {[i,j]: 1 <= i <= 10 && 1 <= j <= n} +# # +# # # +# # # ac := approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# # # 0 <= lambda0, lambda1,lambda2,lambda3,lambda4 +# # # && c = lambda0-lambda1+ 10 lambda2 - lambda3 +# # # && i = lambda1-lambda2 +# # # && j = lambda3-lambda4 +# # # && n = lambda4)}; +# # # +# # # ac; +# # +# # {[i,j]: 0 <= n && 0 <= n+c+i+j && 0 <= n+c+10i+j && 0 <= n+j} +# # +# # # +# # # +# # # #ac intersection {[i,j] : i = 1 && c = -1} ; +# # # #ac intersection {[i,j] : i = -1 && c = 10} ; +# # # #ac intersection {[i,j] : j = 1 && c = -1 } ; +# # # #ac intersection {[i,j] : j = -1 && n = 1} ; +# # # +# +# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# 0 <= lambda0,lambda1,lambda2,lambda3,lambda4 +# && n = lambda1+lambda2+lambda3+lambda4 +# && i = lambda2+10lambda3 +# && j = lambda2+lambda3+lambda4 +# && c = lambda0+lambda2+lambda3 +# && c = 1 +# )}; + +{[i,j]: c = 1 && 0 <= i <= 10j, 10 && j <= n} + +# +# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# 0 <= lambda1,lambda2,lambda3,lambda4 +# && n = lambda1+lambda2+lambda3+lambda4 +# && i = lambda2+10lambda3 +# && j = lambda2+lambda3+lambda4 +# && c = lambda2+lambda3 +# && c = 1 +# )}; + +{[i,j]: c = 1 && 1 <= i <= 10 && 1 <= j <= n} + +# +# approximate {[i,j] : exists (lambda0, lambda1,lambda2,lambda3,lambda4 : +# 0 <= lambda1,lambda2,lambda3,lambda4 +# && n = lambda1+lambda2+lambda3+lambda4 +# && i = lambda2+10lambda3 +# && j = lambda2+lambda3+lambda4 +# && c = lambda2+lambda3 +# )}; + +{[i,j]: c <= i <= 10c && c <= j <= n} + +# diff --git a/omega/examples/old_test/beatrice2 b/omega/examples/old_test/beatrice2 new file mode 100644 index 0000000..7b425fd --- /dev/null +++ b/omega/examples/old_test/beatrice2 @@ -0,0 +1,51 @@ +# do i = 1, np { +# do j = 1, i { +# ij = ia(i) + j +# a = 1. / (i + j) +# do k = 1, i { +# maxl = k +# if (k == i) then +# maxl = j +# endif +# do l = 1, maxl { +# kl = ia(k) + l +# b = 1. / (k + l) +# val = a + b +# if (i == j) then +# val = val * .5 +# endif +# if (k == l) then +# val = val * .5 +# endif +# x(ij,kl) = val +# x(kl,ij) = val +# } +# } +# } +# } +#! +# +# +# As far as I remember it was the dependence test between X(IJ,KL) and X(IJ,KL). +# +# Pips discovered the following precondition: +# + +{[d1,d2,d3,d4] : exists ( NP, + I,J,K,L,IJ,KJ,MAXL, + I',J',K',L',IJ',KJ',MAXL' : + I' = I+d1 && + J' = J+d2 && + K' = K+d3 && + L' = L+d4 + && 1<=L && 1<=J && MAXL<=K && I<=NP && NP<=40 && 10<=NP + && 10+8K+MAXL<=NP+8I+J && 38K+MAXL<=38I+J + && J+K<=I+MAXL && L<=MAXL + && 1 <= J,K <= I <= NP && 1 <=L <= MAXL + + && 1<=L' && 1<=J' && MAXL'<=K' && I'<=NP && NP<=40 && 10<=NP + && 10+8K'+MAXL'<=NP+8I'+J' && 38K'+MAXL'<=38I'+J' + && J'+K'<=I'+MAXL' && L'<=MAXL' + && 1 <= J',K' <= I' <= NP && 1 <=L' <= MAXL' + )}; + diff --git a/omega/examples/old_test/beatrice2.oc-rt b/omega/examples/old_test/beatrice2.oc-rt new file mode 100644 index 0000000..7952859 --- /dev/null +++ b/omega/examples/old_test/beatrice2.oc-rt @@ -0,0 +1,56 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # do i = 1, np { +# # do j = 1, i { +# # ij = ia(i) + j +# # a = 1. / (i + j) +# # do k = 1, i { +# # maxl = k +# # if (k == i) then +# # maxl = j +# # endif +# # do l = 1, maxl { +# # kl = ia(k) + l +# # b = 1. / (k + l) +# # val = a + b +# # if (i == j) then +# # val = val * .5 +# # endif +# # if (k == l) then +# # val = val * .5 +# # endif +# # x(ij,kl) = val +# # x(kl,ij) = val +# # } +# # } +# # } +# # } +# #! +# # +# # +# # As far as I remember it was the dependence test between X(IJ,KL) and X(IJ,KL). +# # +# # Pips discovered the following precondition: +# # +# +# {[d1,d2,d3,d4] : exists ( NP, +# I,J,K,L,IJ,KJ,MAXL, +# I',J',K',L',IJ',KJ',MAXL' : +# I' = I+d1 && +# J' = J+d2 && +# K' = K+d3 && +# L' = L+d4 +# && 1<=L && 1<=J && MAXL<=K && I<=NP && NP<=40 && 10<=NP +# && 10+8K+MAXL<=NP+8I+J && 38K+MAXL<=38I+J +# && J+K<=I+MAXL && L<=MAXL +# && 1 <= J,K <= I <= NP && 1 <=L <= MAXL +# +# && 1<=L' && 1<=J' && MAXL'<=K' && I'<=NP && NP<=40 && 10<=NP +# && 10+8K'+MAXL'<=NP+8I'+J' && 38K'+MAXL'<=38I'+J' +# && J'+K'<=I'+MAXL' && L'<=MAXL' +# && 1 <= J',K' <= I' <= NP && 1 <=L' <= MAXL' +# )}; + +{[d1,d2,d3,d4]: d2-39, -39, d4-39, d3-39 <= d1 <= d3+39, d2+39, d4+39, 39 && d4-39, -39 <= d3 <= 39, d4+39 && -39 <= d2 <= 39 && 39d4 <= 1521+38d1+d2 && d3 <= 39+d1+d4 && d2 <= 1521+d1+38d3+d4 && 38d1+d2 <= 1521+39d4 && 38d1+d2 <= 1521+38d3+d4 && d2 <= 1521+d1+39d4 && d1+38d3+d4 <= 1521+d2 && d1+d4 <= 39+d3 && 38d3+d4 <= 1521+38d1+d2 && d1+39d4 <= 1521+d2} + +# +# diff --git a/omega/examples/old_test/blume1.w b/omega/examples/old_test/blume1.w new file mode 100644 index 0000000..14d7329 --- /dev/null +++ b/omega/examples/old_test/blume1.w @@ -0,0 +1,6 @@ +symbolic n, line5expr(2); + +$$ +\{ [i,j] -> [i',j'] \mid line5expr(In) = line5expr(Out) && 2 <= j <= 1 && 1 <= i <= n && 2 <= j' <= 1 && 1 <= i' <= n \}; +$$ + diff --git a/omega/examples/old_test/blume1.w.oc-rt b/omega/examples/old_test/blume1.w.oc-rt new file mode 100644 index 0000000..68d6aad --- /dev/null +++ b/omega/examples/old_test/blume1.w.oc-rt @@ -0,0 +1,12 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Symbolic n, line5expr(2); +# +# +# $$ +# \{ [i,j] -> [i',j'] \mid line5expr(In) = line5expr(Out) && 2 <= j <= 1 && 1 <= i <= n && 2 <= j' <= 1 && 1 <= i' <= n \}; + +{[i,j] -> [i',j'] : FALSE } + +# +# $$ +# diff --git a/omega/examples/old_test/cfft2d1 b/omega/examples/old_test/cfft2d1 new file mode 100644 index 0000000..8b59f29 --- /dev/null +++ b/omega/examples/old_test/cfft2d1 @@ -0,0 +1,21 @@ +# +# A (memory-based!) data dependence relation from a greatly simplified +# cfft2d1.t that was causing us trouble. +# + +symbolic line22(1), im_1(2); + +flow := { [iii_w,jj_w] -> [iii_r,jj_r] : + im_1(In) = im_1(Out) + && 1 <= jj_w + && jj_w <= line22(In) + && 1 <= iii_w + && iii_w <= 200 + && 1 <= jj_r + && jj_r <= line22(Out) + && 1 <= iii_r + && iii_r <= 200 }; + +zero_plus := { [i1,j1] -> [i2,j2] : i1 = i2 && j1 < j2 }; + +flow intersection zero_plus; diff --git a/omega/examples/old_test/cfft2d1.oc-rt b/omega/examples/old_test/cfft2d1.oc-rt new file mode 100644 index 0000000..8f8dd27 --- /dev/null +++ b/omega/examples/old_test/cfft2d1.oc-rt @@ -0,0 +1,29 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # A (memory-based!) data dependence relation from a greatly simplified +# # cfft2d1.t that was causing us trouble. +# # +# +# Symbolic line22(1), im_1(2); +# +# +# flow := { [iii_w,jj_w] -> [iii_r,jj_r] : +# im_1(In) = im_1(Out) +# && 1 <= jj_w +# && jj_w <= line22(In) +# && 1 <= iii_w +# && iii_w <= 200 +# && 1 <= jj_r +# && jj_r <= line22(Out) +# && 1 <= iii_r +# && iii_r <= 200 }; +# +# +# zero_plus := { [i1,j1] -> [i2,j2] : i1 = i2 && j1 < j2 }; +# +# +# flow intersection zero_plus; + +{[In_1,In_2] -> [Out_1,Out_2] : im_1(In_1,In_2) = im_1(Out_1,Out_2) && Out_1 = In_1 && 1 <= In_2 < Out_2 <= line22(In_1) && 1 <= In_1 <= 200} + +# diff --git a/omega/examples/old_test/chosol b/omega/examples/old_test/chosol new file mode 100644 index 0000000..134172c --- /dev/null +++ b/omega/examples/old_test/chosol @@ -0,0 +1,11 @@ +T10:={[i] -> [0,i,0,0]}; +T20:={[i,j] -> [1,j,0,i]}; +T30:={[i] -> [1,i-1,1,0]}; + +symbolic n; +IS10 := {[i]: 2 <= i <= n}; +IS20 := {[i,j]: 2 <= i <= n && 1 <= j <= i-1}; +IS30 := IS10; + +codegen T10:IS10,T20:IS20,T30:IS30; +codegen 2 T10:IS10,T20:IS20,T30:IS30; diff --git a/omega/examples/old_test/chosol.oc-rt b/omega/examples/old_test/chosol.oc-rt new file mode 100644 index 0000000..8fa3b38 --- /dev/null +++ b/omega/examples/old_test/chosol.oc-rt @@ -0,0 +1,32 @@ +>>> T10:={[i] -> [0,i,0,0]}; +>>> T20:={[i,j] -> [1,j,0,i]}; +>>> T30:={[i] -> [1,i-1,1,0]}; +>>> +>>> Symbolic n; +>>> IS10 := {[i]: 2 <= i <= n}; +>>> IS20 := {[i,j]: 2 <= i <= n && 1 <= j <= i-1}; +>>> IS30 := IS10; +>>> +>>> codegen T10:IS10,T20:IS20,T30:IS30; +for(t2 = 2; t2 <= n; t2++) { + s1(t2); +} +for(t2 = 1; t2 <= n-1; t2++) { + for(t4 = t2+1; t4 <= n; t4++) { + s2(t4,t2); + } + s3(t2+1); +} + +>>> codegen 2 T10:IS10,T20:IS20,T30:IS30; +for(t2 = 2; t2 <= n; t2++) { + s1(t2); +} +for(t2 = 1; t2 <= n-1; t2++) { + for(t4 = t2+1; t4 <= n; t4++) { + s2(t4,t2); + } + s3(t2+1); +} + + diff --git a/omega/examples/old_test/closure1 b/omega/examples/old_test/closure1 new file mode 100644 index 0000000..0e4c541 --- /dev/null +++ b/omega/examples/old_test/closure1 @@ -0,0 +1,8 @@ +({[i] -> [i+2]} union {[i] -> [i+3]})+; +R := ({[i] -> [i'] : i'=i+3} union {[i] -> [i'] : i'=i+5} union {[i] -> [i'] : i'=i+7})+; +R; +notR := {[i] -> [i'] : i' >= i+3} - R; +notR; +{[i] -> [i'] : i' >= i+3} - notR; + + diff --git a/omega/examples/old_test/closure1.oc-rt b/omega/examples/old_test/closure1.oc-rt new file mode 100644 index 0000000..93ecda0 --- /dev/null +++ b/omega/examples/old_test/closure1.oc-rt @@ -0,0 +1,31 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# ({[i] -> [i+2]} union {[i] -> [i+3]})+; + +{[i] -> [Out_1] : Exists ( alpha : 2alpha = i+Out_1 && i <= Out_1-2)} union + {[i] -> [Out_1] : Exists ( alpha : i < Out_1+2alpha && Out_1+3alpha <= i)} + +# +# R := ({[i] -> [i'] : i'=i+3} union {[i] -> [i'] : i'=i+5} union {[i] -> [i'] : i'=i+7})+; +# +# R; + +{[i] -> [i'] : Exists ( alpha : i+3alpha = i' && i <= i'-3)} union + {[i] -> [i'] : Exists ( alpha : i < i'+3alpha && 2i'+7alpha <= 2i)} union + {[i] -> [i'] : Exists ( alpha : i'+3alpha < i && 2i <= 2i'+5alpha)} + +# +# notR := {[i] -> [i'] : i' >= i+3} - R; +# +# notR; + +{[i] -> [i+4] } + +# +# {[i] -> [i'] : i' >= i+3} - notR; + +{[i] -> [i+3] } union + {[i] -> [i'] : i <= i'-5} + +# +# +# diff --git a/omega/examples/old_test/closure2 b/omega/examples/old_test/closure2 new file mode 100644 index 0000000..1cfcefd --- /dev/null +++ b/omega/examples/old_test/closure2 @@ -0,0 +1,4 @@ +R := {[i,j] -> [i+3,j]} union {[i,j] -> [i+2,j-1]} union {[i,j] -> [i+1,j+1]}; +R+; +R+ compose R; +R - (R+ compose R); diff --git a/omega/examples/old_test/closure2.oc-rt b/omega/examples/old_test/closure2.oc-rt new file mode 100644 index 0000000..e10a428 --- /dev/null +++ b/omega/examples/old_test/closure2.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[i,j] -> [i+3,j]} union {[i,j] -> [i+2,j-1]} union {[i,j] -> [i+1,j+1]}; +# +# R+; + +{[i,j] -> [Out_1,j'] : Out_1+2j' = i+2j && j' < j} union + {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 3+i+2j <= Out_1+2j' && i+j' <= j+Out_1)} + +# +# R+ compose R; + +{[i,j] -> [Out_1,j'] : Out_1+2j' = i+2j && j' <= j-2} union + {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 3+i+2j <= Out_1+2j' && 3+i+j' <= j+Out_1)} union + {[i,j] -> [Out_1,j'] : Exists ( alpha : i+j' = j+Out_1+3alpha && 6+i+2j <= Out_1+2j' && i+j' <= j+Out_1)} + +# +# R - (R+ compose R); + +{[i,j] -> [i+2,j-1] } union + {[i,j] -> [i+1,j+1] } + +# diff --git a/omega/examples/old_test/closure3 b/omega/examples/old_test/closure3 new file mode 100644 index 0000000..4fdc022 --- /dev/null +++ b/omega/examples/old_test/closure3 @@ -0,0 +1,10 @@ +symbolic n,m; +d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; +d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; +d := d11 union d12; +d+; +d+ compose d; +d11 - (d+ compose d); +gist d11 - (d+ compose d) given d11; +d12 - (d+ compose d); +gist d12 - (d+ compose d) given d12; diff --git a/omega/examples/old_test/closure3.oc-rt b/omega/examples/old_test/closure3.oc-rt new file mode 100644 index 0000000..4d99b34 --- /dev/null +++ b/omega/examples/old_test/closure3.oc-rt @@ -0,0 +1,48 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; +# +# d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; +# +# d := d11 union d12; +# +# d+; + +{[1,j] -> [1,j+2] : j+2 <= m <= 4 && 1 <= n && 1 <= j} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && Out_2+4 <= m <= 2i && 1 <= j <= Out_2-4 && i <= n)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = 2i+j+4alpha && 1 <= i <= n && Out_2 <= m && 1 <= j && 5 <= m && 2i+j <= Out_2)} union + {[i,j] -> [i,Out_2] : Exists ( alpha,beta : Out_2 = j+4alpha && 1 <= i <= n && Out_2 <= m && 2i+4beta < Out_2 && 1 <= j && Out_2 <= m+2i+4beta && 4i+j <= Out_2)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && 1 <= j <= Out_2-4 && Out_2 <= m && 2i < m)} + +# +# d+ compose d; + +{[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && Out_2+4 <= m <= 2i && 1 <= j <= Out_2-8 && i <= n)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && Out_2 <= m && 1 <= j && 4i+j <= Out_2)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = 2i+j+4alpha && 1 <= i <= n && Out_2 <= m && 4+2i+j <= Out_2 && 1 <= j)} union + {[i,j] -> [i,Out_2] : Exists ( alpha : Out_2 = j+4alpha && 1 <= i <= n && 1 <= j <= Out_2-8 && Out_2 <= m && 2i < m)} + +# +# d11 - (d+ compose d); + +{[i,j] -> [i,2i+j] : 1 <= i <= 3, n && 1 <= j && 2i+j <= m} union + {[i,j] -> [i,2i+j] : Exists ( alpha : 2alpha = 1+i && 5 <= i <= n && 2i+j <= m && 1 <= j)} + +# +# gist d11 - (d+ compose d) given d11; + +{[i,j] -> [i',Out_2] : i' <= 3} union + {[i,j] -> [i',Out_2] : Exists ( alpha : 0 = 1+i'+2alpha && 5 <= i)} + +# +# d12 - (d+ compose d); + +{[i,j] -> [i,j+4] : 2 <= i <= n && 1 <= j <= m-4} + +# +# gist d12 - (d+ compose d) given d12; + +{[i,j] -> [i',Out_2] : 2 <= i'} + +# diff --git a/omega/examples/old_test/closure4 b/omega/examples/old_test/closure4 new file mode 100644 index 0000000..e5adb13 --- /dev/null +++ b/omega/examples/old_test/closure4 @@ -0,0 +1,8 @@ +symbolic n,m; +R1 := {[x,y] -> [x,y+1] : 1 <= x,y <= 10}; +R2 := {[x,y] -> [x+1,y] : 1 <= x <= 20 && 5 <= y <= 15}; +R12 := R1 union R2; +R12c := R12+; +R12c; +(R12c compose R12c) - R12c; +(R12c compose R12) - R12c; diff --git a/omega/examples/old_test/closure4.oc-rt b/omega/examples/old_test/closure4.oc-rt new file mode 100644 index 0000000..d208cce --- /dev/null +++ b/omega/examples/old_test/closure4.oc-rt @@ -0,0 +1,28 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# R1 := {[x,y] -> [x,y+1] : 1 <= x,y <= 10}; +# +# R2 := {[x,y] -> [x+1,y] : 1 <= x <= 20 && 5 <= y <= 15}; +# +# R12 := R1 union R2; +# +# R12c := R12+; +# +# R12c; + +{[x,y] -> [x,y'] : 1 <= y < y' <= 11 && 1 <= x <= 10} union + {[x,y] -> [x',y] : 1 <= x < x' <= 21 && 5 <= y <= 15} union + {[x,y] -> [x',y'] : 1 <= x < x' <= 21 && 1 <= y < y' <= 11 && x <= 10 && 5 <= y'} + +# +# (R12c compose R12c) - R12c; + +{[x,y] -> [x',y'] : FALSE } + +# +# (R12c compose R12) - R12c; + +{[x,y] -> [x',y'] : FALSE } + +# diff --git a/omega/examples/old_test/closure5 b/omega/examples/old_test/closure5 new file mode 100644 index 0000000..2792806 --- /dev/null +++ b/omega/examples/old_test/closure5 @@ -0,0 +1,6 @@ +symbolic n,m; +d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; +d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; +d := d11 union d12; +e := d - (d+ compose d); +gist e given d; diff --git a/omega/examples/old_test/closure5.oc-rt b/omega/examples/old_test/closure5.oc-rt new file mode 100644 index 0000000..62ade41 --- /dev/null +++ b/omega/examples/old_test/closure5.oc-rt @@ -0,0 +1,18 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# d11 := {[i,j] -> [i,2i+j] : 1 <= i <= n && 1 <= j,2i+j <= m}; +# +# d12 := {[i,j] -> [i,j+4] : 1 <= i <= n && 1 <= j,j+4 <= m}; +# +# d := d11 union d12; +# +# e := d - (d+ compose d); +# +# gist e given d; + +{[i,j] -> [i,2i+j] : 1 <= i <= 3, n && 1 <= j && 2i+j <= m} union + {[i,j] -> [i,2i+j] : Exists ( alpha : 2alpha = 1+i && 5 <= i <= n && 2i+j <= m && 1 <= j)} union + {[i,j] -> [i,j+4] : 2 <= i <= n && 1 <= j <= m-4} + +# diff --git a/omega/examples/old_test/closure6 b/omega/examples/old_test/closure6 new file mode 100644 index 0000000..777fbba --- /dev/null +++ b/omega/examples/old_test/closure6 @@ -0,0 +1,13 @@ + +T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < j <= i <= 1024}; + +T2 := {[k,i,i] -> [i,i',j'] : 1 <= k < i < j' <= i' <= 1024}; + +T3 := {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024}; + +T := T1 union T2 union T3; + +B := {[k,i,j]: 1 <= k < j <= i <= 1024}; + +T + within B; + diff --git a/omega/examples/old_test/closure6.oc-rt b/omega/examples/old_test/closure6.oc-rt new file mode 100644 index 0000000..0eefdaa --- /dev/null +++ b/omega/examples/old_test/closure6.oc-rt @@ -0,0 +1,29 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < j <= i <= 1024}; +# +# +# T2 := {[k,i,i] -> [i,i',j'] : 1 <= k < i < j' <= i' <= 1024}; +# +# +# T3 := {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024}; +# +# +# T := T1 union T2 union T3; +# +# +# B := {[k,i,j]: 1 <= k < j <= i <= 1024}; +# +# +# T + within B; + +{[k,i,j] -> [j',i,j] : 1 <= k < j' < j <= i <= 1024} union + {[k,i,j] -> [j',i',Out_3] : 1 <= k < j < i < j' < Out_3 <= i' <= 1024} union + {[k,i,i] -> [j',i',Out_3] : 1 <= k < i < j' < Out_3 <= i' <= 1024} union + {[k,i,i] -> [i,i',Out_3] : 1 <= k < i < Out_3 <= i' <= 1024} union + {[k,i,j] -> [j,i',i] : 1 <= k < j < i <= i' <= 1024} union + {[k,i,j] -> [j',i',i] : 1 <= k < j < j' < i <= i' <= 1024} union + {[k,i,j] -> [i,i',Out_3] : 1 <= k < j < i < Out_3 <= i' <= 1024} + +# +# diff --git a/omega/examples/old_test/closure7 b/omega/examples/old_test/closure7 new file mode 100644 index 0000000..6ba2e1d --- /dev/null +++ b/omega/examples/old_test/closure7 @@ -0,0 +1,12 @@ + +R := {[t,s] -> [t+1,s] } union + {[t,s] -> [t,s] } union + {[t,s] -> [t,s+1] }; + +R; +R+; + +S := {[t,s] -> [t+1,s] } union {[t,s] -> [t,s+1] }; + +S; +S+; diff --git a/omega/examples/old_test/closure7.oc-rt b/omega/examples/old_test/closure7.oc-rt new file mode 100644 index 0000000..0de9745 --- /dev/null +++ b/omega/examples/old_test/closure7.oc-rt @@ -0,0 +1,36 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# R := {[t,s] -> [t+1,s] } union +# {[t,s] -> [t,s] } union +# {[t,s] -> [t,s+1] }; +# +# +# R; + +{[t,s] -> [t+1,s] } union + {[t,s] -> [t,s] } union + {[t,s] -> [t,s+1] } + +# +# R+; + +{[t,s] -> [t,s'] : s <= s'} union + {[t,s] -> [t',s'] : t < t' && s <= s'} + +# +# +# S := {[t,s] -> [t+1,s] } union {[t,s] -> [t,s+1] }; +# +# +# S; + +{[t,s] -> [t+1,s] } union + {[t,s] -> [t,s+1] } + +# +# S+; + +{[t,s] -> [t,s'] : s < s'} union + {[t,s] -> [t',s'] : t < t' && s <= s'} + +# diff --git a/omega/examples/old_test/closure8 b/omega/examples/old_test/closure8 new file mode 100644 index 0000000..b1f9b9b --- /dev/null +++ b/omega/examples/old_test/closure8 @@ -0,0 +1 @@ +{[i] -> [i]}+; diff --git a/omega/examples/old_test/closure8.oc-rt b/omega/examples/old_test/closure8.oc-rt new file mode 100644 index 0000000..90d5282 --- /dev/null +++ b/omega/examples/old_test/closure8.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[i] -> [i]}+; + +{[i] -> [i] } + +# diff --git a/omega/examples/old_test/collard b/omega/examples/old_test/collard new file mode 100644 index 0000000..0fb4ee4 --- /dev/null +++ b/omega/examples/old_test/collard @@ -0,0 +1,16 @@ +symbolic n; + +I1 := {[i,j] : 1 <= i < j <= n}; +I2 := {[i,j,K] : 1 <= i < j,K <= n}; +I3 := {[i] : 1 <= i <= n}; +I4 := {[i,j] : 1 <= j < i <= n}; +I5 := {[i] : 1 <= i <= n}; + +T1 := {[i,j] -> [1,i,0,n-i,n-j]}; +T2 := {[i,j,k] -> [1,i,1,n-j,k]}; +T3 := {[i] -> [0,0,0,0,i]}; +T4 := {[i,j] -> [2,j,1,i,j]}; +T5 := {[i] -> [2,i,0,0,0]}; + + +codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; diff --git a/omega/examples/old_test/collard.oc-rt b/omega/examples/old_test/collard.oc-rt new file mode 100644 index 0000000..9d2c8c0 --- /dev/null +++ b/omega/examples/old_test/collard.oc-rt @@ -0,0 +1,49 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# +# I1 := {[i,j] : 1 <= i < j <= n}; +# +# I2 := {[i,j,K] : 1 <= i < j,K <= n}; +# +# I3 := {[i] : 1 <= i <= n}; +# +# I4 := {[i,j] : 1 <= j < i <= n}; +# +# I5 := {[i] : 1 <= i <= n}; +# +# +# T1 := {[i,j] -> [1,i,0,n-i,n-j]}; +# +# T2 := {[i,j,k] -> [1,i,1,n-j,k]}; +# +# T3 := {[i] -> [0,0,0,0,i]}; +# +# T4 := {[i,j] -> [2,j,1,i,j]}; +# +# T5 := {[i] -> [2,i,0,0,0]}; +# +# +# +# codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +for(t5 = 1; t5 <= n; t5++) { + s3(t5); +} +for(t2 = 1; t2 <= n-1; t2++) { + for(t5 = 0; t5 <= n-t2-1; t5++) { + s1(t2,n-t5); + } + for(t4 = 0; t4 <= n-t2-1; t4++) { + for(t5 = t2+1; t5 <= n; t5++) { + s2(t2,n-t4,t5); + } + } +} +for(t2 = 1; t2 <= n; t2++) { + s5(t2); + for(t4 = t2+1; t4 <= n; t4++) { + s4(t4,t2); + } +} + +# diff --git a/omega/examples/old_test/cover b/omega/examples/old_test/cover new file mode 100644 index 0000000..2cfdacf --- /dev/null +++ b/omega/examples/old_test/cover @@ -0,0 +1,6 @@ +symbolic p(2), n, m; +R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; +W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; +Exposed := R intersection complement ( W1 union W2 ); +Exposed; diff --git a/omega/examples/old_test/cover.oc-rt b/omega/examples/old_test/cover.oc-rt new file mode 100644 index 0000000..1d25c6e --- /dev/null +++ b/omega/examples/old_test/cover.oc-rt @@ -0,0 +1,16 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic p(2), n, m; +# +# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +# +# W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) >= 0 }; +# +# W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(Set) < 0 }; +# +# Exposed := R intersection complement ( W1 union W2 ); +# +# Exposed; + +{[In_1,In_2] : FALSE } + +# diff --git a/omega/examples/old_test/dagstuhl1 b/omega/examples/old_test/dagstuhl1 new file mode 100644 index 0000000..56f1a4e --- /dev/null +++ b/omega/examples/old_test/dagstuhl1 @@ -0,0 +1,7 @@ +T := {[i,j] -> [i+10j]}; +I := {[0:9,0:9]}; +# Version 1.0.0 incorrectly generates references to i and j +codegen T:I; + +# Version 1.0.0 doesn't generate an assignment for t2 +codegen {[p,i,j] : 0 <= i,j <= 9 && p = i+10j}; diff --git a/omega/examples/old_test/dagstuhl1.oc-rt b/omega/examples/old_test/dagstuhl1.oc-rt new file mode 100644 index 0000000..7c3f019 --- /dev/null +++ b/omega/examples/old_test/dagstuhl1.oc-rt @@ -0,0 +1,23 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# T := {[i,j] -> [i+10j]}; +# +# I := {[0:9,0:9]}; +# +# # Version 1.0.0 incorrectly generates references to i and j +# codegen T:I; +for(t1 = 0; t1 <= 99; t1++) { + s1(intDiv(t1+-10*j,1),intDiv(t1-i,10)); +} + +# +# +# # Version 1.0.0 doesn't generate an assignment for t2 +# codegen {[p,i,j] : 0 <= i,j <= 9 && p = i+10j}; +for(t1 = 0; t1 <= 99; t1++) { + for(t2 = intMod(t1,10); t2 <= 9; t2 += 10) { + t3=intDiv((-t2+t1+9),10); + s1(t2+10*t3,t2,t3); + } +} + +# diff --git a/omega/examples/old_test/dagstuhl2 b/omega/examples/old_test/dagstuhl2 new file mode 100644 index 0000000..4cc3758 --- /dev/null +++ b/omega/examples/old_test/dagstuhl2 @@ -0,0 +1,6 @@ +{[i,j] : + 2i+6j>=9 + && 5i-3j >= 0 + && 2i-10j >= -15 + && -2i+6j >= 3 + && -2i-6j >= -17}; diff --git a/omega/examples/old_test/dagstuhl2.oc-rt b/omega/examples/old_test/dagstuhl2.oc-rt new file mode 100644 index 0000000..2cf1f8c --- /dev/null +++ b/omega/examples/old_test/dagstuhl2.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[i,j] : +# 2i+6j>=9 +# && 5i-3j >= 0 +# && 2i-10j >= -15 +# && -2i+6j >= 3 +# && -2i-6j >= -17}; + +{[i,j] : FALSE } + +# diff --git a/omega/examples/old_test/dagstuhl3 b/omega/examples/old_test/dagstuhl3 new file mode 100644 index 0000000..c63fdf8 --- /dev/null +++ b/omega/examples/old_test/dagstuhl3 @@ -0,0 +1,4 @@ +# In verify, we now prefer to eliminate wildcards last +# This gives us an improved chance of finding equality +# constraints on wildcards. +{[i,j] : 0 <= i,j <= 4 && exists(a:i=j+5a)}; diff --git a/omega/examples/old_test/dagstuhl3.oc-rt b/omega/examples/old_test/dagstuhl3.oc-rt new file mode 100644 index 0000000..6dbb128 --- /dev/null +++ b/omega/examples/old_test/dagstuhl3.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # In verify, we now prefer to eliminate wildcards last +# # This gives us an improved chance of finding equality +# # constraints on wildcards. +# {[i,j] : 0 <= i,j <= 4 && exists(a:i=j+5a)}; + +{[i,i]: 0 <= i <= 4} + +# diff --git a/omega/examples/old_test/davew1 b/omega/examples/old_test/davew1 new file mode 100644 index 0000000..2d8d907 --- /dev/null +++ b/omega/examples/old_test/davew1 @@ -0,0 +1,25 @@ +# +# A one point, we couldn't handling this analysis of value-based dependences. +# Now we can :-) +# + +Pos := {[In_1,In_2] -> [i,j] : 1 <= i,j <= 100 && + In_1 = 1+2j+i && 2i+In_2 = 1 }; + +ko := {[In_1,In_2] -> [i,j] : 1+In_1+2j = 4i && In_2+i+2j = 0 && + 1 <= i <= 100 && 1 <= j <= 100}; + +kf := {[i,j] -> [i',j'] : 1 <= i,i',j,j' <= 100 && i < i' && + 4i = 2+2j+2j'+i' && 2i' = 1+2j+i }; + +k := ko join kf; + +k intersection Pos; +example (k intersection Pos); +Pos; +Pos - (ko join kf); +Pos - k; +answer := Pos - k; +answer; +answer intersection {[7,-7] -> [4,1]}; +gist answer given Pos; diff --git a/omega/examples/old_test/davew1.oc-rt b/omega/examples/old_test/davew1.oc-rt new file mode 100644 index 0000000..bc9844c --- /dev/null +++ b/omega/examples/old_test/davew1.oc-rt @@ -0,0 +1,67 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # A one point, we couldn't handling this analysis of value-based dependences. +# # Now we can :-) +# # +# +# Pos := {[In_1,In_2] -> [i,j] : 1 <= i,j <= 100 && +# In_1 = 1+2j+i && 2i+In_2 = 1 }; +# +# +# ko := {[In_1,In_2] -> [i,j] : 1+In_1+2j = 4i && In_2+i+2j = 0 && +# 1 <= i <= 100 && 1 <= j <= 100}; +# +# +# kf := {[i,j] -> [i',j'] : 1 <= i,i',j,j' <= 100 && i < i' && +# 4i = 2+2j+2j'+i' && 2i' = 1+2j+i }; +# +# +# k := ko join kf; +# +# +# k intersection Pos; + +{[In_1,In_2] -> [i,j] : Exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2 = 5+8j+20alpha && -199 <= In_2 <= -2j-5 && 1 <= j)} + +# +# example (k intersection Pos); + +{[7,-7] -> [4,1] } + +# +# Pos; + +{[In_1,In_2] -> [i,j] : In_1 = 1+i+2j && In_2+2i = 1 && 1 <= i <= 100 && 1 <= j <= 100} + +# +# Pos - (ko join kf); + +{[In_1,In_2] -> [i,j] : In_1 = 1+i+2j && In_2+2i = 1 && 1 <= i <= j+2, 100 && 1 <= j <= 100} union + {[In_1,In_2] -> [i,j] : Exists ( alpha : In_1 = 1+i+2j && In_2+2i = 1 && j+3 <= i <= 100 && 5+10alpha <= 3i+2j && 3i+2j <= 13+10alpha && 1 <= j)} + +# +# Pos - k; + +{[In_1,In_2] -> [i,j] : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 2j+2 <= In_1 <= 3j+3, 2j+101 && 1 <= j <= 100} union + {[In_1,In_2] -> [i,j] : Exists ( alpha : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 3j+4 <= In_1 <= 2j+101 && 8+4j+10alpha <= 3In_1 && 3In_1 <= 16+4j+10alpha && 1 <= j)} + +# +# answer := Pos - k; +# +# answer; + +{[In_1,In_2] -> [i,j] : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 2j+2 <= In_1 <= 3j+3, 2j+101 && 1 <= j <= 100} union + {[In_1,In_2] -> [i,j] : Exists ( alpha : 1+i+2j = In_1 && 2In_1+In_2 = 3+4j && 3j+4 <= In_1 <= 2j+101 && 8+4j+10alpha <= 3In_1 && 3In_1 <= 16+4j+10alpha && 1 <= j)} + +# +# answer intersection {[7,-7] -> [4,1]}; + +{[In_1,In_2] -> [i,j] : FALSE } + +# +# gist answer given Pos; + +{[In_1,In_2] -> [i,j] : i <= j+2} union + {[In_1,In_2] -> [i,j] : Exists ( alpha : j <= i-3 && 3i+2j <= 13+10alpha && 5+10alpha <= 3i+2j)} + +# diff --git a/omega/examples/old_test/ddtest b/omega/examples/old_test/ddtest new file mode 100644 index 0000000..27b1ff3 --- /dev/null +++ b/omega/examples/old_test/ddtest @@ -0,0 +1,97 @@ +symbolic p(2), n, m1, m2, low; + +R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 }; + +f1i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && + 1 <= iw <= n && 1 <= jw <= m2 && + jw = jr && + iw = ir }; +f1f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && + 1 <= iw <= n && 1 <= jw <= m2 && + jw = jr && + iw < ir }; + +f3i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && + 1 <= iw <= n && 1 < low <= jw <= m1 && + jw-1 = jr && + iw = ir }; +f3f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && + 1 <= iw <= n && 1 < low <= jw <= m1 && + jw-1 = jr && + iw < ir }; + +o31i := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && + 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && + jw1 = jw3-1 && + iw1 = iw3 }; + +o13f := { [iw1,jw1] -> [iw3,jw3] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && + 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && + jw1 = jw3-1 && + iw1 < iw3 }; + +o31f := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && + 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && + jw1 = jw3-1 && + iw3 < iw1 }; + +o11f := { [iw1a,jw1a] -> [iw1b,jw1b] : 1 <=iw1a<= n && 1 <=jw1a<= m2 && + 1 <=iw1b<= n && 1 <=jw1b<= m2 && + jw1a = jw1b && + iw1a < iw1b }; +o33f := { [iw3a,jw3a] -> [iw3b,jw3b] : 1 <=iw3a<= n && 1 < low <=jw3a<= m1 && + 1 <=iw3b<= n && 1 < low <=jw3b<= m1 && + jw3a-1 = jw3b-1 && + iw3a < iw3b }; + + +# FIRST GROUP - 1i and 2i (NO POSSIBLE OUTPUT DEPS. BETWEEN) +v1i := f1i; +v1i; + +Exposed12i := R intersection complement domain f1i; +Exposed12i; + +# SECOND GROUP - 3i +v3i := f3i / Exposed12i; # / is restrictRange +v3i; + +Exposed3i := R intersection complement domain f3i; +Exposed3i; + +# THIRD GROUP - 1,2,3f (THERE ARE POSSIBLE OUTPUT DEPS BETWEEN THEM) + +v1f := ( f1f / Exposed3i ) + intersection complement ( f3i compose o13f ) + intersection complement ( f3f compose o13f ) + intersection complement ( f1i compose o11f ) + intersection complement ( f1f compose o11f ); +v1f; + +# WE SHOULD BE ABLE TO DO v1f WITH SOME VALUE-BASED FLOW DD'S + +v1f_val := ( f1f / Exposed3i ) + intersection complement ( v3i compose o13f ) + intersection complement ( f3f compose o13f ) + intersection complement ( v1i compose o11f ) + intersection complement ( f1f compose o11f ); +v1f_val; + +# +# The effects of loop-independent flow have been taken out already, +# so this should work. But it does not. Probably I am stupyd. +# + +v1f_clever := ( f1f / Exposed3i ) + intersection complement ( f3f compose o13f ) + intersection complement ( f1f compose o11f ); +v1f_clever; + +# +# NOW CHECK FOR EQUIVALENCES - THESE SHOULD BE TRUE +# + +v1f subset v1f_val; +v1f_val subset v1f; +# v1f subset v1f_clever; +# v1f_clever subset v1f; diff --git a/omega/examples/old_test/ddtest.oc-rt b/omega/examples/old_test/ddtest.oc-rt new file mode 100644 index 0000000..1c3e009 --- /dev/null +++ b/omega/examples/old_test/ddtest.oc-rt @@ -0,0 +1,152 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic p(2), n, m1, m2, low; +# +# +# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 }; +# +# +# f1i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && +# 1 <= iw <= n && 1 <= jw <= m2 && +# jw = jr && +# iw = ir }; +# +# f1f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && +# 1 <= iw <= n && 1 <= jw <= m2 && +# jw = jr && +# iw < ir }; +# +# +# f3i := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && +# 1 <= iw <= n && 1 < low <= jw <= m1 && +# jw-1 = jr && +# iw = ir }; +# +# f3f := { [iw,jw] -> [ir,jr] : 1 <= ir <= n && 1 <= jr <= m1 && +# 1 <= iw <= n && 1 < low <= jw <= m1 && +# jw-1 = jr && +# iw < ir }; +# +# +# o31i := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && +# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && +# jw1 = jw3-1 && +# iw1 = iw3 }; +# +# +# o13f := { [iw1,jw1] -> [iw3,jw3] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && +# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && +# jw1 = jw3-1 && +# iw1 < iw3 }; +# +# +# o31f := { [iw3,jw3] -> [iw1,jw1] : 1 <= iw1 <= n && 1 <= jw1 <= m2 && +# 1 <= iw3 <= n && 1 < low <= jw3 <= m1 && +# jw1 = jw3-1 && +# iw3 < iw1 }; +# +# +# o11f := { [iw1a,jw1a] -> [iw1b,jw1b] : 1 <=iw1a<= n && 1 <=jw1a<= m2 && +# 1 <=iw1b<= n && 1 <=jw1b<= m2 && +# jw1a = jw1b && +# iw1a < iw1b }; +# +# o33f := { [iw3a,jw3a] -> [iw3b,jw3b] : 1 <=iw3a<= n && 1 < low <=jw3a<= m1 && +# 1 <=iw3b<= n && 1 < low <=jw3b<= m1 && +# jw3a-1 = jw3b-1 && +# iw3a < iw3b }; +# +# +# +# # FIRST GROUP - 1i and 2i (NO POSSIBLE OUTPUT DEPS. BETWEEN) +# v1i := f1i; +# +# v1i; + +{[iw,jw] -> [iw,jw] : 1 <= jw <= m1, m2 && 1 <= iw <= n} + +# +# +# Exposed12i := R intersection complement domain f1i; +# +# Exposed12i; + +{[In_1,In_2]: 1, m2+1 <= In_2 <= m1 && 1 <= In_1 <= n} + +# +# +# # SECOND GROUP - 3i +# v3i := f3i / Exposed12i; +# # / is restrictRange +# v3i; + +{[iw,jw] -> [iw,jw-1] : 2 <= low <= jw <= m1 && 1 <= iw <= n && m2 <= jw-2} + +# +# +# Exposed3i := R intersection complement domain f3i; +# +# Exposed3i; + +{[In_1,In_2]: 1 <= In_1 <= n && 1 <= In_2 <= m1 && low <= 1} union + {[In_1,In_2]: 1 <= In_2 <= m1, low-1 && 1 <= In_1 <= n} + +# +# +# # THIRD GROUP - 1,2,3f (THERE ARE POSSIBLE OUTPUT DEPS BETWEEN THEM) +# +# v1f := ( f1f / Exposed3i ) +# intersection complement ( f3i compose o13f ) +# intersection complement ( f3f compose o13f ) +# intersection complement ( f1i compose o11f ) +# intersection complement ( f1f compose o11f ); +# +# v1f; + +{[iw1a,jw1a] -> [ir,jr] : FALSE } + +# +# +# # WE SHOULD BE ABLE TO DO v1f WITH SOME VALUE-BASED FLOW DD'S +# +# v1f_val := ( f1f / Exposed3i ) +# intersection complement ( v3i compose o13f ) +# intersection complement ( f3f compose o13f ) +# intersection complement ( v1i compose o11f ) +# intersection complement ( f1f compose o11f ); +# +# v1f_val; + +{[iw1a,jw1a] -> [ir,jr] : FALSE } + +# +# +# # +# # The effects of loop-independent flow have been taken out already, +# # so this should work. But it does not. Probably I am stupyd. +# # +# +# v1f_clever := ( f1f / Exposed3i ) +# intersection complement ( f3f compose o13f ) +# intersection complement ( f1f compose o11f ); +# +# v1f_clever; + +{[iw1a,jw1a] -> [iw1a+1,jw1a] : 1 <= jw1a <= m2, m1 && 1 <= iw1a < n && low <= 1} union + {[iw1a,jw1a] -> [iw1a+1,jw1a] : 1 <= jw1a <= m2, m1, low-1 && 1 <= iw1a < n} + +# +# +# # +# # NOW CHECK FOR EQUIVALENCES - THESE SHOULD BE TRUE +# # +# +# v1f subset v1f_val; + +True +# +# v1f_val subset v1f; + +True +# +# # v1f subset v1f_clever; +# # v1f_clever subset v1f; diff --git a/omega/examples/old_test/emit b/omega/examples/old_test/emit new file mode 100644 index 0000000..3b33a98 --- /dev/null +++ b/omega/examples/old_test/emit @@ -0,0 +1,38 @@ +# +# A problem that arises during the analysis of emit.t +# We are trying to find the dependences to the read 58: rhs(i) +# There are memory-based deps from the write 58: rhs(j) +# and the write 50: rhs(i0+k) +# Due to some screwy stuff, we do not realize that the first is +# a partial cover for the second, and do the real kill test. +# +# line_49_expr is nwall(l) +# + +symbolic matdim_E, i0_1(1), line_49_expr(1); + +is_58 := { [i,j] : i+1 <= j <= matdim_E && 1 <= i <= matdim_E }; +is_50 := { [l,k] : 1 <= k <= line_49_expr(Set) && 1 <= l <= 5 }; + +plus_plus := { [i,j] -> [i',j'] : i < i' && j < j' }; +plus_zero := { [i,j] -> [i',j'] : i < i' && j = j' }; +plus_star := { [i,j] -> [i',j'] : i < i' }; + +mo_50_50 := (is_50 * is_50) intersection plus_star + intersection { [l1,k1]->[l2,k2] : i0_1(In)+k1 = i0_1(Out)+k2 }; +mo_50_58 := (is_50 * is_58) + intersection { [l,k] -> [i,j] : i0_1(In)+k = j }; +mo_58_58 := (is_58 * is_58) intersection plus_zero + intersection { [i,j] -> [i',j'] : j = j' }; + +mf_58_58 := (is_58 * is_58) intersection plus_plus + intersection { [iw,jw] -> [ir,jr] : jw = ir }; +mf_50_58 := (is_50 * is_58) + intersection { [l,k] -> [i,j] : i0_1(In)+k = i }; + +vf_58_58 := mf_58_58 - (mf_58_58 compose mo_58_58); +vf_58_58; + +vf_50_58 := mf_50_58 intersection ( complement (mf_58_58 compose mo_50_58) ) + intersection ( complement (mf_50_58 compose mo_50_50) ); +vf_50_58; diff --git a/omega/examples/old_test/emit.oc-rt b/omega/examples/old_test/emit.oc-rt new file mode 100644 index 0000000..1bf7d6c --- /dev/null +++ b/omega/examples/old_test/emit.oc-rt @@ -0,0 +1,61 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # A problem that arises during the analysis of emit.t +# # We are trying to find the dependences to the read 58: rhs(i) +# # There are memory-based deps from the write 58: rhs(j) +# # and the write 50: rhs(i0+k) +# # Due to some screwy stuff, we do not realize that the first is +# # a partial cover for the second, and do the real kill test. +# # +# # line_49_expr is nwall(l) +# # +# +# Symbolic matdim_E, i0_1(1), line_49_expr(1); +# +# +# is_58 := { [i,j] : i+1 <= j <= matdim_E && 1 <= i <= matdim_E }; +# +# is_50 := { [l,k] : 1 <= k <= line_49_expr(Set) && 1 <= l <= 5 }; +# +# +# plus_plus := { [i,j] -> [i',j'] : i < i' && j < j' }; +# +# plus_zero := { [i,j] -> [i',j'] : i < i' && j = j' }; +# +# plus_star := { [i,j] -> [i',j'] : i < i' }; +# +# +# mo_50_50 := (is_50 * is_50) intersection plus_star +# intersection { [l1,k1]->[l2,k2] : i0_1(In)+k1 = i0_1(Out)+k2 }; +# +# mo_50_58 := (is_50 * is_58) +# intersection { [l,k] -> [i,j] : i0_1(In)+k = j }; +# +# mo_58_58 := (is_58 * is_58) intersection plus_zero +# intersection { [i,j] -> [i',j'] : j = j' }; +# +# +# mf_58_58 := (is_58 * is_58) intersection plus_plus +# intersection { [iw,jw] -> [ir,jr] : jw = ir }; +# +# mf_50_58 := (is_50 * is_58) +# intersection { [l,k] -> [i,j] : i0_1(In)+k = i }; +# +# +# vf_58_58 := mf_58_58 - (mf_58_58 compose mo_58_58); +# +# vf_58_58; + +{[i,i+1] -> [i+1,Out_2] : 1 <= i <= Out_2-2 && Out_2 <= matdim_E} + +# +# +# vf_50_58 := mf_50_58 intersection ( complement (mf_58_58 compose mo_50_58) ) +# intersection ( complement (mf_50_58 compose mo_50_50) ); +# +# vf_50_58; + +{[In_1,-i0_1(In_1)+1] -> [1,j] : -line_49_expr(In_1)+1 <= i0_1(In_1) <= 0 && 1 <= In_1 <= 4 && 2 <= j <= matdim_E && UNKNOWN} union + {[In_1,-i0_1(In_1)+1] -> [1,j] : In_1 = 5 && -line_49_expr(In_1)+1 <= i0_1(In_1) <= 0 && 2 <= j <= matdim_E} + +# diff --git a/omega/examples/old_test/example1 b/omega/examples/old_test/example1 new file mode 100644 index 0000000..0721b20 --- /dev/null +++ b/omega/examples/old_test/example1 @@ -0,0 +1,4 @@ +foo := {[In_1,In_2] -> [i,j] : exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2+20alpha = 5+8j && -199 <= In_2 <= -2j-5 && 1 <= j)}; +example foo; + + diff --git a/omega/examples/old_test/example1.oc-rt b/omega/examples/old_test/example1.oc-rt new file mode 100644 index 0000000..89b2e0a --- /dev/null +++ b/omega/examples/old_test/example1.oc-rt @@ -0,0 +1,10 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# foo := {[In_1,In_2] -> [i,j] : Exists ( alpha : In_2+2i = 1 && 2In_1+In_2 = 3+4j && In_2+20alpha = 5+8j && -199 <= In_2 <= -2j-5 && 1 <= j)}; +# +# example foo; + +{[7,-7] -> [4,1] } + +# +# +# diff --git a/omega/examples/old_test/farkas b/omega/examples/old_test/farkas new file mode 100644 index 0000000..ce754fc --- /dev/null +++ b/omega/examples/old_test/farkas @@ -0,0 +1,8 @@ + +symbolic n; +symbolic c; + +R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; + +ac := farkas R; +ac; diff --git a/omega/examples/old_test/farkas.oc-rt b/omega/examples/old_test/farkas.oc-rt new file mode 100644 index 0000000..cd52e5e --- /dev/null +++ b/omega/examples/old_test/farkas.oc-rt @@ -0,0 +1,17 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# symbolic n; +# +# symbolic c; +# +# +# R := {[i,j] : 1 <= i <= 10 && 1 <= j <= n}; +# +# +# ac := farkas R; +# +# ac; + +{[i,j]: 0 <= constantTerm+n+i+j && 0 <= constantTerm+n+10i+j && 0 <= n+j && 0 <= n} + +# diff --git a/omega/examples/old_test/farkas2 b/omega/examples/old_test/farkas2 new file mode 100644 index 0000000..2781423 --- /dev/null +++ b/omega/examples/old_test/farkas2 @@ -0,0 +1,6 @@ + +R := {[1:10,1:10]} union {[5:15,11:20]}; +R; +f := farkas R; +f; +Hull R; diff --git a/omega/examples/old_test/farkas2.oc-rt b/omega/examples/old_test/farkas2.oc-rt new file mode 100644 index 0000000..22d43cc --- /dev/null +++ b/omega/examples/old_test/farkas2.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# R := {[1:10,1:10]} union {[5:15,11:20]}; +# +# R; + +{[In_1,In_2]: 1 <= In_1 <= 10 && 1 <= In_2 <= 10} union + {[In_1,In_2]: 5 <= In_1 <= 15 && 11 <= In_2 <= 20} + +# +# f := farkas R; +# +# f; + +{[In_1,In_2]: 0 <= constantTerm+10In_1+In_2 && 0 <= constantTerm+In_1+10In_2 && 0 <= constantTerm+15In_1+20In_2 && 0 <= constantTerm+In_1+In_2 && 0 <= constantTerm+15In_1+11In_2 && 0 <= constantTerm+5In_1+20In_2} + +# +# Hull R; + +{[In_1,In_2]: 1, 2In_1-19 <= In_2 <= 20 && 1 <= In_1 <= 15 && 2In_2 <= 15+5In_1} + +# diff --git a/omega/examples/old_test/farkas3 b/omega/examples/old_test/farkas3 new file mode 100644 index 0000000..8adec2e --- /dev/null +++ b/omega/examples/old_test/farkas3 @@ -0,0 +1,3 @@ + +R := {[1:10,1:10,1:10,1:10]}; +AffineHull R; diff --git a/omega/examples/old_test/farkas3.oc-rt b/omega/examples/old_test/farkas3.oc-rt new file mode 100644 index 0000000..095cb54 --- /dev/null +++ b/omega/examples/old_test/farkas3.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# R := {[1:10,1:10,1:10,1:10]}; +# +# AffineHull R; + +{[In_1,In_2,In_3,In_4]} + +# diff --git a/omega/examples/old_test/fc1 b/omega/examples/old_test/fc1 new file mode 100644 index 0000000..66a9e90 --- /dev/null +++ b/omega/examples/old_test/fc1 @@ -0,0 +1,23 @@ +symbolic n; + +I1 := {[i,j] : 1 <= i < j <= n}; +I2 := {[i,j,k] : 1 <= i < j,k <= n}; +I3 := {[i] : 1 <= i <= n}; +I4 := {[i,j] : 1 <= j < i <= n}; +I5 := {[i] : 1 <= i <= n}; + +T1 := {[i,j] -> [i-1,0,n-i,n-j]}; +T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; +T3 := {[i] -> [0,0,0,i]}; +T4 := {[i,j] -> [j+n-1,0,i,j]}; +T5 := {[i] -> [i+n-2,1,0,0]}; + +T1(I1); +T2(I2); +T3(I3); +T4(I4); +T5(I5); +codegen T1:I1,T2:I2; +codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +codegen 2 T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; + diff --git a/omega/examples/old_test/fc1.oc-rt b/omega/examples/old_test/fc1.oc-rt new file mode 100644 index 0000000..8075f2d --- /dev/null +++ b/omega/examples/old_test/fc1.oc-rt @@ -0,0 +1,89 @@ +>>> symbolic n; +>>> +>>> I1 := {[i,j] : 1 <= i < j <= n}; +>>> I2 := {[i,j,k] : 1 <= i < j,k <= n}; +>>> I3 := {[i] : 1 <= i <= n}; +>>> I4 := {[i,j] : 1 <= j < i <= n}; +>>> I5 := {[i] : 1 <= i <= n}; +>>> +>>> T1 := {[i,j] -> [i-1,0,n-i,n-j]}; +>>> T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; +>>> T3 := {[i] -> [0,0,0,i]}; +>>> T4 := {[i,j] -> [j+n-1,0,i,j]}; +>>> T5 := {[i] -> [i+n-2,1,0,0]}; +>>> +>>> T1(I1); +{[In_1,0,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} +>>> T2(I2); +{[In_1,1,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} +>>> T3(I3); +{[0,0,0,i]: 1 <= i <= n} +>>> T4(I4); +{[In_1,0,i,In_1-n+1]: i <= n <= In_1 && 2+In_1 <= n+i} +>>> T5(I5); +{[In_1,1,0,0]: n-1 <= In_1 <= 2n-2} +>>> codegen T1:I1,T2:I2; +for(t1 = 0; t1 <= n-2; t1++) { + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4,N/A); + } +} + +>>> codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +for(t1 = 0; t1 <= 2*n-2; t1++) { + if (t1 <= 0) { + for(t4 = 1; t4 <= n; t4++) { + s3(t4); + } + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + if (t1 >= n) { + for(t3 = -n+t1+2; t3 <= n; t3++) { + s4(t3,t1-n+1); + } + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4,N/A); + } + if (t1 >= n-1) { + s5(-n+t1+2); + } +} + +>>> codegen 2 T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +for(t4 = 1; t4 <= n; t4++) { + s3(t4); +} +for(t4 = 0; t4 <= n-2; t4++) { + s1(1,-t4+n); +} +for(t4 = 0; t4 <= n-2; t4++) { + s2(1,-t4+n,N/A); +} +if (n == 1) { + s5(-n+2); +} +for(t1 = 1; t1 <= n-2; t1++) { + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4,N/A); + } +} +if (n >= 2) { + s5(1); +} +for(t1 = max(n,1); t1 <= 2*n-2; t1++) { + for(t3 = t1-n+2; t3 <= n; t3++) { + s4(t3,t1-n+1); + } + s5(-n+t1+2); +} + + diff --git a/omega/examples/old_test/fc2 b/omega/examples/old_test/fc2 new file mode 100644 index 0000000..b195d72 --- /dev/null +++ b/omega/examples/old_test/fc2 @@ -0,0 +1,29 @@ +symbolic n; + +I1 := {[i,j] : 1 <= i < j <= n}; +I2 := {[i,j,k] : 1 <= i < j,k <= n}; +I3 := {[i] : 1 <= i <= n}; +I4 := {[i,j] : 1 <= j < i <= n}; +I5 := {[i] : 1 <= i <= n}; + +T1 := {[i,j] -> [i-1,0,n-i,n-j]}; +T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; +T3 := {[i] -> [0,0,0,i]}; +T4 := {[i,j] -> [j+n-1,0,i,j]}; +T5 := {[i] -> [i+n-2,1,0,0]}; + +first := {[i,*,*,*] -> [i]}; + +first(T1(I1)); +first(T2(I2)); +first(T3(I3)); +first(T4(I4)); +first(T5(I5)); +T1(I1); +T2(I2); +T3(I3); +T4(I4); +T5(I5); +codegen T1:I1,T2:I2; +codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; + diff --git a/omega/examples/old_test/fc2.oc-rt b/omega/examples/old_test/fc2.oc-rt new file mode 100644 index 0000000..742929e --- /dev/null +++ b/omega/examples/old_test/fc2.oc-rt @@ -0,0 +1,115 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# +# I1 := {[i,j] : 1 <= i < j <= n}; +# +# I2 := {[i,j,k] : 1 <= i < j,k <= n}; +# +# I3 := {[i] : 1 <= i <= n}; +# +# I4 := {[i,j] : 1 <= j < i <= n}; +# +# I5 := {[i] : 1 <= i <= n}; +# +# +# T1 := {[i,j] -> [i-1,0,n-i,n-j]}; +# +# T2 := {[i,j,k] -> [i-1,1,n-i,n-j]}; +# +# T3 := {[i] -> [0,0,0,i]}; +# +# T4 := {[i,j] -> [j+n-1,0,i,j]}; +# +# T5 := {[i] -> [i+n-2,1,0,0]}; +# +# +# first := {[i,*,*,*] -> [i]}; +# +# +# first(T1(I1)); + +{[i]: 0 <= i <= n-2} + +# +# first(T2(I2)); + +{[i]: 0 <= i <= n-2} + +# +# first(T3(I3)); + +{[0]: 1 <= n} + +# +# first(T4(I4)); + +{[i]: n <= i <= 2n-2} + +# +# first(T5(I5)); + +{[i]: n-1 <= i <= 2n-2} + +# +# T1(I1); + +{[In_1,0,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} + +# +# T2(I2); + +{[In_1,1,n-In_1-1,In_4]: 0 <= In_1 && 2+In_1+In_4 <= n && 0 <= In_4} + +# +# T3(I3); + +{[0,0,0,i]: 1 <= i <= n} + +# +# T4(I4); + +{[In_1,0,i,In_1-n+1]: i <= n <= In_1 && 2+In_1 <= n+i} + +# +# T5(I5); + +{[In_1,1,0,0]: n-1 <= In_1 <= 2n-2} + +# +# codegen T1:I1,T2:I2; +for(t1 = 0; t1 <= n-2; t1++) { + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4); + } +} + +# +# codegen T1:I1,T2:I2,T3:I3,T4:I4,T5:I5; +for(t1 = 0; t1 <= 2*n-2; t1++) { + if (t1 <= 0) { + for(t4 = 1; t4 <= n; t4++) { + s3(t4); + } + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s1(t1+1,n-t4); + } + if (t1 >= n) { + for(t3 = t1-n+2; t3 <= n; t3++) { + s4(t3,t1-n+1); + } + } + for(t4 = 0; t4 <= -t1+n-2; t4++) { + s2(t1+1,n-t4); + } + if (t1 >= n-1) { + s5(t1-n+2); + } +} + +# +# diff --git a/omega/examples/old_test/foo b/omega/examples/old_test/foo new file mode 100644 index 0000000..1a5ef46 --- /dev/null +++ b/omega/examples/old_test/foo @@ -0,0 +1,13 @@ + +R := {[t,s] -> [t+2,s+2] : t <= s} union + {[t,s] -> [t+4,s+4] : t <= s} union + {[t,s] -> [t+3,s+3] : t <= s} union + {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union + {[t,s] -> [t+1,s+1] : t <= s} union + {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2}; +R; +difference R; +Hull difference R; + +Hull R; + diff --git a/omega/examples/old_test/foo.oc-rt b/omega/examples/old_test/foo.oc-rt new file mode 100644 index 0000000..3f7f5a9 --- /dev/null +++ b/omega/examples/old_test/foo.oc-rt @@ -0,0 +1,37 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# R := {[t,s] -> [t+2,s+2] : t <= s} union +# {[t,s] -> [t+4,s+4] : t <= s} union +# {[t,s] -> [t+3,s+3] : t <= s} union +# {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union +# {[t,s] -> [t+1,s+1] : t <= s} union +# {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2}; +# +# R; + +{[t,s] -> [t+2,s+2] : t <= s} union + {[t,s] -> [t+4,s+4] : t <= s} union + {[t,s] -> [t+3,s+3] : t <= s} union + {[t,s] -> [t',s-t+t'] : t <= s, t'-5} union + {[t,s] -> [t+1,s+1] : t <= s} union + {[t,s] -> [t',s-t+t'] : t <= s-1, t'-2} + +# +# difference R; + +{[1,1]} union + {[In_1,In_1]: 2 <= In_1} + +# +# hull difference R; + +{[In_1,In_1]: 1 <= In_1} + +# +# +# Hull R; + +{[t,s] -> [t',s-t+t'] : t <= s, t'-1} + +# +# diff --git a/omega/examples/old_test/foo2 b/omega/examples/old_test/foo2 new file mode 100644 index 0000000..69a63da --- /dev/null +++ b/omega/examples/old_test/foo2 @@ -0,0 +1,3 @@ +Hull( {[1,1]} union + {[In_1,In_1]: 2 <= In_1}); + diff --git a/omega/examples/old_test/foo2.oc-rt b/omega/examples/old_test/foo2.oc-rt new file mode 100644 index 0000000..c8f0209 --- /dev/null +++ b/omega/examples/old_test/foo2.oc-rt @@ -0,0 +1,8 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# hull( {[1,1]} union +# {[In_1,In_1]: 2 <= In_1}); + +{[In_1,In_1]: 1 <= In_1} + +# +# diff --git a/omega/examples/old_test/foo6 b/omega/examples/old_test/foo6 new file mode 100644 index 0000000..0b702cd --- /dev/null +++ b/omega/examples/old_test/foo6 @@ -0,0 +1 @@ +approximate {[i,j] : exists (a,b : a,b >= 0 && i = -201a-3b && j = 103a+200b)}; diff --git a/omega/examples/old_test/foo6.oc-rt b/omega/examples/old_test/foo6.oc-rt new file mode 100644 index 0000000..aeb1b67 --- /dev/null +++ b/omega/examples/old_test/foo6.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# approximate {[i,j] : exists (a,b : a,b >= 0 && i = -201a-3b && j = 103a+200b)}; + +{[i,j]: 200i+3j <= 0 && 0 <= 103i+201j} + +# diff --git a/omega/examples/old_test/forall b/omega/examples/old_test/forall new file mode 100644 index 0000000..8b1de0a --- /dev/null +++ b/omega/examples/old_test/forall @@ -0,0 +1,21 @@ +symbolic n,m,B; +{ [max_diff] : + forall (m : + (not exists (z1,z2 : 0<=z1<n && z1<=z2<m+z1 && z2 = m)) + or + (forall (minX,minY : + (not (forall (x1,x2 : (not (0<=x1<n && x1<=x2<m+x1 && m-B+1 <= x2 <= m)) or (x1+x2 >= minX)) && + exists (x1,x2 : 0<=x1<n && x1<=x2<m+x1 && m-B+1 <= x2 <= m && x1+x2 = minX) && + forall (y1,y2 : (not (0<=y1<n && y1<=y2<=m+y1 && m+1 <= y2 <= m+B)) or (y1+y2 >= minY)) && + exists (y1,y2 : 0<=y1<n && y1<=y2<=m+y1 && m+1 <= y2 <= m+B && y1+y2 = minY))) + or + (minY-minX <= max_diff)))) && + exists (m,z1,z2,minX,minY : + 0<=z1<n && z1<=z2<=m+z1 && z2 = m && + forall (x1,x2 : (not (0<=x1<n && x1<=x2<m+x1 && m-B+1 <= x2 <= m)) or (x1+x2 >= minX)) && + exists (x1,x2 : 0<=x1<n && x1<=x2<m+x1 && m-B+1 <= x2 <= m && x1+x2 = minX) && + forall (y1,y2 : (not (0<=y1<n && y1<=y2<=m+y1 && m+1 <= y2 <= m+B)) or (y1+y2 >= minY)) && + exists (y1,y2 : 0<=y1<n && y1<=y2<=m+y1 && m+1 <= y2 <= m+B && y1+y2 = minY) && + minY-minX = max_diff)}; + + diff --git a/omega/examples/old_test/forall.oc-rt b/omega/examples/old_test/forall.oc-rt new file mode 100644 index 0000000..13f78fa --- /dev/null +++ b/omega/examples/old_test/forall.oc-rt @@ -0,0 +1,28 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m,B; +# +# { [max_diff] : +# forall (m : +# (not exists (z1,z2 : 0<=z1<n && z1<=z2<m+z1 && z2 = m)) +# or +# (forall (minX,minY : +# (not (forall (x1,x2 : (not (0<=x1<n && x1<=x2<m+x1 && m-B+1 <= x2 <= m)) or (x1+x2 >= minX)) && +# exists (x1,x2 : 0<=x1<n && x1<=x2<m+x1 && m-B+1 <= x2 <= m && x1+x2 = minX) && +# forall (y1,y2 : (not (0<=y1<n && y1<=y2<=m+y1 && m+1 <= y2 <= m+B)) or (y1+y2 >= minY)) && +# exists (y1,y2 : 0<=y1<n && y1<=y2<=m+y1 && m+1 <= y2 <= m+B && y1+y2 = minY))) +# or +# (minY-minX <= max_diff)))) && +# exists (m,z1,z2,minX,minY : +# 0<=z1<n && z1<=z2<=m+z1 && z2 = m && +# forall (x1,x2 : (not (0<=x1<n && x1<=x2<m+x1 && m-B+1 <= x2 <= m)) or (x1+x2 >= minX)) && +# exists (x1,x2 : 0<=x1<n && x1<=x2<m+x1 && m-B+1 <= x2 <= m && x1+x2 = minX) && +# forall (y1,y2 : (not (0<=y1<n && y1<=y2<=m+y1 && m+1 <= y2 <= m+B)) or (y1+y2 >= minY)) && +# exists (y1,y2 : 0<=y1<n && y1<=y2<=m+y1 && m+1 <= y2 <= m+B && y1+y2 = minY) && +# minY-minX = max_diff)}; + +{[B+1]: 2 <= B && 2 <= n} union + {[1]: B = 1 && 2 <= n} + +# +# +# diff --git a/omega/examples/old_test/gc b/omega/examples/old_test/gc new file mode 100644 index 0000000..932f595 --- /dev/null +++ b/omega/examples/old_test/gc @@ -0,0 +1,6 @@ +A := {[i] : 1 <= i <= 8}; +b := {[i] : exists (t : i=2t+1 & 0<=t<=3)}; +c := {[i] : exists (t : i=2t+2 & 0<=t<=3)}; +d := A - b; +d; +codegen d; diff --git a/omega/examples/old_test/gc.oc-rt b/omega/examples/old_test/gc.oc-rt new file mode 100644 index 0000000..6d92fa9 --- /dev/null +++ b/omega/examples/old_test/gc.oc-rt @@ -0,0 +1,20 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# A := {[i] : 1 <= i <= 8}; +# +# b := {[i] : exists (t : i=2t+1 & 0<=t<=3)}; +# +# c := {[i] : exists (t : i=2t+2 & 0<=t<=3)}; +# +# d := A - b; +# +# d; + +{[i]: Exists ( alpha : 0 = i+2alpha && 2 <= i <= 8)} + +# +# codegen d; +for(t1 = 2; t1 <= 8; t1 += 2) { + s1(t1); +} + +# diff --git a/omega/examples/old_test/ge b/omega/examples/old_test/ge new file mode 100644 index 0000000..e8e9e1f --- /dev/null +++ b/omega/examples/old_test/ge @@ -0,0 +1,9 @@ +symbolic n; +I1 := {[k,i] : 1 <= k < i <= n }; +I2 := {[k,i,j] : 1 <= k < i,j <= n }; +T1 := {[k,i] -> [i,k,1,0]}; +T2 := {[k,i,j] -> [i,j,0,k]}; +T1(I1); +T2(I2); +codegen T1:I1,T2:I2; +codegen 2 T1:I1,T2:I2; diff --git a/omega/examples/old_test/ge.oc-rt b/omega/examples/old_test/ge.oc-rt new file mode 100644 index 0000000..1006fe5 --- /dev/null +++ b/omega/examples/old_test/ge.oc-rt @@ -0,0 +1,38 @@ +>>> symbolic n; +>>> I1 := {[k,i] : 1 <= k < i <= n }; +>>> I2 := {[k,i,j] : 1 <= k < i,j <= n }; +>>> T1 := {[k,i] -> [i,k,1,0]}; +>>> T2 := {[k,i,j] -> [i,j,0,k]}; +>>> T1(I1); +{[i,k,1,0]: 1 <= k < i <= n} +>>> T2(I2); +{[i,j,0,k]: 1 <= k < i,j <= n} +>>> codegen T1:I1,T2:I2; +for(t1 = 2; t1 <= n; t1++) { + for(t2 = 1; t2 <= n; t2++) { + for(t4 = 1; t4 <= min(t1-1,t2-1); t4++) { + s2(t4,t1,t2); + } + if (t2 <= t1-1) { + s1(t2,t1); + } + } +} + +>>> codegen 2 T1:I1,T2:I2; +for(t1 = 2; t1 <= n; t1++) { + s1(1,t1); + for(t2 = 2; t2 <= t1-1; t2++) { + for(t4 = 1; t4 <= t2-1; t4++) { + s2(t4,t1,t2); + } + s1(t2,t1); + } + for(t2 = t1; t2 <= n; t2++) { + for(t4 = 1; t4 <= t1-1; t4++) { + s2(t4,t1,t2); + } + } +} + + diff --git a/omega/examples/old_test/givens2 b/omega/examples/old_test/givens2 new file mode 100644 index 0000000..0c6f634 --- /dev/null +++ b/omega/examples/old_test/givens2 @@ -0,0 +1,15 @@ +# +# an example from a slightly defective dependence relation for givens2.t +# + +symbolic n, line6exp(2) ; + +{ [i,j,k] -> [i',j',k'] : + 1 <= i <= n && + 1 <= i' <= n && + i+1 <= j <= n && + i'+1 <= j' <= n && + i <= k <= n && + i' <= k' <= n and + ( 1 <= line6exp(i,j) or line6exp(i,j) <= -1 ) and + ( 1 <= line6exp(i',j') or line6exp(i',j') <= -1 ) }; diff --git a/omega/examples/old_test/givens2.oc-rt b/omega/examples/old_test/givens2.oc-rt new file mode 100644 index 0000000..9dfac42 --- /dev/null +++ b/omega/examples/old_test/givens2.oc-rt @@ -0,0 +1,38 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # an example from a slightly defective dependence relation for givens2.t +# # +# +# Symbolic n, line6exp(2) ; +# +# +# { [i,j,k] -> [i',j',k'] : +# 1 <= i <= n && +# 1 <= i' <= n && +# i+1 <= j <= n && +# i'+1 <= j' <= n && +# i <= k <= n && +# i' <= k' <= n and +# ( 1 <= line6exp(i,j) or line6exp(i,j) <= -1 ) and +# ( 1 <= line6exp(i',j') or line6exp(i',j') <= -1 ) }; + +{[i,j,k] -> [i,j,k'] : 1 <= i <= k', j-1, k && j <= n && k <= n && k' <= n && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i,j,k'] : 1 <= i <= k', j-1, k && line6exp(i,j) <= -1 && j <= n && k <= n && k' <= n} union + {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && 1 <= line6exp(i,j) && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i,j) <= -1 && 1 <= line6exp(i',j')} union + {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && 1 <= line6exp(i,j)} union + {[i,j,k] -> [i',j',k'] : 1 <= i' < i < j <= n && i <= k <= n && i' < j' <= n && i' <= k' <= n && line6exp(i,j) <= -1 && line6exp(i',j') <= -1} union + {[i,j,k] -> [i',j',k'] : 1 <= i < i' < j' <= n && i < j <= n && i <= k <= n && i' <= k' <= n && line6exp(i,j) <= -1 && line6exp(i',j') <= -1} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j' < j <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && line6exp(i,j) <= -1} union + {[i,j,k] -> [i',j',k'] : i' = i && 1 <= i < j < j' <= n && i <= k,k' <= n && line6exp(i',j') <= -1 && line6exp(i,j) <= -1} + +# diff --git a/omega/examples/old_test/guard1 b/omega/examples/old_test/guard1 new file mode 100644 index 0000000..0496d3b --- /dev/null +++ b/omega/examples/old_test/guard1 @@ -0,0 +1,11 @@ +symbolic n,m; +incomingKnown := { [i1,i2] : exists ( alpha : i1+3alpha = 1+i2 ) && + i1 = n && i2 = m}; + + +codegen incomingKnown; +incomingKnown := { [i1,i2] : exists ( alpha : i1+2alpha = 1+i2 ) && + i1 = n && i2 = m}; + + +codegen incomingKnown; diff --git a/omega/examples/old_test/guard1.oc-rt b/omega/examples/old_test/guard1.oc-rt new file mode 100644 index 0000000..db4b780 --- /dev/null +++ b/omega/examples/old_test/guard1.oc-rt @@ -0,0 +1,25 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# incomingKnown := { [i1,i2] : Exists ( alpha : i1+3alpha = 1+i2 ) && +# i1 = n && i2 = m}; +# +# +# +# codegen incomingKnown; +if (intMod(-n+m+1,3) == 0) { + s1(n,m); +} + +# +# incomingKnown := { [i1,i2] : Exists ( alpha : i1+2alpha = 1+i2 ) && +# i1 = n && i2 = m}; +# +# +# +# codegen incomingKnown; +if (intMod(n+m+1,2) == 0) { + s1(n,m); +} + +# diff --git a/omega/examples/old_test/hull1 b/omega/examples/old_test/hull1 new file mode 100644 index 0000000..afb18a2 --- /dev/null +++ b/omega/examples/old_test/hull1 @@ -0,0 +1,4 @@ +R := {[1:10,1:10]} union {[-10:-1,-10:-1]} union + {[x,y] : -10 <= x,y <= 10 && -10 <= x-y <= 10}; +R; +Hull R; diff --git a/omega/examples/old_test/hull1.oc-rt b/omega/examples/old_test/hull1.oc-rt new file mode 100644 index 0000000..f8973fa --- /dev/null +++ b/omega/examples/old_test/hull1.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[1:10,1:10]} union {[-10:-1,-10:-1]} union +# {[x,y] : -10 <= x,y <= 10 && -10 <= x-y <= 10}; +# +# R; + +{[x,y]: -10, y-10 <= x <= 10, y+10 && -10 <= y <= 10} + +# +# Hull R; + +{[x,y]: -10, y-10 <= x <= 10, y+10 && -10 <= y <= 10} + +# diff --git a/omega/examples/old_test/hull2 b/omega/examples/old_test/hull2 new file mode 100644 index 0000000..69214f8 --- /dev/null +++ b/omega/examples/old_test/hull2 @@ -0,0 +1,3 @@ +R := {[1,1]} union {[3,3]}; +R; +Hull R; diff --git a/omega/examples/old_test/hull2.oc-rt b/omega/examples/old_test/hull2.oc-rt new file mode 100644 index 0000000..f5e2e94 --- /dev/null +++ b/omega/examples/old_test/hull2.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[1,1]} union {[3,3]}; +# +# R; + +{[1,1]} union + {[3,3]} + +# +# hull R; + +{[In_1,In_1]: 1 <= In_1 <= 3} + +# diff --git a/omega/examples/old_test/hull3 b/omega/examples/old_test/hull3 new file mode 100644 index 0000000..22e0324 --- /dev/null +++ b/omega/examples/old_test/hull3 @@ -0,0 +1,17 @@ + +symbolic n; + +s1:={[t1, 0, 0]:1 <= t1 && 64 * t1 <= n}; + +s2 := {[t1, t2, 0]: 1 <= t1 && 64 * t1 <= n && t2 = t1}; + +s3 := {[t1, 0, t3]: 1 <= t1 && 64 * t1 <= n && t3 = t1}; + +s := (s1 union s2 union s3); + +s; +h := Hull s; + +h; + +h - s; diff --git a/omega/examples/old_test/hull3.oc-rt b/omega/examples/old_test/hull3.oc-rt new file mode 100644 index 0000000..c094288 --- /dev/null +++ b/omega/examples/old_test/hull3.oc-rt @@ -0,0 +1,40 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# symbolic n; +# +# +# s1:={[t1, 0, 0]:1 <= t1 && 64 * t1 <= n}; +# +# +# s2 := {[t1, t2, 0]: 1 <= t1 && 64 * t1 <= n && t2 = t1}; +# +# +# s3 := {[t1, 0, t3]: 1 <= t1 && 64 * t1 <= n && t3 = t1}; +# +# +# s := (s1 union s2 union s3); +# +# +# s; + +{[t1,0,0]: 1 <= t1 && 64t1 <= n} union + {[t1,t1,0]: 1 <= t1 && 64t1 <= n} union + {[t1,0,t1]: 1 <= t1 && 64t1 <= n} + +# +# h := hull s; +# +# +# h; + +{[t1,t2,t3]: 0 <= t3 && 0 <= t2 && 64t1 <= n && 1 <= t1 && t2+t3 <= t1} + +# +# +# h - s; + +{[t1,t2,t3]: 1 <= t3 && 1 <= t2 && 64t1 <= n && t2+t3 <= t1} union + {[t1,t2,0]: 1 <= t2 < t1 && 64t1 <= n} union + {[t1,0,t3]: 1 <= t3 < t1 && 64t1 <= n} + +# diff --git a/omega/examples/old_test/ip1 b/omega/examples/old_test/ip1 new file mode 100644 index 0000000..b8cd8c4 --- /dev/null +++ b/omega/examples/old_test/ip1 @@ -0,0 +1,13 @@ +time {[a,b,c,d,e,f] : + a+b+2c+2d+e+2f >= 1 + && a - 3b - 2f >= 1 + && 3a-b >= 1 + && a-c >= 1 + && -b-3c+2e-2f >= 1 + && -a-2e>=1 + && b-2d-f >= 1 + && 4a+b-e >= 1 + && a-c+e >= 1 + && a >= 1 + }; + diff --git a/omega/examples/old_test/ip1.oc-rt b/omega/examples/old_test/ip1.oc-rt new file mode 100644 index 0000000..6646b8f --- /dev/null +++ b/omega/examples/old_test/ip1.oc-rt @@ -0,0 +1,15 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# time {[a,b,c,d,e,f] : +# a+b+2c+2d+e+2f >= 1 +# && a - 3b - 2f >= 1 +# && 3a-b >= 1 +# && a-c >= 1 +# && -b-3c+2e-2f >= 1 +# && -a-2e>=1 +# && b-2d-f >= 1 +# && 4a+b-e >= 1 +# && a-c+e >= 1 +# && a >= 1 +'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set! +# }; +# diff --git a/omega/examples/old_test/ip2 b/omega/examples/old_test/ip2 new file mode 100644 index 0000000..cfef018 --- /dev/null +++ b/omega/examples/old_test/ip2 @@ -0,0 +1,11 @@ +time {[a,b,c,d,e,f] : + a+b+2c+2d+e+2f >= 1 + && 2a-3b-2f >= 1 + && 3a-2b >= 1 + && a-3c >= 1 + && -b-3c+2e-2f>=1 + && -a-2e >= 1 + && b-2d-3f >= 1 + && 3a+b-e >= 1 + }; + diff --git a/omega/examples/old_test/ip2.oc-rt b/omega/examples/old_test/ip2.oc-rt new file mode 100644 index 0000000..74cda4f --- /dev/null +++ b/omega/examples/old_test/ip2.oc-rt @@ -0,0 +1,13 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# time {[a,b,c,d,e,f] : +# a+b+2c+2d+e+2f >= 1 +# && 2a-3b-2f >= 1 +# && 3a-2b >= 1 +# && a-3c >= 1 +# && -b-3c+2e-2f>=1 +# && -a-2e >= 1 +# && b-2d-3f >= 1 +# && 3a+b-e >= 1 +'time' requires getrusage, but the omega calclator was compiled with OMIT_GETRUSAGE set! +# }; +# diff --git a/omega/examples/old_test/ip3 b/omega/examples/old_test/ip3 new file mode 100644 index 0000000..7fc0ec1 --- /dev/null +++ b/omega/examples/old_test/ip3 @@ -0,0 +1,18 @@ +approximate {[a,b,c,d,e,f] : ( + a+b+2c+2d+e+2f >= 1 + && 2a-3b-2f >= 1 + && 3a-2b >= 1 + && a-3c >= 1 + && -b-3c+2e-2f>=1 + && -a-2e >= 1 + && b-2d-3f >= 1 + && 3a+b-e >= 1 + + && a = 0 + && b = -1 + && c = -1 + && e = -2 + && d = 11 + ) + }; + diff --git a/omega/examples/old_test/ip3.oc-rt b/omega/examples/old_test/ip3.oc-rt new file mode 100644 index 0000000..645e3f8 --- /dev/null +++ b/omega/examples/old_test/ip3.oc-rt @@ -0,0 +1,23 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# approximate {[a,b,c,d,e,f] : ( +# a+b+2c+2d+e+2f >= 1 +# && 2a-3b-2f >= 1 +# && 3a-2b >= 1 +# && a-3c >= 1 +# && -b-3c+2e-2f>=1 +# && -a-2e >= 1 +# && b-2d-3f >= 1 +# && 3a+b-e >= 1 +# +# && a = 0 +# && b = -1 +# && c = -1 +# && e = -2 +# && d = 11 +# ) +# }; + +{[0,-1,-1,11,-2,-8]} + +# +# diff --git a/omega/examples/old_test/iter1 b/omega/examples/old_test/iter1 new file mode 100644 index 0000000..86ece54 --- /dev/null +++ b/omega/examples/old_test/iter1 @@ -0,0 +1,2 @@ +R := { [i] : i < 10 && i > 1}; +codegen R; diff --git a/omega/examples/old_test/iter1.oc-rt b/omega/examples/old_test/iter1.oc-rt new file mode 100644 index 0000000..172ced0 --- /dev/null +++ b/omega/examples/old_test/iter1.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i] : i < 10 && i > 1}; +# +# codegen R; +for(t1 = 2; t1 <= 9; t1++) { + s1(t1); +} + +# diff --git a/omega/examples/old_test/iter2 b/omega/examples/old_test/iter2 new file mode 100644 index 0000000..e3ccff1 --- /dev/null +++ b/omega/examples/old_test/iter2 @@ -0,0 +1,2 @@ +R := { [i,j] : i <= 10 && i >= 1 && j <=100 && j >= 10}; +codegen R; diff --git a/omega/examples/old_test/iter2.oc-rt b/omega/examples/old_test/iter2.oc-rt new file mode 100644 index 0000000..0597426 --- /dev/null +++ b/omega/examples/old_test/iter2.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i,j] : i <= 10 && i >= 1 && j <=100 && j >= 10}; +# +# codegen R; +for(t1 = 1; t1 <= 10; t1++) { + for(t2 = 10; t2 <= 100; t2++) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/iter3 b/omega/examples/old_test/iter3 new file mode 100644 index 0000000..604574b --- /dev/null +++ b/omega/examples/old_test/iter3 @@ -0,0 +1,2 @@ +R := { [i,j] : i < 10 && i > 1 && j < 10 && j > i}; +codegen R; diff --git a/omega/examples/old_test/iter3.oc-rt b/omega/examples/old_test/iter3.oc-rt new file mode 100644 index 0000000..d1288b5 --- /dev/null +++ b/omega/examples/old_test/iter3.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i,j] : i < 10 && i > 1 && j < 10 && j > i}; +# +# codegen R; +for(t1 = 2; t1 <= 8; t1++) { + for(t2 = t1+1; t2 <= 9; t2++) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/iter4 b/omega/examples/old_test/iter4 new file mode 100644 index 0000000..2660d33 --- /dev/null +++ b/omega/examples/old_test/iter4 @@ -0,0 +1,2 @@ +R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i}; +codegen R; diff --git a/omega/examples/old_test/iter4.oc-rt b/omega/examples/old_test/iter4.oc-rt new file mode 100644 index 0000000..182cb09 --- /dev/null +++ b/omega/examples/old_test/iter4.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i}; +# +# codegen R; +for(t1 = 2; t1 <= 9; t1++) { + for(t2 = t1+1; t2 <= 2*t1; t2++) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/iter5 b/omega/examples/old_test/iter5 new file mode 100644 index 0000000..b2a973b --- /dev/null +++ b/omega/examples/old_test/iter5 @@ -0,0 +1,2 @@ +R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i && j <= 16}; +codegen R; diff --git a/omega/examples/old_test/iter5.oc-rt b/omega/examples/old_test/iter5.oc-rt new file mode 100644 index 0000000..8b567d5 --- /dev/null +++ b/omega/examples/old_test/iter5.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i,j] : i < 10 && i > 1 && j <=2i && j > i && j <= 16}; +# +# codegen R; +for(t1 = 2; t1 <= 9; t1++) { + for(t2 = t1+1; t2 <= min(2*t1,16); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/iter6 b/omega/examples/old_test/iter6 new file mode 100644 index 0000000..b093c0b --- /dev/null +++ b/omega/examples/old_test/iter6 @@ -0,0 +1,6 @@ +Y := { [i,j] : 1 <= i <= 5 and 12 <= j <= 17}; +codegen Y; + +X := { [i,j] : 17i-153 = 12j+17 and 1 <= i <= 100 and 1 <= j <= 100 and i < j}; +codegen X; + diff --git a/omega/examples/old_test/iter6.oc-rt b/omega/examples/old_test/iter6.oc-rt new file mode 100644 index 0000000..74f06da --- /dev/null +++ b/omega/examples/old_test/iter6.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Y := { [i,j] : 1 <= i <= 5 and 12 <= j <= 17}; +# +# codegen Y; +for(t1 = 1; t1 <= 5; t1++) { + for(t2 = 12; t2 <= 17; t2++) { + s1(t1,t2); + } +} + +# +# +# X := { [i,j] : 17i-153 = 12j+17 and 1 <= i <= 100 and 1 <= j <= 100 and i < j}; +# +# codegen X; +for(t1 = 46; t1 <= 70; t1 += 12) { + t2=intDiv((17*t1+11),12); + s1(t1,intDiv(17*t1+-170,12)); +} + +# +# diff --git a/omega/examples/old_test/iter7 b/omega/examples/old_test/iter7 new file mode 100644 index 0000000..3364dd7 --- /dev/null +++ b/omega/examples/old_test/iter7 @@ -0,0 +1,3 @@ +R := {[i,j] : 3i+2j=15 && 1<=i<=j<=100}; +R; +codegen R; diff --git a/omega/examples/old_test/iter7.oc-rt b/omega/examples/old_test/iter7.oc-rt new file mode 100644 index 0000000..52b7860 --- /dev/null +++ b/omega/examples/old_test/iter7.oc-rt @@ -0,0 +1,15 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[i,j] : 3i+2j=15 && 1<=i<=j<=100}; +# +# R; + +{[i,j]: 3i+2j = 15 && 3 <= j <= 6} + +# +# codegen R; +for(t1 = 1; t1 <= 3; t1 += 2) { + t2=intDiv((-3*t1+15+1),2); + s1(t1,intDiv(-3*t1+15,2)); +} + +# diff --git a/omega/examples/old_test/iter8 b/omega/examples/old_test/iter8 new file mode 100644 index 0000000..65682bb --- /dev/null +++ b/omega/examples/old_test/iter8 @@ -0,0 +1,12 @@ +symbolic exprVar1; +symbolic exprVar2; +symbolic exprVar3; + +ispace := {[In_1] : exists ( alpha : In_1+8alpha = 1+exprVar2 && exprVar3 = +0 && 1 <= exprVar1 < In_1 <= 16 && exprVar2 < In_1)}; + +known := {[In1] : exists ( alpha : exprVar3 = 0 && exprVar2 <= 8alpha +15 +&& alpha <= 0 && 1 <= exprVar1 && exprVar1+8alpha <= exprVar2)}; + +codegen ispace given known; + diff --git a/omega/examples/old_test/iter8.oc-rt b/omega/examples/old_test/iter8.oc-rt new file mode 100644 index 0000000..ede80cb --- /dev/null +++ b/omega/examples/old_test/iter8.oc-rt @@ -0,0 +1,23 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic exprVar1; +# +# symbolic exprVar2; +# +# symbolic exprVar3; +# +# +# ispace := {[In_1] : Exists ( alpha : In_1+8alpha = 1+exprVar2 && exprVar3 = +# 0 && 1 <= exprVar1 < In_1 <= 16 && exprVar2 < In_1)}; +# +# +# known := {[In1] : Exists ( alpha : exprVar3 = 0 && exprVar2 <= 8alpha +15 +# && alpha <= 0 && 1 <= exprVar1 && exprVar1+8alpha <= exprVar2)}; +# +# +# codegen ispace given known; +for(t1 = max(exprVar2+1,exprVar1+1+intMod(((exprVar2+1)-exprVar1+1),8)); t1 <= 16; t1 += 8) { + s1(t1); +} + +# +# diff --git a/omega/examples/old_test/iter9 b/omega/examples/old_test/iter9 new file mode 100644 index 0000000..42724f5 --- /dev/null +++ b/omega/examples/old_test/iter9 @@ -0,0 +1,40 @@ + +symbolic exprVar1; +symbolic exprVar2; + +ispace0 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace1 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace2 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace3 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace4 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; + +ispace5 := {[In_1] : exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +&& alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union + {[In_1] : exists ( alpha : 1+exprVar1 = In_1+8alpha && exprVar2 = 0 && 1, +exprVar1+1 <= In_1 <= 15)}; + +known := { [In_1] : exprVar2 = 0 && exprVar1 <= 15} union + {[In_1] : exprVar2 = 0 && exprVar1 <= 14} union + {[In_1] : exprVar2 = 0 && exprVar1 <= 15}; + + +k := Hull known; + +gist ispace0 given k; +gist ispace1 given k; +gist ispace2 given k; +gist ispace3 given k; +gist ispace4 given k; +gist ispace5 given k; + +codegen ispace0, ispace1, ispace2, ispace3, ispace4, ispace5 given k; + diff --git a/omega/examples/old_test/iter9.oc-rt b/omega/examples/old_test/iter9.oc-rt new file mode 100644 index 0000000..93b1c48 --- /dev/null +++ b/omega/examples/old_test/iter9.oc-rt @@ -0,0 +1,121 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# symbolic exprVar1; +# +# symbolic exprVar2; +# +# +# ispace0 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace1 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace2 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace3 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace4 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)}; +# +# +# ispace5 := {[In_1] : Exists ( alpha : exprVar2 = 0 && exprVar1 <= 8alpha+15 +# && alpha <= 0 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union +# {[In_1] : Exists ( alpha : 1+exprVar1 = In_1+8alpha && exprVar2 = 0 && 1, +# exprVar1+1 <= In_1 <= 15)}; +# +# +# known := { [In_1] : exprVar2 = 0 && exprVar1 <= 15} union +# {[In_1] : exprVar2 = 0 && exprVar1 <= 14} union +# {[In_1] : exprVar2 = 0 && exprVar1 <= 15}; +# +# +# +# k := Hull known; +# +# +# gist ispace0 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace1 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace2 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace3 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace4 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} + +# +# gist ispace5 given k; + +{[In_1]: Exists ( alpha : exprVar1 <= 8alpha+15 && 1 <= In_1 && In_1+8alpha <= exprVar1)} union + {[In_1]: Exists ( alpha : In_1+8alpha = 1+exprVar1 && 1, exprVar1+1 <= In_1 <= 15)} + +# +# +# codegen ispace0, ispace1, ispace2, ispace3, ispace4, ispace5 given k; +for(t1 = 1; t1 <= 8; t1++) { + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s1(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s2(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s3(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s4(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s5(t1); + } + if (exprVar1-15 <= 8*intDiv(exprVar1-t1,8) && exprVar1-15 <= 8*intDiv(exprVar1-t1,8)) { + s6(t1); + } +} +for(t1 = 9; t1 <= 15; t1++) { + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s1(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s2(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s3(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s4(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s5(t1); + } + if (exprVar1-15 <= 8*intDiv(-t1+exprVar1,8)) { + s6(t1); + } + if (intMod(-t1+exprVar1+1,8) == 0) { + s6(t1); + } +} + +# +# diff --git a/omega/examples/old_test/lefur00 b/omega/examples/old_test/lefur00 new file mode 100644 index 0000000..061f78c --- /dev/null +++ b/omega/examples/old_test/lefur00 @@ -0,0 +1,15 @@ +R := { [i, j, k, l] : + 0 <= i <= 19 && + 0 <= j <= 19 && + 1 <= k <= 1000 && + -k + l >= 0 && + 2 k - l + 1 >= 0 && + -200 i + k + l >= 0 && + 200 i - k - l + 199 >= 0 && + -200 j - k + 2 l >= 0 && + 200 j + k -2 l + 199 >= 0 +} ; + + +codegen R; + diff --git a/omega/examples/old_test/lefur00.oc-rt b/omega/examples/old_test/lefur00.oc-rt new file mode 100644 index 0000000..3b3736f --- /dev/null +++ b/omega/examples/old_test/lefur00.oc-rt @@ -0,0 +1,28 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i, j, k, l] : +# 0 <= i <= 19 && +# 0 <= j <= 19 && +# 1 <= k <= 1000 && +# -k + l >= 0 && +# 2 k - l + 1 >= 0 && +# -200 i + k + l >= 0 && +# 200 i - k - l + 199 >= 0 && +# -200 j - k + 2 l >= 0 && +# 200 j + k -2 l + 199 >= 0 +# } ; +# +# +# +# codegen R; +for(t1 = 0; t1 <= 15; t1++) { + for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { + for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3),intDiv(-200*t2+400*t1-199+2,3),1); t3 <= min(100*t1+99,intDiv(-200*t2+400*t1+398,3),1000); t3++) { + for(t4 = max(t3,200*t1-t3,intDiv(200*t2+t3+1,2)); t4 <= min(2*t3+1,intDiv(200*t2+t3+199,2),200*t1-t3+199); t4++) { + s1(t1,t2,t3,t4); + } + } + } +} + +# +# diff --git a/omega/examples/old_test/lefur01 b/omega/examples/old_test/lefur01 new file mode 100644 index 0000000..495c4f3 --- /dev/null +++ b/omega/examples/old_test/lefur01 @@ -0,0 +1,14 @@ +R := { [i, j, k, l] : + 0 <= i <= 19 && + 0 <= j <= 19 && + 1 <= k <= 1000 && + -k + l >= 0 && + 2 k - l + 1 >= 0 && + -200 i + k + l >= 0 && + 200 i - k - l + 199 >= 0 && + -200 j - k + 2 l >= 0 && + 200 j + k -2 l + 199 >= 0 +} ; + +codegen R; +codegen 2 R; diff --git a/omega/examples/old_test/lefur01.oc-rt b/omega/examples/old_test/lefur01.oc-rt new file mode 100644 index 0000000..4437f93 --- /dev/null +++ b/omega/examples/old_test/lefur01.oc-rt @@ -0,0 +1,103 @@ +>>> R := { [i, j, k, l] : +>>> 0 <= i <= 19 && +>>> 0 <= j <= 19 && +>>> 1 <= k <= 1000 && +>>> -k + l >= 0 && +>>> 2 k - l + 1 >= 0 && +>>> -200 i + k + l >= 0 && +>>> 200 i - k - l + 199 >= 0 && +>>> -200 j - k + 2 l >= 0 && +>>> 200 j + k -2 l + 199 >= 0 +>>> } ; +>>> +>>> codegen R; +for(t1 = 0; t1 <= 15; t1++) { + for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { + for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3),intDiv(400*t1-200*t2-199+2,3),1); t3 <= min(100*t1+99,intDiv(400*t1-200*t2+398,3),1000); t3++) { + for(t4 = max(t3,-t3+200*t1,intDiv(t3+200*t2+1,2)); t4 <= min(2*t3+1,-t3+200*t1+199,intDiv(t3+200*t2+199,2)); t4++) { + s1(t1,t2,t3,t4); + } + } + } +} + +>>> codegen 2 R; +for(t1 = 0; t1 <= 15; t1++) { + for(t2 = max(2*t1-15,intDiv(t1-1+1,2)); t2 <= min(t1+1,15); t2++) { + if (t2 <= t1-1) { + for(t3 = intDiv(-200*t2+400*t1-199+2,3); t3 <= min(100*t1-1,intDiv(-200*t2+400*t1-2,3)); t3++) { + for(t4 = 200*t1-t3; t4 <= intDiv(t3+200*t2+199,2); t4++) { + s1(t1,t2,t3,t4); + } + } + } + for(t3 = max(intDiv(200*t1-1+2,3),intDiv(200*t2-2+2,3)); t3 <= min(100*t1-1,intDiv(200*t2+195,3),intDiv(400*t1-200*t2+398,3),1000); t3++) { + for(t4 = intDiv(t3+200*t2+1,2); t4 <= 2*t3+1; t4++) { + s1(t1,t2,t3,t4); + } + } + for(t3 = max(intDiv(200*t2+196+2,3),intDiv(-200*t2+400*t1-1+2,3)); t3 <= min(100*t1-1,intDiv(-200*t2+400*t1+198,3),1000); t3++) { + for(t4 = intDiv(200*t2+t3+1,2); t4 <= intDiv(200*t2+t3+199,2); t4++) { + s1(t1,t2,t3,t4); + } + } + if (t2 <= t1) { + for(t3 = intDiv(-200*t2+400*t1+199+2,3); t3 <= min(intDiv(-200*t2+400*t1+398,3),100*t1-1,1000); t3++) { + for(t4 = intDiv(200*t2+t3+1,2); t4 <= -t3+200*t1+199; t4++) { + s1(t1,t2,t3,t4); + } + } + } + if (t2 == 1 && t1 == 1) { + for(t3 = 100; t3 <= 132; t3++) { + for(t4 = intDiv(t3+200+1,2); t4 <= 2*t3+1; t4++) { + s1(1,1,t3,t4); + } + } + } + if (2*t2 == t1+1 && t2 >= 2) { + for(t3 = 200*t2-100; t3 <= 200*t2-68; t3++) { + for(t4 = intDiv(200*t2+t3+1,2); t4 <= intDiv(200*t2+t3+199,2); t4++) { + s1(t1,intDiv(t1+1,2),t3,t4); + } + } + } + if (2*t2 >= t1+1) { + for(t3 = max(intDiv(200*t2-2+2,3),intDiv(-200*t2+400*t1+199+2,3),100*t1); t3 <= min(intDiv(-200*t2+400*t1+398,3),1000); t3++) { + for(t4 = intDiv(t3+200*t2+1,2); t4 <= 200*t1-t3+199; t4++) { + s1(t1,t2,t3,t4); + } + } + } + if (t2 == 0 && t1 <= 0) { + for(t3 = 1; t3 <= 65; t3++) { + for(t4 = t3; t4 <= 2*t3+1; t4++) { + s1(0,0,t3,t4); + } + } + } + if (t2 == 0) { + for(t3 = max(100*t1,66); t3 <= intDiv(200*t1+198,3); t3++) { + for(t4 = t3; t4 <= intDiv(t3+199,2); t4++) { + s1(t1,0,t3,t4); + } + } + } + if (2*t2 <= t1) { + for(t3 = max(100*t1,intDiv(200*t1+199+2,3)); t3 <= min(200*t2+199,intDiv(400*t1-200*t2+200,3),1000); t3++) { + for(t4 = t3; t4 <= intDiv(t3+200*t2+199,2); t4++) { + s1(t1,t2,t3,t4); + } + } + } + if (2*t2 == t1 && t2 <= 4) { + for(t3 = 200*t2+67; t3 <= 200*t2+99; t3++) { + for(t4 = t3; t4 <= -t3+400*t2+199; t4++) { + s1(t1,intDiv(t1,2),t3,t4); + } + } + } + } +} + + diff --git a/omega/examples/old_test/lefur03 b/omega/examples/old_test/lefur03 new file mode 100644 index 0000000..c237eca --- /dev/null +++ b/omega/examples/old_test/lefur03 @@ -0,0 +1,16 @@ +# From Fabien Coelho + +R := { [i,j,k,l,m,n] : + 0 <= i <= 3 && + 0 <= j <= 3 && + 0 <= k <= 3 && + 0 <= l <= 3 && + 1 <= m <= 1000 && + -1 <= 3 m - 1000 k <= 998 && + m <= n <= 2 m + 1 && + 0 <= m + n - 1000 i <= 999 && + 0 <= 2 n - m - 1000 j <= 999 && + 2 <= n + 2 m - 1000 l <= 1001 +} ; + +codegen R; diff --git a/omega/examples/old_test/lefur03-3 b/omega/examples/old_test/lefur03-3 new file mode 100644 index 0000000..1c576a1 --- /dev/null +++ b/omega/examples/old_test/lefur03-3 @@ -0,0 +1,20 @@ +# From Fabien Coelho + +R := { [i,j,k,l,m,n] : + 0 <= i <= 3 && + 0 <= j <= 3 && + 0 <= k <= 3 && + 0 <= l <= 3 && + 1 <= m <= 1000 && + -1 <= 3 m - 1000 k <= 998 && + m <= n <= 2 m + 1 && + 0 <= m + n - 1000 i <= 999 && + 0 <= 2 n - m - 1000 j <= 999 && + 2 <= n + 2 m - 1000 l <= 1001 +} ; + +codegen R; +codegen R; +codegen R; +codegen R; +codegen R; diff --git a/omega/examples/old_test/lefur03-3.oc-rt b/omega/examples/old_test/lefur03-3.oc-rt new file mode 100644 index 0000000..a1aa81a --- /dev/null +++ b/omega/examples/old_test/lefur03-3.oc-rt @@ -0,0 +1,107 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # From Fabien Coelho +# +# R := { [i,j,k,l,m,n] : +# 0 <= i <= 3 && +# 0 <= j <= 3 && +# 0 <= k <= 3 && +# 0 <= l <= 3 && +# 1 <= m <= 1000 && +# -1 <= 3 m - 1000 k <= 998 && +# m <= n <= 2 m + 1 && +# 0 <= m + n - 1000 i <= 999 && +# 0 <= 2 n - m - 1000 j <= 999 && +# 2 <= n + 2 m - 1000 l <= 1001 +# } ; +# +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# diff --git a/omega/examples/old_test/lefur03.c b/omega/examples/old_test/lefur03.c new file mode 100644 index 0000000..7df0865 --- /dev/null +++ b/omega/examples/old_test/lefur03.c @@ -0,0 +1,36 @@ + +#include <stdio.h> +#include "basic/util.h" + +template int max(int, int); +template int min(int, int); + +void Exit(int foo) { + exit(foo); + } + +int main() { + +int t1,t2,t3,t4,t5,t6; + + + + + +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(-t2+2*t1+1,3*t2+2,3); t3++) { + for(t4 = max(max(int_div(5*t3+3*t2-6+5,6),int_div(5*t1-t2-4+2,3)),max(t2,0)); t4 <= min(int_div(5*t3+3*t2+7,6),int_div(5*t1-t2+4,3),3); t4++) { + for(t5 = max(max(max(int_div(1000*t2-2+2,3),250*t4+1),max(int_div(2000*t1-1000*t2-999+2,3),400*t4-200*t2-199)),int_div(1000*t3-1+2,3)); + t5 <= min(min(min(400*t4-200*t2+400,500*t1+499),min(int_div(1000*t3+998,3),int_div(1000*t4+1001,3))),1000); t5++) { + for(t6 = max(max(int_div(t5+1000*t2+1,2),t5),max(1000*t1-t5,-2*t5+1000*t4+2)); t6 <= min(min(int_div(t5+1000*t2+999,2),2*t5+1),min(1000*t1-t5+999,-2*t5+1000*t4+1001)); t6++) { + printf("%d,%d,%d,%d,%d,%d\n", + t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + diff --git a/omega/examples/old_test/lefur03.oc-rt b/omega/examples/old_test/lefur03.oc-rt new file mode 100644 index 0000000..3fbb8cb --- /dev/null +++ b/omega/examples/old_test/lefur03.oc-rt @@ -0,0 +1,35 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # From Fabien Coelho +# +# R := { [i,j,k,l,m,n] : +# 0 <= i <= 3 && +# 0 <= j <= 3 && +# 0 <= k <= 3 && +# 0 <= l <= 3 && +# 1 <= m <= 1000 && +# -1 <= 3 m - 1000 k <= 998 && +# m <= n <= 2 m + 1 && +# 0 <= m + n - 1000 i <= 999 && +# 0 <= 2 n - m - 1000 j <= 999 && +# 2 <= n + 2 m - 1000 l <= 1001 +# } ; +# +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(t1+1,3); t2++) { + for(t3 = t1; t3 <= min(2*t1-t2+1,3*t2+2,3); t3++) { + for(t4 = max(intDiv(t3+3*t1-3+2,3),intDiv(5*t3+3*t2-6+5,6),intDiv(4*t2-3+2,3),0); t4 <= min(intDiv(-t2+5*t1+4,3),intDiv(5*t3+3*t2+7,6),3); t4++) { + if (t1 <= t4+1) { + for(t5 = max(intDiv(1000*t3-1+2,3),250*t4+1,intDiv(-1000*t2+2000*t1-999+2,3),intDiv(1000*t2-2+2,3),-200*t2+400*t4-199); t5 <= min(intDiv(1000*t4+1001,3),-200*t2+400*t4+400,intDiv(1000*t3+998,3),500*t1+499,1000); t5++) { + for(t6 = max(t5,intDiv(t5+1000*t2+1,2),-2*t5+1000*t4+2,-t5+1000*t1); t6 <= min(-2*t5+1000*t4+1001,2*t5+1,intDiv(t5+1000*t2+999,2),-t5+1000*t1+999); t6++) { + s1(t1,t2,t3,t4,t5,t6); + } + } + } + } + } + } +} + +# diff --git a/omega/examples/old_test/lefur04 b/omega/examples/old_test/lefur04 new file mode 100644 index 0000000..4a9e0c4 --- /dev/null +++ b/omega/examples/old_test/lefur04 @@ -0,0 +1,19 @@ +# From Fabien Coelho + +R := { [i, j, k, l, m, n, o, p] : + 0 <= i <= 3 && + 0 <= j <= 3 && + 0 <= k <= 3 && + 0 <= l <= 3 && + 0 <= m <= 3 && + 0 <= n <= 3 && + 1 <= o <= 1000 && o <= p <= 2 o +1 && + 0 <= -1000 i + o + p <= 999 && + 0 <= -1000 j - o + 2p <= 999 && + -1 <= -1000 k + 3 o <= 998 && + 2 <= -1000 l + 2 o + p <= 1001 && + 0 <= -1000 m + o <= 999 && + 3 <= -1000 n + 2 p<= 1002 +} ; + +codegen R; diff --git a/omega/examples/old_test/lefur04.oc-rt b/omega/examples/old_test/lefur04.oc-rt new file mode 100644 index 0000000..b449d8c --- /dev/null +++ b/omega/examples/old_test/lefur04.oc-rt @@ -0,0 +1,42 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # From Fabien Coelho +# +# R := { [i, j, k, l, m, n, o, p] : +# 0 <= i <= 3 && +# 0 <= j <= 3 && +# 0 <= k <= 3 && +# 0 <= l <= 3 && +# 0 <= m <= 3 && +# 0 <= n <= 3 && +# 1 <= o <= 1000 && o <= p <= 2 o +1 && +# 0 <= -1000 i + o + p <= 999 && +# 0 <= -1000 j - o + 2p <= 999 && +# -1 <= -1000 k + 3 o <= 998 && +# 2 <= -1000 l + 2 o + p <= 1001 && +# 0 <= -1000 m + o <= 999 && +# 3 <= -1000 n + 2 p<= 1002 +# } ; +# +# +# codegen R; +for(t1 = 0; t1 <= 3; t1++) { + for(t2 = max(2*t1-3,0); t2 <= min(intDiv(3*t1+2,2),3); t2++) { + for(t3 = t1; t3 <= min(-t2+2*t1+1,intDiv(3*t1+2,2),3); t3++) { + for(t4 = max(intDiv(2*t3-2+2,3),intDiv(-t2+5*t1-4+2,3),intDiv(3*t2+5*t3-6+5,6),intDiv(4*t2-3+2,3)); t4 <= min(intDiv(t2+5,2),intDiv(4*t3+3,3),intDiv(-t2+5*t1+4,3),3); t4++) { + for(t5 = max(intDiv(t2-2+2,3),intDiv(t3-2+2,3)); t5 <= intDiv(t3,3); t5++) { + for(t6 = max(intDiv(6*t4-4*t3-6+2,3),intDiv(2*t3-3+2,3),2*t4-4,intDiv(4*t2-3+2,3),intDiv(t3+3*t2-3+2,3),0); t6 <= min(intDiv(6*t4-4*t3+5,3),t2+1,t4); t6++) { + if (t4 >= t1-1) { + for(t7 = max(intDiv(2000*t1-1000*t2-999+2,3),1000*t1-500*t6-501,250*t4+1,400*t4-200*t2-199,intDiv(1000*t3-1+2,3),intDiv(1000*t2-2+2,3)); t7 <= min(1000*t1-500*t6+997,intDiv(1000*t4+1001,3),400*t4-200*t2+400,500*t1+499,500*t6+501,intDiv(1000*t3+998,3),1000); t7++) { + for(t8 = max(1000*t1-t7,500*t6+2,1000*t4-2*t7+2,t7,intDiv(t7+1000*t2+1,2)); t8 <= min(1000*t1-t7+999,500*t6+501,1000*t4-2*t7+1001,2*t7+1,intDiv(t7+1000*t2+999,2)); t8++) { + s1(t1,t2,t3,t4,t5,t6,t7,t8); + } + } + } + } + } + } + } + } +} + +# diff --git a/omega/examples/old_test/lefur05 b/omega/examples/old_test/lefur05 new file mode 100644 index 0000000..436ac54 --- /dev/null +++ b/omega/examples/old_test/lefur05 @@ -0,0 +1,49 @@ +# From Fabien Coelho + +R := { [i, j, k, l, m, n, o, p] : + 0 <= i <= 3 && + 0 <= j <= 3 && + 0 <= k <= 3 && + 0 <= l <= 3 && + 0 <= m <= 3 && + 0 <= n <= 3 && + 1 <= o <= 1000 && o <= p <= 2 o +1 && + 0 <= -1000 i + o + p <= 999 && + 0 <= -1000 j - o + 2p <= 999 && + -1 <= -1000 k + 3 o <= 998 && + 2 <= -1000 l + 2 o + p <= 1001 && + 0 <= -1000 m + o <= 999 && + 3 <= -1000 n + 2 p<= 1002 +} ; + +R; + +R7 := { [i, j, k, l, m, n, o, p] + -> [i, j, k, l, m, n, o ]}(R); +R7; +approximate R7; +R6 := { [i, j, k, l, m, n, o] + -> [i, j, k, l, m, n ]}(R7); +R6; +approximate R6; +R5 := { [i, j, k, l, m, n] + -> [i, j, k, l, m ]}(R6); +R5; +approximate R5; +R4 := { [i, j, k, l, m] + -> [i, j, k, l ]}(R5); +R4; +approximate R4; +R3 := { [i, j, k, l] + -> [i, j, k ]}(R4); +R3; +approximate R3; +R2 := { [i, j, k] + -> [i, j ]}(R3); +R2; +approximate R2; +R1 := { [i, j] + -> [i]}(R2); +R1; +approximate R1; + diff --git a/omega/examples/old_test/lefur05.oc-rt b/omega/examples/old_test/lefur05.oc-rt new file mode 100644 index 0000000..6d5e45e --- /dev/null +++ b/omega/examples/old_test/lefur05.oc-rt @@ -0,0 +1,118 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # From Fabien Coelho +# +# R := { [i, j, k, l, m, n, o, p] : +# 0 <= i <= 3 && +# 0 <= j <= 3 && +# 0 <= k <= 3 && +# 0 <= l <= 3 && +# 0 <= m <= 3 && +# 0 <= n <= 3 && +# 1 <= o <= 1000 && o <= p <= 2 o +1 && +# 0 <= -1000 i + o + p <= 999 && +# 0 <= -1000 j - o + 2p <= 999 && +# -1 <= -1000 k + 3 o <= 998 && +# 2 <= -1000 l + 2 o + p <= 1001 && +# 0 <= -1000 m + o <= 999 && +# 3 <= -1000 n + 2 p<= 1002 +# } ; +# +# +# R; + +{[i,j,k,l,m,n,o,p]: 1000m <= o <= p <= 500n+501, 2o+1 && o <= 1000m+999, 1000 && 1000i <= o+p && o+p <= 999+1000i && 1000j+o <= 2p && 2p <= 999+1000j+o && 1000k <= 1+3o && 3o <= 998+1000k && 2+500n <= p && 0 <= n && 2+1000l <= 2o+p && 2o+p <= 1001+1000l} + +# +# +# R7 := { [i, j, k, l, m, n, o, p] +# -> [i, j, k, l, m, n, o ]}(R); +# +# R7; + +{[i,j,k,l,m,n,o]: 1000m, 250n+1 <= o <= 1000m+999, 1000, 500n+501, 1000j+999, 500i+499 && 200j+o <= 400+400l && 1000j+o <= 1002+1000n && 1000i <= 1+3o && 1000j+3o <= 1998+2000i && 1000k <= 1+3o && 3o <= 998+1000k && 1000j <= 2+3o && 2000i <= 999+1000j+3o && 0 <= n && 1000i <= 501+500n+o && 250n+o <= 499+500l && 1000n <= 995+1000j+o && 500n+o <= 997+1000i && 3o <= 1001+1000l && 500l <= 249+250n+o && 400l <= 199+200j+o && 1000l <= 997+1000i+o} + +# +# approximate R7; + +{[i,j,k,l,m,n,o]: 1000m, 250n+1 <= o <= 1000m+999, 1000, 500n+501, 1000j+999, 500i+499 && 200j+o <= 400+400l && 1000j+o <= 1002+1000n && 1000i <= 1+3o && 1000j+3o <= 1998+2000i && 1000k <= 1+3o && 3o <= 998+1000k && 1000j <= 2+3o && 2000i <= 999+1000j+3o && 0 <= n && 1000i <= 501+500n+o && 250n+o <= 499+500l && 1000n <= 995+1000j+o && 500n+o <= 997+1000i && 3o <= 1001+1000l && 500l <= 249+250n+o && 400l <= 199+200j+o && 1000l <= 997+1000i+o} + +# +# R6 := { [i, j, k, l, m, n, o] +# -> [i, j, k, l, m, n ]}(R7); +# +# R6; + +{[i,j,k,l,m,n]: Exists ( alpha : 0, 2l-4 <= n <= 3, j+1, l, 2j+1 && 3m <= k <= 3, 3m+2 && 2i-3 <= j <= 3m+2 && 2k <= 2+3i && 1000i <= 1+3alpha && 1000j+3alpha <= 1998+2000i && 4j <= 3+3n && 1000k <= 1+3alpha && 3alpha <= 998+1000k && 1000j <= 2+3alpha && 2000i <= 999+1000j+3alpha && 4k+3n <= 5+6l && 6i <= 5+2l+3n && 3alpha <= 1001+1000l && 3j+5k <= 6+6l && 4l <= 7+2j+5n && 2l <= 2+3i && 2k <= 3+3n)} + +# +# approximate R6; + +{[i,j,k,l,m,n]: 2l-4, 0 <= n <= 3, j+1, l, 2j+1 && 3m, i <= k <= 3m+2, 3 && 2i-3 <= j <= 3m+2 && 2k <= 2+3i && j+k <= 1+2i && 4j <= 3+3n && 2l <= 2+3i && 2k <= 3+3n && 4l <= 7+2j+5n && 4k+3n <= 5+6l && 6i <= 5+2l+3n && 3j+5k <= 6+6l} + +# +# R5 := { [i, j, k, l, m, n] +# -> [i, j, k, l, m ]}(R6); +# +# R5; + +{[i,j,k,l,m]: Exists ( alpha,beta : 2i-3, 0 <= j <= 3m+2 && 3m <= k <= 3, 3m+2 && l <= 3 && 2k <= 2+3i && 2k <= 3+3alpha && 1000i <= 1+3beta && 1000j+3beta <= 1998+2000i && 4j <= 3+3alpha && 1000k <= 1+3beta && 3beta <= 998+1000k && 1000j <= 2+3beta && 2000i <= 999+1000j+3beta && 4k+3alpha <= 5+6l && 6i <= 5+2l+3alpha && 6i <= 5+5l && 3beta <= 1001+1000l && 4j <= 3+3l && 2k <= 2+3l && 3j+5k <= 6+6l && 4l <= 7+2j+5alpha && 2l <= 2+3i)} + +# +# approximate R5; + +{[i,j,k,l,m]: i, 3m <= k <= 3m+2, 3 && 0, 2i-3 <= j <= 3m+2 && l <= 3 && 2k <= 2+3i && 2l <= 2+3i && 2k <= 2+3l && j+k <= 1+2i && 3j+5k <= 6+6l && 6i <= 5+5l && 4j <= 3+3l} + +# +# R4 := { [i, j, k, l, m] +# -> [i, j, k, l ]}(R5); +# +# R4; + +{[i,j,k,l]: Exists ( alpha,beta,gamma : 2i-3, 0 <= j <= 3alpha+2 && 3alpha <= k <= 3, 3alpha+2 && l <= 3 && 2k <= 2+3i && 2k <= 3+3beta && 1000i <= 1+3gamma && 1000j+3gamma <= 1998+2000i && 4j <= 3+3beta && 1000k <= 1+3gamma && 3gamma <= 998+1000k && 1000j <= 2+3gamma && 2000i <= 999+1000j+3gamma && 4k+3beta <= 5+6l && 6i <= 5+2l+3beta && 6i <= 5+5l && 3gamma <= 1001+1000l && 4j <= 3+3l && 2k <= 2+3l && 3j+5k <= 6+6l && 4l <= 7+2j+5beta && 2l <= 2+3i)} + +# +# approximate R4; + +{[i,j,k,l]: i <= k <= 3 && l <= 3 && 2k <= 2+3i && 2l <= 2+3i && 6i <= 5+5l && j+k <= 1+2i && 3j+5k <= 6+6l && 4j <= 3+3l && 2i <= 3+j && 2k <= 2+3l && 0 <= j} + +# +# R3 := { [i, j, k, l] +# -> [i, j, k ]}(R4); +# +# R3; + +{[i,j,k]: Exists ( alpha,beta,gamma,delta : 2i-3, 0 <= j <= 3beta+2 && 3beta <= k <= 3, 3beta+2 && alpha <= 3 && 2k <= 2+3i && 2k <= 3+3gamma && 1000i <= 1+3delta && 1000j+3delta <= 1998+2000i && 4j <= 3+3gamma && 1000k <= 1+3delta && 3delta <= 998+1000k && 1000j <= 2+3delta && 2000i <= 999+1000j+3delta && 4k+3gamma <= 5+6alpha && 6i <= 5+2alpha+3gamma && 6i <= 5+5alpha && 3delta <= 1001+1000alpha && 4j <= 3+3alpha && 2k <= 2+3alpha && 3j+5k <= 6+6alpha && 4alpha <= 7+2j+5gamma && 2alpha <= 2+3i)} + +# +# approximate R3; + +{[i,j,k]: 0, 2i-3 <= j <= 3 && i <= k <= 3 && 2k <= 2+3i && j+k <= 1+2i} + +# +# R2 := { [i, j, k] +# -> [i, j ]}(R3); +# +# R2; + +{[i,j]: Exists ( alpha,beta,gamma,delta,tau : 2i-3, 0 <= j <= 3tau+2 && 3tau <= alpha <= 3, 3tau+2 && delta <= 3 && 2alpha <= 2+3i && 2alpha <= 3+3beta && 1000i <= 1+3gamma && 1000j+3gamma <= 1998+2000i && 4j <= 3+3beta && 1000alpha <= 1+3gamma && 3gamma <= 998+1000alpha && 1000j <= 2+3gamma && 2000i <= 999+1000j+3gamma && 4alpha+3beta <= 5+6delta && 6i <= 5+3beta+2delta && 6i <= 5+5delta && 3gamma <= 1001+1000delta && 4j <= 3+3delta && 2alpha <= 2+3delta && 3j+5alpha <= 6+6delta && 4delta <= 7+2j+5beta && 2delta <= 2+3i)} + +# +# approximate R2; + +{[i,j]: 0, 2i-3 <= j <= i+1, 3} + +# +# R1 := { [i, j] +# -> [i]}(R2); +# +# R1; + +{[i]: Exists ( alpha,beta,gamma,delta,tau,sigma : 2i-3, 0 <= alpha <= 3beta+2 && 3beta <= gamma <= 3, 3beta+2 && sigma <= 3 && 2gamma <= 2+3i && 2gamma <= 3+3delta && 1000i <= 1+3tau && 1000alpha+3tau <= 1998+2000i && 4alpha <= 3+3delta && 1000gamma <= 1+3tau && 3tau <= 998+1000gamma && 1000alpha <= 2+3tau && 2000i <= 999+1000alpha+3tau && 4gamma+3delta <= 5+6sigma && 6i <= 5+3delta+2sigma && 6i <= 5+5sigma && 3tau <= 1001+1000sigma && 4alpha <= 3+3sigma && 2gamma <= 2+3sigma && 3alpha+5gamma <= 6+6sigma && 4sigma <= 7+2alpha+5delta && 2sigma <= 2+3i)} + +# +# approximate R1; + +{[i]: -1 <= i <= 3} + +# +# diff --git a/omega/examples/old_test/lift1 b/omega/examples/old_test/lift1 new file mode 100644 index 0000000..fb3ada1 --- /dev/null +++ b/omega/examples/old_test/lift1 @@ -0,0 +1,16 @@ +I1 := { [i,j,k,l,m] : 1 <= i <= 60 && 1 <= j,k,l,m <= 100 }; +I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; + +codegen 0 I1,I2; + +#default +codegen 1 I1,I2; + +codegen 2 I1,I2; + +codegen 3 I1,I2; + +codegen 4 I1,I2; + +codegen 5 I1,I2; + diff --git a/omega/examples/old_test/lift1.oc-rt b/omega/examples/old_test/lift1.oc-rt new file mode 100644 index 0000000..683ac07 --- /dev/null +++ b/omega/examples/old_test/lift1.oc-rt @@ -0,0 +1,147 @@ +>>> I1 := { [i,j,k,l,m] : 1 <= i <= 60 && 1 <= j,k,l,m <= 100 }; +>>> I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; +>>> +>>> codegen 0 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + if (t1 <= 60) { + s1(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> #default +>>> codegen 1 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + if (t1 <= 60) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + if (t1 >= 61) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 2 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + if (t1 <= 60) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + if (t1 >= 61) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 3 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + if (t1 <= 60) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } + if (t1 >= 61) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 4 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + if (t1 <= 60) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } + } + if (t1 >= 61) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 5 I1,I2; +for(t1 = 1; t1 <= 60; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } +} +for(t1 = 61; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } +} + + diff --git a/omega/examples/old_test/lift2 b/omega/examples/old_test/lift2 new file mode 100644 index 0000000..fada83e --- /dev/null +++ b/omega/examples/old_test/lift2 @@ -0,0 +1,16 @@ +I1 := { [i,j,k,l,m] : 5 <= i <= 60 && 1 <= j,k,l,m <= 100 }; +I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; + +codegen 0 I1,I2; + +#default +codegen 1 I1,I2; + +codegen 2 I1,I2; + +codegen 3 I1,I2; + +codegen 4 I1,I2; + +codegen 5 I1,I2; + diff --git a/omega/examples/old_test/lift2.oc-rt b/omega/examples/old_test/lift2.oc-rt new file mode 100644 index 0000000..41e1fa8 --- /dev/null +++ b/omega/examples/old_test/lift2.oc-rt @@ -0,0 +1,190 @@ +>>> I1 := { [i,j,k,l,m] : 5 <= i <= 60 && 1 <= j,k,l,m <= 100 }; +>>> I2 := { [i,j,k,l,m] : 1 <= i,j,k,l,m <= 100 }; +>>> +>>> codegen 0 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + if (t1 >= 5 && t1 <= 60) { + s1(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> #default +>>> codegen 1 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + if (t1 <= 4) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + if (t1 >= 5 && t1 <= 60) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + if (t1 >= 61) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 2 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + if (t1 <= 4) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + if (t1 >= 5 && t1 <= 60) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + if (t1 >= 61) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 3 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + if (t1 <= 4) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + if (t1 >= 5 && t1 <= 60) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } + if (t1 >= 61) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 4 I1,I2; +for(t1 = 1; t1 <= 100; t1++) { + if (t1 <= 4) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } + if (t1 >= 5 && t1 <= 60) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } + } + if (t1 >= 61) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } + } +} + +>>> +>>> codegen 5 I1,I2; +for(t1 = 1; t1 <= 4; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } +} +for(t1 = 5; t1 <= 60; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s1(t1,t2,t3,t4,t5); + s2(t1,t2,t3,t4,t5); + } + } + } + } +} +for(t1 = 61; t1 <= 100; t1++) { + for(t2 = 1; t2 <= 100; t2++) { + for(t3 = 1; t3 <= 100; t3++) { + for(t4 = 1; t4 <= 100; t4++) { + for(t5 = 1; t5 <= 100; t5++) { + s2(t1,t2,t3,t4,t5); + } + } + } + } +} + + diff --git a/omega/examples/old_test/long_input b/omega/examples/old_test/long_input new file mode 100644 index 0000000..6112756 --- /dev/null +++ b/omega/examples/old_test/long_input @@ -0,0 +1,2 @@ +{ [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20 }; +{ [j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20 }; diff --git a/omega/examples/old_test/long_input.oc-rt b/omega/examples/old_test/long_input.oc-rt new file mode 100644 index 0000000..281d321 --- /dev/null +++ b/omega/examples/old_test/long_input.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20 }; + +{[i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c] -> [j] : 1 <= i < j <= 20} + +# +# { [j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20 }; + +{[j] -> [i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v] : 1 <= i < j <= 20} + +# diff --git a/omega/examples/old_test/lu_ijk b/omega/examples/old_test/lu_ijk new file mode 100644 index 0000000..5f60bfa --- /dev/null +++ b/omega/examples/old_test/lu_ijk @@ -0,0 +1,17 @@ +symbolic n,lb,ub; +I5 := {[k,j] : 1 <= k < j <= n}; +I7 := {[k,j,i] : 1 <= k < j,i <= n}; +T5 := {[k,j] -> [k,j,1,0]}; +T7 := {[k,j,i] -> [i,j,0,k]}; +D57 := {[k,j] -> [k,j,i] : 1 <= k < j,i <= n}; +D75 := {[k,j,k+1] -> [k+1,j] : 1 <= k <= j-2 && j <= n} union + {[k,k+1,k+1] -> [k+1,j'] : 1 <= k <= j'-2 && j' <= n}; +D77 := {[k,j,i] -> [k+1,j,i] : 1 <= k <= i-2, j-2 && j <= n && i <= n} + union + {[k,k+1,i] -> [k+1,j',i] : 1 <= k <= i-2, j'-2 && j' <= n && i <= n}; +difference ( (inverse T5) join D57 join T7 ); +difference ( (inverse T7) join D75 join T5 ); +difference ( (inverse T7) join D77 join T7 ); +codegen T5:I5,T7:I7; +codegen 2 T5:I5,T7:I7; +codegen 3 T5:I5,T7:I7; diff --git a/omega/examples/old_test/lu_ijk.oc-rt b/omega/examples/old_test/lu_ijk.oc-rt new file mode 100644 index 0000000..d067dff --- /dev/null +++ b/omega/examples/old_test/lu_ijk.oc-rt @@ -0,0 +1,81 @@ +>>> symbolic n,lb,ub; +>>> I5 := {[k,j] : 1 <= k < j <= n}; +>>> I7 := {[k,j,i] : 1 <= k < j,i <= n}; +>>> T5 := {[k,j] -> [k,j,1,0]}; +>>> T7 := {[k,j,i] -> [i,j,0,k]}; +>>> D57 := {[k,j] -> [k,j,i] : 1 <= k < j,i <= n}; +>>> D75 := {[k,j,k+1] -> [k+1,j] : 1 <= k <= j-2 && j <= n} union +>>> {[k,k+1,k+1] -> [k+1,j'] : 1 <= k <= j'-2 && j' <= n}; +>>> D77 := {[k,j,i] -> [k+1,j,i] : 1 <= k <= i-2, j-2 && j <= n && i <= n} +>>> union +>>> {[k,k+1,i] -> [k+1,j',i] : 1 <= k <= i-2, j'-2 && j' <= n && i <= n}; +>>> difference ( (inverse T5) join D57 join T7 ); +{[In_1,0,-1,In_4]: 1 <= In_4 && In_1+In_4 <= n && 1 <= In_1} +>>> difference ( (inverse T7) join D75 join T5 ); +{[0,0,1,In_4]: -n+2 <= In_4 <= -1} union + {[0,In_2,1,In_4]: In_4 <= -1 && 1 <= In_2 && In_2 < n+In_4} +>>> difference ( (inverse T7) join D77 join T7 ); +{[0,0,0,1]: 3 <= n} union + {[0,In_2,0,1]: 1 <= In_2 <= n-2} +>>> codegen T5:I5,T7:I7; +if (n >= 2) { + for(t1 = 1; t1 <= n; t1++) { + for(t2 = 2; t2 <= n; t2++) { + for(t4 = 1; t4 <= min(t2-1,t1-1); t4++) { + s2(t4,t2,t1); + } + if (t1 <= t2-1) { + s1(t1,t2); + } + } + } +} + +>>> codegen 2 T5:I5,T7:I7; +if (n >= 2) { + for(t1 = 1; t1 <= n; t1++) { + if (t1 <= 1) { + for(t2 = 2; t2 <= n; t2++) { + s1(1,t2); + } + } + for(t2 = 2; t2 <= t1; t2++) { + for(t4 = 1; t4 <= t2-1; t4++) { + s2(t4,t2,t1); + } + } + if (t1 >= 2) { + for(t2 = t1+1; t2 <= n; t2++) { + for(t4 = 1; t4 <= t1-1; t4++) { + s2(t4,t2,t1); + } + s1(t1,t2); + } + } + } +} + +>>> codegen 3 T5:I5,T7:I7; +for(t2 = 2; t2 <= n; t2++) { + s1(1,t2); +} +for(t1 = 2; t1 <= n-1; t1++) { + for(t2 = 2; t2 <= t1; t2++) { + for(t4 = 1; t4 <= t2-1; t4++) { + s2(t4,t2,t1); + } + } + for(t2 = t1+1; t2 <= n; t2++) { + for(t4 = 1; t4 <= t1-1; t4++) { + s2(t4,t2,t1); + } + s1(t1,t2); + } +} +for(t2 = 2; t2 <= n; t2++) { + for(t4 = 1; t4 <= t2-1; t4++) { + s2(t4,t2,n); + } +} + + diff --git a/omega/examples/old_test/lu_spmd b/omega/examples/old_test/lu_spmd new file mode 100644 index 0000000..6587ef0 --- /dev/null +++ b/omega/examples/old_test/lu_spmd @@ -0,0 +1,19 @@ +symbolic n,lb,ub; +I1 := {[k,i] : 1 <= k < i <= n && lb <= k <= ub}; +I2 := {[k,i,j] : 1 <= k <= i,j <= n && lb <= j <= ub}; +p := {[k,i] : 1, lb <= k <= ub < n && k < i <= n}; +w := {[k,i,j,k,i] : 1 <= k <= i,j <= n && k < lb = j <= ub}; + +T1 := {[k,i] -> [k,i,0,0,0,0,0,0]}; +T2 := {[k,i,j] -> [k,i,1,j,0,0,0,0]}; +Tp := {[k,i] -> [k,i,0,0,1,0,0,0]}; +Tw := {[k,i,j,t1,t2] -> [k,i,1,j,-1,t1,t2,0]}; + +known := {[*,*,*,*,*,*,*,*] : 1 <= lb && ub <= n}; +known2 := {[*,*,*,*,*,*,*,*] : 1 <= lb <= ub <= n}; + +codegen 0 T1:I1,T2:I2,Tp:p,Tw:w given known; +codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known; +# codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known; +# codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known2; +# codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known2; diff --git a/omega/examples/old_test/lu_spmd.oc-rt b/omega/examples/old_test/lu_spmd.oc-rt new file mode 100644 index 0000000..f221d8e --- /dev/null +++ b/omega/examples/old_test/lu_spmd.oc-rt @@ -0,0 +1,58 @@ +>>> symbolic n,lb,ub; +>>> I1 := {[k,i] : 1 <= k < i <= n && lb <= k <= ub}; +>>> I2 := {[k,i,j] : 1 <= k <= i,j <= n && lb <= j <= ub}; +>>> p := {[k,i] : 1, lb <= k <= ub < n && k < i <= n}; +>>> w := {[k,i,j,k,i] : 1 <= k <= i,j <= n && k < lb = j <= ub}; +>>> +>>> T1 := {[k,i] -> [k,i,0,0,0,0,0,0]}; +>>> T2 := {[k,i,j] -> [k,i,1,j,0,0,0,0]}; +>>> Tp := {[k,i] -> [k,i,0,0,1,0,0,0]}; +>>> Tw := {[k,i,j,t1,t2] -> [k,i,1,j,-1,t1,t2,0]}; +>>> +>>> known := {[*,*,*,*,*,*,*,*] : 1 <= lb && ub <= n}; +>>> known2 := {[*,*,*,*,*,*,*,*] : 1 <= lb <= ub <= n}; +>>> +>>> codegen 0 T1:I1,T2:I2,Tp:p,Tw:w given known; +if (lb <= ub) { + for(t1 = 1; t1 <= ub; t1++) { + for(t2 = t1; t2 <= n; t2++) { + if (t1 >= lb && t2 >= t1+1) { + s1(t1,t2); + } + if (ub <= n-1 && t2 >= t1+1 && t1 >= lb) { + s3(t1,t2); + } + for(t4 = max(lb,t1); t4 <= ub; t4++) { + if (t4 >= t1+1 && t4 <= lb) { + s4(t1,t2,t4,t1,t2); + } + s2(t1,t2,t4); + } + } + } +} + +>>> codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known; +if (lb <= ub) { + for(t1 = 1; t1 <= ub; t1++) { + for(t2 = t1; t2 <= n; t2++) { + if (t1 >= lb && t2 >= t1+1) { + s1(t1,t2); + } + if (ub <= n-1 && t2 >= t1+1 && t1 >= lb) { + s3(t1,t2); + } + for(t4 = max(lb,t1); t4 <= ub; t4++) { + if (t4 >= t1+1 && t4 <= lb) { + s4(t1,t2,t4,t1,t2); + } + s2(t1,t2,t4); + } + } + } +} + +>>> # codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known; +>>> # codegen 1 T1:I1,T2:I2,Tp:p,Tw:w given known2; +>>> # codegen 2 T1:I1,T2:I2,Tp:p,Tw:w given known2; + diff --git a/omega/examples/old_test/m1 b/omega/examples/old_test/m1 new file mode 100644 index 0000000..1ff50d1 --- /dev/null +++ b/omega/examples/old_test/m1 @@ -0,0 +1,6 @@ +T1:={[i,j]->[i,j,0]}; +T2:={[i,j]->[i,j,1]}; +R1:={[1:9,1:9]}; +R2:={[5,1:9]}; +codegen T1:R1,T2:R2; +codegen 2 T1:R1,T2:R2; diff --git a/omega/examples/old_test/m1.oc-rt b/omega/examples/old_test/m1.oc-rt new file mode 100644 index 0000000..ad2c49c --- /dev/null +++ b/omega/examples/old_test/m1.oc-rt @@ -0,0 +1,41 @@ +>>> T1:={[i,j]->[i,j,0]}; +>>> T2:={[i,j]->[i,j,1]}; +>>> R1:={[1:9,1:9]}; +>>> R2:={[5,1:9]}; +>>> codegen T1:R1,T2:R2; +for(t1 = 1; t1 <= 9; t1++) { + if (t1 <= 4) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t1,t2); + } + } + if (t1 == 5) { + for(t2 = 1; t2 <= 9; t2++) { + s1(5,t2); + s2(5,t2); + } + } + if (t1 >= 6) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t1,t2); + } + } +} + +>>> codegen 2 T1:R1,T2:R2; +for(t1 = 1; t1 <= 4; t1++) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t1,t2); + } +} +for(t2 = 1; t2 <= 9; t2++) { + s1(5,t2); + s2(5,t2); +} +for(t1 = 6; t1 <= 9; t1++) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t1,t2); + } +} + + diff --git a/omega/examples/old_test/m10 b/omega/examples/old_test/m10 new file mode 100644 index 0000000..01fa540 --- /dev/null +++ b/omega/examples/old_test/m10 @@ -0,0 +1,5 @@ +IS:={[i,j]: 1 <= i,j <= 9}; +T1:={[i,j]->[4j,i,0]}; +T2:={[i,j]->[2j,i,1]}; +codegen T1:IS,T2:IS; +codegen 2 T1:IS,T2:IS; diff --git a/omega/examples/old_test/m10.oc-rt b/omega/examples/old_test/m10.oc-rt new file mode 100644 index 0000000..c782e1d --- /dev/null +++ b/omega/examples/old_test/m10.oc-rt @@ -0,0 +1,47 @@ +>>> IS:={[i,j]: 1 <= i,j <= 9}; +>>> T1:={[i,j]->[4j,i,0]}; +>>> T2:={[i,j]->[2j,i,1]}; +>>> codegen T1:IS,T2:IS; +for(t1 = 2; t1 <= 36; t1 += 2) { + if (intMod(t1,4) == 0 && t1 <= 16) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + s2(t2,intDiv(t1,2)); + } + } + if (intMod(t1,4) == 0 && t1 >= 20) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + } + } + if (intMod(t1-2,4) == 0 && t1 <= 18) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,intDiv(t1,2)); + } + } +} + +>>> codegen 2 T1:IS,T2:IS; +for(t1 = 2; t1 <= 16; t1 += 2) { + if (intMod(t1,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + s2(t2,intDiv(t1,2)); + } + } + if (intMod(t1-2,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,intDiv(t1,2)); + } + } +} +for(t2 = 1; t2 <= 9; t2++) { + s2(t2,9); +} +for(t1 = 20; t1 <= 36; t1 += 4) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + } +} + + diff --git a/omega/examples/old_test/m11 b/omega/examples/old_test/m11 new file mode 100644 index 0000000..1367ff8 --- /dev/null +++ b/omega/examples/old_test/m11 @@ -0,0 +1,10 @@ +symbolic m; +I := {[p1,p2,c2,a1,a2,b1,b2] : + 1 <= p1 <= 4 && 1 <= p2 <= 2 && 17p1<=16+2m + && 1<=2c2+p2 <= 6 + && 0 <= 10c2+5p2-a2 <= 4 + && 0 <= 17p1-2a1 <= 16 && a1 <= 30 && a2-m+a1 <= 1 + && 17 <= 2b1-2a1+17p1 <= 18 + && b2 = 5 + a2-5p2-5c2}; +I; +codegen I; diff --git a/omega/examples/old_test/m11.oc-rt b/omega/examples/old_test/m11.oc-rt new file mode 100644 index 0000000..4218a2e --- /dev/null +++ b/omega/examples/old_test/m11.oc-rt @@ -0,0 +1,32 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic m; +# +# I := {[p1,p2,c2,a1,a2,b1,b2] : +# 1 <= p1 <= 4 && 1 <= p2 <= 2 && 17p1<=16+2m +# && 1<=2c2+p2 <= 6 +# && 0 <= 10c2+5p2-a2 <= 4 +# && 0 <= 17p1-2a1 <= 16 && a1 <= 30 && a2-m+a1 <= 1 +# && 17 <= 2b1-2a1+17p1 <= 18 +# && b2 = 5 + a2-5p2-5c2}; +# +# I; + +{[p1,p2,c2,a1,a2,b1,a2-5p2-5c2+5]: 1, -2c2+1 <= p2 <= 2, -2c2+6 && a1 <= 30 && 1 <= p1 && 17p1+2b1 <= 18+2a1 && 17+2a1 <= 17p1+2b1 && a2 <= 5p2+10c2 && 5p2+10c2 <= 4+a2 && 2a1 <= 17p1 && 17p1 <= 16+2a1 && a1+a2 <= 1+m} + +# +# codegen I; +for(t1 = 1; t1 <= min(intDiv(2*m+16,17),4); t1++) { + for(t2 = 1; t2 <= min(intDiv(2*m-17*t1+26,10),2); t2++) { + for(t3 = 0; t3 <= min(intDiv(2*m-10*t2-17*t1+26,20),2); t3++) { + for(t4 = intDiv(17*t1-16+1,2); t4 <= min(intDiv(17*t1,2),m-5*t2-10*t3+5,30); t4++) { + for(t5 = 5*t2+10*t3-4; t5 <= min(m-t4+1,5*t2+10*t3); t5++) { + for(t6 = intDiv(-17*t1+2*t4+17+1,2); t6 <= intDiv(-17*t1+2*t4+18,2); t6++) { + s1(t1,t2,t3,t4,t5,t6,t5+-5*t2+-5*t3+5); + } + } + } + } + } +} + +# diff --git a/omega/examples/old_test/m12 b/omega/examples/old_test/m12 new file mode 100644 index 0000000..2f1101f --- /dev/null +++ b/omega/examples/old_test/m12 @@ -0,0 +1,8 @@ +symbolic n,m; +I1 := {[1,1:n,1:m,0]}; +I2 := {[2,1:n,0,0]}; +I3 := {[3,1:m,1,1:n]}; +I4 := {[3,1:m,2,1:n]}; +I5 := {[4,1:m,0,0]}; +codegen I1; +codegen I1,I1,I2,I2,I3,I3,I4,I4,I5,I5; diff --git a/omega/examples/old_test/m12.oc-rt b/omega/examples/old_test/m12.oc-rt new file mode 100644 index 0000000..ab5953b --- /dev/null +++ b/omega/examples/old_test/m12.oc-rt @@ -0,0 +1,54 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# I1 := {[1,1:n,1:m,0]}; +# +# I2 := {[2,1:n,0,0]}; +# +# I3 := {[3,1:m,1,1:n]}; +# +# I4 := {[3,1:m,2,1:n]}; +# +# I5 := {[4,1:m,0,0]}; +# +# codegen I1; +if (m >= 1) { + for(t2 = 1; t2 <= n; t2++) { + for(t3 = 1; t3 <= m; t3++) { + s1(1,t2,t3,0); + } + } +} + +# +# codegen I1,I1,I2,I2,I3,I3,I4,I4,I5,I5; +if (m >= 1) { + for(t2 = 1; t2 <= n; t2++) { + for(t3 = 1; t3 <= m; t3++) { + s1(1,t2,t3,0); + s2(1,t2,t3,0); + } + } +} +for(t2 = 1; t2 <= n; t2++) { + s3(2,t2,0,0); + s4(2,t2,0,0); +} +if (n >= 1) { + for(t2 = 1; t2 <= m; t2++) { + for(t4 = 1; t4 <= n; t4++) { + s5(3,t2,1,t4); + s6(3,t2,1,t4); + } + for(t4 = 1; t4 <= n; t4++) { + s7(3,t2,2,t4); + s8(3,t2,2,t4); + } + } +} +for(t2 = 1; t2 <= m; t2++) { + s9(4,t2,0,0); + s10(4,t2,0,0); +} + +# diff --git a/omega/examples/old_test/m2 b/omega/examples/old_test/m2 new file mode 100644 index 0000000..be93f8e --- /dev/null +++ b/omega/examples/old_test/m2 @@ -0,0 +1,4 @@ +R1:={[i,j]: 2 <= i,j <= 9}; +R2:={[i,j]: 5 <= i <= 9 & 1 <= j <= 9}; +codegen R1,R2; +codegen 2 R1,R2; diff --git a/omega/examples/old_test/m2.oc-rt b/omega/examples/old_test/m2.oc-rt new file mode 100644 index 0000000..cdd76dd --- /dev/null +++ b/omega/examples/old_test/m2.oc-rt @@ -0,0 +1,35 @@ +>>> R1:={[i,j]: 2 <= i,j <= 9}; +>>> R2:={[i,j]: 5 <= i <= 9 & 1 <= j <= 9}; +>>> codegen R1,R2; +for(t1 = 2; t1 <= 9; t1++) { + if (t1 >= 5) { + s2(t1,1); + } + if (t1 <= 4) { + for(t2 = 2; t2 <= 9; t2++) { + s1(t1,t2); + } + } + if (t1 >= 5) { + for(t2 = 2; t2 <= 9; t2++) { + s1(t1,t2); + s2(t1,t2); + } + } +} + +>>> codegen 2 R1,R2; +for(t1 = 2; t1 <= 4; t1++) { + for(t2 = 2; t2 <= 9; t2++) { + s1(t1,t2); + } +} +for(t1 = 5; t1 <= 9; t1++) { + s2(t1,1); + for(t2 = 2; t2 <= 9; t2++) { + s1(t1,t2); + s2(t1,t2); + } +} + + diff --git a/omega/examples/old_test/m3 b/omega/examples/old_test/m3 new file mode 100644 index 0000000..e160e8c --- /dev/null +++ b/omega/examples/old_test/m3 @@ -0,0 +1,2 @@ +I := {[i,j] : 1 <= i+j,j <= 10}; +codegen I; diff --git a/omega/examples/old_test/m3.oc-rt b/omega/examples/old_test/m3.oc-rt new file mode 100644 index 0000000..b466eb9 --- /dev/null +++ b/omega/examples/old_test/m3.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# I := {[i,j] : 1 <= i+j,j <= 10}; +# +# codegen I; +for(t1 = -9; t1 <= 9; t1++) { + for(t2 = max(-t1+1,1); t2 <= min(-t1+10,10); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/m4 b/omega/examples/old_test/m4 new file mode 100644 index 0000000..d25f961 --- /dev/null +++ b/omega/examples/old_test/m4 @@ -0,0 +1,11 @@ +T1:={[i,j]->[j,i,0]}; +T2:={[i,j]->[j,i,1]}; +IS:={[i,j]: 1 <= i,j <= 9}; + +newIS1 := T1 \ IS; +newIS1; +newIS2 := T2 \ IS; +newIS2; + +codegen T1:IS,T2:IS; +codegen 2 T1:IS,T2:IS; diff --git a/omega/examples/old_test/m4.oc-rt b/omega/examples/old_test/m4.oc-rt new file mode 100644 index 0000000..d710dce --- /dev/null +++ b/omega/examples/old_test/m4.oc-rt @@ -0,0 +1,28 @@ +>>> T1:={[i,j]->[j,i,0]}; +>>> T2:={[i,j]->[j,i,1]}; +>>> IS:={[i,j]: 1 <= i,j <= 9}; +>>> +>>> newIS1 := T1 \ IS; +>>> newIS1; +{[i,j] -> [j,i,0] : 1 <= i <= 9 && 1 <= j <= 9} +>>> newIS2 := T2 \ IS; +>>> newIS2; +{[i,j] -> [j,i,1] : 1 <= i <= 9 && 1 <= j <= 9} +>>> +>>> codegen T1:IS,T2:IS; +for(t1 = 1; t1 <= 9; t1++) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } +} + +>>> codegen 2 T1:IS,T2:IS; +for(t1 = 1; t1 <= 9; t1++) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } +} + + diff --git a/omega/examples/old_test/m7 b/omega/examples/old_test/m7 new file mode 100644 index 0000000..62c0c64 --- /dev/null +++ b/omega/examples/old_test/m7 @@ -0,0 +1,6 @@ +T1:={[i,j]->[j,i,0]}; +T2:={[i,j]->[j,i,1]}; +R2:={[i,j]: 1 <= i,j <= 9}; +R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; +codegen T1:R2,T2:R3; +codegen 2 T1:R2,T2:R3; diff --git a/omega/examples/old_test/m7.oc-rt b/omega/examples/old_test/m7.oc-rt new file mode 100644 index 0000000..a98c8a7 --- /dev/null +++ b/omega/examples/old_test/m7.oc-rt @@ -0,0 +1,35 @@ +>>> T1:={[i,j]->[j,i,0]}; +>>> T2:={[i,j]->[j,i,1]}; +>>> R2:={[i,j]: 1 <= i,j <= 9}; +>>> R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; +>>> codegen T1:R2,T2:R3; +for(t1 = 1; t1 <= 9; t1++) { + if (intMod(-t1,2) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } + } + if (intMod(-t1-1,2) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + } + } +} + +>>> codegen 2 T1:R2,T2:R3; +for(t1 = 1; t1 <= 9; t1++) { + if (intMod(-t1,2) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } + } + if (intMod(-t1-1,2) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + } + } +} + + diff --git a/omega/examples/old_test/m8 b/omega/examples/old_test/m8 new file mode 100644 index 0000000..eb6938b --- /dev/null +++ b/omega/examples/old_test/m8 @@ -0,0 +1,6 @@ +T1:={[i,j]->[j,i,0]}; +T2:={[i,j]->[j,i,1]}; +R2:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 4alpha)}; +R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; +codegen T1:R2,T2:R3; +codegen 2 T1:R2,T2:R3; diff --git a/omega/examples/old_test/m8.oc-rt b/omega/examples/old_test/m8.oc-rt new file mode 100644 index 0000000..670052b --- /dev/null +++ b/omega/examples/old_test/m8.oc-rt @@ -0,0 +1,35 @@ +>>> T1:={[i,j]->[j,i,0]}; +>>> T2:={[i,j]->[j,i,1]}; +>>> R2:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 4alpha)}; +>>> R3:={[i,j]: 1 <= i,j <= 9 && exists (alpha: j = 2alpha)}; +>>> codegen T1:R2,T2:R3; +for(t1 = 2; t1 <= 8; t1 += 2) { + if (intMod(t1,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } + } + if (intMod(t1-2,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,t1); + } + } +} + +>>> codegen 2 T1:R2,T2:R3; +for(t1 = 2; t1 <= 8; t1 += 2) { + if (intMod(t1,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,t1); + s2(t2,t1); + } + } + if (intMod(t1-2,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,t1); + } + } +} + + diff --git a/omega/examples/old_test/m9 b/omega/examples/old_test/m9 new file mode 100644 index 0000000..fb59381 --- /dev/null +++ b/omega/examples/old_test/m9 @@ -0,0 +1,5 @@ +IS:={[i,j]: 1 <= i,j <= 9}; +T1:={[i,j]->[2j,i,0]}; +T2:={[i,j]->[2j,i,1]}; +codegen T1:IS,T2:IS; +codegen 2 T1:IS,T2:IS; diff --git a/omega/examples/old_test/m9.oc-rt b/omega/examples/old_test/m9.oc-rt new file mode 100644 index 0000000..c331a0c --- /dev/null +++ b/omega/examples/old_test/m9.oc-rt @@ -0,0 +1,20 @@ +>>> IS:={[i,j]: 1 <= i,j <= 9}; +>>> T1:={[i,j]->[2j,i,0]}; +>>> T2:={[i,j]->[2j,i,1]}; +>>> codegen T1:IS,T2:IS; +for(t1 = 2; t1 <= 18; t1 += 2) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,2)); + s2(t2,intDiv(t1,2)); + } +} + +>>> codegen 2 T1:IS,T2:IS; +for(t1 = 2; t1 <= 18; t1 += 2) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,2)); + s2(t2,intDiv(t1,2)); + } +} + + diff --git a/omega/examples/old_test/maximize b/omega/examples/old_test/maximize new file mode 100644 index 0000000..be13c89 --- /dev/null +++ b/omega/examples/old_test/maximize @@ -0,0 +1,7 @@ +symbolic n, f(1); + +R0 := {[x] : 1 <= x <= n}; +R1 := {[x] : 1 <= x <= n && f(x) >= 0}; +maximize R0; +maximize R1; +R1 intersection maximize R0; diff --git a/omega/examples/old_test/maximize.oc-rt b/omega/examples/old_test/maximize.oc-rt new file mode 100644 index 0000000..4f1826e --- /dev/null +++ b/omega/examples/old_test/maximize.oc-rt @@ -0,0 +1,24 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n, f(1); +# +# +# R0 := {[x] : 1 <= x <= n}; +# +# R1 := {[x] : 1 <= x <= n && f(x) >= 0}; +# +# maximize R0; + +{[n]: 1 <= n} + +# +# maximize R1; + +{[x]: 1 <= x < n && 0 <= f(x) && UNKNOWN} union + {[x]: n = x && 0 <= f(x) && 1 <= x} + +# +# R1 intersection maximize R0; + +{[x]: n = x && 1 <= x && 0 <= f(x)} + +# diff --git a/omega/examples/old_test/olda b/omega/examples/old_test/olda new file mode 100644 index 0000000..095388b --- /dev/null +++ b/omega/examples/old_test/olda @@ -0,0 +1,9 @@ +T10:={[mp,mq,mi] -> [mi,mq,mp,0]}; +T20:={[mp,mq,mi] -> [mi,mp,mq,1]}; + +symbolic np,morb; +IS10 := {[mp,mq,mi]: 1 <= mp <= np && 1 <= mq <= mp && 1 <= mi <= morb}; +IS20 := IS10; + +codegen T10:IS10,T20:IS20; +codegen 2 T10:IS10,T20:IS20; diff --git a/omega/examples/old_test/olda.oc-rt b/omega/examples/old_test/olda.oc-rt new file mode 100644 index 0000000..52e3406 --- /dev/null +++ b/omega/examples/old_test/olda.oc-rt @@ -0,0 +1,52 @@ +>>> T10:={[mp,mq,mi] -> [mi,mq,mp,0]}; +>>> T20:={[mp,mq,mi] -> [mi,mp,mq,1]}; +>>> +>>> Symbolic np,morb; +>>> IS10 := {[mp,mq,mi]: 1 <= mp <= np && 1 <= mq <= mp && 1 <= mi <= morb}; +>>> IS20 := IS10; +>>> +>>> codegen T10:IS10,T20:IS20; +if (np >= 1) { + for(t1 = 1; t1 <= morb; t1++) { + for(t2 = 1; t2 <= np; t2++) { + for(t3 = 1; t3 <= t2-1; t3++) { + s2(t2,t3,t1); + } + s1(t2,t2,t1); + s2(t2,t2,t1); + for(t3 = t2+1; t3 <= np; t3++) { + s1(t3,t2,t1); + } + } + } +} + +>>> codegen 2 T10:IS10,T20:IS20; +if (np >= 1) { + for(t1 = 1; t1 <= morb; t1++) { + s1(1,1,t1); + s2(1,1,t1); + for(t3 = 2; t3 <= np; t3++) { + s1(t3,1,t1); + } + for(t2 = 2; t2 <= np-1; t2++) { + for(t3 = 1; t3 <= t2-1; t3++) { + s2(t2,t3,t1); + } + s1(t2,t2,t1); + s2(t2,t2,t1); + for(t3 = t2+1; t3 <= np; t3++) { + s1(t3,t2,t1); + } + } + for(t3 = 1; t3 <= np-1; t3++) { + s2(np,t3,t1); + } + if (np >= 2) { + s1(np,np,t1); + s2(np,np,t1); + } + } +} + + diff --git a/omega/examples/old_test/p.delft b/omega/examples/old_test/p.delft new file mode 100644 index 0000000..27840a2 --- /dev/null +++ b/omega/examples/old_test/p.delft @@ -0,0 +1,22 @@ +# Generate local code for this HPF code fragment +# !HPF$ template T(0:150,0:150) +# !HPF$ align X(I,J) with T(3*I,3*J) +A := { [i,j] -> [3i,3j] }; +# !HPF$ processors P(0:3, 0:3) +# !HPF$ distribute +# !HPF$ T(cyclic(4), cyclic(4)) onto P +D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : + t1 = 16c1+4p1+l1 + && t2 = 16c2+4p2+l2 + && 0 <= p1,p2 <= 3 + && 0 <= l1,l2 <= 3 }; +# do I = 0, 14 +# Y(I,I) = 1.0 +# enddo +I := { [i] : 0 <= i <= 14 }; +X := { [i] -> [i,i] }; +R := D(A(X(I))); +R; +symbolic P1,P2; +selectLocal := {[P1,P2,c1,c2,l1,l2] -> [c1,c2,l1,l2]}; +codegen selectLocal(R); diff --git a/omega/examples/old_test/p.delft.oc-rt b/omega/examples/old_test/p.delft.oc-rt new file mode 100644 index 0000000..d59a886 --- /dev/null +++ b/omega/examples/old_test/p.delft.oc-rt @@ -0,0 +1,43 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # Generate local code for this HPF code fragment +# # !HPF$ template T(0:150,0:150) +# # !HPF$ align X(I,J) with T(3*I,3*J) +# A := { [i,j] -> [3i,3j] }; +# +# # !HPF$ processors P(0:3, 0:3) +# # !HPF$ distribute +# # !HPF$ T(cyclic(4), cyclic(4)) onto P +# D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : +# t1 = 16c1+4p1+l1 +# && t2 = 16c2+4p2+l2 +# && 0 <= p1,p2 <= 3 +# && 0 <= l1,l2 <= 3 }; +# +# # do I = 0, 14 +# # Y(I,I) = 1.0 +# # enddo +# I := { [i] : 0 <= i <= 14 }; +# +# X := { [i] -> [i,i] }; +# +# R := D(A(X(I))); +# +# R; + +{[p1,p1,c1,c1,l1,l1]: Exists ( alpha : p1+l1+c1 = 3alpha && 0 <= p1 <= -4c1+10, 3 && 0 <= l1 <= 3 && 0 <= c1)} + +# +# symbolic P1,P2; +# +# selectLocal := {[P1,P2,c1,c2,l1,l2] -> [c1,c2,l1,l2]}; +# +# codegen selectLocal(R); +if (P1 == P2 && P1 >= 0 && P1 <= 3) { + for(t1 = 0; t1 <= min(-P1+4,2); t1++) { + for(t3 = intMod((-P1-t1),3); t3 <= 3; t3 += 3) { + s1(t1,t1,t3,t3); + } + } +} + +# diff --git a/omega/examples/old_test/p.delft2 b/omega/examples/old_test/p.delft2 new file mode 100644 index 0000000..32e5da0 --- /dev/null +++ b/omega/examples/old_test/p.delft2 @@ -0,0 +1,24 @@ +# Compute Sends and receives for the following HPF fragment + +I := { [i,j] : 1 <= i <= 14 && 0 <= j <= 14 }; +X := { [i,j] -> [3i,3j] }; +Y := { [i,j] -> [i',3j] : 3i-1 <= i'<= 3i}; +A := { [i,j] -> [3i,3j] }; +D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : + t1 = 16c1+4p1+l1 + && t2 = 16c2+4p2+l2 + && 0 <= p1,p2 <= 3 + && 0 <= l1,l2 <= 3 }; +P := { [p1,p2,c1,c2,l1,l2] -> [p1,p2]}; +C := { [p1,p2,c1,c2,l1,l2] -> [p1,p2,c1,c2]}; +own := P(D(A(X))) \I; +own; +need := D(A(Y)) \I; +need; +different := {[p1,p2] -> [q1,q2,c1,c2,l1,l2] : p1 != q1 || p2 != q2}; +ship := (need compose (inverse own) ) intersection different; +symbolic P1,P2; +P := {[P1,P2]}; +S := range (ship \ P); +S; +codegen S; diff --git a/omega/examples/old_test/p.delft2.oc-rt b/omega/examples/old_test/p.delft2.oc-rt new file mode 100644 index 0000000..3ee662e --- /dev/null +++ b/omega/examples/old_test/p.delft2.oc-rt @@ -0,0 +1,80 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # Compute Sends and receives for the following HPF fragment +# +# I := { [i,j] : 1 <= i <= 14 && 0 <= j <= 14 }; +# +# X := { [i,j] -> [3i,3j] }; +# +# Y := { [i,j] -> [i',3j] : 3i-1 <= i'<= 3i}; +# +# A := { [i,j] -> [3i,3j] }; +# +# D := { [t1,t2] -> [p1,p2,c1,c2,l1,l2] : +# t1 = 16c1+4p1+l1 +# && t2 = 16c2+4p2+l2 +# && 0 <= p1,p2 <= 3 +# && 0 <= l1,l2 <= 3 }; +# +# P := { [p1,p2,c1,c2,l1,l2] -> [p1,p2]}; +# +# C := { [p1,p2,c1,c2,l1,l2] -> [p1,p2,c1,c2]}; +# +# own := P(D(A(X))) \I; +# +# own; + +{[i,j] -> [p1,p2] : Exists ( alpha,beta : 1 <= i <= 14 && 0 <= j <= 14 && 0 <= p1 <= 3 && 0 <= p2 <= 3 && 4p1+16alpha <= 9i && 4p2+16beta <= 9j && 9i <= 3+4p1+16alpha && 9j <= 3+4p2+16beta)} + +# +# need := D(A(Y)) \I; +# +# need; + +{[i,j] -> [p1,p2,c1,c2,l1,9j-4p2-16c2] : Exists ( alpha : p1+c1+l1 = 3alpha && 1 <= i <= 14 && 0 <= j <= 14 && 0 <= p1 <= 3 && 0 <= p2 <= 3 && 0 <= l1 <= 3 && 4p2+16c2 <= 9j && 9j <= 3+4p2+16c2 && 9i <= 3+4p1+16c1+l1 && 4p1+16c1+l1 <= 9i)} + +# +# different := {[p1,p2] -> [q1,q2,c1,c2,l1,l2] : p1 != q1 || p2 != q2}; +# +# ship := (need compose (inverse own) ) intersection different; +# +# symbolic P1,P2; +# +# P := {[P1,P2]}; +# +# S := range (ship \ P); +# +# S; + +{[3,P2,c1,c2,l1,l2]: Exists ( alpha,beta,gamma : 4P2+l2 = 2c2+9beta && l1+c1 = 3alpha && 0 <= P1 <= -4c1+27 && 0 <= P2 <= 3 && -16c1-6 <= l1 <= 3 && 0 <= l2 <= 3 && 0 <= c2 && 4P2+l2+16c2 <= 126 && 9gamma <= 15+l1+16c1 && 16+4P1+16c1 <= 9gamma)} union + {[In_1,P2,c1,c2,l1,l2]: Exists ( alpha,beta,gamma : 4P2+l2 = 2c2+9beta && In_1+c1+l1 = 3alpha && 0 <= In_1 < P1 <= -4c1+31, 3 && 0 <= P2 <= 3 && 0 <= l2 <= 3 && l1 <= 3 && 6 <= 4In_1+16c1+l1 && 4P1+16c1 <= 9gamma && 0 <= 4P2+l2+16c2 && 4P2+l2+16c2 <= 126 && 9gamma <= 3+4In_1+16c1+l1)} + +# +# codegen S; +if (P1 >= 1 && P2 >= 0 && P1 <= 3 && P2 <= 3) { + for(t3 = intDiv(-P1+2+3,4); t3 <= 7; t3++) { + for(t4 = 0; t4 <= 7; t4++) { + for(t5 = 1+intMod(((-P1-t3+1)-1),3); t5 <= 3; t5 += 3) { + if (intMod(4*P1-2*t3+t5-1,9) == 0) { + for(t6 = intMod((-4*P2+2*t4),9); t6 <= 3; t6 += 9) { + s1(P1-1,P2,t3,t4,t5,t6); + } + } + } + } + } +} +if (P1 == 0 && P2 >= 0 && P2 <= 3) { + for(t3 = 0; t3 <= 6; t3++) { + for(t4 = 0; t4 <= 7; t4++) { + for(t5 = 1+intMod((-t3-1),3); t5 <= 3; t5 += 3) { + if (4*t5 == -t3+12) { + for(t6 = intMod((-4*P2+2*t4),9); t6 <= 3; t6 += 9) { + s1(3,P2,-4*t5+12,t4,t5,t6); + } + } + } + } + } +} + +# diff --git a/omega/examples/old_test/p.delft3 b/omega/examples/old_test/p.delft3 new file mode 100644 index 0000000..b2321f1 --- /dev/null +++ b/omega/examples/old_test/p.delft3 @@ -0,0 +1,20 @@ +Hull {[p1,p2] -> [p1-1,p2,Out_3,Out_4] : +exists ( alpha,gamma : +1 <= p1 <= 3 +&& 0 <= p2 <= 3 +&& -2Out_4+1 <= alpha <= -2Out_4+14 +&& -2Out_3+1 <= gamma <= -2Out_3+14 +&& 4p1 <= 2Out_3+9gamma +&& 4p2 <= 2Out_4+9alpha +&& 2Out_3+9gamma <= 2+4p1 +&& 2Out_4+9alpha <= 3+4p2)}; + +Hull {[0,p2] -> [3,p2,Out_3,Out_4] : +exists (alpha,gamma : +Out_3+4alpha = 0 +&& 0 <= p2 <= 3 +&& 0 <= Out_3 <= 4 +&& -2Out_4+1 <= gamma <= -2Out_4+14 +&& 4p2 <= 2Out_4+9gamma +&& 2Out_4+9gamma <= 3+4p2)}; + diff --git a/omega/examples/old_test/p.delft3.oc-rt b/omega/examples/old_test/p.delft3.oc-rt new file mode 100644 index 0000000..6f85d83 --- /dev/null +++ b/omega/examples/old_test/p.delft3.oc-rt @@ -0,0 +1,29 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# hull {[p1,p2] -> [p1-1,p2,Out_3,Out_4] : +# Exists ( alpha,gamma : +# 1 <= p1 <= 3 +# && 0 <= p2 <= 3 +# && -2Out_4+1 <= alpha <= -2Out_4+14 +# && -2Out_3+1 <= gamma <= -2Out_3+14 +# && 4p1 <= 2Out_3+9gamma +# && 4p2 <= 2Out_4+9alpha +# && 2Out_3+9gamma <= 2+4p1 +# && 2Out_4+9alpha <= 3+4p2)}; + +{[p1,p2] -> [p1-1,p2,Out_3,Out_4] : 1, -4Out_3+2 <= p1 <= 3 && 0, -4Out_4+2 <= p2 <= 3 && Out_3 <= 7 && Out_4 <= 7} + +# +# +# hull {[0,p2] -> [3,p2,Out_3,Out_4] : +# Exists (alpha,gamma : +# Out_3+4alpha = 0 +# && 0 <= p2 <= 3 +# && 0 <= Out_3 <= 4 +# && -2Out_4+1 <= gamma <= -2Out_4+14 +# && 4p2 <= 2Out_4+9gamma +# && 2Out_4+9gamma <= 3+4p2)}; + +{[0,p2] -> [3,p2,Out_3,Out_4] : 0, -4Out_4+2 <= p2 <= 3 && 0 <= Out_3 <= 4 && Out_4 <= 7} + +# +# diff --git a/omega/examples/old_test/p.subset b/omega/examples/old_test/p.subset new file mode 100644 index 0000000..3c8894c --- /dev/null +++ b/omega/examples/old_test/p.subset @@ -0,0 +1,3 @@ +{ [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 11 }; + +{ [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 7 }; diff --git a/omega/examples/old_test/p.subset.oc-rt b/omega/examples/old_test/p.subset.oc-rt new file mode 100644 index 0000000..b35b90f --- /dev/null +++ b/omega/examples/old_test/p.subset.oc-rt @@ -0,0 +1,10 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 11 }; + +True +# +# +# { [i] -> [j] : 1 <= i <= 9 } subset { [i] -> [j] : 1 <= i <= 7 }; + +False +# diff --git a/omega/examples/old_test/p1 b/omega/examples/old_test/p1 new file mode 100644 index 0000000..0f29643 --- /dev/null +++ b/omega/examples/old_test/p1 @@ -0,0 +1 @@ +{ [i] -> [j] : 1 <= i < j <= 20 }; diff --git a/omega/examples/old_test/p1.oc-rt b/omega/examples/old_test/p1.oc-rt new file mode 100644 index 0000000..3151bd6 --- /dev/null +++ b/omega/examples/old_test/p1.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i] -> [j] : 1 <= i < j <= 20 }; + +{[i] -> [j] : 1 <= i < j <= 20} + +# diff --git a/omega/examples/old_test/p10 b/omega/examples/old_test/p10 new file mode 100644 index 0000000..c802845 --- /dev/null +++ b/omega/examples/old_test/p10 @@ -0,0 +1 @@ +{[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100 }; diff --git a/omega/examples/old_test/p10.oc-rt b/omega/examples/old_test/p10.oc-rt new file mode 100644 index 0000000..e10a453 --- /dev/null +++ b/omega/examples/old_test/p10.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100 }; + +{[i,j,k,l,m] -> [i,i,i,i,i] : 1 <= i <= 100} + +# diff --git a/omega/examples/old_test/p11 b/omega/examples/old_test/p11 new file mode 100644 index 0000000..1871c82 --- /dev/null +++ b/omega/examples/old_test/p11 @@ -0,0 +1,10 @@ +{[i] : 1 <= i <= 10 + && ! i = 3 + && ! i = 2 + && ! i = 4 + && ! i = 7 + && ! i = 6 + && ! i = 8 +}; + + diff --git a/omega/examples/old_test/p11.oc-rt b/omega/examples/old_test/p11.oc-rt new file mode 100644 index 0000000..04641f2 --- /dev/null +++ b/omega/examples/old_test/p11.oc-rt @@ -0,0 +1,17 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[i] : 1 <= i <= 10 +# && ! i = 3 +# && ! i = 2 +# && ! i = 4 +# && ! i = 7 +# && ! i = 6 +# && ! i = 8 +# }; + +{[1]} union + {[5]} union + {[i]: 9 <= i <= 10} + +# +# +# diff --git a/omega/examples/old_test/p12 b/omega/examples/old_test/p12 new file mode 100644 index 0000000..ffe4b1d --- /dev/null +++ b/omega/examples/old_test/p12 @@ -0,0 +1,7 @@ +symbolic n,m; +T := { [i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m } union + { [i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m }; +T; +T+; +Inverse ( (Inverse T)+); +T@; diff --git a/omega/examples/old_test/p12.oc-rt b/omega/examples/old_test/p12.oc-rt new file mode 100644 index 0000000..51df294 --- /dev/null +++ b/omega/examples/old_test/p12.oc-rt @@ -0,0 +1,33 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n,m; +# +# T := { [i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m } union +# { [i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m }; +# +# T; + +{[i,j] -> [i-1,j] : 1 <= i <= n && 0 <= j <= m} union + {[i,j] -> [i,j-1] : 0 <= i <= n && 1 <= j <= m} + +# +# T+; + +{[i,0] -> [i',0] : m = 0 && 0 <= i' < i <= n} union + {[0,j] -> [0,j'] : n = 0 && 0 <= j' < j <= m} union + {[i,j] -> [i',j'] : 0 <= i' < i <= n && 0 <= j' <= j <= m && 1 <= m} union + {[i,j] -> [i,j'] : 0 <= j' < j <= m && 0 <= i <= n && 1 <= n} + +# +# Inverse ( (Inverse T)+); + +{[i,0] -> [i',0] : m = 0 && 0 <= i' < i <= n} union + {[0,j] -> [0,j'] : n = 0 && 0 <= j' < j <= m} union + {[i,j] -> [i',j'] : 0 <= i' < i <= n && 0 <= j' <= j <= m && 1 <= m} union + {[i,j] -> [i,j'] : 0 <= j' < j <= m && 0 <= i <= n && 1 <= n} + +# +# T@; + +{[In_1,In_2] -> [Out_1,Out_2] : Out_1 <= In_1 && Out_2 <= In_2 && In_2 <= m+Out_2 && In_1 <= n+Out_1} + +# diff --git a/omega/examples/old_test/p13 b/omega/examples/old_test/p13 new file mode 100644 index 0000000..28ca23c --- /dev/null +++ b/omega/examples/old_test/p13 @@ -0,0 +1,3 @@ +T := { [d1, -1] : d1 > 0 }; +T; +farkas T; diff --git a/omega/examples/old_test/p13.oc-rt b/omega/examples/old_test/p13.oc-rt new file mode 100644 index 0000000..b52c4d6 --- /dev/null +++ b/omega/examples/old_test/p13.oc-rt @@ -0,0 +1,13 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# T := { [d1, -1] : d1 > 0 }; +# +# T; + +{[d1,-1]: 1 <= d1} + +# +# farkas T; + +{[d1,In_2]: 0 <= d1 && In_2 <= constantTerm+d1} + +# diff --git a/omega/examples/old_test/p2 b/omega/examples/old_test/p2 new file mode 100644 index 0000000..b880627 --- /dev/null +++ b/omega/examples/old_test/p2 @@ -0,0 +1 @@ +{ [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; diff --git a/omega/examples/old_test/p2.oc-rt b/omega/examples/old_test/p2.oc-rt new file mode 100644 index 0000000..0d4f77c --- /dev/null +++ b/omega/examples/old_test/p2.oc-rt @@ -0,0 +1,6 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; + +{[i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25} + +# diff --git a/omega/examples/old_test/p3 b/omega/examples/old_test/p3 new file mode 100644 index 0000000..226a619 --- /dev/null +++ b/omega/examples/old_test/p3 @@ -0,0 +1,2 @@ +symbolic n; +{ [i] -> [i+1] : 1 <= i <= n }+; diff --git a/omega/examples/old_test/p3.oc-rt b/omega/examples/old_test/p3.oc-rt new file mode 100644 index 0000000..03c8ebb --- /dev/null +++ b/omega/examples/old_test/p3.oc-rt @@ -0,0 +1,8 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# { [i] -> [i+1] : 1 <= i <= n }+; + +{[i] -> [Out_1] : 1 <= i < Out_1 <= n+1} + +# diff --git a/omega/examples/old_test/p4 b/omega/examples/old_test/p4 new file mode 100644 index 0000000..2fcd2aa --- /dev/null +++ b/omega/examples/old_test/p4 @@ -0,0 +1,5 @@ +inverse { [i] -> [i+1] : 1 <= i <= 9 }; +domain { [i] -> [i+1] : 1 <= i <= 9 }; +range { [i] -> [i+1] : 1 <= i <= 9 }; +{ [i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }; + diff --git a/omega/examples/old_test/p4.oc-rt b/omega/examples/old_test/p4.oc-rt new file mode 100644 index 0000000..020d1d2 --- /dev/null +++ b/omega/examples/old_test/p4.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# inverse { [i] -> [i+1] : 1 <= i <= 9 }; + +{[In_1] -> [In_1-1] : 2 <= In_1 <= 10} + +# +# domain { [i] -> [i+1] : 1 <= i <= 9 }; + +{[i]: 1 <= i <= 9} + +# +# range { [i] -> [i+1] : 1 <= i <= 9 }; + +{[In_1]: 2 <= In_1 <= 10} + +# +# { [i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }; + +{[i] -> [i+2] : 1 <= i <= 8} + +# +# diff --git a/omega/examples/old_test/p5 b/omega/examples/old_test/p5 new file mode 100644 index 0000000..ae7b242 --- /dev/null +++ b/omega/examples/old_test/p5 @@ -0,0 +1,8 @@ +symbolic n; +{[iw] -> [ir] : + 1 <= iw, ir <= 2n and iw=ir + and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and + iw <= ik = ir and 2jk = ir ) + and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and + iw <= ik = ir and 2jk+1 = ir ) + }; diff --git a/omega/examples/old_test/p5.oc-rt b/omega/examples/old_test/p5.oc-rt new file mode 100644 index 0000000..ef73886 --- /dev/null +++ b/omega/examples/old_test/p5.oc-rt @@ -0,0 +1,16 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# {[iw] -> [ir] : +# 1 <= iw, ir <= 2n and iw=ir +# and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and +# iw <= ik = ir and 2jk = ir ) +# and ! exists ( ik,jk : 1 <= ik <= 2n && 1 <= jk < n and +# iw <= ik = ir and 2jk+1 = ir ) +# }; + +{[iw] -> [iw] : n = 1 && 1 <= iw <= 2} union + {[2n] -> [2n] : 2 <= n} union + {[1] -> [1] : 2 <= n} + +# diff --git a/omega/examples/old_test/p6 b/omega/examples/old_test/p6 new file mode 100644 index 0000000..f09634a --- /dev/null +++ b/omega/examples/old_test/p6 @@ -0,0 +1,25 @@ +R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; +R; +inverse R; +domain R; +range R; +R compose R; +R+; # closure of R = R union (R compose R) union (R compose R ... +complement R; +S := {[i] : 5 <= i <= 25}; +S; +R(S); # apply R to S +R \ S; # restrict domain of R to S +R / S; # restrict range of R to S +(R\S) union (R/S); +(R\S) intersection (R/S); +(R/S) - (R\S); +S*S; # cross product +D := S - {[9:16:2]} - {[17:19]}; +D; +T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; +T; +Hull T; +Hull D; +codegen D; +codegen {[i,j] : 1 <= i+j,j <= 10}; diff --git a/omega/examples/old_test/p6.oc-rt b/omega/examples/old_test/p6.oc-rt new file mode 100644 index 0000000..109e029 --- /dev/null +++ b/omega/examples/old_test/p6.oc-rt @@ -0,0 +1,129 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i] -> [i'] : 1 <= i,i' <= 10 && i' = i+1 }; +# +# R; + +{[i] -> [i+1] : 1 <= i <= 9} + +# +# inverse R; + +{[i] -> [i-1] : 2 <= i <= 10} + +# +# domain R; + +{[i]: 1 <= i <= 9} + +# +# range R; + +{[i]: 2 <= i <= 10} + +# +# R compose R; + +{[i] -> [i+2] : 1 <= i <= 8} + +# +# R+; + +{[i] -> [i'] : 1 <= i < i' <= 10} + +# # closure of R = R union (R compose R) union (R compose R ... +# complement R; + +{[i] -> [i'] : i <= 0} union + {[i] -> [i'] : 10 <= i} union + {[i] -> [i'] : 1 <= i <= 9, i'-2} union + {[i] -> [i'] : 1, i' <= i <= 9} + +# +# S := {[i] : 5 <= i <= 25}; +# +# S; + +{[i]: 5 <= i <= 25} + +# +# R(S); + +{[i]: 6 <= i <= 10} + +# # apply R to S +# R \ S; + +{[i] -> [i+1] : 5 <= i <= 9} + +# # restrict domain of R to S +# R / S; + +{[i] -> [i+1] : 4 <= i <= 9} + +# # restrict range of R to S +# (R\S) union (R/S); + +{[i] -> [i+1] : 4 <= i <= 9} + +# +# (R\S) intersection (R/S); + +{[i] -> [i+1] : 5 <= i <= 9} + +# +# (R/S) - (R\S); + +{[4] -> [5] } + +# +# S*S; + +{[i] -> [i'] : 5 <= i <= 25 && 5 <= i' <= 25} + +# # cross product +# D := S - {[9:16:2]} - {[17:19]}; +# +# D; + +{[i]: 5 <= i <= 8} union + {[i]: Exists ( alpha : 2alpha = i && 10 <= i <= 16)} union + {[i]: 20 <= i <= 25} + +# +# T := { [i] : 1 <= i <= 11 & exists (a : i = 2a) }; +# +# T; + +{[i]: Exists ( alpha : 2alpha = i && 2 <= i <= 10)} + +# +# Hull T; + +{[i]: 2 <= i <= 10} + +# +# Hull D; + +{[i]: 5 <= i <= 25} + +# +# codegen D; +for(t1 = 5; t1 <= 8; t1++) { + s1(t1); +} +for(t1 = 10; t1 <= 16; t1 += 2) { + s1(t1); +} +for(t1 = 20; t1 <= 25; t1++) { + s1(t1); +} + +# +# codegen {[i,j] : 1 <= i+j,j <= 10}; +for(t1 = -9; t1 <= 9; t1++) { + for(t2 = max(-t1+1,1); t2 <= min(-t1+10,10); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/p7 b/omega/examples/old_test/p7 new file mode 100644 index 0000000..d892912 --- /dev/null +++ b/omega/examples/old_test/p7 @@ -0,0 +1 @@ +{ [i] -> [j] : 1 <= i,j <= 10 and i != j}; diff --git a/omega/examples/old_test/p7.oc-rt b/omega/examples/old_test/p7.oc-rt new file mode 100644 index 0000000..af7cf5f --- /dev/null +++ b/omega/examples/old_test/p7.oc-rt @@ -0,0 +1,7 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# { [i] -> [j] : 1 <= i,j <= 10 and i != j}; + +{[i] -> [j] : 1 <= j < i <= 10} union + {[i] -> [j] : 1 <= i < j <= 10} + +# diff --git a/omega/examples/old_test/p8 b/omega/examples/old_test/p8 new file mode 100644 index 0000000..d6031ad --- /dev/null +++ b/omega/examples/old_test/p8 @@ -0,0 +1,6 @@ +R1 := {[i] -> [j] : i < j}; +R2 := {[x] -> [y] : x < y}; +inverse R2; +R1 union R2; +R2(R1); + diff --git a/omega/examples/old_test/p8.oc-rt b/omega/examples/old_test/p8.oc-rt new file mode 100644 index 0000000..b9d569a --- /dev/null +++ b/omega/examples/old_test/p8.oc-rt @@ -0,0 +1,21 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R1 := {[i] -> [j] : i < j}; +# +# R2 := {[x] -> [y] : x < y}; +# +# inverse R2; + +{[y] -> [x] : x < y} + +# +# R1 union R2; + +{[In_1] -> [Out_1] : In_1 < Out_1} + +# +# R2(R1); + +{[i] -> [y] : i <= y-2} + +# +# diff --git a/omega/examples/old_test/p9 b/omega/examples/old_test/p9 new file mode 100644 index 0000000..8f38d36 --- /dev/null +++ b/omega/examples/old_test/p9 @@ -0,0 +1,7 @@ +symbolic lot_E; +{[k_w,l_w] -> [k_r,l_r] : +1 <= k_r <= 12 and +1 <= l_r <= lot_E and +2k_r+96l_r = 12+2k_w+96l_w and +1 <= k_w <= 3 and +1 <= l_w <= lot_E}; diff --git a/omega/examples/old_test/p9.oc-rt b/omega/examples/old_test/p9.oc-rt new file mode 100644 index 0000000..b3e1f55 --- /dev/null +++ b/omega/examples/old_test/p9.oc-rt @@ -0,0 +1,13 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic lot_E; +# +# {[k_w,l_w] -> [k_r,l_r] : +# 1 <= k_r <= 12 and +# 1 <= l_r <= lot_E and +# 2k_r+96l_r = 12+2k_w+96l_w and +# 1 <= k_w <= 3 and +# 1 <= l_w <= lot_E}; + +{[k_w,l_w] -> [k_w+6,l_w] : 1 <= k_w <= 3 && 1 <= l_w <= lot_E} + +# diff --git a/omega/examples/old_test/pufs1 b/omega/examples/old_test/pufs1 new file mode 100644 index 0000000..908c84f --- /dev/null +++ b/omega/examples/old_test/pufs1 @@ -0,0 +1,2 @@ +symbolic n(1); +{ [i] -> [j] : 1 <= i <= j <= 100 && n(i) != n(j)}; diff --git a/omega/examples/old_test/pufs1.oc-rt b/omega/examples/old_test/pufs1.oc-rt new file mode 100644 index 0000000..0a7312f --- /dev/null +++ b/omega/examples/old_test/pufs1.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1); +# +# { [i] -> [j] : 1 <= i <= j <= 100 && n(i) != n(j)}; + +{[i] -> [j] : 1 <= i < j <= 100 && n(j) < n(i)} union + {[i] -> [j] : 1 <= i < j <= 100 && n(i) < n(j)} + +# diff --git a/omega/examples/old_test/pufs2 b/omega/examples/old_test/pufs2 new file mode 100644 index 0000000..391c9d4 --- /dev/null +++ b/omega/examples/old_test/pufs2 @@ -0,0 +1,9 @@ +symbolic n(1); +R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; +S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; + +R; +S; +R intersection S; +R union S; +R intersection complement S; diff --git a/omega/examples/old_test/pufs2.oc-rt b/omega/examples/old_test/pufs2.oc-rt new file mode 100644 index 0000000..b71d651 --- /dev/null +++ b/omega/examples/old_test/pufs2.oc-rt @@ -0,0 +1,35 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1); +# +# R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; +# +# S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; +# +# +# R; + +{[i] -> [i] : 1 <= i <= 100} + +# +# S; + +{[i] -> [i] : 1 <= i <= 100} union + {[i] -> [j] : n(j) = n(i) && 1 <= i < j <= 100} + +# +# R intersection S; + +{[i] -> [i] : 1 <= i <= 100} + +# +# R union S; + +{[i] -> [j] : n(j) = n(i) && 1 <= i < j <= 100} union + {[i] -> [i] : 1 <= i <= 100} + +# +# R intersection complement S; + +{[i] -> [j] : FALSE } + +# diff --git a/omega/examples/old_test/pufs3 b/omega/examples/old_test/pufs3 new file mode 100644 index 0000000..0a1af56 --- /dev/null +++ b/omega/examples/old_test/pufs3 @@ -0,0 +1,8 @@ +symbolic n(1); +R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; +S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; + +R intersection complement S; +inverse R; +inverse S; +inverse S intersection complement inverse R; diff --git a/omega/examples/old_test/pufs3.oc-rt b/omega/examples/old_test/pufs3.oc-rt new file mode 100644 index 0000000..55f851c --- /dev/null +++ b/omega/examples/old_test/pufs3.oc-rt @@ -0,0 +1,29 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1); +# +# R := { [i] -> [j] : 1 <= i = j <= 100 && n(i) <= n(j)}; +# +# S := { [i] -> [j] : 1 <= i <= j <= 100 && n(i) = n(j)}; +# +# +# R intersection complement S; + +{[i] -> [j] : FALSE } + +# +# inverse R; + +{[j] -> [j] : 1 <= j <= 100} + +# +# inverse S; + +{[j] -> [j] : 1 <= j <= 100} union + {[j] -> [i] : n(j) = n(i) && 1 <= i < j <= 100} + +# +# inverse S intersection complement inverse R; + +{[j] -> [i] : n(j) = n(i) && 1 <= i < j <= 100} + +# diff --git a/omega/examples/old_test/pufs4 b/omega/examples/old_test/pufs4 new file mode 100644 index 0000000..57e868e --- /dev/null +++ b/omega/examples/old_test/pufs4 @@ -0,0 +1,16 @@ +# Calculate exposed reads for this code fragment +# for i := 1 to n do +# for j := 1 to m do +# if p(i,j) >= 0 then a(i,j) = 1 +# else a(i,j) = 0 +# .... a(i,j) +# + +symbolic p(2), n, m; +R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) >= 0 }; +W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) < 0 }; + +Exposed := R-W1-W2; + +Exposed; diff --git a/omega/examples/old_test/pufs4.oc-rt b/omega/examples/old_test/pufs4.oc-rt new file mode 100644 index 0000000..2c32c83 --- /dev/null +++ b/omega/examples/old_test/pufs4.oc-rt @@ -0,0 +1,26 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # Calculate exposed reads for this code fragment +# # for i := 1 to n do +# # for j := 1 to m do +# # if p(i,j) >= 0 then a(i,j) = 1 +# # else a(i,j) = 0 +# # .... a(i,j) +# # +# +# symbolic p(2), n, m; +# +# R := { [ir,jr] : 1 <= ir <= n && 1 <= jr <= m }; +# +# W1 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) >= 0 }; +# +# W2 := { [iw,jw] : 1 <= iw <= n && 1 <= jw <= m && p(iw,jw) < 0 }; +# +# +# Exposed := R-W1-W2; +# +# +# Exposed; + +{[iw,jw] : FALSE } + +# diff --git a/omega/examples/old_test/pufs5 b/omega/examples/old_test/pufs5 new file mode 100644 index 0000000..19249af --- /dev/null +++ b/omega/examples/old_test/pufs5 @@ -0,0 +1,22 @@ +symbolic n(1); +S := { [i] -> [j] : 1 <= i < j <= 100 && n(j) >= 0}; +R := domain S; +S; +R; +upper_bound R; +lower_bound R; + +R - {[1:50]}; +{[1:50]} - R; +{[1:50]} - upper_bound R; +{[1:50]} - lower_bound R; + +R union {[10:30]} union {[25:100]} union {[1:10]}; +upper_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); +lower_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); + +{[101:200]} - R; +{[1:200]} - R; +{[1:200]} - R - {[10:30]} - {[25:100]}; +{[1:200]} - (R union {[10:30]} union {[25:100]} union {[1:10]}); +{[1:200]} - R - {[10:30]} - {[25:100]} - {[1:10]}; diff --git a/omega/examples/old_test/pufs5.oc-rt b/omega/examples/old_test/pufs5.oc-rt new file mode 100644 index 0000000..614a9fb --- /dev/null +++ b/omega/examples/old_test/pufs5.oc-rt @@ -0,0 +1,98 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1); +# +# S := { [i] -> [j] : 1 <= i < j <= 100 && n(j) >= 0}; +# +# R := domain S; +# +# S; + +{[i] -> [j] : 1 <= i < j <= 100 && 0 <= n(j)} + +# +# R; + +{[i]: 1 <= i <= 99 && UNKNOWN} + +# +# upper_bound R; + +{[i]: 1 <= i <= 99} + +# +# lower_bound R; + +{[i] : FALSE } + +# +# +# R - {[1:50]}; + +{[i]: 51 <= i <= 99 && UNKNOWN} + +# +# {[1:50]} - R; + +{[i]: 1 <= i <= 50 && UNKNOWN} + +# +# {[1:50]} - upper_bound R; + +{[i] : FALSE } + +# +# {[1:50]} - lower_bound R; + +{[i]: 1 <= i <= 50} + +# +# +# R union {[10:30]} union {[25:100]} union {[1:10]}; + +{[i]: 1 <= i <= 99 && UNKNOWN} union + {[i]: 10 <= i <= 30} union + {[i]: 25 <= i <= 100} union + {[i]: 1 <= i <= 10} + +# +# upper_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); + +{[i]: 1 <= i <= 99} union + {[i]: 25 <= i <= 100} + +# +# lower_bound (R union {[10:30]} union {[25:100]} union {[1:10]}); + +{[i]: 10 <= i <= 30} union + {[i]: 25 <= i <= 100} union + {[i]: 1 <= i <= 10} + +# +# +# {[101:200]} - R; + +{[i]: 101 <= i <= 200} + +# +# {[1:200]} - R; + +{[i]: 1 <= i <= 99 && UNKNOWN} union + {[i]: 100 <= i <= 200} + +# +# {[1:200]} - R - {[10:30]} - {[25:100]}; + +{[i]: 1 <= i <= 9 && UNKNOWN} union + {[i]: 101 <= i <= 200} + +# +# {[1:200]} - (R union {[10:30]} union {[25:100]} union {[1:10]}); + +{[i]: 101 <= i <= 200} + +# +# {[1:200]} - R - {[10:30]} - {[25:100]} - {[1:10]}; + +{[i]: 101 <= i <= 200} + +# diff --git a/omega/examples/old_test/pufs6 b/omega/examples/old_test/pufs6 new file mode 100644 index 0000000..e24aa12 --- /dev/null +++ b/omega/examples/old_test/pufs6 @@ -0,0 +1,19 @@ +symbolic n, f(1), f_last, f_first; + +True := { [] : 1 = 1 }; + +old_R1 := { [x] -> [] : (1 <= x <= n and f(x) > 0)}; +old_R2 := { [x] -> [] : (1 <= x <= n and f(x) <=0)}; +True - range old_R1 - range old_R2; + +R1 := { [x] -> [] : (3 <= x <= n-1 and f(x) > 0) + or (1 <= n and f_last > 0) + or (1 <= n and f_first > 0) }; +R2 := { [x] -> [] : (3 <= x <= n-1 and f(x) <=0) + or (1 <= n and f_last <=0) + or (1 <= n and f_first <=0) }; +True - range R1 - range R2; + +R1a := { [x] -> [] : (1 <= x <= n and (f(x) > 0 or f_first > 0 or f_last > 0)) }; +R2a := { [x] -> [] : (1 <= x <= n and (f(x) <=0 or f_first <=0 or f_last <=0)) }; +True - range R1a - range R2a; diff --git a/omega/examples/old_test/pufs6.oc-rt b/omega/examples/old_test/pufs6.oc-rt new file mode 100644 index 0000000..d782cfc --- /dev/null +++ b/omega/examples/old_test/pufs6.oc-rt @@ -0,0 +1,42 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Symbolic n, f(1), f_last, f_first; +# +# +# True := { [] : 1 = 1 }; +# +# +# old_R1 := { [x] -> [] : (1 <= x <= n and f(x) > 0)}; +# +# old_R2 := { [x] -> [] : (1 <= x <= n and f(x) <=0)}; +# +# True - range old_R1 - range old_R2; + +{ 1 <= n && UNKNOWN} union + { n <= 0} + +# +# +# R1 := { [x] -> [] : (3 <= x <= n-1 and f(x) > 0) +# or (1 <= n and f_last > 0) +# or (1 <= n and f_first > 0) }; +# +# R2 := { [x] -> [] : (3 <= x <= n-1 and f(x) <=0) +# or (1 <= n and f_last <=0) +# or (1 <= n and f_first <=0) }; +# +# True - range R1 - range R2; + +{ n <= 0} + +# +# +# R1a := { [x] -> [] : (1 <= x <= n and (f(x) > 0 or f_first > 0 or f_last > 0)) }; +# +# R2a := { [x] -> [] : (1 <= x <= n and (f(x) <=0 or f_first <=0 or f_last <=0)) }; +# +# True - range R1a - range R2a; + +{ f_last <= 0 && n <= 0} union + { n <= 0 && 1 <= f_last} + +# diff --git a/omega/examples/old_test/pufs7 b/omega/examples/old_test/pufs7 new file mode 100644 index 0000000..33905bf --- /dev/null +++ b/omega/examples/old_test/pufs7 @@ -0,0 +1,6 @@ +symbolic n(1),m; +{[i] : n(i) >= 0} union {[i] : n(i) <=0}; + +{[i] : n(i) >= 1 && 1 <= i <= m} + union {[i] : n(i) <1 && 1 <= i <= m}; + diff --git a/omega/examples/old_test/pufs7.oc-rt b/omega/examples/old_test/pufs7.oc-rt new file mode 100644 index 0000000..84a8b93 --- /dev/null +++ b/omega/examples/old_test/pufs7.oc-rt @@ -0,0 +1,18 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n(1),m; +# +# {[i] : n(i) >= 0} union {[i] : n(i) <=0}; + +{[i]: 0 <= n(i)} union + {[i]: n(i) <= 0} + +# +# +# {[i] : n(i) >= 1 && 1 <= i <= m} +# union {[i] : n(i) <1 && 1 <= i <= m}; + +{[i]: 1 <= i <= m && 1 <= n(i)} union + {[i]: 1 <= i <= m && n(i) <= 0} + +# +# diff --git a/omega/examples/old_test/reach1 b/omega/examples/old_test/reach1 new file mode 100644 index 0000000..268868f --- /dev/null +++ b/omega/examples/old_test/reach1 @@ -0,0 +1,5 @@ + +reachable (a,b,c) + { a->b:{[1]->[2]}, + b->c:{[2]->[3]}, + a:{[1]}}; diff --git a/omega/examples/old_test/reach1.oc-rt b/omega/examples/old_test/reach1.oc-rt new file mode 100644 index 0000000..8333ede --- /dev/null +++ b/omega/examples/old_test/reach1.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# reachable (a,b,c) +# { a->b:{[1]->[2]}, +# b->c:{[2]->[3]}, +# a:{[1]}}; +Node b: {[2]} +Node c: {[3]} +# diff --git a/omega/examples/old_test/reach2 b/omega/examples/old_test/reach2 new file mode 100644 index 0000000..1a692a0 --- /dev/null +++ b/omega/examples/old_test/reach2 @@ -0,0 +1,29 @@ + +a2b:={[1]->[2]}; + +b2c1:={[i]->[i]}; +b2c2:={[i]->[j]}; + +a2a:={[i]->[i]}; +b2b:={[i]->[i]}; +c2c:={[i]->[i]}; + + + +reachable (a,b,c){ a->b:a2b, b->c:b2c1, a->a:a2a, b->b:b2b, c->c:c2c, + a:{[1]}}; + +reachable (a,b,c) { a->b:a2b, b->c:b2c2, a->a:a2a, b->b:b2b, c->c:c2c, + a:{[1]}}; + +b2c3:={[i]->[i+1]}; +b2b2:={[i]->[i+1]}; + +reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, + a:{[1]}}; + +b2c3:={[i]->[i]}; + +reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, + a:{[1]}}; + diff --git a/omega/examples/old_test/reach2.oc-rt b/omega/examples/old_test/reach2.oc-rt new file mode 100644 index 0000000..8a8a904 --- /dev/null +++ b/omega/examples/old_test/reach2.oc-rt @@ -0,0 +1,61 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# a2b:={[1]->[2]}; +# +# +# b2c1:={[i]->[i]}; +# +# b2c2:={[i]->[j]}; +# +# +# a2a:={[i]->[i]}; +# +# b2b:={[i]->[i]}; +# +# c2c:={[i]->[i]}; +# +# +# +# +# reachable (a,b,c){ a->b:a2b, b->c:b2c1, a->a:a2a, b->b:b2b, c->c:c2c, +# a:{[1]}}; +Node a: {[1]} +Node b: {[2]} +Node c: {[2]} +# +# +# reachable (a,b,c) { a->b:a2b, b->c:b2c2, a->a:a2a, b->b:b2b, c->c:c2c, +# a:{[1]}}; +Node a: {[1]} +Node b: {[2]} +Node c: {[In_1]} +# +# +# b2c3:={[i]->[i+1]}; +# +# b2b2:={[i]->[i+1]}; +# +# +# reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, +# a:{[1]}}; +Node a: {[1]} +Node b: {[2]} union + {[In_1]: 4 <= In_1} union + {[3]} +Node c: {[i]: 4 <= i} union + {[3]} +# +# +# b2c3:={[i]->[i]}; +# +# +# reachable (a,b,c){ a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, +# a:{[1]}}; +Node a: {[1]} +Node b: {[2]} union + {[In_1]: 4 <= In_1} union + {[3]} +Node c: {[i]: 3 <= i} union + {[2]} +# +# diff --git a/omega/examples/old_test/reach3 b/omega/examples/old_test/reach3 new file mode 100644 index 0000000..39c954d --- /dev/null +++ b/omega/examples/old_test/reach3 @@ -0,0 +1,18 @@ + +a2b:={[1]->[2]}; +a2a:={[i]->[i]}; +b2b2:={[i]->[i+1]}; +b2c3:={[i]->[i]}; +c2c:={[i]->[i]}; + +reachable of a in (a,b,c) { + a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, + a:{[1]} + }; +reachable of b in (a,b,c) { + a->b:a2b, b->c:b2c3, a->a:a2a, a:{[1]}, b->b:b2b2, c->c:c2c + }; +cr := reachable of c in (a,b,c) { + a:{[1]},a->b:a2b, b->c:b2c3, a->a:a2a, + b->b:b2b2, c->c:c2c }; +cr; diff --git a/omega/examples/old_test/reach3.oc-rt b/omega/examples/old_test/reach3.oc-rt new file mode 100644 index 0000000..3418061 --- /dev/null +++ b/omega/examples/old_test/reach3.oc-rt @@ -0,0 +1,40 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# a2b:={[1]->[2]}; +# +# a2a:={[i]->[i]}; +# +# b2b2:={[i]->[i+1]}; +# +# b2c3:={[i]->[i]}; +# +# c2c:={[i]->[i]}; +# +# +# reachable of a in (a,b,c) { +# a->b:a2b, b->c:b2c3, a->a:a2a, b->b:b2b2, c->c:c2c, +# a:{[1]} +# }; + +{[1]} + +# +# reachable of b in (a,b,c) { +# a->b:a2b, b->c:b2c3, a->a:a2a, a:{[1]}, b->b:b2b2, c->c:c2c +# }; + +{[2]} union + {[In_1]: 4 <= In_1} union + {[3]} + +# +# cr := reachable of c in (a,b,c) { +# a:{[1]},a->b:a2b, b->c:b2c3, a->a:a2a, +# b->b:b2b2, c->c:c2c }; +# +# cr; + +{[i]: 3 <= i} union + {[2]} + +# diff --git a/omega/examples/old_test/red1 b/omega/examples/old_test/red1 new file mode 100644 index 0000000..1a479b3 --- /dev/null +++ b/omega/examples/old_test/red1 @@ -0,0 +1,3 @@ +R1 := {[i,j,k] : 17i=12j+170}; +R2 := {[i,j,k] : k >= 0}; +gist R1 given R2; diff --git a/omega/examples/old_test/red1.oc-rt b/omega/examples/old_test/red1.oc-rt new file mode 100644 index 0000000..32cbb97 --- /dev/null +++ b/omega/examples/old_test/red1.oc-rt @@ -0,0 +1,10 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R1 := {[i,j,k] : 17i=12j+170}; +# +# R2 := {[i,j,k] : k >= 0}; +# +# gist R1 given R2; + +{[i,j,k]: 17i = 170+12j} + +# diff --git a/omega/examples/old_test/saman b/omega/examples/old_test/saman new file mode 100644 index 0000000..bf44452 --- /dev/null +++ b/omega/examples/old_test/saman @@ -0,0 +1,20 @@ +# Passing array sections through array reshaping +# procedure foo() +# real a(1:5,1:64,1:64,1:5) +# for i = 1 to 64 do +# for j = 1 to 64 do +# bar(a(1,i,j,1)) +# ... +# procedure bar(x(*)) +# x(1:5) = ... +# +# Question which element of a are effected by the call to bar? +# +symbolic i,j; +R := {[i1,i2,i3,i4] -> [o1] : + (i1-1) + (i2-i)*5 + (i3-j)*5*64 + (i4-1)*5*64*64 + = o1-1 + && 1 <= i1,i4 <= 5 + && 1 <= i,j,i2,i3 <= 64}; +R; +(inverse R)({[1:5]}); diff --git a/omega/examples/old_test/saman.oc-rt b/omega/examples/old_test/saman.oc-rt new file mode 100644 index 0000000..d75d4df --- /dev/null +++ b/omega/examples/old_test/saman.oc-rt @@ -0,0 +1,31 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # Passing array sections through array reshaping +# # procedure foo() +# # real a(1:5,1:64,1:64,1:5) +# # for i = 1 to 64 do +# # for j = 1 to 64 do +# # bar(a(1,i,j,1)) +# # ... +# # procedure bar(x(*)) +# # x(1:5) = ... +# # +# # Question which element of a are effected by the call to bar? +# # +# symbolic i,j; +# +# R := {[i1,i2,i3,i4] -> [o1] : +# (i1-1) + (i2-i)*5 + (i3-j)*5*64 + (i4-1)*5*64*64 +# = o1-1 +# && 1 <= i1,i4 <= 5 +# && 1 <= i,j,i2,i3 <= 64}; +# +# R; + +{[i1,i2,i3,i4] -> [i1-320j-5i+5i2+320i3+20480i4-20480] : 1 <= j <= 64 && 1 <= i <= 64 && 1 <= i1 <= 5 && 1 <= i2 <= 64 && 1 <= i3 <= 64 && 1 <= i4 <= 5} + +# +# (inverse R)({[1:5]}); + +{[i1,i,j,1]: 1 <= i <= 64 && 1 <= j <= 64 && 1 <= i1 <= 5} + +# diff --git a/omega/examples/old_test/sample1 b/omega/examples/old_test/sample1 new file mode 100644 index 0000000..fb292b3 --- /dev/null +++ b/omega/examples/old_test/sample1 @@ -0,0 +1,14 @@ +example { [i] -> [j] : 1 <= i < j <= 20 }; + +example { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; + +example (inverse { [i] -> [i+1] : 1 <= i <= 9 }); + +example (domain { [i] -> [i+1] : 1 <= i <= 9 }); + +example (range { [i] -> [i+1] : 1 <= i <= 9 }); + +example ({[i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }); + + + diff --git a/omega/examples/old_test/sample1.oc-rt b/omega/examples/old_test/sample1.oc-rt new file mode 100644 index 0000000..bb19b15 --- /dev/null +++ b/omega/examples/old_test/sample1.oc-rt @@ -0,0 +1,39 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# example { [i] -> [j] : 1 <= i < j <= 20 }; + +{[19] -> [20] } + +# +# +# example { [i,j] -> [i+1,j+1] : 1 <= i <= 9 && 5 <= j <= 25 }; + +{[1,5] -> [2,6] } + +# +# +# example (inverse { [i] -> [i+1] : 1 <= i <= 9 }); + +{[2] -> [1] } + +# +# +# example (domain { [i] -> [i+1] : 1 <= i <= 9 }); + +{[1]} + +# +# +# example (range { [i] -> [i+1] : 1 <= i <= 9 }); + +{[2]} + +# +# +# example ({[i] -> [i+1] : 1 <= i <= 9 } compose { [i] -> [i+1] : 1 <= i <= 9 }); + +{[1] -> [3] } + +# +# +# +# diff --git a/omega/examples/old_test/sample2 b/omega/examples/old_test/sample2 new file mode 100644 index 0000000..1ca6b19 --- /dev/null +++ b/omega/examples/old_test/sample2 @@ -0,0 +1,11 @@ +symbolic n,m; + +example { [i] -> [j] : 1 <= i <= 20 }; + +example {[i] : 1 <= i <= n}; + +example {[i] : m <= i <= n}; + +example {[i] : exists ( alpha : i <= 2alpha)}; + +example {[i] : exists ( alpha : i = 2alpha)}; diff --git a/omega/examples/old_test/sample2.oc-rt b/omega/examples/old_test/sample2.oc-rt new file mode 100644 index 0000000..e18d650 --- /dev/null +++ b/omega/examples/old_test/sample2.oc-rt @@ -0,0 +1,33 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Symbolic n,m; +# +# +# example { [i] -> [j] : 1 <= i <= 20 }; + +{[1] -> [42] } + +# +# +# example {[i] : 1 <= i <= n}; + +{[1]: n = 1} + +# +# +# example {[i] : m <= i <= n}; + +{[42]: m = 42 && n = 42} + +# +# +# example {[i] : exists ( alpha : i <= 2alpha)}; + +{[42]} + +# +# +# example {[i] : exists ( alpha : i = 2alpha)}; + +{[0]} + +# diff --git a/omega/examples/old_test/sample3 b/omega/examples/old_test/sample3 new file mode 100644 index 0000000..44a481d --- /dev/null +++ b/omega/examples/old_test/sample3 @@ -0,0 +1,11 @@ +symbolic n,m; + +sym_example {[i] : 1 <= i <= n}; + +sym_example {[i] : m <= i <= n}; + +sym_example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; +example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; +example {[i] : m < i <= n && exists (alpha : i = 2alpha)}; +example {[i] : m < i < n}; + diff --git a/omega/examples/old_test/sample3.oc-rt b/omega/examples/old_test/sample3.oc-rt new file mode 100644 index 0000000..a486bdd --- /dev/null +++ b/omega/examples/old_test/sample3.oc-rt @@ -0,0 +1,37 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Symbolic n,m; +# +# +# sym_example {[i] : 1 <= i <= n}; + +{[1]: 1 <= n} + +# +# +# sym_example {[i] : m <= i <= n}; + +{[m]: m <= n} + +# +# +# sym_example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; + +{[0]: m <= 0 && 0 <= n} + +# +# example {[i] : m <= i <= n && exists (alpha : i = 2alpha)}; + +{[42]: m = 42 && n = 42} + +# +# example {[i] : m < i <= n && exists (alpha : i = 2alpha)}; + +{[44]: m = 42 && n = 44} + +# +# example {[i] : m < i < n}; + +{[43]: m = 42 && n = 44} + +# +# diff --git a/omega/examples/old_test/stodghil b/omega/examples/old_test/stodghil new file mode 100644 index 0000000..99e9430 --- /dev/null +++ b/omega/examples/old_test/stodghil @@ -0,0 +1,21 @@ +symbolic n; + +S := {[k_w,j_w,l_w]->[k_r,j_r,l_r] : ((1 <= k_w) and (k_w <= n) and ((k_w + 1) <= j_w) +and (j_w <= n) +and ((k_w + 1) <= l_w) and (l_w <= j_w) and (1 <= k_r) +and (k_r <= n) and ((k_r + 1) <= j_r) and (j_r <= n) +and ((k_r + 1) <= l_r) and (l_r <= j_r) and ((k_w < k_r) or ((k_w = k_r) +and (j_w < j_r)) or ((k_w = k_r) and (j_w = j_r) and (l_w < l_r))) +and (j_w = j_r) and (l_w = l_r) +and !exists(k_1 : ((1 <= k_1) and (k_1 <= n) and (k_w < k_1) and ((k_1 < k_r) or (k_1 = k_r)) +and (k_1 = j_r) and (k_1 = l_r))) +and !exists(k_2,i_2 : ((1 <= k_2) and (k_2 <= n) and ((k_2 + 1) <= i_2) and (i_2 <= n) and (k_w < k_2) and ((k_2 < k_r) or (k_2 = k_r)) and (i_2 = j_r) and (k_2 = l_r))) +and !exists(k_3,j_3,l_3 : ((1 <= k_3) and (k_3 <= n) and ((k_3 + 1) <= j_3) + and (j_3 <= n) and ((k_3 + 1) <= l_3) and (l_3 <= j_3) +and ((k_w < k_3) or ((k_w = k_3) and (j_w < j_3)) or ((k_w = k_3) +and (j_w = j_3) and (l_w < l_3))) +and ((k_3 < k_r) or ((k_3 = k_r) and (j_3 < j_r)) or ((k_3 = k_r) +and (j_3 = j_r) and (l_3 < l_r))) and (j_3 = j_r) and (l_3 = l_r)) +))}; + +S; diff --git a/omega/examples/old_test/stodghil.oc-rt b/omega/examples/old_test/stodghil.oc-rt new file mode 100644 index 0000000..0d554d2 --- /dev/null +++ b/omega/examples/old_test/stodghil.oc-rt @@ -0,0 +1,28 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# +# S := {[k_w,j_w,l_w]->[k_r,j_r,l_r] : ((1 <= k_w) and (k_w <= n) and ((k_w + 1) <= j_w) +# and (j_w <= n) +# and ((k_w + 1) <= l_w) and (l_w <= j_w) and (1 <= k_r) +# and (k_r <= n) and ((k_r + 1) <= j_r) and (j_r <= n) +# and ((k_r + 1) <= l_r) and (l_r <= j_r) and ((k_w < k_r) or ((k_w = k_r) +# and (j_w < j_r)) or ((k_w = k_r) and (j_w = j_r) and (l_w < l_r))) +# and (j_w = j_r) and (l_w = l_r) +# and !exists(k_1 : ((1 <= k_1) and (k_1 <= n) and (k_w < k_1) and ((k_1 < k_r) or (k_1 = k_r)) +# and (k_1 = j_r) and (k_1 = l_r))) +# and !exists(k_2,i_2 : ((1 <= k_2) and (k_2 <= n) and ((k_2 + 1) <= i_2) and (i_2 <= n) and (k_w < k_2) and ((k_2 < k_r) or (k_2 = k_r)) and (i_2 = j_r) and (k_2 = l_r))) +# and !exists(k_3,j_3,l_3 : ((1 <= k_3) and (k_3 <= n) and ((k_3 + 1) <= j_3) +# and (j_3 <= n) and ((k_3 + 1) <= l_3) and (l_3 <= j_3) +# and ((k_w < k_3) or ((k_w = k_3) and (j_w < j_3)) or ((k_w = k_3) +# and (j_w = j_3) and (l_w < l_3))) +# and ((k_3 < k_r) or ((k_3 = k_r) and (j_3 < j_r)) or ((k_3 = k_r) +# and (j_3 = j_r) and (l_3 < l_r))) and (j_3 = j_r) and (l_3 = l_r)) +# ))}; +# +# +# S; + +{[k_w,j_w,l_w] -> [k_w+1,j_w,l_w] : k_w+2 <= l_w <= j_w <= n && 1 <= k_w} + +# diff --git a/omega/examples/old_test/stride1 b/omega/examples/old_test/stride1 new file mode 100644 index 0000000..fc2b727 --- /dev/null +++ b/omega/examples/old_test/stride1 @@ -0,0 +1,2 @@ +R := { [i] : i < 10 && i > 1 && exists ( alpha : i = 3alpha) }; +codegen R; diff --git a/omega/examples/old_test/stride1.oc-rt b/omega/examples/old_test/stride1.oc-rt new file mode 100644 index 0000000..a577449 --- /dev/null +++ b/omega/examples/old_test/stride1.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i] : i < 10 && i > 1 && exists ( alpha : i = 3alpha) }; +# +# codegen R; +for(t1 = 3; t1 <= 9; t1 += 3) { + s1(t1); +} + +# diff --git a/omega/examples/old_test/stride2 b/omega/examples/old_test/stride2 new file mode 100644 index 0000000..37a355f --- /dev/null +++ b/omega/examples/old_test/stride2 @@ -0,0 +1,4 @@ +symbolic n; +new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha && + t2 - 31,0 <= t1 <= t2 <= n)}; +codegen new_IS; diff --git a/omega/examples/old_test/stride2.oc-rt b/omega/examples/old_test/stride2.oc-rt new file mode 100644 index 0000000..ee8fb75 --- /dev/null +++ b/omega/examples/old_test/stride2.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha && +# t2 - 31,0 <= t1 <= t2 <= n)}; +# +# codegen new_IS; +for(t1 = 0; t1 <= n; t1 += 32) { + for(t2 = t1; t2 <= min(n,t1+31); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/stride3 b/omega/examples/old_test/stride3 new file mode 100644 index 0000000..859e9b8 --- /dev/null +++ b/omega/examples/old_test/stride3 @@ -0,0 +1,4 @@ +symbolic n; +new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha+3 && + t2 - 31,0 <= t1 <= t2 <= n)}; +codegen new_IS; diff --git a/omega/examples/old_test/stride3.oc-rt b/omega/examples/old_test/stride3.oc-rt new file mode 100644 index 0000000..7ba925f --- /dev/null +++ b/omega/examples/old_test/stride3.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# new_IS := {[t1,t2] : exists (alpha : t1 = 32alpha+3 && +# t2 - 31,0 <= t1 <= t2 <= n)}; +# +# codegen new_IS; +for(t1 = 3; t1 <= n; t1 += 32) { + for(t2 = t1; t2 <= min(n,t1+31); t2++) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/stride4 b/omega/examples/old_test/stride4 new file mode 100644 index 0000000..21781a2 --- /dev/null +++ b/omega/examples/old_test/stride4 @@ -0,0 +1,4 @@ +symbolic n; +new_IS := {[i] : exists (alpha : i = 5alpha-2 && + i >= 17 && i <= 100)}; +codegen new_IS; diff --git a/omega/examples/old_test/stride4.oc-rt b/omega/examples/old_test/stride4.oc-rt new file mode 100644 index 0000000..3905486 --- /dev/null +++ b/omega/examples/old_test/stride4.oc-rt @@ -0,0 +1,12 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# new_IS := {[i] : exists (alpha : i = 5alpha-2 && +# i >= 17 && i <= 100)}; +# +# codegen new_IS; +for(t1 = 18; t1 <= 98; t1 += 5) { + s1(t1); +} + +# diff --git a/omega/examples/old_test/stride5 b/omega/examples/old_test/stride5 new file mode 100644 index 0000000..9c4f1b0 --- /dev/null +++ b/omega/examples/old_test/stride5 @@ -0,0 +1,4 @@ +symbolic n; +R := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && + j >= i+2n && j <=401 && exists (alpha : j = 2 alpha)}; +codegen R; diff --git a/omega/examples/old_test/stride5.oc-rt b/omega/examples/old_test/stride5.oc-rt new file mode 100644 index 0000000..85e9551 --- /dev/null +++ b/omega/examples/old_test/stride5.oc-rt @@ -0,0 +1,14 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# R := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && +# j >= i+2n && j <=401 && exists (alpha : j = 2 alpha)}; +# +# codegen R; +for(t1 = 2; t1 <= min(-2*n+400,100); t1 += 2) { + for(t2 = 2*n+t1; t2 <= 400; t2 += 2) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/stride6 b/omega/examples/old_test/stride6 new file mode 100644 index 0000000..364e24c --- /dev/null +++ b/omega/examples/old_test/stride6 @@ -0,0 +1,10 @@ +symbolic n; +R := {[i,j]: i >= 1 && i <= 101 && + j >= i && j <=401 && exists (alpha : j = 2 alpha)}; +codegen R; +S := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && + j >= i && j <=401 && exists (alpha : j = 2 alpha)}; +codegen S; +T := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && + j >= i && j <=401 && exists (alpha : 2j = 4 alpha)}; +codegen T; diff --git a/omega/examples/old_test/stride6.oc-rt b/omega/examples/old_test/stride6.oc-rt new file mode 100644 index 0000000..eeb242f --- /dev/null +++ b/omega/examples/old_test/stride6.oc-rt @@ -0,0 +1,36 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# Sym n; +# +# R := {[i,j]: i >= 1 && i <= 101 && +# j >= i && j <=401 && exists (alpha : j = 2 alpha)}; +# +# codegen R; +for(t1 = 1; t1 <= 101; t1++) { + for(t2 = 2*intDiv(t1+1,2); t2 <= 400; t2 += 2) { + s1(t1,t2); + } +} + +# +# S := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && +# j >= i && j <=401 && exists (alpha : j = 2 alpha)}; +# +# codegen S; +for(t1 = 2; t1 <= 100; t1 += 2) { + for(t2 = t1; t2 <= 400; t2 += 2) { + s1(t1,t2); + } +} + +# +# T := {[i,j]: i >= 1 && i <= 101 && exists (alpha : i = 2 alpha) && +# j >= i && j <=401 && exists (alpha : 2j = 4 alpha)}; +# +# codegen T; +for(t1 = 2; t1 <= 100; t1 += 2) { + for(t2 = t1; t2 <= 400; t2 += 2) { + s1(t1,t2); + } +} + +# diff --git a/omega/examples/old_test/stride7 b/omega/examples/old_test/stride7 new file mode 100644 index 0000000..4bfe1cd --- /dev/null +++ b/omega/examples/old_test/stride7 @@ -0,0 +1,6 @@ +IS:={[i,j]: 1 <= i,j <= 9}; +T1:={[i,j]->[4j,i,0]}; +T2:={[i,j]->[j,i,1]}; +codegen T1:IS,T2:IS; +codegen 2 T1:IS,T2:IS; + diff --git a/omega/examples/old_test/stride7.oc-rt b/omega/examples/old_test/stride7.oc-rt new file mode 100644 index 0000000..60ac1d4 --- /dev/null +++ b/omega/examples/old_test/stride7.oc-rt @@ -0,0 +1,47 @@ +>>> IS:={[i,j]: 1 <= i,j <= 9}; +>>> T1:={[i,j]->[4j,i,0]}; +>>> T2:={[i,j]->[j,i,1]}; +>>> codegen T1:IS,T2:IS; +for(t1 = 1; t1 <= 36; t1++) { + if (intMod(t1,4) == 0 && t1 <= 8) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + s2(t2,t1); + } + } + if (intMod(t1,4) == 0 && t1 >= 12) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + } + } + if (t1-3 <= 4*intDiv(t1-1,4) && t1 <= 9) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,t1); + } + } +} + +>>> codegen 2 T1:IS,T2:IS; +for(t1 = 1; t1 <= 8; t1++) { + if (intMod(t1,4) == 0) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + s2(t2,t1); + } + } + if (t1-3 <= 4*intDiv(t1-1,4)) { + for(t2 = 1; t2 <= 9; t2++) { + s2(t2,t1); + } + } +} +for(t2 = 1; t2 <= 9; t2++) { + s2(t2,9); +} +for(t1 = 12; t1 <= 36; t1 += 4) { + for(t2 = 1; t2 <= 9; t2++) { + s1(t2,intDiv(t1,4)); + } +} + + diff --git a/omega/examples/old_test/subsets1 b/omega/examples/old_test/subsets1 new file mode 100644 index 0000000..1b3721d --- /dev/null +++ b/omega/examples/old_test/subsets1 @@ -0,0 +1,20 @@ +R := {[x]:x > 1 }; +R; +R2 := subsetof R; +R2; + +R - R2; +R subset R2; +R2 - R; +R2 subset R; + +S := {[x]: x > 0}; +S - R; +R subset S; +S - R2; +R2 subset S; + +S2 := {[x]: x > -1}; +S3 := subsetof S2; +S3 - S; +S subset S3; diff --git a/omega/examples/old_test/subsets1.oc-rt b/omega/examples/old_test/subsets1.oc-rt new file mode 100644 index 0000000..345639f --- /dev/null +++ b/omega/examples/old_test/subsets1.oc-rt @@ -0,0 +1,70 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[x]:x > 1 }; +# +# R; + +{[x]: 2 <= x} + +# +# R2 := subsetof R; +# +# R2; + +{[x]: 2 <= x && UNKNOWN} + +# +# +# R - R2; + +{[x]: 2 <= x && UNKNOWN} + +# +# R subset R2; + +False +# +# R2 - R; + +{[x] : FALSE } + +# +# R2 subset R; + +True +# +# +# S := {[x]: x > 0}; +# +# S - R; + +{[1]} + +# +# R subset S; + +True +# +# S - R2; + +{[x]: 2 <= x && UNKNOWN} union + {[1]} + +# +# R2 subset S; + +True +# +# +# S2 := {[x]: x > -1}; +# +# S3 := subsetof S2; +# +# S3 - S; + +{[0]: UNKNOWN} + +# +# S subset S3; + +False +# diff --git a/omega/examples/old_test/subsets2 b/omega/examples/old_test/subsets2 new file mode 100644 index 0000000..4d4a98a --- /dev/null +++ b/omega/examples/old_test/subsets2 @@ -0,0 +1,5 @@ +(subsetof {[1:10]}) - subsetof {[1:10]}; + +{[1:10]} - subsetof {[1:10]}; + +(subsetof {[1:10]}) - {[1:10]}; diff --git a/omega/examples/old_test/subsets2.oc-rt b/omega/examples/old_test/subsets2.oc-rt new file mode 100644 index 0000000..0bbb1c7 --- /dev/null +++ b/omega/examples/old_test/subsets2.oc-rt @@ -0,0 +1,18 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# (subsetof {[1:10]}) - subsetof {[1:10]}; + +{[In_1]: 1 <= In_1 <= 10 && UNKNOWN} + +# +# +# {[1:10]} - subsetof {[1:10]}; + +{[In_1]: 1 <= In_1 <= 10 && UNKNOWN} + +# +# +# (subsetof {[1:10]}) - {[1:10]}; + +{[In_1] : FALSE } + +# diff --git a/omega/examples/old_test/tex1 b/omega/examples/old_test/tex1 new file mode 100644 index 0000000..ca84924 --- /dev/null +++ b/omega/examples/old_test/tex1 @@ -0,0 +1,49 @@ +# +# Extract from omega4 +# removed "eqnarray" commands, associated &'s, and overbrace commands +# added declaration of n +# added semicolon +# +# It would be nice not to have to do the following: +# removed \ in front of variable names +# + +$$ +symbolic n; +R := \{\ [ii] \rightarrow [ki] \mid +1 \leq ii \leq 2n + \ \land \ 1 \leq ki \leq 2n +\land ii = ki +\land ii = ki\\ +\t \land + \ \neg (\ \exists [ji, jj] \st +(1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) +\land (ii \leq ji \land ji \leq ki) \land (2jj = ki)\ )\\ +\t +\land \ +\neg (\ \exists [ji, jj] \st +(1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) +\land (ii \leq ji \land ji \leq ki) \land (2jj\!+\!1 = ki)\ ) +\ \} +; + +R; +$$ +# S := \{\ [\ii] \rightarrow [\ki] \mid +# 1 \leq \ii \leq 2\n +# \ \land \ 1 \leq \ki \leq 2\n +# \land \ii = \ki +# \land \ii = \ki\\ +# \t \land +# \ \neg (\ \exists [\ji, \jj] \st +# (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) +# \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj = \ki)\ )\\ +# \t +# \land \ +# \neg (\ \exists [\ji, \jj] \st +# (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) +# \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj\!+\!1 = \ki)\ ) +# \ \} +# ; +# +# S; diff --git a/omega/examples/old_test/tex1.oc-rt b/omega/examples/old_test/tex1.oc-rt new file mode 100644 index 0000000..fd138d0 --- /dev/null +++ b/omega/examples/old_test/tex1.oc-rt @@ -0,0 +1,58 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# # +# # Extract from omega4 +# # removed "eqnarray" commands, associated &'s, and overbrace commands +# # added declaration of n +# # added semicolon +# # +# # It would be nice not to have to do the following: +# # removed \ in front of variable names +# # +# +# $$ +# symbolic n; +# +# R := \{\ [ii] \rightarrow [ki] \mid +# 1 \leq ii \leq 2n +# \ \land \ 1 \leq ki \leq 2n +# \land ii = ki +# \land ii = ki\\ +# \t \land +# \ \neg (\ \exists [ji, jj] \st +# (1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) +# \land (ii \leq ji \land ji \leq ki) \land (2jj = ki)\ )\\ +# \t +# \land \ +# \neg (\ \exists [ji, jj] \st +# (1 \leq ji \leq 2n \land 1 \leq jj \leq n\!-\!1) +# \land (ii \leq ji \land ji \leq ki) \land (2jj\!+\!1 = ki)\ ) +# \ \} +# ; +# +# +# R; + +{[ii] -> [ii] : n = 1 && 1 <= ii <= 2} union + {[2n] -> [2n] : 2 <= n} union + {[1] -> [1] : 2 <= n} + +# +# $$ +# # S := \{\ [\ii] \rightarrow [\ki] \mid +# # 1 \leq \ii \leq 2\n +# # \ \land \ 1 \leq \ki \leq 2\n +# # \land \ii = \ki +# # \land \ii = \ki\\ +# # \t \land +# # \ \neg (\ \exists [\ji, \jj] \st +# # (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) +# # \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj = \ki)\ )\\ +# # \t +# # \land \ +# # \neg (\ \exists [\ji, \jj] \st +# # (1 \leq \ji \leq 2\n \land 1 \leq \jj \leq \n\!-\!1) +# # \land (\ii \leq \ji \land \ji \leq \ki) \land (2\jj\!+\!1 = \ki)\ ) +# # \ \} +# # ; +# # +# # S; diff --git a/omega/examples/old_test/tricky b/omega/examples/old_test/tricky new file mode 100644 index 0000000..d12077c --- /dev/null +++ b/omega/examples/old_test/tricky @@ -0,0 +1,11 @@ +symbolic N,M,k; +{ [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k + and not ( exists [i2,j2] : + 0 <= i2 <= M and 0 <= j2 <= N + and 2i2+j2 = k + and i < i2 ) }; +{ [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k + and not ( i < M && 2i-2 <= k && + N-k <= 2M + && ( N-k < k or N <= 2k && (exists a : k = 2 a) + ))}; diff --git a/omega/examples/old_test/tricky.oc-rt b/omega/examples/old_test/tricky.oc-rt new file mode 100644 index 0000000..8282b7f --- /dev/null +++ b/omega/examples/old_test/tricky.oc-rt @@ -0,0 +1,25 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic N,M,k; +# +# { [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k +# and NOT( exists [i2,j2] : +# 0 <= i2 <= M and 0 <= j2 <= N +# and 2i2+j2 = k +# and i < i2 ) }; + +{[i,k-2i] -> : 2i <= k <= 2i+1 && 0 <= i <= M && k <= N+2i} union + {[M,k-2M] -> : 2+2M <= k && k <= N+2M && 0 <= M} + +# +# { [i,j] -> [] : 0 <= i <= M and 0 <= j <= N and 2i+j = k +# and NOT( i < M && 2i-2 <= k && +# N-k <= 2M +# && ( N-k < k or N <= 2k && (exists a : k = 2 a) +# ))}; + +{[i,k-2i] -> : 0 <= i <= M && 2M+k < N && 2i <= k} union + {[M,k-2M] -> : N <= 2M+k && k <= N+2M && 2M <= k} union + {[i,k-2i] -> : 2k < N && N <= 2M+k && 0 <= i && 2i <= k} union + {[i,k-2i] -> : Exists ( alpha : N = 2k && 2i = 1+k+2alpha && 2i+1 <= k <= 2M-1 && 0 <= i)} + +# diff --git a/omega/examples/old_test/ts1d-check-sblock b/omega/examples/old_test/ts1d-check-sblock new file mode 100644 index 0000000..01757ea --- /dev/null +++ b/omega/examples/old_test/ts1d-check-sblock @@ -0,0 +1,155 @@ +# 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 }; + +IS_INIT_EXP := { [1,t,1,i,0] : (0=t && 0<=i<=N-1) || + (1=t && 0=i) || + (1=t && N-1=i) }; + +TSKEW := { [2, t, 1, i, 1] -> [2, tb, t+i, tt, 0] : + 1000*tb+tt = t and 0 <= tt < 1000 }; + +codegen + IS_INIT_EXP, TSKEW : IS_CALC +given (KNOWN join ex_0_5v); + diff --git a/omega/examples/old_test/ts1d-check-sblock.oc-rt b/omega/examples/old_test/ts1d-check-sblock.oc-rt new file mode 100644 index 0000000..492fa30 --- /dev/null +++ b/omega/examples/old_test/ts1d-check-sblock.oc-rt @@ -0,0 +1,227 @@ +# 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 }; +# +# +# IS_INIT_EXP := { [1,t,1,i,0] : (0=t && 0<=i<=N-1) || +# (1=t && 0=i) || +# (1=t && N-1=i) }; +# +# +# TSKEW := { [2, t, 1, i, 1] -> [2, tb, t+i, tt, 0] : +# 1000*tb+tt = t and 0 <= tt < 1000 }; +# +# +# codegen +# IS_INIT_EXP, TSKEW : IS_CALC +# given (KNOWN join ex_0_5v); +for(t4 = 0; t4 <= N-1; t4++) { + s1(1,0,1,t4,0); +} +s1(1,1,1,0,0); +s1(1,1,1,N-1,0); +for(t2 = 0; t2 <= intDiv(T-1,1000); t2++) { + for(t3 = 1000*t2+1; t3 <= min(N+1000*t2+997,N+T-3); t3++) { + for(t4 = max(-N+t3-1000*t2+2,0); t4 <= min(T-1000*t2-1,t3-1000*t2-1,999); t4++) { + s2(2,t4+1000*t2,1,t3-t4+-1000*t2,1); + } + } +} + +# +# diff --git a/omega/examples/old_test/ts1d-check0 b/omega/examples/old_test/ts1d-check0 new file mode 100644 index 0000000..9db25df --- /dev/null +++ b/omega/examples/old_test/ts1d-check0 @@ -0,0 +1,176 @@ +# 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 }; + +# Lets try to build up the equivalent of the time skewing transformation, +# IS_Trans := { [2,t,1,i,1] -> [2,tb,1,x,1,y,1] : +# 1000*tb<=t-1<=1000*(tb+1)-1 && y=t-1000*tb && x=y+i }; +# for both statements together, right from the diagram in the new TOPLAS stuff. + +# original code without mmap +# + +# First, look at it as a wider space + +WIDEN := { [2, t, s, i , 1] -> [2, 2t+s, 0, i, 1] : 0<=s<=1 }; +TSKEW := { [2, t, 0, i , 1] -> [2, tb, t+i, tt, 1] : + 1000*tb+tt = t and 0 <= tt < 1000 }; + +TSKEW_2LOOPS := WIDEN join TSKEW; +# print this for the paper + +# I think this should work but it blows up codegen: +# codegen +# IS_INIT, TSKEW_2LOOPS : IS_COPY, TSKEW_2LOOPS : IS_CALC +# given (KNOWN join ex_0_5v); + +# So we fake it as follows, +# relying on the fact that neither "t" nor "s" is used in any statement + +WIDEN0 := { [2, t, 0, i , 1] -> [2, 2t, 0, i, 1] }; +WIDEN1 := { [2, t, 1, i , 1] -> [2, 2t+1, 0, i, 1] }; + +codegen + IS_INIT, TSKEW : (IS_COPY join WIDEN0) , TSKEW : (IS_CALC join WIDEN1) +given (KNOWN join ex_0_5v); + diff --git a/omega/examples/old_test/ts1d-check0.oc-rt b/omega/examples/old_test/ts1d-check0.oc-rt new file mode 100644 index 0000000..a258f26 --- /dev/null +++ b/omega/examples/old_test/ts1d-check0.oc-rt @@ -0,0 +1,260 @@ +# 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 }; +# +# +# # Lets try to build up the equivalent of the time skewing transformation, +# # IS_Trans := { [2,t,1,i,1] -> [2,tb,1,x,1,y,1] : +# # 1000*tb<=t-1<=1000*(tb+1)-1 && y=t-1000*tb && x=y+i }; +# # for both statements together, right from the diagram in the new TOPLAS stuff. +# +# # original code without mmap +# # +# +# # First, look at it as a wider space +# +# WIDEN := { [2, t, s, i , 1] -> [2, 2t+s, 0, i, 1] : 0<=s<=1 }; +# +# TSKEW := { [2, t, 0, i , 1] -> [2, tb, t+i, tt, 1] : +# 1000*tb+tt = t and 0 <= tt < 1000 }; +# +# +# TSKEW_2LOOPS := WIDEN join TSKEW; +# +# # print this for the paper +# +# # I think this should work but it blows up codegen: +# # codegen +# # IS_INIT, TSKEW_2LOOPS : IS_COPY, TSKEW_2LOOPS : IS_CALC +# # given (KNOWN join ex_0_5v); +# +# # So we fake it as follows, +# # relying on the fact that neither "t" nor "s" is used in any statement +# +# WIDEN0 := { [2, t, 0, i , 1] -> [2, 2t, 0, i, 1] }; +# +# WIDEN1 := { [2, t, 1, i , 1] -> [2, 2t+1, 0, i, 1] }; +# +# +# codegen +# IS_INIT, TSKEW : (IS_COPY join WIDEN0) , TSKEW : (IS_CALC join WIDEN1) +# given (KNOWN join ex_0_5v); +for(t2 = 0; t2 <= N-1; t2++) { + s1(1,t2,1,0,0); +} +for(t2 = 0; t2 <= intDiv(T-1,500); t2++) { + for(t3 = 1000*t2; t3 <= min(1000*t2+N+997,N+2*T-3); t3++) { + if (intMod(-N+t3+1,2) == 0 && 1000*t2 <= -N+t3+1) { + s2(2,t3-N+1,0,N-1,1); + } + for(t4 = max(-1000*t2-N+t3+2,0); t4 <= min(-1000*t2+2*T-1,-1000*t2+t3-1,999); t4++) { + if (intMod(t4,2) == 0) { + s2(2,t4+1000*t2,0,t3-t4+-1000*t2,1); + } + if (intMod(t4+1,2) == 0) { + s3(2,t4+1000*t2,0,t3-t4+-1000*t2,1); + } + } + if (intMod(t3,2) == 0 && 2*T >= t3+2 && 1000*t2 >= t3-998) { + s2(2,t3,0,0,1); + } + } +} + +# +# diff --git a/omega/examples/old_test/ts1d-mp-i_ts-m_b b/omega/examples/old_test/ts1d-mp-i_ts-m_b new file mode 100644 index 0000000..f288263 --- /dev/null +++ b/omega/examples/old_test/ts1d-mp-i_ts-m_b @@ -0,0 +1,289 @@ +# 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<500 && s=i+1*t && t=500*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 }; + +# +# multiprocessor version +# time skewed iteration space +# blocked memory mapping +# + +# +# First of all, if 500 is much less than 4000, +# there's a problem with the constraints below. +# To keep send and recv. slices from "crashing", 4000>=2BS+2 (safe approx?) +# + +assertUnsatisfiable( { [] : 4000 < 2 * 500 + 2 } ); + +# this transformation has no existentially quantified variables; +# basically, it factors out the common stuff below, +# but the quantified variables are left in the output, so we can get them +# everything after the 000 is not needed in final xform + +# +# DANGER WILL ROBINSON! +# the .c file depends on the fact that t4 is always the processor number +# + +MP_TSKEW_ALL := { [2, t, 1, i, 1] -> + [2, tb, slice, proc, t+i, tt, 000, t, i, lproc, t0, i0, ie]: +## +## define time block and tt +## + 500*tb+tt = t and 0 <= tt < 500 +## +## define "logical proc", then "wrap" onto physical later: +## "logical proc" (lproc) = (t-i) div sigma +## + and 4000*lproc <= t-i < 4000*(lproc+1) +## +## for uniproc. test, just do proc = -lproc (for multi, proc = lproc % 8) +## + and proc = -lproc +## +## t0,i0 = first iteration in a block; +## t0,ie = maximum "i" in t0 of this block) +## + and t0=500*tb + and t0-ie=4000*lproc + and i0+4000-1=ie +}; + +# +# We need to send things "down" (to same time block of next proc.) +# and "right" (to next time block of next proc.) +# The "+2" is for the things to send right (not mentioned in IPDPS paper). +# + +MP_TSKEW_SEND_SL := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [2, tb, 1, proc, t_p_i, tt, 0] : +## define send slice... + (t+i) <= (t0+(500-2) + i0+(500-1) + 2) +}; + +MP_TSKEW_SEND_ME := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [2, tb, 2, proc, t_p_i, tt, 0] : +## in the send slice + (t+i) <= (t0+(500-2) + i0+(500-1) + 2) +## and near the (t-i) border: + and (t-i) >= ((t0-i0)-1) +}; + +MP_TSKEW_COMP_SL := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [2, tb, 3, proc, t_p_i, tt, 0] : +## define computation slice... +## not send + (t+i) > (t0+(500-2) + i0+(500-1) + 2) +## and not recv + and (t+i) <= (t0+ie) +}; + + + +# Receive the iterations that we sent, +# but after the calculation, +# and on the neighbor (lower) processor + +MP_TSKEW_R_FROM_ME := MP_TSKEW_SEND_ME join + { [2, tb, 2, proc, t_p_i, tt, 0] -> + [2, tb, 4, proc-1, t_p_i, tt, 0] }; + + +MP_TSKEW_RECV_SL := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [2, tb, 5, proc, t_p_i, tt, 0] : +## define recv slice... + (t+i) > (t0+ie) +}; + + + + +## stuff to gather each processor's final results... + +IS_GATHER := IS_CALC intersection { [2,t,1,i,1] : t=T-1 }; + +GATHER_EXPANDER := MP_TSKEW_ALL join + { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> + [3, tb, 7, proc, t_p_i, tt, 0] }; + +## stuff to initialize things right in the first place + +### NOTE THAT t4 (processor #) is used in a loop in initialization + +IS_INIT_EXP := { [1,t,i,0,0] : (-1=t && 0<=i<=N-1) || + (0<=t<T && 0=i) || + (0<=t<T && N-1=i) }; + + +# send_slice + calc_slice + recv slice == total + +TheSendIS := domain(MP_TSKEW_SEND_SL restrictDomain IS_CALC); +TheCompIS := domain(MP_TSKEW_COMP_SL restrictDomain IS_CALC); +TheRecvIS := domain(MP_TSKEW_RECV_SL restrictDomain IS_CALC); + +assertUnsatisfiable(TheSendIS intersection TheCompIS); +assertUnsatisfiable(TheCompIS intersection TheRecvIS); +assertUnsatisfiable(TheSendIS intersection TheRecvIS); +# +# These cause inexact negation and thus blow up... +# +# assertUnsatisfiable(IS_CALC - (TheSendIS union TheCompIS union TheRecvIS)); +# assertUnsatisfiable((TheSendIS union TheCompIS union TheRecvIS) - IS_CALC); + + + +codegen + ex_5_7 : IS_INIT_EXP, + MP_TSKEW_SEND_SL : IS_CALC, + MP_TSKEW_SEND_ME : IS_CALC, + MP_TSKEW_COMP_SL : IS_CALC, + MP_TSKEW_R_FROM_ME : IS_CALC, + MP_TSKEW_RECV_SL : IS_CALC, + GATHER_EXPANDER : IS_GATHER +given (KNOWN join ex_0_7v); + diff --git a/omega/examples/old_test/ts1d-mp-i_ts-m_b.oc-rt b/omega/examples/old_test/ts1d-mp-i_ts-m_b.oc-rt new file mode 100644 index 0000000..6d3ef2a --- /dev/null +++ b/omega/examples/old_test/ts1d-mp-i_ts-m_b.oc-rt @@ -0,0 +1,430 @@ +# 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<500 && s=i+1*t && t=500*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 }; +# +# +# # +# # multiprocessor version +# # time skewed iteration space +# # blocked memory mapping +# # +# +# # +# # First of all, if 500 is much less than 4000, +# # there's a problem with the constraints below. +# # To keep send and recv. slices from "crashing", 4000>=2BS+2 (safe approx?) +# # +# +# assertUnsatisfiable( { [] : 4000 < 2 * 500 + 2 } ); + +{ FALSE } + +# +# +# # this transformation has no existentially quantified variables; +# # basically, it factors out the common stuff below, +# # but the quantified variables are left in the output, so we can get them +# # everything after the 000 is not needed in final xform +# +# # +# # DANGER WILL ROBINSON! +# # the .c file depends on the fact that t4 is always the processor number +# # +# +# MP_TSKEW_ALL := { [2, t, 1, i, 1] -> +# [2, tb, slice, proc, t+i, tt, 000, t, i, lproc, t0, i0, ie]: +# ## +# ## define time block and tt +# ## +# 500*tb+tt = t and 0 <= tt < 500 +# ## +# ## define "logical proc", then "wrap" onto physical later: +# ## "logical proc" (lproc) = (t-i) div sigma +# ## +# and 4000*lproc <= t-i < 4000*(lproc+1) +# ## +# ## for uniproc. test, just do proc = -lproc (for multi, proc = lproc % 8) +# ## +# and proc = -lproc +# ## +# ## t0,i0 = first iteration in a block; +# ## t0,ie = maximum "i" in t0 of this block) +# ## +# and t0=500*tb +# and t0-ie=4000*lproc +# and i0+4000-1=ie +# }; +# +# +# # +# # We need to send things "down" (to same time block of next proc.) +# # and "right" (to next time block of next proc.) +# # The "+2" is for the things to send right (not mentioned in IPDPS paper). +# # +# +# MP_TSKEW_SEND_SL := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [2, tb, 1, proc, t_p_i, tt, 0] : +# ## define send slice... +# (t+i) <= (t0+(500-2) + i0+(500-1) + 2) +# }; +# +# +# MP_TSKEW_SEND_ME := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [2, tb, 2, proc, t_p_i, tt, 0] : +# ## in the send slice +# (t+i) <= (t0+(500-2) + i0+(500-1) + 2) +# ## and near the (t-i) border: +# and (t-i) >= ((t0-i0)-1) +# }; +# +# +# MP_TSKEW_COMP_SL := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [2, tb, 3, proc, t_p_i, tt, 0] : +# ## define computation slice... +# ## not send +# (t+i) > (t0+(500-2) + i0+(500-1) + 2) +# ## and not recv +# and (t+i) <= (t0+ie) +# }; +# +# +# +# +# # Receive the iterations that we sent, +# # but after the calculation, +# # and on the neighbor (lower) processor +# +# MP_TSKEW_R_FROM_ME := MP_TSKEW_SEND_ME join +# { [2, tb, 2, proc, t_p_i, tt, 0] -> +# [2, tb, 4, proc-1, t_p_i, tt, 0] }; +# +# +# +# MP_TSKEW_RECV_SL := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [2, tb, 5, proc, t_p_i, tt, 0] : +# ## define recv slice... +# (t+i) > (t0+ie) +# }; +# +# +# +# +# +# ## stuff to gather each processor's final results... +# +# IS_GATHER := IS_CALC intersection { [2,t,1,i,1] : t=T-1 }; +# +# +# GATHER_EXPANDER := MP_TSKEW_ALL join +# { [2, tb, slice, proc, t_p_i, tt, 000, t, i, lproc, t0, i0, ie] -> +# [3, tb, 7, proc, t_p_i, tt, 0] }; +# +# +# ## stuff to initialize things right in the first place +# +# ### NOTE THAT t4 (processor #) is used in a loop in initialization +# +# IS_INIT_EXP := { [1,t,i,0,0] : (-1=t && 0<=i<=N-1) || +# (0<=t<T && 0=i) || +# (0<=t<T && N-1=i) }; +# +# +# +# # send_slice + calc_slice + recv slice == total +# +# TheSendIS := domain(MP_TSKEW_SEND_SL restrictDomain IS_CALC); +# +# TheCompIS := domain(MP_TSKEW_COMP_SL restrictDomain IS_CALC); +# +# TheRecvIS := domain(MP_TSKEW_RECV_SL restrictDomain IS_CALC); +# +# +# assertUnsatisfiable(TheSendIS intersection TheCompIS); + +{[In_1,t,In_3,i,In_5] : FALSE } + +# +# assertUnsatisfiable(TheCompIS intersection TheRecvIS); + +{[In_1,t,In_3,i,In_5] : FALSE } + +# +# assertUnsatisfiable(TheSendIS intersection TheRecvIS); + +{[In_1,t,In_3,i,In_5] : FALSE } + +# +# # +# # These cause inexact negation and thus blow up... +# # +# # assertUnsatisfiable(IS_CALC - (TheSendIS union TheCompIS union TheRecvIS)); +# # assertUnsatisfiable((TheSendIS union TheCompIS union TheRecvIS) - IS_CALC); +# +# +# +# codegen +# ex_5_7 : IS_INIT_EXP, +# MP_TSKEW_SEND_SL : IS_CALC, +# MP_TSKEW_SEND_ME : IS_CALC, +# MP_TSKEW_COMP_SL : IS_CALC, +# MP_TSKEW_R_FROM_ME : IS_CALC, +# MP_TSKEW_RECV_SL : IS_CALC, +# GATHER_EXPANDER : IS_GATHER +# given (KNOWN join ex_0_7v); +for(t3 = 0; t3 <= N-1; t3++) { + s1(1,-1,t3,0,0); +} +for(t2 = 0; t2 <= T-1; t2++) { + s1(1,t2,0,0,0); + s1(1,t2,N-1,0,0); +} +for(t2 = 0; t2 <= intDiv(T-1,500); t2++) { + for(t4 = intDiv(-t2+7+7,8); t4 <= intDiv(-500*t2+N+3997,4000); t4++) { + for(t5 = max(1000*t2+4000*t4-3999,500*t2+1); t5 <= min(1000*t2+4000*t4-3000,N+T-3,2*N-4000*t4+3995); t5++) { + for(t6 = max(-N+t5-500*t2+2,0); t6 <= min(t5-500*t2-1,T-500*t2-1,intDiv(t5-4000*t4-1000*t2+3999,2)); t6++) { + s2(2,500*t2+t6,1,t5+-500*t2-t6,1); + } + } + } + for(t4 = max(intDiv(-T+4000+3999,4000),intDiv(-t2+7+7,8)); t4 <= intDiv(-500*t2+N+3997,4000); t4++) { + for(t5 = max(1000*t2+4000*t4-3999,-4000*t4+4000); t5 <= min(1000*t2+4000*t4-3000,2*N-4000*t4+3995,2*T+4000*t4-4000); t5++) { + for(t6 = intDiv(t5-4000*t4-1000*t2+3998+1,2); t6 <= intDiv(t5-4000*t4-1000*t2+3999,2); t6++) { + s3(2,500*t2+t6,1,t5+-500*t2-t6,1); + } + } + } + for(t4 = intDiv(-t2+1+7,8); t4 <= min(intDiv(-500*t2+N+3496,4000),intDiv(-1000*t2+N+T+2996,4000)); t4++) { + for(t5 = max(500*t2+1,4000*t4+1000*t2-2999); t5 <= min(N+T-3,4000*t4+1000*t2,N+500*t2+497); t5++) { + for(t6 = max(-N+t5-500*t2+2,0); t6 <= min(T-500*t2-1,t5-500*t2-1,499); t6++) { + s4(2,500*t2+t6,1,t5+-500*t2-t6,1); + } + } + } + for(t4 = max(intDiv(-T+3999,4000),intDiv(-t2-1+7,8)); t4 <= intDiv(-500*t2+N-3,4000); t4++) { + for(t5 = max(1000*t2+4000*t4+1,-4000*t4); t5 <= min(1000*t2+4000*t4+1000,2*N-4000*t4-5,2*T+4000*t4); t5++) { + for(t6 = intDiv(-1000*t2-4000*t4+t5-2+1,2); t6 <= intDiv(-1000*t2-4000*t4+t5-1,2); t6++) { + s5(2,500*t2+t6,1,t5+-500*t2-t6,1); + } + } + } + if (500*t2 <= T-2) { + for(t4 = intDiv(-t2+7,8); t4 <= min(intDiv(-500*t2+N+496,4000),intDiv(-1000*t2+N+T-4,4000)); t4++) { + for(t5 = max(1000*t2+4000*t4+1,-4000*t4+2); t5 <= min(2*T+4000*t4-2,N+T-3,N+500*t2+497,1000*t2+4000*t4+998); t5++) { + for(t6 = max(-N+t5-500*t2+2,intDiv(t5-4000*t4-1000*t2+1,2)); t6 <= min(t5-500*t2-1,T-500*t2-1,499); t6++) { + s6(2,500*t2+t6,1,t5+-500*t2-t6,1); + } + } + } + } +} +if (T >= 1) { + for(t2 = intDiv(T-500+499,500); t2 <= intDiv(T-1,500); t2++) { + for(t4 = intDiv(-T+2+3999,4000); t4 <= intDiv(N-T+3998,4000); t4++) { + for(t5 = max(4000*t4+2*T-4001,T); t5 <= min(4000*t4+2*T-2,N+T-3); t5++) { + s7(2,T-1,1,t5-T+1,1); + } + } + } +} + +# +# diff --git a/omega/examples/old_test/ts1d-orig0 b/omega/examples/old_test/ts1d-orig0 new file mode 100644 index 0000000..48e5a10 --- /dev/null +++ b/omega/examples/old_test/ts1d-orig0 @@ -0,0 +1,151 @@ +# 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); + diff --git a/omega/examples/old_test/ts1d-orig0.oc-rt b/omega/examples/old_test/ts1d-orig0.oc-rt new file mode 100644 index 0000000..775af7e --- /dev/null +++ b/omega/examples/old_test/ts1d-orig0.oc-rt @@ -0,0 +1,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); + } +} + +# +# diff --git a/omega/examples/old_test/tseng b/omega/examples/old_test/tseng new file mode 100644 index 0000000..2ae39f8 --- /dev/null +++ b/omega/examples/old_test/tseng @@ -0,0 +1,16 @@ +symbolic n; +symbolic LV,UV; +D := {[ i,i+1] -> [i+1,k] : 1 <= i && i+1 < k <= n}; +local := {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV }; +sameP := {[i1,k1] -> [i2,k2] : k1=k2 || LV <= k1,k2 <= UV }; +myIter := {[i,k] : LV <= k <= UV}; +lexPos := {[i1,k1] -> [i2,k2] : i1 = i2 && k1 < k2 || i1 < i2}; + +post := D restrictDomain myIter; +wait := D restrictRange myIter; +enforcedTime := sameP intersection lexPos; +enforcedTime; +enforced := enforcedTime compose D union D compose enforcedTime union enforcedTime; +enforced; +post - enforced; +wait - enforced; diff --git a/omega/examples/old_test/tseng.oc-rt b/omega/examples/old_test/tseng.oc-rt new file mode 100644 index 0000000..53ff139 --- /dev/null +++ b/omega/examples/old_test/tseng.oc-rt @@ -0,0 +1,54 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# symbolic LV,UV; +# +# D := {[ i,i+1] -> [i+1,k] : 1 <= i && i+1 < k <= n}; +# +# local := {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV }; +# +# sameP := {[i1,k1] -> [i2,k2] : k1=k2 || LV <= k1,k2 <= UV }; +# +# myIter := {[i,k] : LV <= k <= UV}; +# +# lexPos := {[i1,k1] -> [i2,k2] : i1 = i2 && k1 < k2 || i1 < i2}; +# +# +# post := D restrictDomain myIter; +# +# wait := D restrictRange myIter; +# +# enforcedTime := sameP intersection lexPos; +# +# enforcedTime; + +{[i1,k1] -> [i1,k2] : LV <= k1 < k2 <= UV} union + {[i1,k1] -> [i2,k1] : i1 < i2} union + {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV && i1 < i2} + +# +# enforced := enforcedTime compose D union D compose enforcedTime union enforcedTime; +# +# enforced; + +{[i1,i1+1] -> [i2,k2] : 1 <= i1 <= n-2, UV-2, i2-2 && LV <= k2 <= UV && LV <= n} union + {[i1,k1] -> [i2,k2] : k1 = 1+i1 && 1 <= i1 <= i2-2, k2-2 && k2 <= n} union + {[i1,i1+1] -> [i1+1,k2] : 1 <= i1 <= n-2, k2-3 && LV < k2 <= UV && LV <= n} union + {[i1,k1] -> [i2,k2] : 2, LV, i1+2 <= i2 < k2 <= n && LV <= k1 <= UV && i2 <= UV} union + {[i1,k1] -> [k1,k2] : 2, i1+2 <= k1 < k2 <= n} union + {[i1,k1] -> [i1+1,k2] : LV <= k1 <= i1 <= k2-2, UV-1 && k2 <= n && 1 <= i1} union + {[i1,k1] -> [i2,k2] : LV <= k1,k2 <= UV && i1 < i2} union + {[i1,k1] -> [i2,k1] : i1 < i2} union + {[i1,k1] -> [i1,k2] : LV <= k1 < k2 <= UV} + +# +# post - enforced; + +{[In_1,In_1+1] -> [In_1+1,Out_2] : 1, LV-1 <= In_1 < UV < Out_2 <= n} + +# +# wait - enforced; + +{[In_1,In_1+1] -> [In_1+1,LV] : In_1+2 <= LV <= n, UV && 1 <= In_1} + +# diff --git a/omega/examples/old_test/verlind1 b/omega/examples/old_test/verlind1 new file mode 100644 index 0000000..181b1c5 --- /dev/null +++ b/omega/examples/old_test/verlind1 @@ -0,0 +1,44 @@ + without_simplify; + + R3 := {[x] -> [y] : (y = x) | (y = 3x)}; + + Rf := {[x] -> [y] : x <= y <= 3x}; + + R3; + + Rf; + + s12 := {[x] : 1 <= x <= 2}; + s12; + + sd3 := R3(s12); + sd3; + + sc3 := Rf(s12); + sc3; + + sc3 intersection sd3; + + # I think this is faulty + sc3 - sd3; + + # This is OK + sd3 - sc3; + + complement sc3; + complement sd3; + + sc3; + + sc3 intersection (complement sd3); + + # alternative description of sd3; + sd3' := {[y] : 1 <= y <= 3 | y = 6}; + sd3'; + sc3 - sd3'; + + # sd3 wrt sd3'; + + sd3 - sd3'; + + sd3' - sd3; diff --git a/omega/examples/old_test/verlind1.oc-rt b/omega/examples/old_test/verlind1.oc-rt new file mode 100644 index 0000000..050b199 --- /dev/null +++ b/omega/examples/old_test/verlind1.oc-rt @@ -0,0 +1,120 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R3 := {[x] -> [y] : (y = x) | (y = 3x)}; +# +# +# Rf := {[x] -> [y] : x <= y <= 3x}; +# +# +# R3; + +{[x] -> [x] } union + {[x] -> [3x] } + +# +# +# Rf; + +{[x] -> [y] : x <= y <= 3x} + +# +# +# s12 := {[x] : 1 <= x <= 2}; +# +# s12; + +{[x]: 1 <= x <= 2} + +# +# +# sd3 := R3(s12); +# +# sd3; + +{[y]: 1 <= y <= 2} union + {[y]: Exists ( alpha : y = 3alpha && 3 <= y <= 6)} + +# +# +# sc3 := Rf(s12); +# +# sc3; + +{[y]: 1 <= y <= 6} + +# +# +# sc3 intersection sd3; + +{[y]: 1 <= y <= 2} union + {[y]: Exists ( alpha : y = 3alpha && 3 <= y <= 6)} + +# +# +# # I think this is faulty +# sc3 - sd3; + +{[y]: 4 <= y <= 5} + +# +# +# # This is OK +# sd3 - sc3; + +{[y] : FALSE } + +# +# +# complement sc3; + +{[y]: y <= 0} union + {[y]: 7 <= y} + +# +# complement sd3; + +{[y]: y <= 0} union + {[y]: 7 <= y} union + {[y]: 4 <= y <= 5} + +# +# +# sc3; + +{[y]: 1 <= y <= 6} + +# +# +# sc3 intersection (complement sd3); + +{[y]: 4 <= y <= 5} + +# +# +# # alternative description of sd3; +# sd3' := {[y] : 1 <= y <= 3 | y = 6}; +# +# sd3'; + +{[y]: 1 <= y <= 3} union + {[6]} + +# +# sc3 - sd3'; + +{[y]: 4 <= y <= 5} + +# +# +# # sd3 wrt sd3'; +# +# sd3 - sd3'; + +{[y] : FALSE } + +# +# +# sd3' - sd3; + +{[y] : FALSE } + +# diff --git a/omega/examples/old_test/verlind1a b/omega/examples/old_test/verlind1a new file mode 100644 index 0000000..e43ec19 --- /dev/null +++ b/omega/examples/old_test/verlind1a @@ -0,0 +1,3 @@ +R := { [i] : 1 <= i <= 6 & exists (alpha : 3 alpha + 1 <= i <= 3 alpha + 2) + & not (1 <= i <= 2) }; +R; diff --git a/omega/examples/old_test/verlind1a.oc-rt b/omega/examples/old_test/verlind1a.oc-rt new file mode 100644 index 0000000..11e2d1e --- /dev/null +++ b/omega/examples/old_test/verlind1a.oc-rt @@ -0,0 +1,9 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := { [i] : 1 <= i <= 6 & Exists (alpha : 3 alpha + 1 <= i <= 3 alpha + 2) +# & not (1 <= i <= 2) }; +# +# R; + +{[i]: 4 <= i <= 5} + +# diff --git a/omega/examples/old_test/wak1 b/omega/examples/old_test/wak1 new file mode 100644 index 0000000..5e9e315 --- /dev/null +++ b/omega/examples/old_test/wak1 @@ -0,0 +1,13 @@ +symbolic a1,a2,a3,b1,b2,b3; + +IS1 := {[i] : a1 <= i <= b1 }; +IS2 := {[i] : a2 <= i <= b2 }; +IS3 := {[i] : a3 <= i <= b3 }; + +T1 := {[i] -> [i,0]}; +T2 := {[i] -> [i,1]}; +T3 := {[i] -> [i,2]}; + +codegen 0 T1:IS1,T2:IS2,T3:IS3; + +codegen T1:IS1,T2:IS2,T3:IS3; diff --git a/omega/examples/old_test/wak1.oc-rt b/omega/examples/old_test/wak1.oc-rt new file mode 100644 index 0000000..e8bdf0e --- /dev/null +++ b/omega/examples/old_test/wak1.oc-rt @@ -0,0 +1,87 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# +# Symbolic a1,a2,a3,b1,b2,b3; +# +# +# IS1 := {[i] : a1 <= i <= b1 }; +# +# IS2 := {[i] : a2 <= i <= b2 }; +# +# IS3 := {[i] : a3 <= i <= b3 }; +# +# +# T1 := {[i] -> [i,0]}; +# +# T2 := {[i] -> [i,1]}; +# +# T3 := {[i] -> [i,2]}; +# +# +# codegen T1:IS1,T2:IS2,T3:IS3; +for(t1 = a3; t1 <= min(b3,a1-1,a2-1); t1++) { + s3(t1); +} +for(t1 = a2; t1 <= min(b2,a1-1,a3-1,b3); t1++) { + s2(t1); +} +for(t1 = max(a2,a3); t1 <= min(a1-1,b2,b3); t1++) { + s2(t1); + s3(t1); +} +for(t1 = max(a2,b3+1); t1 <= min(b2,a1-1); t1++) { + s2(t1); +} +for(t1 = max(a3,a2,b2+1); t1 <= min(b3,a1-1); t1++) { + s3(t1); +} +for(t1 = a1; t1 <= min(b1,a3-1,b3,a2-1); t1++) { + s1(t1); +} +for(t1 = max(a1,a3); t1 <= min(b1,a2-1,b3); t1++) { + s1(t1); + s3(t1); +} +for(t1 = max(a1,b3+1); t1 <= min(b1,a2-1); t1++) { + s1(t1); +} +for(t1 = max(a1,a2); t1 <= min(b1,b2,a3-1); t1++) { + s1(t1); + s2(t1); +} +for(t1 = max(a1,a2,a3); t1 <= min(b1,b2,b3); t1++) { + s1(t1); + s2(t1); + s3(t1); +} +for(t1 = max(a1,a2,a3,b3+1); t1 <= min(b1,b2); t1++) { + s1(t1); + s2(t1); +} +for(t1 = max(a1,b2+1,a2); t1 <= min(b1,a3-1); t1++) { + s1(t1); +} +for(t1 = max(a1,a2,b2+1,a3); t1 <= min(b1,b3); t1++) { + s1(t1); + s3(t1); +} +for(t1 = max(a1,b3+1,a3,a2,b2+1); t1 <= b1; t1++) { + s1(t1); +} +for(t1 = max(a3,a1,b1+1); t1 <= min(b3,b2,a2-1); t1++) { + s3(t1); +} +for(t1 = max(a2,a1,b1+1); t1 <= min(b2,a3-1); t1++) { + s2(t1); +} +for(t1 = max(a1,b1+1,a2,a3); t1 <= min(b2,b3); t1++) { + s2(t1); + s3(t1); +} +for(t1 = max(a2,a1,b1+1,b3+1,a3); t1 <= b2; t1++) { + s2(t1); +} +for(t1 = max(a3,a1,b1+1,b2+1); t1 <= b3; t1++) { + s3(t1); +} + +# diff --git a/omega/examples/old_test/wak2 b/omega/examples/old_test/wak2 new file mode 100644 index 0000000..927fc2f --- /dev/null +++ b/omega/examples/old_test/wak2 @@ -0,0 +1,10 @@ +symbolic a1,a2,b1,b2,c1,c2,d1,d2; + +IS1 := {[i,j] : a1 <= i <= b1 && c1 <= j <= d1}; +IS2 := {[i,j] : a2 <= i <= b2 && c2 <= j <= d2}; + +T1 := {[i,j] -> [i,j,0]}; +T2 := {[i,j] -> [i,j,1]}; + +codegen T1:IS1,T2:IS2; +codegen 2 T1:IS1,T2:IS2; diff --git a/omega/examples/old_test/wak2.oc-rt b/omega/examples/old_test/wak2.oc-rt new file mode 100644 index 0000000..6dc6270 --- /dev/null +++ b/omega/examples/old_test/wak2.oc-rt @@ -0,0 +1,307 @@ +>>> Symbolic a1,a2,b1,b2,c1,c2,d1,d2; +>>> +>>> IS1 := {[i,j] : a1 <= i <= b1 && c1 <= j <= d1}; +>>> IS2 := {[i,j] : a2 <= i <= b2 && c2 <= j <= d2}; +>>> +>>> T1 := {[i,j] -> [i,j,0]}; +>>> T2 := {[i,j] -> [i,j,1]}; +>>> +>>> codegen T1:IS1,T2:IS2; +if (d2 >= c2) { + for(t1 = a2; t1 <= min(a1-1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +for(t1 = a1; t1 <= b1; t1++) { + if (t1 >= a2 && t1 <= b2) { + for(t2 = c2; t2 <= min(c1-1,d2); t2++) { + s2(t1,t2); + } + } + if (t1 <= a2-1) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } + if (t1 >= a2 && t1 <= b2) { + for(t2 = c1; t2 <= min(d1,c2-1,d2); t2++) { + s1(t1,t2); + } + } + if (t1 <= b2 && t1 >= a2) { + for(t2 = max(c2,c1); t2 <= min(d2,d1); t2++) { + s1(t1,t2); + s2(t1,t2); + } + } + if (t1 >= a2 && t1 <= b2) { + for(t2 = max(d2+1,c1); t2 <= d1; t2++) { + s1(t1,t2); + } + } + if (t1 >= a2 && t1 >= b2+1) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } + if (t1 >= a2 && t1 <= b2) { + for(t2 = max(c2,d1+1,c1); t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d2 >= c2) { + for(t1 = max(a1,a2,b1+1); t1 <= b2; t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} + +>>> codegen 2 T1:IS1,T2:IS2; +if (d2 >= c2) { + for(t1 = a2; t1 <= min(a1-1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d1 >= c1) { + for(t1 = a1; t1 <= min(a2-1,b1); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 >= c1 && c1 >= d2+2 && c2 <= d2) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d2 >= c2 && d2 <= c1-2 && d1 <= c1-1) { + for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c1 >= c2+1 && d1 <= d2-1 && d1 >= c1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d1+1; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c1 >= c2+1 && c1 <= d2 && d1 >= d2+1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d2+1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 == d2 && d1 >= c1 && c1 >= c2+1) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + } +} +if (d2 == c1-1 && d2 <= d1-1 && d2 >= c2) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (c2 <= c1-1 && d2 >= c1 && d1 <= c1-1) { + for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= c1-1; t2++) { + s2(t1,t2); + } + for(t2 = c1; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d2 == c1-1 && d2 >= d1 && d2 >= c2) { + for(t1 = max(a1,a2); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d1 >= c1 && c1 >= c2+1 && d2 <= c2-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (c1 <= c2-1 && d1 >= c2 && d1 <= d2-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= c2-1; t2++) { + s1(t1,t2); + } + for(t2 = c2; t2 <= d1; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d1+1; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c1 <= c2-1 && d1 >= d2+1 && c2 <= d2) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= c2-1; t2++) { + s1(t1,t2); + } + for(t2 = c2; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d2+1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 == d2 && d1 >= c2 && c1 <= c2-1) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= c2-1; t2++) { + s1(t1,t2); + } + for(t2 = c2; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + } +} +if (c2 <= d2 && d1 >= c1 && d1 <= c2-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d1 >= c1 && d2 <= c2-1 && d1 <= d2-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d2 >= c1 && d2 <= c2-1 && d1 >= d2+1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + } + for(t2 = d2+1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 == d2 && d1 <= c2-1 && d1 >= c1) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d2 >= c2 && c2 >= c1+1 && d1 <= c1-1) { + for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c2 == c1 && c2 <= d1 && d1 <= d2-1) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d1+1; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (c2 == c1 && d1 >= d2+1 && c2 <= d2) { + for(t1 = max(a2,a1); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + for(t2 = d2+1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (c1 == c2 && d1 == d2 && d1 >= c1) { + for(t1 = max(a1,a2); t1 <= min(b2,b1); t1++) { + for(t2 = c1; t2 <= d2; t2++) { + s1(t1,t2); + s2(t1,t2); + } + } +} +if (c1 == c2 && c1 >= d1+1 && d2 >= c1) { + for(t1 = max(a1,a2); t1 <= min(b1,b2); t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} +if (d1 >= c1 && c1 <= c2 && d2 <= c1-1) { + for(t1 = max(a2,a1); t1 <= min(b1,b2); t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d1 >= c1) { + for(t1 = max(b2+1,a1,a2); t1 <= b1; t1++) { + for(t2 = c1; t2 <= d1; t2++) { + s1(t1,t2); + } + } +} +if (d2 >= c2) { + for(t1 = max(a1,a2,b1+1); t1 <= b2; t1++) { + for(t2 = c2; t2 <= d2; t2++) { + s2(t1,t2); + } + } +} + + diff --git a/omega/examples/old_test/wak3 b/omega/examples/old_test/wak3 new file mode 100644 index 0000000..51ca234 --- /dev/null +++ b/omega/examples/old_test/wak3 @@ -0,0 +1,12 @@ +symbolic a,b; + +IS1 := {[i] : a <= i <= b }; +IS2 := {[i] : a+10 <= i <= b+10 }; +IS3 := {[i] : a+20 <= i <= b+20 }; + +T1 := {[i] -> [i,0]}; +T2 := {[i] -> [i,1]}; +T3 := {[i] -> [i,2]}; + +codegen T1:IS1,T2:IS2,T3:IS3; +codegen 2 T1:IS1,T2:IS2,T3:IS3; diff --git a/omega/examples/old_test/wak3.oc-rt b/omega/examples/old_test/wak3.oc-rt new file mode 100644 index 0000000..825c72f --- /dev/null +++ b/omega/examples/old_test/wak3.oc-rt @@ -0,0 +1,59 @@ +>>> Symbolic a,b; +>>> +>>> IS1 := {[i] : a <= i <= b }; +>>> IS2 := {[i] : a+10 <= i <= b+10 }; +>>> IS3 := {[i] : a+20 <= i <= b+20 }; +>>> +>>> T1 := {[i] -> [i,0]}; +>>> T2 := {[i] -> [i,1]}; +>>> T3 := {[i] -> [i,2]}; +>>> +>>> codegen T1:IS1,T2:IS2,T3:IS3; +for(t1 = a; t1 <= min(b,a+9); t1++) { + s1(t1); +} +for(t1 = a+10; t1 <= min(b,a+19); t1++) { + s1(t1); + s2(t1); +} +for(t1 = a+20; t1 <= b; t1++) { + s1(t1); + s2(t1); + s3(t1); +} +for(t1 = max(a+10,b+1); t1 <= min(b+10,a+19); t1++) { + s2(t1); +} +for(t1 = max(a+20,b+1); t1 <= b+10; t1++) { + s2(t1); + s3(t1); +} +for(t1 = max(a+20,b+11); t1 <= b+20; t1++) { + s3(t1); +} + +>>> codegen 2 T1:IS1,T2:IS2,T3:IS3; +for(t1 = a; t1 <= min(b,a+9); t1++) { + s1(t1); +} +for(t1 = a+10; t1 <= min(b,a+19); t1++) { + s1(t1); + s2(t1); +} +for(t1 = a+20; t1 <= b; t1++) { + s1(t1); + s2(t1); + s3(t1); +} +for(t1 = max(a+10,b+1); t1 <= min(b+10,a+19); t1++) { + s2(t1); +} +for(t1 = max(a+20,b+1); t1 <= b+10; t1++) { + s2(t1); + s3(t1); +} +for(t1 = max(a+20,b+11); t1 <= b+20; t1++) { + s3(t1); +} + + diff --git a/omega/examples/old_test/wak4 b/omega/examples/old_test/wak4 new file mode 100644 index 0000000..48224b9 --- /dev/null +++ b/omega/examples/old_test/wak4 @@ -0,0 +1,9 @@ +symbolic a1,a2,a3,a4,a5,b1,b2,b3,b4,b5; +IS1 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; +IS2 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; + +T1 := {[i] -> [i,0]}; +T2 := {[i] -> [i,1]}; + +codegen T1:IS1,T2:IS2; +codegen 2 T1:IS1,T2:IS2; diff --git a/omega/examples/old_test/wak4.oc-rt b/omega/examples/old_test/wak4.oc-rt new file mode 100644 index 0000000..5f2cacd --- /dev/null +++ b/omega/examples/old_test/wak4.oc-rt @@ -0,0 +1,20 @@ +>>> Symbolic a1,a2,a3,a4,a5,b1,b2,b3,b4,b5; +>>> IS1 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; +>>> IS2 := {[i] : a1,a2,a3,a4,a5 <= i <= b1,b2,b3,b4,b5 }; +>>> +>>> T1 := {[i] -> [i,0]}; +>>> T2 := {[i] -> [i,1]}; +>>> +>>> codegen T1:IS1,T2:IS2; +for(t1 = max(a1,a2,a3,a4,a5); t1 <= min(b1,b2,b3,b4,b5); t1++) { + s1(t1); + s2(t1); +} + +>>> codegen 2 T1:IS1,T2:IS2; +for(t1 = max(a1,a2,a3,a4,a5); t1 <= min(b1,b2,b3,b4,b5); t1++) { + s1(t1); + s2(t1); +} + + diff --git a/omega/examples/old_test/wak5 b/omega/examples/old_test/wak5 new file mode 100644 index 0000000..1232b34 --- /dev/null +++ b/omega/examples/old_test/wak5 @@ -0,0 +1,4 @@ +S1 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 2 <= In_4 <= 1024 && 2 <= In_2 <= 1024}; +S2 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 < In_2 <= 1024}; + +Hull (S1 union S2); diff --git a/omega/examples/old_test/wak5.oc-rt b/omega/examples/old_test/wak5.oc-rt new file mode 100644 index 0000000..2d5830c --- /dev/null +++ b/omega/examples/old_test/wak5.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# S1 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 2 <= In_4 <= 1024 && 2 <= In_2 <= 1024}; +# +# S2 := {[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 < In_2 <= 1024}; +# +# +# Hull (S1 union S2); + +{[1,In_2,0,In_4,In_5,In_6,In_7]: 1 <= In_4 <= 1024 && 2 <= In_2 <= 1024} + +# diff --git a/omega/examples/old_test/wak6 b/omega/examples/old_test/wak6 new file mode 100644 index 0000000..c251ca6 --- /dev/null +++ b/omega/examples/old_test/wak6 @@ -0,0 +1,14 @@ +T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < i <= 1024 && k'+1 <= j <= 1024}; +T2 := {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024}; +T3 := {[k,k+1,k+1] -> [k+1,i',j'] : 1 <= k <= i'-2, j'-2 && j' <= 1024 && i' <= 1024}; + +# The following expression evaluates to FALSE, which I believe is incorrect: + +T3+; + +# And the following cause assertion failures: + +(T2 union T3)+; +(T1 union T2)+; + +# This comes from Guassian Elimination. diff --git a/omega/examples/old_test/wak6.oc-rt b/omega/examples/old_test/wak6.oc-rt new file mode 100644 index 0000000..458f5e9 --- /dev/null +++ b/omega/examples/old_test/wak6.oc-rt @@ -0,0 +1,36 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# T1 := {[k,i,j] -> [k',i,j] : 1 <= k < k' < i <= 1024 && k'+1 <= j <= 1024}; +# +# T2 := {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024}; +# +# T3 := {[k,k+1,k+1] -> [k+1,i',j'] : 1 <= k <= i'-2, j'-2 && j' <= 1024 && i' <= 1024}; +# +# +# # The following expression evaluates to FALSE, which I believe is incorrect: +# +# T3+; + +{[k,k+1,k+1] -> [Out_1,i,j] : 1 <= k < Out_1 < i <= 1024 && Out_1+1 <= j <= 1024} + +# +# +# # And the following cause assertion failures: +# +# (T2 union T3)+; + +{[k,k+1,k+1] -> [j',i',j''] : 1 <= k < j' < i' <= 1024 && j'+1 <= j'' <= 1024} union + {[k,i,i-1] -> [j',i',j''] : k+2 <= i <= j' < j'' <= 1024 && j' < i' <= 1024 && 1 <= k} union + {[k,i,j] -> [j',i',j''] : j+2 <= i <= j' < i' <= 1024 && 1 <= k < j && j' < j'' <= 1024} union + {[k,i,j] -> [j',i,j''] : 1 <= k < j < j' < i <= 1024 && j' < j'' <= 1024} union + {[k,i,j] -> [j,i,j''] : 1 <= k < j < i <= 1024 && j < j'' <= 1024} + +# +# (T1 union T2)+; + +{[k,i,j] -> [Out_1,i,j] : 1 <= k < Out_1 < i <= 1024 && Out_1+1 <= j <= 1024} union + {[k,i,j] -> [Out_1,i,j'] : 1 <= k < j < Out_1 < i <= 1024 && Out_1 < j' <= 1024} union + {[k,i,j] -> [j,i,j'] : 1 <= k < j < i <= 1024 && j < j' <= 1024} + +# +# +# # This comes from Guassian Elimination. diff --git a/omega/examples/old_test/wak7 b/omega/examples/old_test/wak7 new file mode 100644 index 0000000..b122c5a --- /dev/null +++ b/omega/examples/old_test/wak7 @@ -0,0 +1,5 @@ +R := {[k,k+1,k+1]: 1 <= k <= 1022} + union {[k,i,j]: 2 <= k < i <= 1024 && k < j <= 1024}; + +Hull R; + diff --git a/omega/examples/old_test/wak7.oc-rt b/omega/examples/old_test/wak7.oc-rt new file mode 100644 index 0000000..3ccdb0a --- /dev/null +++ b/omega/examples/old_test/wak7.oc-rt @@ -0,0 +1,11 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# R := {[k,k+1,k+1]: 1 <= k <= 1022} +# union {[k,i,j]: 2 <= k < i <= 1024 && k < j <= 1024}; +# +# +# Hull R; + +{[k,i,j]: k+1, 2 <= j <= 1024 && k < i <= 1024} + +# +# diff --git a/omega/examples/old_test/wak8 b/omega/examples/old_test/wak8 new file mode 100644 index 0000000..f55c2b9 --- /dev/null +++ b/omega/examples/old_test/wak8 @@ -0,0 +1,15 @@ + T1 := {[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 +&& o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 + && 255i3+o1 <= i1+255o3 && 1 <= i1}; + +T1; + + T2 := {[i1,i2,i3] -> [o1,i2,o3] : exists ( x: 2 <= i2 <= 511 + && 2 <= o3 <= 509 && o1 <= 256 + && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2x + && 2 <= i3 && i1+2o1+o3 <= i3+3x + && 255i3+511x <= i1+510o1+255o3 && 1 <= i1)}; + +T2; + + T1 compose T2; diff --git a/omega/examples/old_test/wak8.oc-rt b/omega/examples/old_test/wak8.oc-rt new file mode 100644 index 0000000..10ba68d --- /dev/null +++ b/omega/examples/old_test/wak8.oc-rt @@ -0,0 +1,30 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# T1 := {[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 +# && o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 +# && 255i3+o1 <= i1+255o3 && 1 <= i1}; +# +# +# T1; + +{[i1,i2,i3] -> [o1,i2,o3] : 2 <= i2 <= 511 && o1 <= 256 && o3 <= 511 && 2 <= i3 && i1+o3 <= i3+o1 && 255i3+o1 <= i1+255o3 && 1 <= i1} + +# +# +# T2 := {[i1,i2,i3] -> [o1,i2,o3] : Exists ( x: 2 <= i2 <= 511 +# && 2 <= o3 <= 509 && o1 <= 256 +# && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2x +# && 2 <= i3 && i1+2o1+o3 <= i3+3x +# && 255i3+511x <= i1+510o1+255o3 && 1 <= i1)}; +# +# +# T2; + +{[i1,i2,i3] -> [o1,i2,o3] : Exists ( alpha : 2 <= i2 <= 511 && 2 <= o3 <= 509 && o1 <= 256 && 3+i1+o3 <= i3+o1 && 2o1+o3 <= 511+2alpha && 2 <= i3 && i1+2o1+o3 <= i3+3alpha && 255i3+511alpha <= i1+510o1+255o3 && 1 <= i1)} + +# +# +# T1 compose T2; + +{[i1,i2,i3] -> [o1,i2,o3] : Exists ( alpha,beta,gamma : 2 <= i2 <= 511 && 2 <= gamma <= 509 && o1 <= 256 && o3 <= 511 && o3+alpha <= o1+gamma && o1+255gamma <= 255o3+alpha && gamma+2alpha <= 511+2beta && 1 <= i1 && 255i3+511beta <= i1+255gamma+510alpha && i1+gamma+2alpha <= i3+3beta && 2 <= i3 && 3+i1+gamma <= i3+alpha)} + +# diff --git a/omega/examples/old_test/wielage b/omega/examples/old_test/wielage new file mode 100644 index 0000000..f2e3911 --- /dev/null +++ b/omega/examples/old_test/wielage @@ -0,0 +1,13 @@ +{[k1,k2,k3] : +15+k1+2k2+3k3 = 0 + && k2+k3 <= 0 + && 0 <= 5+k2+k3 + && k3 <= 0 + && 0 <= 5+k3 + && k1+k2+k3 <= 0 + && 0 <= 5+k1+k2+k3 +}; + + +{[x] : exists (a,b : 0 <= x+4a <= 2 && 0 <= x+8b <= 6)}; + diff --git a/omega/examples/old_test/wielage.oc-rt b/omega/examples/old_test/wielage.oc-rt new file mode 100644 index 0000000..6c4b10a --- /dev/null +++ b/omega/examples/old_test/wielage.oc-rt @@ -0,0 +1,22 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# {[k1,k2,k3] : +# 15+k1+2k2+3k3 = 0 +# && k2+k3 <= 0 +# && 0 <= 5+k2+k3 +# && k3 <= 0 +# && 0 <= 5+k3 +# && k1+k2+k3 <= 0 +# && 0 <= 5+k1+k2+k3 +# }; + +{[0,0,-5]} + +# +# +# +# {[x] : exists (a,b : 0 <= x+4a <= 2 && 0 <= x+8b <= 6)}; + +{[x]: Exists ( alpha,beta : -4alpha <= x <= -4alpha+2, -8beta+6 && alpha <= 2beta)} + +# +# diff --git a/omega/examples/old_test/wild b/omega/examples/old_test/wild new file mode 100644 index 0000000..7c43e3c --- /dev/null +++ b/omega/examples/old_test/wild @@ -0,0 +1,13 @@ +symbolic L,M; + +I := {[j,i] : 1 <= j <= 100 && j-L <= i <= j}; + +D := I*I intersection {[j1,i1] -> [j2,i2] : i1+j1 = i2+M}; +I; +D; +range D; +(range D) - (range D); +E := I - range D; +sample := {[-M+3,-M+3]: L = 0 && -97 <= M <= 2}; +sample intersection range D; +sample intersection E; diff --git a/omega/examples/old_test/wild.oc-rt b/omega/examples/old_test/wild.oc-rt new file mode 100644 index 0000000..811519b --- /dev/null +++ b/omega/examples/old_test/wild.oc-rt @@ -0,0 +1,43 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic L,M; +# +# +# I := {[j,i] : 1 <= j <= 100 && j-L <= i <= j}; +# +# +# D := I*I intersection {[j1,i1] -> [j2,i2] : i1+j1 = i2+M}; +# +# I; + +{[j,i]: 1, i <= j <= 100 && j <= L+i} + +# +# D; + +{[In_1,In_2] -> [Out_1,In_1-M+In_2] : 1, In_2 <= In_1 <= 100 && 1 <= Out_1 <= 100 && In_1 <= L+In_2 && M+Out_1 <= L+In_1+In_2 && In_1+In_2 <= M+Out_1} + +# +# range D; + +{[In_1,In_2]: Exists ( alpha : 1, In_2 <= In_1 <= 100 && M <= -In_2+200 && 2 <= M+L+In_2 && M+In_2 <= L+2alpha && 2alpha <= M+In_2 && In_1 <= L+In_2)} + +# +# (range D) - (range D); + +{[In_1,In_2] : FALSE } + +# +# E := I - range D; +# +# sample := {[-M+3,-M+3]: L = 0 && -97 <= M <= 2}; +# +# sample intersection range D; + +{[In_1,In_2] : FALSE } + +# +# sample intersection E; + +{[-M+3,-M+3]: L = 0 && -97 <= M <= 2} + +# diff --git a/omega/examples/old_test/wrap b/omega/examples/old_test/wrap new file mode 100644 index 0000000..895c51b --- /dev/null +++ b/omega/examples/old_test/wrap @@ -0,0 +1,12 @@ +symbolic n; +I := {[i,j,k] : 1 <= i,j,k <= n}; +R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} + union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +R1; +R1+; +R1+ within I; +R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} + union R1; +R2; +R2+; +R2+ within I; diff --git a/omega/examples/old_test/wrap.oc-rt b/omega/examples/old_test/wrap.oc-rt new file mode 100644 index 0000000..0729e41 --- /dev/null +++ b/omega/examples/old_test/wrap.oc-rt @@ -0,0 +1,50 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# I := {[i,j,k] : 1 <= i,j,k <= n}; +# +# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} +# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +# +# R1; + +{[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} union + {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} + +# +# R1+; + +{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# +# R1+ within I; + +{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# +# R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} +# union R1; +# +# R2; + +{[i,n,n] -> [i+1,1,1] : 1 <= i < n} union + {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} union + {[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} + +# +# R2+; + +{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# +# R2+ within I; + +{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# diff --git a/omega/examples/old_test/wrap0 b/omega/examples/old_test/wrap0 new file mode 100644 index 0000000..ca914af --- /dev/null +++ b/omega/examples/old_test/wrap0 @@ -0,0 +1,7 @@ +symbolic n; +I := {[i,j,k] : 1 <= i,j,k <= n}; +R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} + union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +R1; +R1+ within I; +R1+; diff --git a/omega/examples/old_test/wrap0.oc-rt b/omega/examples/old_test/wrap0.oc-rt new file mode 100644 index 0000000..d9c7d34 --- /dev/null +++ b/omega/examples/old_test/wrap0.oc-rt @@ -0,0 +1,26 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# I := {[i,j,k] : 1 <= i,j,k <= n}; +# +# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} +# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +# +# R1; + +{[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} union + {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} + +# +# R1+ within I; + +{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# +# R1+; + +{[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# diff --git a/omega/examples/old_test/wrap1 b/omega/examples/old_test/wrap1 new file mode 100644 index 0000000..d862a5a --- /dev/null +++ b/omega/examples/old_test/wrap1 @@ -0,0 +1,8 @@ +symbolic n; +I := {[i,j,k] : 1 <= i,j,k <= n}; +R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} + union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} + union R1; +R2; +R2+ within I; diff --git a/omega/examples/old_test/wrap1.oc-rt b/omega/examples/old_test/wrap1.oc-rt new file mode 100644 index 0000000..9e43201 --- /dev/null +++ b/omega/examples/old_test/wrap1.oc-rt @@ -0,0 +1,25 @@ +# Omega Calculator v1.2 (based on Omega Library 1.2, August, 2000): +# symbolic n; +# +# I := {[i,j,k] : 1 <= i,j,k <= n}; +# +# R1 := {[i,j,n] -> [i,j+1,1] : 1 <= i,j,j+1 <= n} +# union {[i,j,k] -> [i,j,k'] : 1 <= i,j,k,k' <= n && k' = k+1}; +# +# R2 := {[i,n,n] -> [i+1,1,1] : 1 <= i,i+1 <= n} +# union R1; +# +# R2; + +{[i,n,n] -> [i+1,1,1] : 1 <= i < n} union + {[i,j,k] -> [i,j,k+1] : 1 <= i <= n && 1 <= j <= n && 1 <= k < n} union + {[i,j,n] -> [i,j+1,1] : 1 <= i <= n && 1 <= j < n} + +# +# R2+ within I; + +{[i,j,k] -> [i',j',k'] : 1 <= i < i' <= n && 1 <= j <= n && 1 <= k <= n && 1 <= j' <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j',k'] : 1 <= j < j' <= n && 1 <= i <= n && 1 <= k <= n && 1 <= k' <= n} union + {[i,j,k] -> [i,j,k'] : 1 <= k < k' <= n && 1 <= i <= n && 1 <= j <= n} + +# diff --git a/omega/examples/old_test/x b/omega/examples/old_test/x new file mode 100644 index 0000000..56c23ca --- /dev/null +++ b/omega/examples/old_test/x @@ -0,0 +1,9 @@ +old_IS:= {[i,j]: 1 <= i <= 8 & 1 <= j <= 4}; +T1:={[i,j] -> [j-i+8,i,0]}; +T2:={[i,j] -> [i+j-1,i,1]}; +n1:= T1 \ old_IS; +n1; +n2:= T2 \ old_IS; +n2; +codegen T1:old_IS,T2:old_IS; +codegen 2 T1:old_IS,T2:old_IS; diff --git a/omega/examples/old_test/x.oc-rt b/omega/examples/old_test/x.oc-rt new file mode 100644 index 0000000..fc77e1a --- /dev/null +++ b/omega/examples/old_test/x.oc-rt @@ -0,0 +1,84 @@ +>>> old_IS:= {[i,j]: 1 <= i <= 8 & 1 <= j <= 4}; +>>> T1:={[i,j] -> [j-i+8,i,0]}; +>>> T2:={[i,j] -> [i+j-1,i,1]}; +>>> n1:= T1 \ old_IS; +>>> n1; +{[i,j] -> [j-i+8,i,0] : 1 <= i <= 8 && 1 <= j <= 4} +>>> n2:= T2 \ old_IS; +>>> n2; +{[i,j] -> [i+j-1,i,1] : 1 <= i <= 8 && 1 <= j <= 4} +>>> codegen T1:old_IS,T2:old_IS; +for(t1 = 1; t1 <= 11; t1++) { + for(t2 = max(t1-3,1); t2 <= min(t1,-t1+8); t2++) { + s2(t2,t1-t2+1); + } + for(t2 = max(-t1+9,1); t2 <= min(-t1+12,t1-4); t2++) { + s1(t2,t1+t2-8); + } + for(t2 = max(-t1+9,t1-3); t2 <= min(-t1+12,t1); t2++) { + s1(t2,t1+t2-8); + s2(t2,t1-t2+1); + } + for(t2 = max(-t1+9,t1+1); t2 <= min(-t1+12,8); t2++) { + s1(t2,t1+t2-8); + } + for(t2 = max(t1-3,-t1+13); t2 <= min(t1,8); t2++) { + s2(t2,t1-t2+1); + } +} + +>>> codegen 2 T1:old_IS,T2:old_IS; +for(t1 = 1; t1 <= 3; t1++) { + for(t2 = 1; t2 <= t1; t2++) { + s2(t2,t1-t2+1); + } + for(t2 = -t1+9; t2 <= 8; t2++) { + s1(t2,t1+t2-8); + } +} +for(t2 = 1; t2 <= 4; t2++) { + s2(t2,-t2+5); +} +for(t2 = 5; t2 <= 8; t2++) { + s1(t2,t2-4); +} +for(t2 = 2; t2 <= 3; t2++) { + s2(t2,-t2+6); +} +for(t2 = 4; t2 <= 5; t2++) { + s1(t2,t2-3); + s2(t2,-t2+6); +} +for(t2 = 6; t2 <= 7; t2++) { + s1(t2,t2-3); +} +for(t2 = 3; t2 <= 6; t2++) { + s1(t2,t2-2); + s2(t2,-t2+7); +} +for(t2 = 2; t2 <= 3; t2++) { + s1(t2,t2-1); +} +for(t2 = 4; t2 <= 5; t2++) { + s1(t2,t2-1); + s2(t2,-t2+8); +} +for(t2 = 6; t2 <= 7; t2++) { + s2(t2,-t2+8); +} +for(t2 = 1; t2 <= 4; t2++) { + s1(t2,t2); +} +for(t2 = 5; t2 <= 8; t2++) { + s2(t2,-t2+9); +} +for(t1 = 9; t1 <= 11; t1++) { + for(t2 = 1; t2 <= -t1+12; t2++) { + s1(t2,t1+t2-8); + } + for(t2 = t1-3; t2 <= 8; t2++) { + s2(t2,t1-t2+1); + } +} + + |