Browse Source

dubhe: Coremark and Dhrystone recipes commit on Dubhe

Added Coremark and Dhrystone benchmarks for Dubhe. Patch files are included
for adding additional compiler flags.

Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
Jun Yuan Tan 2 years ago
parent
commit
27f283ce60

+ 25 - 0
recipes-benchmark/coremark/coremark_1.0.bb

@@ -0,0 +1,25 @@
+SUMMARY = "Coremark CPU benchmark"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9"
+
+INHIBIT_PACKAGE_STRIP = "1"
+
+SRC_URI = "git://github.com/sifive/benchmark-coremark.git \
+           file://0001-Add-Compiler-Flags-and-remove-exe-from-output.patch \
+           "
+SRCREV = "4486de1f0afe9d6c1fa8dd63743e5751286f3d2f"
+
+S = "${WORKDIR}/git"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+EXTRA_OEMAKE += "'CC=${CC}' PORT_DIR=linux64"
+
+do_compile(){
+	oe_runmake compile
+}
+
+do_install() {
+    install -d ${D}${bindir}
+    install -m 0755 coremark ${D}${bindir}
+}
+

+ 39 - 0
recipes-benchmark/coremark/files/0001-Add-Compiler-Flags-and-remove-exe-from-output.patch

@@ -0,0 +1,39 @@
+From d535a7032b73eaa1d5128e571323de724e4eef3a Mon Sep 17 00:00:00 2001
+From: junyuantan <junyuan.tan@starfivetech.com>
+Date: Mon, 16 Aug 2021 17:38:27 +0800
+Subject: [PATCH] Add Compiler Flags and remove exe from output
+
+This patch is required for adding compiler flags and change output format
+
+Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
+---
+ Makefile                | 2 +-
+ linux64/core_portme.mak | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 51760d1..b90e0ca 100644
+--- a/Makefile
++++ b/Makefile
+@@ -60,7 +60,7 @@ CORE_FILES = core_list_join core_main core_matrix core_state core_util
+ ORIG_SRCS = $(addsuffix .c,$(CORE_FILES))
+ SRCS = $(ORIG_SRCS) $(PORT_SRCS)
+ OBJS = $(addprefix $(OPATH),$(addsuffix $(OEXT),$(CORE_FILES)) $(PORT_OBJS))
+-OUTNAME = coremark$(EXE)
++OUTNAME = coremark
+ OUTFILE = $(OPATH)$(OUTNAME)
+ LOUTCMD = $(OFLAG) $(OUTFILE) $(LFLAGS_END)
+ OUTCMD = $(OUTFLAG) $(OUTFILE) $(LFLAGS_END)
+diff --git a/linux64/core_portme.mak b/linux64/core_portme.mak
+index 3276f40..b85bd52 100755
+--- a/linux64/core_portme.mak
++++ b/linux64/core_portme.mak
+@@ -24,7 +24,7 @@ OUTFLAG= -o
+ CC = gcc
+ # Flag: CFLAGS
+ #	Use this flag to define compiler options. Note, you can add compiler options from the command line using XCFLAGS="other flags"
+-PORT_CFLAGS = -O2 -fno-common -funroll-loops -finline-functions --param max-inline-insns-auto=20 -falign-functions=4 -falign-jumps=4 -falign-loops=4 --param inline-min-speedup=10
++PORT_CFLAGS = -mabi=lp64d -O3 -fno-common -funroll-loops -finline-functions -funroll-all-loops -falign-jumps=8 -falign-loops=8 -finline-limit=1000 -falign-functions=8 -ffast-math -fno-tree-loop-distribute-patterns --param fsm-scale-path-stmts=3 -mcmodel=medany -fno-builtin-printf
+ FLAGS_STR = "$(PORT_CFLAGS) $(XCFLAGS) $(XLFLAGS) $(LFLAGS_END)"
+ CFLAGS = $(PORT_CFLAGS) -I$(PORT_DIR) -I. -DFLAGS_STR=\"$(FLAGS_STR)\"
+ #Flag: LFLAGS_END

+ 25 - 0
recipes-benchmark/dhrystone/dhrystone_2.1.bb

@@ -0,0 +1,25 @@
+SUMMARY = "Dhrystone CPU benchmark"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9"
+
+INHIBIT_PACKAGE_STRIP = "1"
+
+SRC_URI = "git://github.com/sifive/benchmark-dhrystone.git \
+           file://0001-Edit-Makefile-to-add-compiler-flags.patch \
+           "
+SRCREV = "0ddff533cc9052c524990d5ace4560372053314b"
+
+S = "${WORKDIR}/git"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+EXTRA_OEMAKE += "'CC=${CC}'"
+
+do_compile(){
+	oe_runmake dhrystone
+}
+
+do_install() {
+    install -d ${D}${bindir}
+    install -m 0755 dhrystone ${D}${bindir}
+}
+

+ 29 - 0
recipes-benchmark/dhrystone/files/0001-Edit-Makefile-to-add-compiler-flags.patch

@@ -0,0 +1,29 @@
+From 62f00defc2fbee9cb76d7a424df7281fcec748c7 Mon Sep 17 00:00:00 2001
+From: junyuantan <junyuan.tan@starfivetech.com>
+Date: Mon, 16 Aug 2021 17:41:19 +0800
+Subject: [PATCH] Edit Makefile to add compiler flags
+
+This patch is needed for adding compiler flags for Coremark
+
+Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 6fb3e5a..2454959 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,10 +1,10 @@
+ DHRY-LFLAGS =
+ 
+ DHRY-CFLAGS := -O3 -DTIME -DNOENUM -Wno-implicit -save-temps
+-DHRY-CFLAGS += -fno-builtin-printf -fno-common -falign-functions=4
++DHRY-CFLAGS += -mabi=lp64d -O3 -fno-common -funroll-loops -finline-functions -funroll-all-loops -falign-jumps=8 -falign-loops=8 -finline-limit=1000 -falign-functions=8 -ffast-math -fno-tree-loop-distribute-patterns --param fsm-scale-path-stmts=3 -mcmodel=medany -fno-builtin-printf -lrt
+ 
+ #Uncomment below for FPGA run, default DHRY_ITERS is 2000 for RTL
+-#DHRY-CFLAGS += -DDHRY_ITERS=20000000
++DHRY-CFLAGS += -DDHRY_ITERS=20000000
+ 
+ SRC = dhry_1.c dhry_2.c strcmp.S
+ HDR = dhry.h