[PATCH v2] Add CoreMark Benchmark

Hesham Almatary hesham.almatary at cl.cam.ac.uk
Wed May 26 09:23:41 UTC 2021


CoreMark's primary goals are simplicity and providing a method for
testing only a processor's core features. It is used primarily here as
a performance benchmark.

Built and tested for RISC-V rv64imafdc_medany on QEMU and HW
---
 .gitmodules                  |  3 +++
 benchmarks/coremark/coremark |  1 +
 benchmarks/coremark/wscript  | 50 ++++++++++++++++++++++++++++++++++++
 benchmarks/wscript           |  1 +
 4 files changed, 55 insertions(+)
 create mode 160000 benchmarks/coremark/coremark
 create mode 100644 benchmarks/coremark/wscript

diff --git a/.gitmodules b/.gitmodules
index ae86e49..d7e52b9 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
 [submodule "rtems_waf"]
 	path = rtems_waf
 	url = git://git.rtems.org/rtems_waf.git
+[submodule "benchmarks/coremark/coremark"]
+	path = benchmarks/coremark/coremark
+	url = git at github.com:eembc/coremark.git
diff --git a/benchmarks/coremark/coremark b/benchmarks/coremark/coremark
new file mode 160000
index 0000000..1541482
--- /dev/null
+++ b/benchmarks/coremark/coremark
@@ -0,0 +1 @@
+Subproject commit 1541482bf3e6ef7f5c69f5be76b14537b60833d0
diff --git a/benchmarks/coremark/wscript b/benchmarks/coremark/wscript
new file mode 100644
index 0000000..2ec5f1e
--- /dev/null
+++ b/benchmarks/coremark/wscript
@@ -0,0 +1,50 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2021 Hesham Almatary
+#
+# This software was developed by SRI International and the University of
+# Cambridge Computer Laboratory (Department of Computer Science and
+# Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+# DARPA SSITH research programme.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+
+import rtems_waf.rtems as rtems
+
+def build(bld):
+    rtems.build(bld)
+
+    bld(features = 'c cprogram',
+        target = 'coremark.bin',
+        includes = ['coremark/', 'coremark/posix/'],
+        source = ['coremark/rtems/init.c', 'coremark/posix/core_portme.c',
+                  'coremark/core_list_join.c', 'coremark/core_main.c',
+                  'coremark/core_matrix.c', 'coremark/core_state.c',
+                  'coremark/core_util.c'],
+
+        defines = [
+        # FLAGS_STR is used within CoreMark to print the compiler flags used
+        'FLAGS_STR="'+' '.join([str(flag) for flag in bld.env.CFLAGS])+'"'
+        ]
+    )
diff --git a/benchmarks/wscript b/benchmarks/wscript
index 12741e7..807ed6e 100644
--- a/benchmarks/wscript
+++ b/benchmarks/wscript
@@ -7,4 +7,5 @@ import rtems_waf.rtems as rtems
 
 def build(bld):
     bld.recurse('nbench')
+    bld.recurse('coremark')
 
-- 
2.25.1



More information about the devel mailing list