From 67a98949479fb70fb59dd6a4cdba8e812ffe40cd Mon Sep 17 00:00:00 2001 From: markhallutah Date: Thu, 11 Sep 2014 15:54:23 -0600 Subject: fixed some chill examples with use of uninitialized variables --- examples/chill/gemm.c | 13 ++++++++----- examples/chill/unroll.c | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/chill/gemm.c b/examples/chill/gemm.c index 355bafe..a565511 100644 --- a/examples/chill/gemm.c +++ b/examples/chill/gemm.c @@ -1,12 +1,15 @@ + +#define N 512 + int main() { - float a[512][512], b[512][512], c[512][512]; + float a[N][N], b[N][N], c[N][N]; int i, j, k; - int n; - for (j = 0; j < n; j++) - for (k = 0; k < n; k++) - for (i = 0; i < n; i++) { + + 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]; } diff --git a/examples/chill/unroll.c b/examples/chill/unroll.c index 68f4633..e74dea3 100644 --- a/examples/chill/unroll.c +++ b/examples/chill/unroll.c @@ -1,6 +1,8 @@ + #define N 14 +#define DT 0.314 + void foo(int n, float* x, float* y, float* z, float* f3, float* f1, float* w) { - int dt; int i, j; @@ -16,7 +18,7 @@ void foo(int n, float* x, float* y, float* z, float* f3, float* f1, float* w) { 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; + f3[i] = f3[i] * DT; } return 0; -- cgit v1.2.3-70-g09d2