Skip to content

Commit

Permalink
REFACTOR: reorganized embench to be scalable
Browse files Browse the repository at this point in the history
  • Loading branch information
iansseijelly committed Oct 30, 2024
1 parent 3d12a0c commit 5585e23
Show file tree
Hide file tree
Showing 10 changed files with 586 additions and 27 deletions.
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
add_subdirectory(blinky)
add_subdirectory(embench/wikisort)
add_subdirectory(embench)
28 changes: 28 additions & 0 deletions examples/embench/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Define the list of benchmarks
set(BENCHMARKS
wikisort
nettle-sha256
# Add other benchmarks here
)

# Create the support library
add_library(beebsc STATIC common/src/beebsc.c)
target_include_directories(beebsc PUBLIC common/inc)

# Create executables for each benchmark
foreach(benchmark ${BENCHMARKS})
# Create the benchmark-specific library
add_library(${benchmark}_lib STATIC ${benchmark}/lib${benchmark}.c)
target_include_directories(${benchmark}_lib PUBLIC common/inc)

# Create the executable
add_executable(${benchmark} common/src/main.c)

# Link dependencies
target_link_libraries(${benchmark}
PUBLIC ${benchmark}_lib
PUBLIC beebsc
PUBLIC l_trace_encoder
PRIVATE -L${CMAKE_BINARY_DIR}/glossy -Wl,--whole-archive glossy -Wl,--no-whole-archive -lm
)
endforeach()
File renamed without changes.
65 changes: 65 additions & 0 deletions examples/embench/common/inc/support.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* Support header for BEEBS.
Copyright (C) 2014 Embecosm Limited and the University of Bristol
Copyright (C) 2019 Embecosm Limited
Contributor James Pallister <james.pallister@bristol.ac.uk>
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
This file is part of Embench and was formerly part of the Bristol/Embecosm
Embedded Benchmark Suite.
SPDX-License-Identifier: GPL-3.0-or-later */

#ifndef SUPPORT_H
#define SUPPORT_H

/* custom configuration*/
#define CPU_MHZ 1
#define WARMUP_HEAT 1
/* Benchmarks must implement verify_benchmark, which must return -1 if no
verification is done. */

int verify_benchmark (int result);

/* Standard functions implemented for each board */

void initialise_board (void);
void start_trigger (void);
void stop_trigger (void);

/* Every benchmark implements this for one-off data initialization. This is
only used for initialization that is independent of how often benchmark ()
is called. */

void initialise_benchmark (void);

/* Every benchmark implements this for cache warm up, typically calling
benchmark several times. The argument controls how much warming up is
done, with 0 meaning no warming. */

void warm_caches (int temperature);

/* Every benchmark implements this as its entry point. Don't allow it to be
inlined! */

int benchmark (void) __attribute__ ((noinline));

/* Every benchmark must implement this to validate the result of the
benchmark. */

int verify_benchmark (int res);

/* Local simplified versions of library functions */

#include "beebsc.h"

#endif /* SUPPORT_H */

/*
Local Variables:
mode: C
c-file-style: "gnu"
End:
*/
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "trigger.h"
#include "libwikisort.h"
#include "rocketcore.h"
#include "support.h"

int __attribute__ ((used))
main (int argc __attribute__ ((unused)),
Expand Down
Loading

0 comments on commit 5585e23

Please sign in to comment.