Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some updates for easier Embench runs (+ some coremark/matmul_32b_float improvements) #2372

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions bin/run_embench.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ def main():
core_config = 'corev32'
elif args.cfg == 'pulp':
core_config = 'corev32_pulp'
elif args.cfg == 'pulp_fpu':
core_config = 'corev32_pulp_fpu'
elif args.cfg == 'pulp_fpu_zfinx':
core_config = 'corev32_pulp_fpu_zfinx'
else:
logger.info(f"Invalid config selected: {args.cfg}, must be 'default' or 'pulp'")
logger.info(f"Invalid config selected: {args.cfg}, must be 'default', 'pulp', 'pulp_fpu' or 'pulp_fpu_zfinx'")
sys.exit(1)

if args.ccomp == 'notset':
Expand Down Expand Up @@ -187,7 +191,7 @@ def main():
f'--cc={args.ccomp}',
f'--warmup-heat=0',
f'--cpu-mhz={args.cpu_mhz}',
f'--ldflags=-T{paths["bsp"]}/link.ld',
f'--ldflags=-T{paths["bsp"]}/link_gp_relax.ld',
f'--builddir={args.builddir}',
f'--logdir={args.logdir}',
f'--timeout=15',
Expand Down Expand Up @@ -229,14 +233,21 @@ def main():
logger.fatal(f"Failed to generate folder {paths['testsem']}/{folder_ext}")
sys.exit(1)

logger.debug(f"Creating folder {args.builddir}/{folder_ext}")
try:
subprocess.run(['mkdir', f"{args.builddir}/{folder_ext}"])
except:
logger.fatal(f"Failed to generate folder {args.builddir}/{folder_ext}")
sys.exit(1)

# copy test files into the tests/programs/embench directories
for file in os.listdir(f"{paths['emres']}/{folder}"):
if not file.endswith('.o'):
logger.debug(f"Copying file {file}")
try:
subprocess.run(['cp', f"{paths['emres']}/{folder}/{file}", f"{paths['testsem']}/{folder_ext}/emb_{file}.elf"])
subprocess.run(['cp', f"{paths['emres']}/{folder}/{file}", f"{args.builddir}/{folder_ext}/emb_{file}.elf"])
except:
logger.fatal(f"Copying file {file} to {paths['emres']}/{folder_ext}/ failed")
logger.fatal(f"Copying file {file} to {args.builddir}/{folder_ext}/ failed")
sys.exit(1)

break
Expand Down
2 changes: 1 addition & 1 deletion cv32e40p/tests/embench/config/corev32/chips/size/chip.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# - we garbage collect unused sections on linking

cflags = [
'-c', '-Os', '-ffunction-sections', '-mabi=ilp32', '-march=rv32imc_zicsr'
'-c', '-Os', '-ffunction-sections', '-msave-restore', '-mabi=ilp32', '-march=rv32imc_zicsr'
]

ldflags = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <support.h>
#include <stdint.h>
#include <stdio.h>
#include "chipsupport.h"

void
Expand All @@ -31,8 +32,6 @@ initialise_board ()
void __attribute__ ((noinline)) __attribute__ ((externally_visible))
start_trigger ()
{


__asm__ volatile ("li a0, 0" : : : "memory");
}

Expand All @@ -41,4 +40,4 @@ stop_trigger ()
{

}


Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@

#define CPU_MHZ 1

#define TICKS_ADDR (*((volatile uint32_t*)0x15001004))

#endif
4 changes: 2 additions & 2 deletions cv32e40p/tests/embench/config/corev32/chips/speed/chip.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
# - we garbage collect unused sections on linking

cflags = [
'-c', '-O2', '-ffunction-sections', '-mabi=ilp32', '-march=rv32im_zicsr'
'-c', '-O2', '-ffunction-sections', '-mabi=ilp32', '-march=rv32imc_zicsr'
]

ldflags = [
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-mabi=ilp32', '-march=rv32im_zicsr'
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-mabi=ilp32', '-march=rv32imc_zicsr'
]
user_libs = ['-lm']

Expand Down
18 changes: 13 additions & 5 deletions cv32e40p/tests/embench/config/corev32/chips/speed/chipsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@

#include <support.h>
#include <stdint.h>
#include <stdio.h>
#include "chipsupport.h"

extern void _exit();

static uint32_t start_time, stop_time;

void
initialise_board ()
{
Expand All @@ -32,20 +37,23 @@ void __attribute__ ((noinline)) __attribute__ ((externally_visible))
start_trigger ()
{
printf("start of test \n");
//reset cycle counter
TICKS_ADDR = 0;


// Enable mcycle counter and read value
__asm__ volatile("csrci mcountinhibit, 0x1"); // mcountinhibit.cy = 0
__asm__ volatile("rdcycle %0" : "=r"(start_time));

__asm__ volatile ("li a0, 0" : : : "memory");
}

void __attribute__ ((noinline)) __attribute__ ((externally_visible))
stop_trigger ()
{
uint32_t cycle_cnt = TICKS_ADDR;
__asm__ volatile("rdcycle %0" : "=r"(stop_time));
uint32_t cycle_cnt = stop_time - start_time;
printf("end of test \n");
printf("Result is given in CPU cycles \n");
printf("RES: %d \n", cycle_cnt);

_exit(0);
}


Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@

#define CPU_MHZ 1

#define TICKS_ADDR (*((volatile uint32_t*)0x15001004))

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
# - we garbage collect unused sections on linking

cflags = [
'-c', '-Os', '-ffunction-sections', '-mabi=ilp32', '-march=rv32imc_zicsr_zifencei_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
'-c', '-Os', '-ffunction-sections', '-msave-restore', '-mabi=ilp32', '-march=rv32imc_zicsr_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
]

ldflags = [
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-nostdlib', '-mabi=ilp32', '-march=rv32imc_zicsr_zifencei_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-nostdlib', '-mabi=ilp32', '-march=rv32imc_zicsr_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
]

dummy_libs = ['crt0', 'libm', 'libc', 'libgcc']
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <support.h>
#include <stdint.h>
#include <stdio.h>
#include "chipsupport.h"

void
Expand All @@ -31,8 +32,6 @@ initialise_board ()
void __attribute__ ((noinline)) __attribute__ ((externally_visible))
start_trigger ()
{


__asm__ volatile ("li a0, 0" : : : "memory");
}

Expand All @@ -41,4 +40,4 @@ stop_trigger ()
{

}


Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@

#define CPU_MHZ 1

#define TICKS_ADDR (*((volatile uint32_t*)0x15001004))

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
# - we garbage collect unused sections on linking

cflags = [
'-c', '-O2', '-ffunction-sections', '-mabi=ilp32', '-march=rv32im_zicsr_zifencei_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
'-c', '-O2', '-ffunction-sections', '-mabi=ilp32', '-march=rv32imc_zicsr_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
]

ldflags = [
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-mabi=ilp32', '-march=rv32im_zicsr_zifencei_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
'-Wl,-gc-sections', '-Wl,-A,elf32lriscv', '-nostartfiles', '-mabi=ilp32', '-march=rv32imc_zicsr_xcvhwlp_xcvmem_xcvmac_xcvbi_xcvalu_xcvsimd_xcvbitmanip'
]
user_libs = ['-lm']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@

#include <support.h>
#include <stdint.h>
#include <stdio.h>
#include "chipsupport.h"

extern void _exit();

static uint32_t start_time, stop_time;

void
initialise_board ()
{
Expand All @@ -32,20 +37,23 @@ void __attribute__ ((noinline)) __attribute__ ((externally_visible))
start_trigger ()
{
printf("start of test \n");
//reset cycle counter
TICKS_ADDR = 0;


// Enable mcycle counter and read value
__asm__ volatile("csrci mcountinhibit, 0x1"); // mcountinhibit.cy = 0
__asm__ volatile("rdcycle %0" : "=r"(start_time));

__asm__ volatile ("li a0, 0" : : : "memory");
}

void __attribute__ ((noinline)) __attribute__ ((externally_visible))
stop_trigger ()
{
uint32_t cycle_cnt = TICKS_ADDR;
__asm__ volatile("rdcycle %0" : "=r"(stop_time));
uint32_t cycle_cnt = stop_time - start_time;
printf("end of test \n");
printf("Result is given in CPU cycles \n");
printf("RES: %d \n", cycle_cnt);

_exit(0);
}


Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@

#define CPU_MHZ 1

#define TICKS_ADDR (*((volatile uint32_t*)0x15001004))

#endif
67 changes: 67 additions & 0 deletions cv32e40p/tests/embench/config/corev32_pulp_fpu/arch.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
###############################################################################
#
# Copyright 2020 OpenHW Group
#
# Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://solderpad.org/licenses/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
#
###############################################################################

# This is a python setting of parameters for the architecture. The following
# parameters may be set (other keys are silently ignored). Defaults are shown
# in brackets
# - cc ('cc')
# - ld (same value as for cc)
# - cflags ([])
# - ldflags ([])
# - cc_define_pattern ('-D{0}')
# - cc_incdir_pattern ('-I{0}')
# - cc_input_pattern ('{0}')
# - cc_output_pattern ('-o {0}')
# - ld_input_pattern ('{0}')
# - ld_output_pattern ('-o {0}')
# - user_libs ([])
# - dummy_libs ([])
# - cpu_mhz (1)
# - warmup_heat (1)

# The "flags" and "libs" parameters (cflags, ldflags, user_libs, dummy_libs)
# should be lists of arguments to be passed to the compile or link line as
# appropriate. Patterns are Python format patterns used to create arguments.
# Thus for GCC or Clang/LLVM defined constants can be passed using the prefix
# '-D', and the pattern '-D{0}' would be appropriate (which happens to be the
# default).

# "user_libs" may be absolute file names or arguments to the linker. In the
# latter case corresponding arguments in ldflags may be needed. For example
# with GCC or Clang/LLVM is "-l" flags are used in "user_libs", the "-L" flags
# may be needed in "ldflags".

# Dummy libs have their source in the "support" subdirectory. Thus if 'crt0'
# is specified, there should be a source file 'dummy-crt0.c' in the support
# directory.

# There is no need to set an unused parameter, and this file may be empty to
# set no flags.

# Parameter values which are duplicated in architecture, board, chip or
# command line are used in the following order of priority
# - default value
# - architecture specific value
# - chip specific value
# - board specific value
# - command line value

# For flags, this priority is applied to individual flags, not the complete
# list of flags.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
###############################################################################
#
# Copyright 2020 OpenHW Group
#
# Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://solderpad.org/licenses/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
#
###############################################################################

# This is a python setting of parameters for the board. The following
# parameters may be set (other keys are silently ignored). Defaults are shown
# in brackets
# - cc ('cc')
# - ld (same value as for cc)
# - cflags ([])
# - ldflags ([])
# - cc_define_pattern ('-D{0}')
# - cc_incdir_pattern ('-I{0}')
# - cc_input_pattern ('{0}')
# - cc_output_pattern ('-o {0}')
# - ld_input_pattern ('{0}')
# - ld_output_pattern ('-o {0}')
# - user_libs ([])
# - dummy_libs ([])
# - cpu_mhz (1)
# - warmup_heat (1)

# The "flags" and "libs" parameters (cflags, ldflags, user_libs, dummy_libs)
# should be lists of arguments to be passed to the compile or link line as
# appropriate. Patterns are Python format patterns used to create arguments.
# Thus for GCC or Clang/LLVM defined constants can be passed using the prefix
# '-D', and the pattern '-D{0}' would be appropriate (which happens to be the
# default).

# "user_libs" may be absolute file names or arguments to the linker. In the
# latter case corresponding arguments in ldflags may be needed. For example
# with GCC or Clang/LLVM is "-l" flags are used in "user_libs", the "-L" flags
# may be needed in "ldflags".

# Dummy libs have their source in the "support" subdirectory. Thus if 'crt0'
# is specified, there should be a source file 'dummy-crt0.c' in the support
# directory.

# There is no need to set an unused parameter, and this file may be empty to
# set no flags.

# Parameter values which are duplicated in architecture, board, chip or
# command line are used in the following order of priority
# - default value
# - architecture specific value
# - chip specific value
# - board specific value
# - command line value

# For flags, this priority is applied to individual flags, not the complete
# list of flags.

cpu_mhz = 1
Loading