From 3c160af58a079597d7d3d12dd21e4c5557dcbf46 Mon Sep 17 00:00:00 2001 From: Cedric Bastoul Date: Fri, 24 Jun 2011 18:35:13 +0200 Subject: [PATCH] Add matmult tests --- tests/test_matmult_matrix.scop | 126 +++++++++++++++++++++++++++++++++++++++ tests/test_matmult_relation.scop | 125 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 251 insertions(+) create mode 100644 tests/test_matmult_matrix.scop create mode 100644 tests/test_matmult_relation.scop diff --git a/tests/test_matmult_matrix.scop b/tests/test_matmult_matrix.scop new file mode 100644 index 0000000..73aeba9 --- /dev/null +++ b/tests/test_matmult_matrix.scop @@ -0,0 +1,126 @@ +# Matmul example, matrix representation + +OpenScop + +# =============================================== Global +# Language +C + +# Context +CONTEXT +1 3 +# e/i N 1 + 1 1 -1 ## N-1 >= 0 + +# Parameter names are provided +1 +# Parameter names +N + +# Iterator names are provided +1 +# Iterator names +i j k + +# Scattering dimension names are not provided +0 + +# Number of statements +2 + +# =============================================== Statement 1 +# Number of relations describing the statement +3 + +# ---------------------------------------------- 1.1 Domain +DOMAIN +4 5 +# e/i i j N 1 + 1 1 0 0 0 ## i >= 0 + 1 -1 0 1 -1 ## -i+N-1 >= 0 + 1 0 1 0 0 ## j >= 0 + 1 0 -1 1 -1 ## -j+N-1 >= 0 + +# ---------------------------------------------- 1.2 Scattering +SCATTERING +5 5 +# e i j N 1 + 0 0 0 0 0 ## 0 + 0 1 0 0 0 ## i + 0 0 0 0 0 ## 0 + 0 0 1 0 0 ## j + 0 0 0 0 0 ## 0 + +# ---------------------------------------------- 1.3 Access +WRITE +3 5 +# eq i j N 1 + 0 0 0 0 1 ## C + 0 1 0 0 0 ## [i] + 0 0 1 0 0 ## [j] + +# ---------------------------------------------- 1.4 Body +# Statement body is provided +1 +# Original iterator names +i j +# Statement body +c[i][j] = 0.0; + + +# =============================================== Statement 2 +# Number of relations describing the statement +5 + +# ---------------------------------------------- 2.1 Domain +DOMAIN +6 6 +# e/i i j k N 1 + 1 1 0 0 0 0 ## i >= 0 + 1 -1 0 0 1 -1 ## -i+N-1 >= 0 + 1 0 1 0 0 0 ## j >= 0 + 1 0 -1 0 1 -1 ## -j+N-1 >= 0 + 1 0 0 1 0 0 ## k >= 0 + 1 0 0 -1 1 -1 ## -k+N-1 >= 0 + +# ---------------------------------------------- 2.2 Scattering +SCATTERING +7 6 +# e i j k N 1 + 0 0 0 0 0 0 ## 0 + 0 1 0 0 0 0 ## i + 0 0 0 0 0 0 ## 0 + 0 0 1 0 0 0 ## j + 0 0 0 0 0 1 ## 1 + 0 0 0 1 0 0 ## k + 0 0 0 0 0 0 ## 0 + +# ---------------------------------------------- 2.3 Access +RDWR +3 6 +# eq i j k N 1 + 0 0 0 0 0 1 ## C + 0 1 0 0 0 0 ## [i] + 0 0 1 0 0 0 ## [j] + +READ +3 6 +# eq i j k N 1 + 0 0 0 0 0 2 ## A + 0 1 0 0 0 0 ## [i] + 0 0 0 1 0 0 ## [k] + +READ +3 6 +# eq i j k N 1 + 0 0 0 0 0 3 ## B + 0 0 0 1 0 0 ## [k] + 0 0 1 0 0 0 ## [j] + +# ---------------------------------------------- 2.4 Body +# Statement body is provided +1 +# Original iterator names +i j k +# Statement body +c[i][j] = c[i][j] + a[i][k] * b[k][j]; diff --git a/tests/test_matmult_relation.scop b/tests/test_matmult_relation.scop new file mode 100644 index 0000000..8d09628 --- /dev/null +++ b/tests/test_matmult_relation.scop @@ -0,0 +1,125 @@ +# Matmul example, relation representation + +OpenScop + +# =============================================== Global +# Backend Language +C + +# Context +CONTEXT +1 3 0 0 0 1 + 1 1 -1 ## N-1 >= 0 + +# Parameter names are provided +1 +# Parameter names +N + +# Iterator names are provided +1 +# Iterator names +i j k + +# Scattering dimension names are not provided +0 + +# Number of statements +2 + +# =============================================== Statement 1 +# Number of relations describing the statement +3 + +# ---------------------------------------------- 1.1 Domain +DOMAIN +4 5 2 0 0 1 +# e/i i j N 1 + 1 1 0 0 0 ## i >= 0 + 1 -1 0 1 -1 ## -i+N-1 >= 0 + 1 0 1 0 0 ## j >= 0 + 1 0 -1 1 -1 ## -j+N-1 >= 0 + +# ---------------------------------------------- 1.2 Scattering +SCATTERING +5 10 5 2 0 1 +# e/i s1 s2 s3 s4 s5 i j N 1 + 0 -1 0 0 0 0 0 0 0 0 ## s1 = 0 + 0 0 -1 0 0 0 1 0 0 0 ## s2 = i + 0 0 0 -1 0 0 0 0 0 0 ## s3 = 0 + 0 0 0 0 -1 0 0 1 0 0 ## s4 = j + 0 0 0 0 0 -1 0 0 0 0 ## s5 = 0 + +# ---------------------------------------------- 1.3 Access +WRITE +3 8 3 2 0 1 +# e/i Arr [1] [2] i j N 1 + 0 -1 0 0 0 0 0 1 ## C + 0 0 -1 0 1 0 0 0 ## [i] + 0 0 0 -1 0 1 0 0 ## [j] + +# ---------------------------------------------- 1.4 Body +# Statement body is provided +1 +# Original iterator names +i j +# Statement body +C[i][j] = 0.0; + + +# =============================================== Statement 2 +# Number of relations describing the statement +5 + +# ---------------------------------------------- 2.1 Domain +DOMAIN +6 6 3 0 0 1 +# e/i i j k N 1 + 1 1 0 0 0 0 ## i >= 0 + 1 -1 0 0 1 -1 ## -i+N-1 >= 0 + 1 0 1 0 0 0 ## j >= 0 + 1 0 -1 0 1 -1 ## -j+N-1 >= 0 + 1 0 0 1 0 0 ## k >= 0 + 1 0 0 -1 1 -1 ## -k+N-1 >= 0 + +# ---------------------------------------------- 2.2 Scattering +SCATTERING +7 13 7 3 0 1 +# e/i s1 s2 s3 s4 s5 s6 s7 i j k N 1 + 0 -1 0 0 0 0 0 0 0 0 0 0 0 ## s1 = 0 + 0 0 -1 0 0 0 0 0 1 0 0 0 0 ## s2 = i + 0 0 0 -1 0 0 0 0 0 0 0 0 0 ## s3 = 0 + 0 0 0 0 -1 0 0 0 0 1 0 0 0 ## s4 = j + 0 0 0 0 0 -1 0 0 0 0 0 0 1 ## s5 = 1 + 0 0 0 0 0 0 -1 0 0 0 1 0 0 ## s6 = k + 0 0 0 0 0 0 0 -1 0 0 0 0 0 ## s7 = 0 + +# ---------------------------------------------- 2.3 Access +RDWR +3 9 3 3 0 1 +# e/i Arr [1] [2] i j k N 1 + 0 -1 0 0 0 0 0 0 1 ## C + 0 0 -1 0 1 0 0 0 0 ## [i] + 0 0 0 -1 0 1 0 0 0 ## [j] + +READ +3 9 3 3 0 1 +# e/i Arr [1] [2] i j k N 1 + 0 -1 0 0 0 0 0 0 2 ## A + 0 0 -1 0 1 0 0 0 0 ## [i] + 0 0 0 -1 0 0 1 0 0 ## [k] + +READ +3 9 3 3 0 1 +# e/i Arr [1] [2] i j k N 1 + 0 -1 0 0 0 0 0 0 3 ## B + 0 0 -1 0 0 0 1 0 0 ## [k] + 0 0 0 -1 0 1 0 0 0 ## [j] + +# ---------------------------------------------- 2.4 Body +# Statement body is provided +1 +# Original iterator names +i j k +# Statement body +C[i][j] = C[i][j] + A[i][k] * B[k][j]; -- 2.11.4.GIT