git: b2a837790c7e - main - benchmarks/tinymembench: Add new port

From: Emanuel Haupt <ehaupt_at_FreeBSD.org>
Date: Thu, 21 Dec 2023 08:13:54 UTC
The branch main has been updated by ehaupt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b2a837790c7e63ae76f999c296d46be9f1517c03

commit b2a837790c7e63ae76f999c296d46be9f1517c03
Author:     Emanuel Haupt <ehaupt@FreeBSD.org>
AuthorDate: 2023-12-21 08:11:19 +0000
Commit:     Emanuel Haupt <ehaupt@FreeBSD.org>
CommitDate: 2023-12-21 08:11:19 +0000

    benchmarks/tinymembench: Add new port
    
    This is a simple memory benchmark program, which tries to measure the
    peak bandwidth of sequential memory accesses and the latency of random
    memory accesses. Bandwidth is measured by running different assembly
    code for the aligned memory blocks and attempting different prefetch
    strategies.
---
 benchmarks/Makefile                               |  1 +
 benchmarks/tinymembench/Makefile                  | 23 +++++++++++++
 benchmarks/tinymembench/distinfo                  |  3 ++
 benchmarks/tinymembench/files/patch-Makefile      | 40 +++++++++++++++++++++++
 benchmarks/tinymembench/files/patch-aarch64-asm.S |  8 +++++
 benchmarks/tinymembench/files/patch-arm-neon.S    |  8 +++++
 benchmarks/tinymembench/files/patch-mips-32.S     |  8 +++++
 benchmarks/tinymembench/files/patch-x86-sse2.S    |  8 +++++
 benchmarks/tinymembench/pkg-descr                 |  5 +++
 9 files changed, 104 insertions(+)

diff --git a/benchmarks/Makefile b/benchmarks/Makefile
index 020638d3115e..fcb36bb69a2d 100644
--- a/benchmarks/Makefile
+++ b/benchmarks/Makefile
@@ -104,6 +104,7 @@
     SUBDIR += sysbench
     SUBDIR += tcpblast
     SUBDIR += thrulay
+    SUBDIR += tinymembench
     SUBDIR += tsung
     SUBDIR += ttcp
     SUBDIR += typometer
diff --git a/benchmarks/tinymembench/Makefile b/benchmarks/tinymembench/Makefile
new file mode 100644
index 000000000000..cad875cb8b4d
--- /dev/null
+++ b/benchmarks/tinymembench/Makefile
@@ -0,0 +1,23 @@
+PORTNAME=	tinymembench
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.4
+CATEGORIES=	benchmarks
+
+MAINTAINER=	ehaupt@FreeBSD.org
+COMMENT=	Simple benchmark for memory throughput and latency
+WWW=		https://github.com/ssvb/tinymembench
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		gmake
+USE_GCC=	yes
+USE_GITHUB=	yes
+GH_ACCOUNT=	ssvb
+
+PLIST_FILES=	bin/tinymembench
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
+
+.include <bsd.port.mk>
diff --git a/benchmarks/tinymembench/distinfo b/benchmarks/tinymembench/distinfo
new file mode 100644
index 000000000000..09b5d4be0996
--- /dev/null
+++ b/benchmarks/tinymembench/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1703098360
+SHA256 (ssvb-tinymembench-v0.4_GH0.tar.gz) = e37a2682065b2778f2fa7f22bd59472f5ca2191be48503952ae020b8f023f23d
+SIZE (ssvb-tinymembench-v0.4_GH0.tar.gz) = 13564
diff --git a/benchmarks/tinymembench/files/patch-Makefile b/benchmarks/tinymembench/files/patch-Makefile
new file mode 100644
index 000000000000..a5969ae8dc04
--- /dev/null
+++ b/benchmarks/tinymembench/files/patch-Makefile
@@ -0,0 +1,40 @@
+--- Makefile.orig	2016-03-30 04:42:59 UTC
++++ Makefile
+@@ -1,29 +1,27 @@ all: tinymembench
+ all: tinymembench
+ 
+-ifdef WINDIR
+-	CC = gcc
+-endif
++CC ?= gcc
+ 
+ tinymembench: main.c util.o util.h asm-opt.h version.h asm-opt.o x86-sse2.o arm-neon.o mips-32.o aarch64-asm.o
+-	${CC} -O2 ${CFLAGS} -o tinymembench main.c util.o asm-opt.o x86-sse2.o arm-neon.o mips-32.o aarch64-asm.o -lm
++	${CC} ${CFLAGS} -o tinymembench main.c util.o asm-opt.o x86-sse2.o arm-neon.o mips-32.o aarch64-asm.o -lm
+ 
+ util.o: util.c util.h
+-	${CC} -O2 ${CFLAGS} -c util.c
++	${CC} ${CFLAGS} -c util.c
+ 
+ asm-opt.o: asm-opt.c asm-opt.h x86-sse2.h arm-neon.h mips-32.h
+-	${CC} -O2 ${CFLAGS} -c asm-opt.c
++	${CC} ${CFLAGS} -c asm-opt.c
+ 
+ x86-sse2.o: x86-sse2.S
+-	${CC} -O2 ${CFLAGS} -c x86-sse2.S
++	${CC} ${CFLAGS} -c x86-sse2.S
+ 
+ arm-neon.o: arm-neon.S
+-	${CC} -O2 ${CFLAGS} -c arm-neon.S
++	${CC} ${CFLAGS} -c arm-neon.S
+ 
+ aarch64-asm.o: aarch64-asm.S
+-	${CC} -O2 ${CFLAGS} -c aarch64-asm.S
++	${CC} ${CFLAGS} -c aarch64-asm.S
+ 
+ mips-32.o: mips-32.S
+-	${CC} -O2 ${CFLAGS} -c mips-32.S
++	${CC} ${CFLAGS} -c mips-32.S
+ 
+ clean:
+ 	-rm -f tinymembench
diff --git a/benchmarks/tinymembench/files/patch-aarch64-asm.S b/benchmarks/tinymembench/files/patch-aarch64-asm.S
new file mode 100644
index 000000000000..b7c404b11042
--- /dev/null
+++ b/benchmarks/tinymembench/files/patch-aarch64-asm.S
@@ -0,0 +1,8 @@
+--- aarch64-asm.S.orig	2016-03-30 04:42:59 UTC
++++ aarch64-asm.S
+@@ -123,3 +123,5 @@ asm_function aligned_block_copy_ld1st1_aarch64
+ .endfunc
+ 
+ #endif
++
++.section .note.GNU-stack,"",@progbits
diff --git a/benchmarks/tinymembench/files/patch-arm-neon.S b/benchmarks/tinymembench/files/patch-arm-neon.S
new file mode 100644
index 000000000000..0442c9a67c5d
--- /dev/null
+++ b/benchmarks/tinymembench/files/patch-arm-neon.S
@@ -0,0 +1,8 @@
+--- arm-neon.S.orig	2016-03-30 04:42:59 UTC
++++ arm-neon.S
+@@ -473,3 +473,5 @@ asm_function aligned_block_copy_vfp
+ .endfunc
+ 
+ #endif
++
++.section .note.GNU-stack,"",@progbits
diff --git a/benchmarks/tinymembench/files/patch-mips-32.S b/benchmarks/tinymembench/files/patch-mips-32.S
new file mode 100644
index 000000000000..69e6d7b61d84
--- /dev/null
+++ b/benchmarks/tinymembench/files/patch-mips-32.S
@@ -0,0 +1,8 @@
+--- mips-32.S.orig	2016-03-30 04:42:59 UTC
++++ mips-32.S
+@@ -181,3 +181,5 @@ asm_function aligned_block_copy_pf32_mips32
+ .endfunc
+ 
+ #endif
++
++.section .note.GNU-stack,"",@progbits
diff --git a/benchmarks/tinymembench/files/patch-x86-sse2.S b/benchmarks/tinymembench/files/patch-x86-sse2.S
new file mode 100644
index 000000000000..85acec1b372f
--- /dev/null
+++ b/benchmarks/tinymembench/files/patch-x86-sse2.S
@@ -0,0 +1,8 @@
+--- x86-sse2.S.orig	2016-03-30 04:42:59 UTC
++++ x86-sse2.S
+@@ -243,3 +243,5 @@ asm_function aligned_block_fill_nt_sse2
+ /*****************************************************************************/
+ 
+ #endif
++
++.section .note.GNU-stack,"",@progbits
diff --git a/benchmarks/tinymembench/pkg-descr b/benchmarks/tinymembench/pkg-descr
new file mode 100644
index 000000000000..a72e63c7da30
--- /dev/null
+++ b/benchmarks/tinymembench/pkg-descr
@@ -0,0 +1,5 @@
+This is a simple memory benchmark program, which tries to measure the
+peak bandwidth of sequential memory accesses and the latency of random
+memory accesses. Bandwidth is measured by running different assembly
+code for the aligned memory blocks and attempting different prefetch
+strategies.