aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/polybench-syn
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-09-22 19:26:01 +0100
committerYann Herklotz <git@yannherklotz.com>2021-09-22 19:26:01 +0100
commit2ff1316847b9d338a792f67b7b9f6364d4b65551 (patch)
tree6aaf069a05f889d6f3fe012332a5e74dd8707429 /benchmarks/polybench-syn
parentc114bd7a269824623f2dbb41322d95d5056fca02 (diff)
parent8386bed39f413bb461c19debbad92e85f927c4b5 (diff)
downloadvericert-kvx-2ff1316847b9d338a792f67b7b9f6364d4b65551.tar.gz
vericert-kvx-2ff1316847b9d338a792f67b7b9f6364d4b65551.zip
Merge remote-tracking branch 'origin/develop' into develop
Diffstat (limited to 'benchmarks/polybench-syn')
-rw-r--r--benchmarks/polybench-syn/Makefile15
-rw-r--r--benchmarks/polybench-syn/common.mk33
-rw-r--r--benchmarks/polybench-syn/data-mining/Makefile3
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/Makefile3
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/trmm.preproc.c144
-rw-r--r--benchmarks/polybench-syn/linear-algebra/kernels/Makefile3
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/Makefile3
-rw-r--r--benchmarks/polybench-syn/medley/Makefile3
-rwxr-xr-xbenchmarks/polybench-syn/run-vericert.sh14
-rw-r--r--benchmarks/polybench-syn/stencils/Makefile6
-rw-r--r--benchmarks/polybench-syn/stencils/adi.c23
11 files changed, 84 insertions, 166 deletions
diff --git a/benchmarks/polybench-syn/Makefile b/benchmarks/polybench-syn/Makefile
new file mode 100644
index 0000000..2c20246
--- /dev/null
+++ b/benchmarks/polybench-syn/Makefile
@@ -0,0 +1,15 @@
+all:
+ $(MAKE) -C stencils
+ $(MAKE) -C medley
+ $(MAKE) -C linear-algebra/blas
+ $(MAKE) -C linear-algebra/kernels
+ $(MAKE) -C linear-algebra/solvers
+ $(MAKE) -C data-mining
+
+clean:
+ $(MAKE) clean -C stencils
+ $(MAKE) clean -C medley
+ $(MAKE) clean -C linear-algebra/blas
+ $(MAKE) clean -C linear-algebra/kernels
+ $(MAKE) clean -C linear-algebra/solvers
+ $(MAKE) clean -C data-mining
diff --git a/benchmarks/polybench-syn/common.mk b/benchmarks/polybench-syn/common.mk
new file mode 100644
index 0000000..fbada0b
--- /dev/null
+++ b/benchmarks/polybench-syn/common.mk
@@ -0,0 +1,33 @@
+VERICERT ?= vericert
+VERICERT_OPTS ?= -DSYNTHESIS
+
+IVERILOG ?= iverilog
+IVERILOG_OPTS ?=
+
+TARGETS ?=
+
+%.v: %.c
+ $(VERICERT) $(VERICERT_OPTS) $< -o $@
+
+%.iver: %.v
+ $(IVERILOG) -o $@ $(IVERILOG_OPTS) $<
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $< -o $@
+
+%: %.iver %.gcc
+ cp $< $@
+
+all: $(TARGETS)
+
+clean:
+ rm -f *.iver
+ rm -f *.v
+ rm -f *.gcc
+ rm -f *.clog
+ rm -f *.tmp
+ rm -f $(TARGETS)
+
+.PRECIOUS: %.v %.gcc %.iver
+.PHONY: all clean
+.SUFFIXES:
diff --git a/benchmarks/polybench-syn/data-mining/Makefile b/benchmarks/polybench-syn/data-mining/Makefile
new file mode 100644
index 0000000..d4817a0
--- /dev/null
+++ b/benchmarks/polybench-syn/data-mining/Makefile
@@ -0,0 +1,3 @@
+TARGETS := covariance
+
+include ../common.mk
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/Makefile b/benchmarks/polybench-syn/linear-algebra/blas/Makefile
new file mode 100644
index 0000000..e1f3b58
--- /dev/null
+++ b/benchmarks/polybench-syn/linear-algebra/blas/Makefile
@@ -0,0 +1,3 @@
+TARGETS := gemm gemver gesummv symm syr2k syrk trmm
+
+include ../../common.mk
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/trmm.preproc.c b/benchmarks/polybench-syn/linear-algebra/blas/trmm.preproc.c
deleted file mode 100644
index 9b8edfe..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/trmm.preproc.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* trmm.c: this file is part of PolyBench/C */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <math.h>
-
-/* Include polybench common header. */
-#include<polybench.h>
-# 1 "trmm.c"
-# 1 "<built-in>" 1
-# 1 "<built-in>" 3
-# 362 "<built-in>" 3
-# 1 "<command line>" 1
-# 1 "<built-in>" 2
-# 1 "trmm.c" 2
-# 1 "utilities/polybench.h" 1
-# 30 "utilities/polybench.h"
-# 1 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h" 1 3 4
-# 31 "utilities/polybench.h" 2
-# 231 "utilities/polybench.h"
-extern void* polybench_alloc_data(unsigned long long int n, int elt_size);
-extern void polybench_free_data(void* ptr);
-
-
-
-
-extern void polybench_flush_cache();
-extern void polybench_prepare_instruments();
-# 2 "trmm.c" 2
-
-
-# 1 "./linear-algebra/blas/trmm/trmm.h" 1
-# 5 "trmm.c" 2
-
-
-
-static
-void init_array(int m, int n,
- int *alpha,
- int A[ 20 + 0][20 + 0],
- int B[ 20 + 0][30 + 0])
-{
- int i, j;
-
- *alpha = 1.5;
- for (i = 0; i < m; i++) {
- for (j = 0; j < i; j++) {
- A[i][j] = (int)((i+j) % m)/m;
- }
- A[i][i] = 1.0;
- for (j = 0; j < n; j++) {
- B[i][j] = (int)((n+(i-j)) % n)/n;
- }
- }
-
-}
-
-
-
-
-static
-void print_array(int m, int n,
- int B[ 20 + 0][30 + 0])
-{
- int i, j;
-
- fprintf(stderr, "==BEGIN DUMP_ARRAYS==\n");
- fprintf(stderr, "begin dump: %s", "B");
- for (i = 0; i < m; i++)
- for (j = 0; j < n; j++) {
- if ((i * m + j) % 20 == 0) fprintf (stderr, "\n");
- fprintf (stderr, "%d ", B[i][j]);
- }
- fprintf(stderr, "\nend dump: %s\n", "B");
- fprintf(stderr, "==END DUMP_ARRAYS==\n");
-}
-
-
-
-
-static
-void kernel_trmm(int m, int n,
- int alpha,
- int A[ 20 + 0][20 + 0],
- int B[ 20 + 0][30 + 0])
-{
- int i, j, k;
-# 68 "trmm.c"
-#pragma scop
- for (i = 0; i < m; i++)
- for (j = 0; j < n; j++) {
- for (k = i+1; k < m; k++)
- B[i][j] += A[k][i] * B[k][j];
- B[i][j] = alpha * B[i][j];
- }
-#pragma endscop
-
-}
-
-
-int main(int argc, char** argv)
-{
-
- int m = 20;
- int n = 30;
-
-
- int alpha;
- int (*A)[20 + 0][20 + 0]; A = (int(*)[20 + 0][20 + 0])polybench_alloc_data ((20 + 0) * (20 + 0), sizeof(int));;
- int (*B)[20 + 0][30 + 0]; B = (int(*)[20 + 0][30 + 0])polybench_alloc_data ((20 + 0) * (30 + 0), sizeof(int));;
-
-
- init_array (m, n, &alpha, *A, *B);
-
-
- ;
-
-
- kernel_trmm (m, n, alpha, *A, *B);
-
-
- ;
- ;
-
-
-
- if (argc > 42 && ! strcmp(argv[0], "")) print_array(m, n, *B);
-
-
- free((void*)A);;
- free((void*)B);;
-
- return 0;
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/kernels/Makefile b/benchmarks/polybench-syn/linear-algebra/kernels/Makefile
new file mode 100644
index 0000000..4b7f6e1
--- /dev/null
+++ b/benchmarks/polybench-syn/linear-algebra/kernels/Makefile
@@ -0,0 +1,3 @@
+TARGETS := 2mm 3mm atas bicg doitgen mvt
+
+include ../../common.mk
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/Makefile b/benchmarks/polybench-syn/linear-algebra/solvers/Makefile
new file mode 100644
index 0000000..146620b
--- /dev/null
+++ b/benchmarks/polybench-syn/linear-algebra/solvers/Makefile
@@ -0,0 +1,3 @@
+TARGETS := cholesky durbin lu ludcmp trisolv
+
+include ../../common.mk
diff --git a/benchmarks/polybench-syn/medley/Makefile b/benchmarks/polybench-syn/medley/Makefile
new file mode 100644
index 0000000..816a0ce
--- /dev/null
+++ b/benchmarks/polybench-syn/medley/Makefile
@@ -0,0 +1,3 @@
+TARGETS := floyd-warshall nussinov
+
+include ../common.mk
diff --git a/benchmarks/polybench-syn/run-vericert.sh b/benchmarks/polybench-syn/run-vericert.sh
index 2f8097f..6cf4cd9 100755
--- a/benchmarks/polybench-syn/run-vericert.sh
+++ b/benchmarks/polybench-syn/run-vericert.sh
@@ -1,20 +1,18 @@
-#! /bin/bash
+#!/usr/bin/env bash
+
+rm exec.csv
top=$(pwd)
#set up
while read benchmark ; do
echo "Running "$benchmark
- clang -Wall -Werror -fsanitize=undefined $benchmark.c -o $benchmark.o
- ./$benchmark.o > $benchmark.clog
+ ./$benchmark.gcc > $benchmark.clog
cresult=$(cat $benchmark.clog | cut -d' ' -f2)
echo "C output: "$cresult
- { time ../../bin/vericert -DSYNTHESIS -finline -fschedule --debug-hls $benchmark.c -o $benchmark.v ; } 2> $benchmark.comp
- iverilog -o $benchmark.iver -- $benchmark.v
./$benchmark.iver > $benchmark.tmp
veriresult=$(tail -1 $benchmark.tmp | cut -d' ' -f2)
cycles=$(tail -2 $benchmark.tmp | head -1 | tr -s ' ' | cut -d' ' -f2)
- ctime=$(cat $benchmark.comp | head -2 | tail -1 | xargs | cut -d' ' -f2 | cut -d'm' -f2 | sed 's/s//g')
- echo "Veri output: "$veriresult
+ echo "Verilog output: "$veriresult
#Undefined checks
if test -z $veriresult
@@ -39,5 +37,5 @@ while read benchmark ; do
echo "PASS"
fi
name=$(echo $benchmark | awk -v FS="/" '{print $NF}')
- echo $name","$cycles","$ctime >> exec.csv
+ echo $name","$cycles >> exec.csv
done < benchmark-list-master
diff --git a/benchmarks/polybench-syn/stencils/Makefile b/benchmarks/polybench-syn/stencils/Makefile
new file mode 100644
index 0000000..d2e1c9b
--- /dev/null
+++ b/benchmarks/polybench-syn/stencils/Makefile
@@ -0,0 +1,6 @@
+TARGETS := adi fdtd-2d heat-3d jacobi-1d jacobi-2d seidel-2d
+
+include ../common.mk
+
+adi.v: adi.c
+ $(VERICERT) $(VERICERT_OPTS) -O0 -finline $< -o $@
diff --git a/benchmarks/polybench-syn/stencils/adi.c b/benchmarks/polybench-syn/stencils/adi.c
index ec2bf2a..2f4aca3 100644
--- a/benchmarks/polybench-syn/stencils/adi.c
+++ b/benchmarks/polybench-syn/stencils/adi.c
@@ -15,28 +15,23 @@
#include <stdio.h>
#endif
-#define plus(i) i = i + ONE
-
static
-void init_array (int n,
- int u[ 20 + 0][20 + 0])
+void init_array (int n, int u[ 20 + 0][20 + 0])
{
int i, j;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
- {
- u[i][j] = divider((int)(i + n-j) ,n);
- }
+ {
+ u[i][j] = divider((int)(i + n-j), n);
+ }
}
static
-int print_array(int n,
- int u[ 20 + 0][20 + 0])
-
+int print_array(int n, int u[ 20 + 0][20 + 0])
{
int i, j;
int res = 0;
@@ -53,10 +48,10 @@ int print_array(int n,
}
static
void kernel_adi(int tsteps, int n,
- int u[ 20 + 0][20 + 0],
- int v[ 20 + 0][20 + 0],
- int p[ 20 + 0][20 + 0],
- int q[ 20 + 0][20 + 0])
+ int u[ 20 + 0][20 + 0],
+ int v[ 20 + 0][20 + 0],
+ int p[ 20 + 0][20 + 0],
+ int q[ 20 + 0][20 + 0])
{
int t, i, j;
int B1, B2;