From 8df21ad36b72e2c14f9dcf0f4371db0621d11590 Mon Sep 17 00:00:00 2001 From: Taj Muhammad Khan Date: Sat, 24 May 2014 13:07:22 +0200 Subject: [PATCH] Added test for osl_loop support --- osl | 2 +- test/Makefile.am | 1 + test/openscop/loops.c | 52 ++++++++++ test/openscop/loops.orig.c | 10 ++ test/openscop/loops.scop | 234 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 test/openscop/loops.c create mode 100644 test/openscop/loops.orig.c create mode 100644 test/openscop/loops.scop diff --git a/osl b/osl index 46ef4ec..beeef6c 160000 --- a/osl +++ b/osl @@ -1 +1 @@ -Subproject commit 46ef4ec9917713d5d51dd45331c0e74870c5375d +Subproject commit beeef6cf937b26befaac17179e9a35512c7c284d diff --git a/test/Makefile.am b/test/Makefile.am index c333554..693030f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -210,6 +210,7 @@ else CLOOGTEST_OPENSCOP = \ openscop/matmult \ openscop/empty \ + openscop/loops \ openscop/union endif diff --git a/test/openscop/loops.c b/test/openscop/loops.c new file mode 100644 index 0000000..b0bfa88 --- /dev/null +++ b/test/openscop/loops.c @@ -0,0 +1,52 @@ +/* Useful macros. */ +#define floord(n,d) (((n)<0) ? -((-(n)+(d)-1)/(d)) : (n)/(d)) +#define ceild(n,d) (((n)<0) ? -((-(n))/(d)) : ((n)+(d)-1)/(d)) +#define max(x,y) ((x) > (y) ? (x) : (y)) +#define min(x,y) ((x) < (y) ? (x) : (y)) + +#ifdef TIME +#define IF_TIME(foo) foo; +#else +#define IF_TIME(foo) +#endif +/* matmul.c 128*128 matrix multiply */ +#pragma scop + if (N >= 1) { + lbp=0; + ubp=floord(N-1,32); +#pragma omp parallel for private(lbv,ubv) + for (t2=lbp;t2<=ubp;t2++) { + for (t3=0;t3<=floord(N-1,32);t3++) { + for (t4=32*t2;t4<=min(N-1,32*t2+31);t4++) { + lbv=32*t3; + ubv=min(N-1,32*t3+31); + #pragma ivdep + #pragma vector always + for (t9=lbv;t9<=ubv;t9++) { + c[t4][t9] = 0.0; + } + } + } + } + lbp=0; + ubp=floord(N-1,32); +#pragma omp parallel for private(lbv,ubv) + for (t2=lbp;t2<=ubp;t2++) { + for (t3=0;t3<=floord(N-1,32);t3++) { + for (t4=0;t4<=floord(N-1,32);t4++) { + for (t5=32*t2;t5<=min(N-1,32*t2+31);t5++) { + for (t6=32*t4;t6<=min(N-1,32*t4+31);t6++) { + lbv=32*t3; + ubv=min(N-1,32*t3+31); + #pragma ivdep + #pragma vector always + for (t9=lbv;t9<=ubv;t9++) { + c[t5][t9] = c[t5][t9] + a[t5][t6]*b[t6][t9]; + } + } + } + } + } + } + } +#pragma endscop diff --git a/test/openscop/loops.orig.c b/test/openscop/loops.orig.c new file mode 100644 index 0000000..ca97caf --- /dev/null +++ b/test/openscop/loops.orig.c @@ -0,0 +1,10 @@ +/* matmul.c 128*128 matrix multiply */ +#pragma scop + for(i=0; i + +# =============================================== Global +# Language +C + +# Context +CONTEXT +0 3 0 0 0 1 + +# Parameters are provided +1 + +N + + +# Number of statements +2 + +# =============================================== Statement 1 +# Number of relations describing the statement: +3 + +# ---------------------------------------------- 1.1 Domain +DOMAIN +10 7 4 0 0 1 +# e/i| fk0 fk1 i j | N | 1 + 1 0 0 1 0 0 0 ## i >= 0 + 1 0 0 -1 0 1 -1 ## -i+N-1 >= 0 + 1 0 0 0 0 1 -1 ## N-1 >= 0 + 1 0 0 0 1 0 0 ## j >= 0 + 1 0 0 0 -1 1 -1 ## -j+N-1 >= 0 + 0 0 0 0 0 0 0 ## 0 == 0 + 1 0 -32 1 0 0 0 ## -32*fk1+i >= 0 + 1 0 32 -1 0 0 31 ## 32*fk1-i+31 >= 0 + 1 -32 0 0 1 0 0 ## -32*fk0+j >= 0 + 1 32 0 0 -1 0 31 ## 32*fk0-j+31 >= 0 + +# ---------------------------------------------- 1.2 Scattering +SCATTERING +9 16 9 4 0 1 +# e/i| c1 c2 c3 c4 c5 c6 c7 c8 c9 | fk0 fk1 i j | N | 1 + 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ## c1 == 0 + 0 0 -1 0 0 0 0 0 0 0 0 1 0 0 0 0 ## c2 == fk1 + 0 0 0 -1 0 0 0 0 0 0 1 0 0 0 0 0 ## c3 == fk0 + 0 0 0 0 -1 0 0 0 0 0 0 0 1 0 0 0 ## c4 == i + 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 ## c5 == 0 + 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 ## c6 == 0 + 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 ## c7 == 0 + 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 ## c8 == 0 + 0 0 0 0 0 0 0 0 0 -1 0 0 0 1 0 0 ## c9 == j + +# ---------------------------------------------- 1.3 Access +WRITE +3 10 3 4 0 1 +# e/i| Arr [1] [2]| fk0 fk1 i j | N | 1 + 0 -1 0 0 0 0 0 0 0 4 ## Arr == c + 0 0 -1 0 0 0 1 0 0 0 ## [1] == i + 0 0 0 -1 0 0 0 1 0 0 ## [2] == j + +# ---------------------------------------------- 1.4 Body +# Statement body is provided +1 + +# Number of original iterators +4 +# List of original iterators +fk0 fk1 i j +# Statement body expression +c[i][j] = 0.0; + + +# =============================================== Statement 2 +# Number of relations describing the statement: +6 + +# ---------------------------------------------- 2.1 Domain +DOMAIN +13 9 6 0 0 1 +# e/i| fk0 fk1 fk2 i j k | N | 1 + 1 0 0 0 1 0 0 0 0 ## i >= 0 + 1 0 0 0 -1 0 0 1 -1 ## -i+N-1 >= 0 + 1 0 0 0 0 0 0 1 -1 ## N-1 >= 0 + 1 0 0 0 0 1 0 0 0 ## j >= 0 + 1 0 0 0 0 -1 0 1 -1 ## -j+N-1 >= 0 + 1 0 0 0 0 0 1 0 0 ## k >= 0 + 1 0 0 0 0 0 -1 1 -1 ## -k+N-1 >= 0 + 1 0 0 -32 1 0 0 0 0 ## -32*fk2+i >= 0 + 1 0 0 32 -1 0 0 0 31 ## 32*fk2-i+31 >= 0 + 1 0 -32 0 0 1 0 0 0 ## -32*fk1+j >= 0 + 1 0 32 0 0 -1 0 0 31 ## 32*fk1-j+31 >= 0 + 1 -32 0 0 0 0 1 0 0 ## -32*fk0+k >= 0 + 1 32 0 0 0 0 -1 0 31 ## 32*fk0-k+31 >= 0 + +# ---------------------------------------------- 2.2 Scattering +SCATTERING +9 18 9 6 0 1 +# e/i| c1 c2 c3 c4 c5 c6 c7 c8 c9 | fk0 fk1 fk2 i j k | N | 1 + 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 ## c1 == 1 + 0 0 -1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 ## c2 == fk2 + 0 0 0 -1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 ## c3 == fk1 + 0 0 0 0 -1 0 0 0 0 0 1 0 0 0 0 0 0 0 ## c4 == fk0 + 0 0 0 0 0 -1 0 0 0 0 0 0 0 1 0 0 0 0 ## c5 == i + 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 1 0 0 ## c6 == k + 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 ## c7 == 0 + 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 ## c8 == 0 + 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 1 0 0 0 ## c9 == j + +# ---------------------------------------------- 2.3 Access +WRITE +3 12 3 6 0 1 +# e/i| Arr [1] [2]| fk0 fk1 fk2 i j k | N | 1 + 0 -1 0 0 0 0 0 0 0 0 0 4 ## Arr == c + 0 0 -1 0 0 0 0 1 0 0 0 0 ## [1] == i + 0 0 0 -1 0 0 0 0 1 0 0 0 ## [2] == j + +READ +3 12 3 6 0 1 +# e/i| Arr [1] [2]| fk0 fk1 fk2 i j k | N | 1 + 0 -1 0 0 0 0 0 0 0 0 0 4 ## Arr == c + 0 0 -1 0 0 0 0 1 0 0 0 0 ## [1] == i + 0 0 0 -1 0 0 0 0 1 0 0 0 ## [2] == j + +READ +3 12 3 6 0 1 +# e/i| Arr [1] [2]| fk0 fk1 fk2 i j k | N | 1 + 0 -1 0 0 0 0 0 0 0 0 0 6 ## Arr == a + 0 0 -1 0 0 0 0 1 0 0 0 0 ## [1] == i + 0 0 0 -1 0 0 0 0 0 1 0 0 ## [2] == k + +READ +3 12 3 6 0 1 +# e/i| Arr [1] [2]| fk0 fk1 fk2 i j k | N | 1 + 0 -1 0 0 0 0 0 0 0 0 0 7 ## Arr == b + 0 0 -1 0 0 0 0 0 0 1 0 0 ## [1] == k + 0 0 0 -1 0 0 0 0 1 0 0 0 ## [2] == j + +# ---------------------------------------------- 2.4 Body +# Statement body is provided +1 + +# Number of original iterators +6 +# List of original iterators +fk0 fk1 fk2 i j k +# Statement body expression +c[i][j] = c[i][j] + a[i][k]*b[k][j]; + + +# =============================================== Extensions + +# Number of arrays +7 +# Mapping array-identifiers/array-names +1 i +2 N +3 j +4 c +5 k +6 a +7 b + + + +# File name +openscop/loops.orig.c +# Starting line and column +3 0 +# Ending line and column +10 0 +# Indentation +2 + + + +t1 t2 t3 t4 t5 t6 t7 t8 t9 + + + +# Number of loops +4 +# =========================================== +# Loop number 1 +# Iterator name +t2 +# Number of stmts +1 +# Statement identifiers +1 +# Private variables +lbv,ubv +# Directive +1 +# =========================================== +# Loop number 2 +# Iterator name +t2 +# Number of stmts +1 +# Statement identifiers +2 +# Private variables +lbv,ubv +# Directive +1 +# =========================================== +# Loop number 3 +# Iterator name +t9 +# Number of stmts +1 +# Statement identifiers +1 +# Private variables +(null) +# Directive +4 +# =========================================== +# Loop number 4 +# Iterator name +t9 +# Number of stmts +1 +# Statement identifiers +2 +# Private variables +(null) +# Directive +4 + + + -- 2.11.4.GIT