diff options
| author | Derick Huth <derickhuth@gmail.com> | 2016-01-18 15:43:52 -0700 | 
|---|---|---|
| committer | Derick Huth <derickhuth@gmail.com> | 2016-01-18 15:43:52 -0700 | 
| commit | 983749787ee0dc1beb1107873e8a13ebdaeba576 (patch) | |
| tree | e9bff337b4d5582b87ad2edc25baa4d3b0c163fa /test-chill/test-cases/examples/chill | |
| parent | 0cff3f9a3c4ccd434900162ebef4bd814850f481 (diff) | |
| download | chill-983749787ee0dc1beb1107873e8a13ebdaeba576.tar.gz chill-983749787ee0dc1beb1107873e8a13ebdaeba576.tar.bz2 chill-983749787ee0dc1beb1107873e8a13ebdaeba576.zip | |
restore test suite
Diffstat (limited to 'test-chill/test-cases/examples/chill')
32 files changed, 703 insertions, 0 deletions
| diff --git a/test-chill/test-cases/examples/chill/gemm.c b/test-chill/test-cases/examples/chill/gemm.c new file mode 100644 index 0000000..2c90ea5 --- /dev/null +++ b/test-chill/test-cases/examples/chill/gemm.c @@ -0,0 +1,25 @@ + +#ifndef N +#define N 512 +#endif + +/* +<test name=gemm define="{'N':512}"> +procedure int gemm( +    in  float[N][N] a = matrix([,], lambda i,j: random(2,-2)), +    in  float[N][N] b = matrix([,], lambda i,j: random(2,-2)), +    out float[N][N] c = matrix([,], lambda i,j: 0)) +</test> +*/ +int gemm(float a[N][N], float b[N][N], float c[N][N]) { +	int i, j, k; +	int n = N; +	for (j = 0; j < n; j++) +		for (k = 0; k < n; k++) +			for (i = 0; i < n; i++) { +				c[i][j] = c[i][j] + a[i][k] * b[k][j]; +			} + +	return 0; +} + diff --git a/test-chill/test-cases/examples/chill/gemm.script b/test-chill/test-cases/examples/chill/gemm.script new file mode 100644 index 0000000..393f236 --- /dev/null +++ b/test-chill/test-cases/examples/chill/gemm.script @@ -0,0 +1,31 @@ +#matrix multiply large array size for intel machine +source: gemm.c +procedure: gemm +format: rose +loop: 0 + +TI = 128 +TJ = 8 +TK = 512 +UI = 2 +UJ = 2 + +permute([3,1,2]) +tile(0,2,TJ) +#print space +tile(0,2,TI) +#print space +tile(0,5,TK) +#print space + +datacopy(0,3,a,false,1) +#print space + +datacopy(0,4,b) +print +unroll(0,4,UI)#print space +print  +unroll(0,5,UJ) +#print space +print + diff --git a/test-chill/test-cases/examples/chill/gemv.c b/test-chill/test-cases/examples/chill/gemv.c new file mode 100644 index 0000000..39b083c --- /dev/null +++ b/test-chill/test-cases/examples/chill/gemv.c @@ -0,0 +1,21 @@ +#ifndef N +#define N 512 +#endif + +/* +<test name=gemv define="{'N':512}"> +procedure int gemv( +    out float[N]    a = matrix([],  lambda i:   random(2,-2)), +    in  float[N]    b = matrix([],  lambda i:   random(2,-2)), +    in  float[N][N] c = matrix([,], lambda i,j: random(2,-2))) +</test> +*/ +int gemv(float a[N], float b[N], float c[N][N]) { +    int i, j; + +    for (i = 1; i < N; i++) +        for (j = 1; j < N; j++) +            a[i] = a[i] + c[i][j] * b[j]; + +    return 0; +} diff --git a/test-chill/test-cases/examples/chill/gemv.script b/test-chill/test-cases/examples/chill/gemv.script new file mode 100644 index 0000000..73b3b58 --- /dev/null +++ b/test-chill/test-cases/examples/chill/gemv.script @@ -0,0 +1,9 @@ +source: gemv.c # matrix-vector multiply +procedure: gemv +format : rose +loop: 0 + + + +original() +print diff --git a/test-chill/test-cases/examples/chill/jacobi1.c b/test-chill/test-cases/examples/chill/jacobi1.c new file mode 100644 index 0000000..e7ff8f8 --- /dev/null +++ b/test-chill/test-cases/examples/chill/jacobi1.c @@ -0,0 +1,19 @@ + +#ifndef N +#define N 512 +#endif + +/* +<test name=jacobi define="{'N':512}"> +procedure int jacobi( +    in out float[N][N] a = matrix [i,j] random(2,-2)) +</test> +*/ +int jacobi(float a[N][N]) { +    int t, i; +	for (t = 2; t <= 100; t++) +		for (i = 2; i <= N - 1; i++) +			a[t][i] = a[t - 1][i - 1] + a[t - 1][i] + a[t - 1][i + 1]; + +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/jacobi1.script b/test-chill/test-cases/examples/chill/jacobi1.script new file mode 100644 index 0000000..604f763 --- /dev/null +++ b/test-chill/test-cases/examples/chill/jacobi1.script @@ -0,0 +1,18 @@ +# +# tiling perfect jacobi loop nest with time step, use +# unimodular transformation first (only applicable to the +# perfect loop nest) to make tiling legal. +# + +source: jacobi1.c +procedure: jacobi +format : rose +loop: 0 + +print dep + +nonsingular([[1,0],[1,1]])  # unimodular matrix, determinant is one +tile(0,2,64) + +print dep +print diff --git a/test-chill/test-cases/examples/chill/jacobi2.c b/test-chill/test-cases/examples/chill/jacobi2.c new file mode 100644 index 0000000..b8d8d7b --- /dev/null +++ b/test-chill/test-cases/examples/chill/jacobi2.c @@ -0,0 +1,15 @@ +#define N 512 + +int main() { +	double a[N]; +	double b[N]; +	int t, i; +	for (t = 1; t <= 100; t++) { +		for (i = 2; i <= N - 1; i++) +			b[i] = (double) 0.25 * (a[i - 1] + a[i + 1]) + (double) 0.5 * a[i]; + +		for (i = 2; i <= N - 1; i++) +			a[i] = b[i]; +	} +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/jacobi2.script b/test-chill/test-cases/examples/chill/jacobi2.script new file mode 100644 index 0000000..afe14c6 --- /dev/null +++ b/test-chill/test-cases/examples/chill/jacobi2.script @@ -0,0 +1,21 @@ +# +# tiling imperfect jacobi loop nest, more details in the paper +# "Automatic Tiling of Iterative Stencil Loops" by Zhiyuan Li and +# Yonghong Song, TOPLAS, 2004. +# + +source: jacobi2.c +procedure: main +format: rose +loop: 0 + +print dep + +original() +shift([1], 2, 1) +fuse([0,1], 2)  # optional +skew([0,1], 2, [2,1]) +tile(0, 2, 32, 1) + +print dep +print diff --git a/test-chill/test-cases/examples/chill/qr.c b/test-chill/test-cases/examples/chill/qr.c new file mode 100644 index 0000000..8d18b72 --- /dev/null +++ b/test-chill/test-cases/examples/chill/qr.c @@ -0,0 +1,44 @@ +#include <math.h> + +int main() { + +	int M, N; +	float** A; +	float *s; +	float *Rdiag; +	float *nrm; +	int i, j, k; +        float t; +	for (k = 0; k < N; k++) { +		nrm[k] = 0; + +		for (i = k; i < M; i++) +			nrm[k] = sqrt(nrm[k] * nrm[k] + A[i][k] * A[i][k]); +                //t = A[k][k]; + +		//if (t < 0) +		//	nrm[k] = -nrm[k]; +		for (i = k; i < M; i++) +			A[i][k] = A[i][k] / nrm[k]; + +		A[k][k] = A[k][k] + 1; + +		for (j = k + 1; j < N; j++) { +			s[j] = 0; //S6 + +			for (i = k; i < M; i++) +				s[j] = s[j] + A[i][k] * A[i][j]; //S7 + +			s[j] = -s[j] / A[k][k]; //S8 + +			for (i = k; i < M; i++) +				A[i][j] = A[i][j] + s[j] * A[i][k]; //S9 + +		} + +		Rdiag[k] = -nrm[k]; + +	} + +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/qr.script b/test-chill/test-cases/examples/chill/qr.script new file mode 100644 index 0000000..6b4cd46 --- /dev/null +++ b/test-chill/test-cases/examples/chill/qr.script @@ -0,0 +1,13 @@ +# +# tiling imperfect jacobi loop nest, more details in the paper +# "Automatic Tiling of Iterative Stencil Loops" by Zhiyuan Li and +# Yonghong Song, TOPLAS, 2004. +# + +source: qr.c +procedure: main +format: rose +loop: 0 +original() +print  + diff --git a/test-chill/test-cases/examples/chill/scalar_test.c b/test-chill/test-cases/examples/chill/scalar_test.c new file mode 100644 index 0000000..733c882 --- /dev/null +++ b/test-chill/test-cases/examples/chill/scalar_test.c @@ -0,0 +1,16 @@ +int a[10][10]; +int main() { + +	int temp; +	int i, j; + +	for (i = 0; i < 10; i++) { +		for (j = 0; j < 10; j++) { +			a[i + 1][j - 1] = a[i][j]; +		} + +	} + +	return 0; + +} diff --git a/test-chill/test-cases/examples/chill/scalar_test.script b/test-chill/test-cases/examples/chill/scalar_test.script new file mode 100644 index 0000000..f5b0aa8 --- /dev/null +++ b/test-chill/test-cases/examples/chill/scalar_test.script @@ -0,0 +1,10 @@ +#Simple Scalar dependence check +source: scalar_test.c +procedure: main +format : rose +loop: 0 + +original() +permute([2,1]) +print dep +print space diff --git a/test-chill/test-cases/examples/chill/swim.c b/test-chill/test-cases/examples/chill/swim.c new file mode 100644 index 0000000..a21ef24 --- /dev/null +++ b/test-chill/test-cases/examples/chill/swim.c @@ -0,0 +1,159 @@ +#define M 100 +#define N 100 +#define  N3 10  + +int main() { + +	int DX; +	int DY; +	int FSDX; +	int FSDY; +	int TDT; +	int TDTS8; +	int TDTSDX; +	int TDTSDY; +	int t, i, j; +	double CU[M + 1][N + 1]; +	double CV[M + 1][N + 1]; +	double Z[M + 1][N + 1]; +	double H[M + 1][N + 1]; +	double P[M + 1][N + 1]; +	double U[M + 1][N + 1]; +	double V[M + 1][N + 1]; +	double UNEW[M + 1][N + 1]; +	double UOLD[M + 1][N + 1]; +	double PNEW[M + 1][N + 1]; +	double POLD[M + 1][N + 1]; +	double VNEW[M + 1][N + 1]; +	double VOLD[M + 1][N + 1]; +	double ALPHA; + +	for (t = 0; t < N3; t++) { + +		FSDX = 4 / DX; +		FSDY = 4 / DY; + +		for (i = 0; i < M; i++) { +			for (j = 0; j < N; j++) { +				CU[i + 1][j] = (double) 0.5 * (P[i + 1][j] + P[i][j]) +						* U[i + 1][j]; +				CV[i][j + 1] = (double) 0.5 * (P[i][j + 1] + P[i][j]) +						* V[i][j + 1]; +				Z[i + 1][j + 1] = +						(FSDX * (V[i + 1][j + 1] - V[i][j + 1]) +								- FSDY * (U[i + 1][j + 1] - U[i + 1][j])) +								/ (P[i][j] + P[i + 1][j] + P[i + 1][j + 1] +										+ P[i][j + 1]); +				H[i][j] = P[i][j] +						+ (double) 0.25 +								* (U[i + 1][j] * U[i + 1][j] + U[i][j] * U[i][j] +										+ V[i][j + 1] * V[i][j + 1] +										+ V[i][j] * V[i][j]); +			} +		} + +		for (j = 0; j < N; j++) { +			// CU[0][j] = CU[M+1][j]; +			CU[0][j] = CU[M][j]; +			CV[M][j + 1] = CV[0][j + 1]; +			Z[0][j + 1] = Z[M][j + 1]; +			H[M][j] = H[0][j]; +		} + +		for (i = 0; i < M; i++) { +			CU[i + 1][N] = CU[i + 1][0]; +			CV[i][0] = CV[i][N]; +			Z[i + 1][0] = Z[i + 1][N]; +			H[i][N] = H[i][0]; +		} + +		CU[0][N] = CU[M][0]; +		CV[M][0] = CV[0][N]; +		Z[0][0] = Z[M][N]; +		H[M][N] = H[0][0]; + +		TDTS8 = TDT / 8; +		TDTSDX = TDT / DX; +		TDTSDY = TDT / DY; + +		for (i = 0; i < M; i++) { +			for (j = 0; j < N; j++) { +				UNEW[i + 1][j] = UOLD[i + 1][j] +						+ TDTS8 * (Z[i + 1][j + 1] + Z[i + 1][j]) +								* (CV[i + 1][j + 1] + CV[i][j + 1] + CV[i][j] +										+ CV[i + 1][j]) +						- TDTSDX * (H[i + 1][j] - H[i][j]); +				VNEW[i][j + 1] = VOLD[i][j + 1] +						- TDTS8 * (Z[i + 1][j + 1] + Z[i][j + 1]) +								* (CU[i + 1][j + 1] + CU[i][j + 1] + CU[i][j] +										+ CU[i + 1][j]) +						- TDTSDY * (H[i][j + 1] - H[i][j]); +				PNEW[i][j] = POLD[i][j] - TDTSDX * (CU[i + 1][j] - CU[i][j]) +						- TDTSDY * (CV[i][j + 1] - CV[i][j]); +			} +		} +		for (j = 0; j < N; j++) { +			UNEW[0][j] = UNEW[M][j]; +			VNEW[M][j + 1] = VNEW[0][j + 1]; +			PNEW[M][j] = PNEW[0][j]; +		} + +		for (i = 0; i < M; i++) { +			UNEW[i + 1][N] = UNEW[i + 1][0]; +			VNEW[i][0] = VNEW[i][N]; +			PNEW[i][N] = PNEW[i][0]; +		} + +		UNEW[0][N] = UNEW[M][0]; +		VNEW[M][0] = VNEW[0][N]; +		PNEW[M][N] = PNEW[0][0]; +		// time = time + DT; + +		for (i = 0; i < M; i++) { +			for (j = 0; j < N; j++) { +				UOLD[i][j] = U[i][j] +						+ ALPHA +								* (UNEW[i][j] - (double) 2 * U[i][j] +										+ UOLD[i][j]); +				VOLD[i][j] = V[i][j] +						+ ALPHA +								* (VNEW[i][j] - (double) 2 * V[i][j] +										+ VOLD[i][j]); +				POLD[i][j] = P[i][j] +						+ ALPHA +								* (PNEW[i][j] - (double) 2 * P[i][j] +										+ POLD[i][j]); +				U[i][j] = UNEW[i][j]; +				V[i][j] = VNEW[i][j]; +				P[i][j] = PNEW[i][j]; +			} +		} + +		for (j = 0; j < N; j++) { +			UOLD[M][j] = UOLD[0][j]; +			VOLD[M][j] = VOLD[0][j]; +			POLD[M][j] = POLD[0][j]; +			U[M][j] = U[0][j]; +			V[M][j] = V[0][j]; +			P[M][j] = P[0][j]; +		} + +		for (i = 0; i < M; i++) { +			UOLD[i][N] = UOLD[i][0]; +			VOLD[i][N] = VOLD[i][0]; +			POLD[i][N] = POLD[i][0]; +			U[i][N] = U[i][0]; +			V[i][N] = V[i][0]; +			P[i][N] = P[i][0]; +		} + +		UOLD[M][N] = UOLD[0][0]; +		VOLD[M][N] = VOLD[0][0]; +		POLD[M][N] = POLD[0][0]; +		U[M][N] = U[0][0]; +		V[M][N] = V[0][0]; +		P[M][N] = P[0][0]; + +	} +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/swim.script b/test-chill/test-cases/examples/chill/swim.script new file mode 100644 index 0000000..79de9d9 --- /dev/null +++ b/test-chill/test-cases/examples/chill/swim.script @@ -0,0 +1,13 @@ +# +# tiling imperfect jacobi loop nest, more details in the paper +# "Automatic Tiling of Iterative Stencil Loops" by Zhiyuan Li and +# Yonghong Song, TOPLAS, 2004. +# + +source: swim.c +procedure: main +format: rose +loop: 0 +original() +#print space +print diff --git a/test-chill/test-cases/examples/chill/test_align.c b/test-chill/test-cases/examples/chill/test_align.c new file mode 100644 index 0000000..d1365ca --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_align.c @@ -0,0 +1,20 @@ +int main() { + +	int m, n; +	int a[10], b[10]; +	int i, j; +	for (i = 0; i < n; i++) { +		for (j = 0; j < n; j++) { +			a[i] = 1; +		} + +		for (j = 0; j < n; j++) { +			b[i] -= 1; +		} + +	} + +	return 0; + +} + diff --git a/test-chill/test-cases/examples/chill/test_align.script b/test-chill/test-cases/examples/chill/test_align.script new file mode 100644 index 0000000..c990e22 --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_align.script @@ -0,0 +1,12 @@ +#matrix multiply large array size for intel machine +source: test_align.c +procedure: main +format: rose +loop: 0 + +original() + + + +print + diff --git a/test-chill/test-cases/examples/chill/test_fusion.c b/test-chill/test-cases/examples/chill/test_fusion.c new file mode 100644 index 0000000..bd2c4f2 --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_fusion.c @@ -0,0 +1,13 @@ +int main() { + +	int a[10][10]; +	int i, j; +	for (i = 0; i < 10; i++) { +		for (j = 0; j < 10; j++) +			a[i][j] = a[i][j] + 5; +		for (j = 0; j < 10; j++) +			a[i][j + 1] = a[i][j + 1] + 5; + +	} + +} diff --git a/test-chill/test-cases/examples/chill/test_fusion.script b/test-chill/test-cases/examples/chill/test_fusion.script new file mode 100644 index 0000000..41f6cc0 --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_fusion.script @@ -0,0 +1,7 @@ +source: test_fusion.c +procedure: main +loop: 0 +original() +fuse([0,1],2) +print + diff --git a/test-chill/test-cases/examples/chill/test_lex_order.c b/test-chill/test-cases/examples/chill/test_lex_order.c new file mode 100644 index 0000000..1a3b26d --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_lex_order.c @@ -0,0 +1,31 @@ +int main() { + +	int m, n; +	int a[10]; +        int b[10];  +        int c[10]; +	int i, j; +	for (i = 0; i < n; i++) { +		for (j = 0; j < n; j++) { +			b[j] = a[j]; +		} + +            +                 +                for (j = 0; j < n; j++) { +			a[j+1] = 6; +		} + +                for (j = 0; j < n; j++) { +			c[j] = a[j]; +		} + + +        + +	} + +	return 0; + +} + diff --git a/test-chill/test-cases/examples/chill/test_lex_order.script b/test-chill/test-cases/examples/chill/test_lex_order.script new file mode 100644 index 0000000..2629e50 --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_lex_order.script @@ -0,0 +1,12 @@ +#matrix multiply large array size for intel machine +source: test_lex_order.c +procedure: main +format: rose +loop: 0 + +original() + + + +print + diff --git a/test-chill/test-cases/examples/chill/test_split.c b/test-chill/test-cases/examples/chill/test_split.c new file mode 100644 index 0000000..6ca62cc --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_split.c @@ -0,0 +1,14 @@ +int main() { + +	int a[10][10][10][10]; +	int i, j, k, l; + +	for (i = 0; i < 10; i++) +		for (j = 0; j < 10; j++) +			for (k = 0; k < 10; k++) +				for (l = 0; l < 10; l++) +					a[i][j][k + 1][l] = a[i][j][k][l]; +	//    a[i+1][j-1] = a[i][j]; + +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/test_split.script b/test-chill/test-cases/examples/chill/test_split.script new file mode 100644 index 0000000..e1ebba9 --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_split.script @@ -0,0 +1,9 @@ +source: test_split.c +procedure: main +format: rose +loop: 0 +original() +N=10 +split(0,1, L3-L2-L4 <= 5)   +print + diff --git a/test-chill/test-cases/examples/chill/test_split2.c b/test-chill/test-cases/examples/chill/test_split2.c new file mode 100644 index 0000000..1ab8e43 --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_split2.c @@ -0,0 +1,14 @@ +int main() { + +	int a[10][10][10][10]; +	int i, j, k, l; + +	for (i = 0; i < 10; i++) +		for (j = 0; j < 10; j++) +			for (k = 0; k < 10; k++) +				for (l = 0; l < 10; l++) +					a[i][j][k + 1][l - 1] = a[i][j][k][l]; +	//    a[i+1][j-1] = a[i][j]; + +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/test_split2.script b/test-chill/test-cases/examples/chill/test_split2.script new file mode 100644 index 0000000..bcaa2a0 --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_split2.script @@ -0,0 +1,9 @@ +source: test_split2.c +procedure: main +format: rose +loop: 0 +original() +N=10 +split(0,1, L4 <= 5)   +print + diff --git a/test-chill/test-cases/examples/chill/test_tile.c b/test-chill/test-cases/examples/chill/test_tile.c new file mode 100644 index 0000000..aeaaefc --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_tile.c @@ -0,0 +1,16 @@ +void func(int n) { + +	int i; +	int a[10]; + +	for (i = 0; i < n; i++) +		a[i] = 2; + +} + +int main() { + +	func(10); + +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/test_tile.script b/test-chill/test-cases/examples/chill/test_tile.script new file mode 100644 index 0000000..d437145 --- /dev/null +++ b/test-chill/test-cases/examples/chill/test_tile.script @@ -0,0 +1,14 @@ +#matrix multiply large array size for intel machine +source: test_tile.c +procedure: func +format : rose +loop: 0 + +original() +#permute([3,2,1]) +tile(0,1,4) + + + +print + diff --git a/test-chill/test-cases/examples/chill/tile_violation.c b/test-chill/test-cases/examples/chill/tile_violation.c new file mode 100644 index 0000000..d719e52 --- /dev/null +++ b/test-chill/test-cases/examples/chill/tile_violation.c @@ -0,0 +1,12 @@ +int main() { + +	int i, j, k; +	int a[10][10][10]; + +	for (i = 0; i < 10; i++) +		for (j = 0; j < 10; j++) +			for (k = 0; k < 10; k++) +				a[i][j + 1][k - 1] = a[i][j][k]; + +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/tile_violation.script b/test-chill/test-cases/examples/chill/tile_violation.script new file mode 100644 index 0000000..57d1423 --- /dev/null +++ b/test-chill/test-cases/examples/chill/tile_violation.script @@ -0,0 +1,14 @@ +#matrix multiply large array size for intel machine +source: tile_violation.c +procedure: main +format :rose +loop: 0 + +original() +#permute([3,2,1]) +tile(0,3,2,1) + + + +print + diff --git a/test-chill/test-cases/examples/chill/unroll.c b/test-chill/test-cases/examples/chill/unroll.c new file mode 100644 index 0000000..68f4633 --- /dev/null +++ b/test-chill/test-cases/examples/chill/unroll.c @@ -0,0 +1,31 @@ +#define N 14 +void foo(int n, float* x, float* y, float* z, float* f3, float* f1, float* w) { +	int dt; + +	int i, j; + +	for (i = 1; i <= 14; i++) +		x[i] = 1.0; + +	for (i = 1; i <= 14; i += 3) +		y[i] = 1.0; + +	for (i = N + 1; i <= N + 20; i += 3) +		z[i] = 1.0; + +	for (i = 0; i <= N; i++) { +		for (j = i; j <= i + N; j++) +			f3[i] = f3[i] + f1[j] * w[j - i]; +		f3[i] = f3[i] * dt; +	} + +	return 0; +} + +int main() { +	float x[N], y[N], z[N], f3[N], f1[N], w[N]; + +	foo(N, x, y, z, f3, f1, w); +	return 0; +} + diff --git a/test-chill/test-cases/examples/chill/unroll.script b/test-chill/test-cases/examples/chill/unroll.script new file mode 100644 index 0000000..e64acb6 --- /dev/null +++ b/test-chill/test-cases/examples/chill/unroll.script @@ -0,0 +1,35 @@ +# +# Test unroll-and-jam. The last loop adapted from the simple +# convolution example from p463 of "Optimizing Compilers for +# Modern Architectures", by Randy Allen and Ken Kennedy. +# + +source: unroll.c +procedure: foo +format: rose +# fully unroll a loop with known iteration count +loop: 0 +original() +unroll(0,1,3) +print +print space + + +# a strided loop +loop: 1 +original() +unroll(0,1,2) +print +print space + +# lower and upper bounds are not constant +loop: 2 +original() +unroll(0,1,20) +print + +# parallelogram iteration space +loop: 3 +original() +unroll(0,1,2) +print diff --git a/test-chill/test-cases/examples/chill/unroll_violation.c b/test-chill/test-cases/examples/chill/unroll_violation.c new file mode 100644 index 0000000..d719e52 --- /dev/null +++ b/test-chill/test-cases/examples/chill/unroll_violation.c @@ -0,0 +1,12 @@ +int main() { + +	int i, j, k; +	int a[10][10][10]; + +	for (i = 0; i < 10; i++) +		for (j = 0; j < 10; j++) +			for (k = 0; k < 10; k++) +				a[i][j + 1][k - 1] = a[i][j][k]; + +	return 0; +} diff --git a/test-chill/test-cases/examples/chill/unroll_violation.script b/test-chill/test-cases/examples/chill/unroll_violation.script new file mode 100644 index 0000000..019473d --- /dev/null +++ b/test-chill/test-cases/examples/chill/unroll_violation.script @@ -0,0 +1,14 @@ +#matrix multiply large array size for intel machine +source: unroll_violation.c +procedure: main +format: rose +loop: 0 + +original() +#permute([3,2,1]) +unroll(0,2,2) + + + +print + | 
