Add wasm tacle-bench targets

This commit is contained in:
2026-06-12 20:06:22 +02:00
parent 30daa8a00c
commit 08c2e9c13d
1122 changed files with 520422 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# ~~~
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2026, Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
# ~~~
cmake_minimum_required(VERSION 3.20)
project(fir2dim)
set(TACLEBENCH_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../..")
set(REPOSITORY_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../..")
set(APP_TARGET_NAME "${CMAKE_PROJECT_NAME}")
if(DEFINED TACLEBENCH_VARIANT AND "${TACLEBENCH_VARIANT}" STREQUAL "inline")
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/inline/fir2dim.c")
else()
set(APP_SOURCE_FILE_PATH
"generated/modified_sources/default/fir2dim.c")
endif()
include(${REPOSITORY_ROOT_PATH}/cmake/taclebench_wasm.cmake)

View File

@ -0,0 +1,45 @@
File: fir2dim.c
Original provenience: DSP-Stone,
http://www.ice.rwth-aachen.de/research/tools-projects/entry/detail/dspstone/
2015-12-21:
- Renamed benchmark to fir2dim
- Renamed each function FUNC to fir2dim_FUNC
- Added functions fir2dim_init, fir2dim_return and main
- Added a global variable 'int fir2dim_result' to introduce a
non-optimizable return value
- Substituted all 4 defines:
#define STORAGE_CLASS register
#define TYPE float
#define IMAGEDIM 4
#define ARRAYDIM (IMAGEDIM + 2)
#define COEFFICIENTS 3
- Added forward declarations of all functions before the declarations of global
variables
- Removed return statement in void function fir2dim_main()
- Re-ordered functions to fit template-order
- Applied code formatting according to the following rules
(incomplete, to be discussed; I basically used astyle with the attached
options file):
- Lines shall not be wider than 80 characters; whenever possible, appropriate
line breaks shall be inserted to keep lines below 80 characters
- Indentation is done using whitespaces only, no tabs. Code is indented by
two whitespaces
- Two empty lines are put between any two functions
- In non-empty lists or index expressions, opening '(' and '[' are followed by
one whitespace, closing ')' and ']' are preceded by one whitespace
- In comma- or colon-separated argument lists, one whitespace is put after
each comma/colon
- Names of functions and global variables all start with a benchmark-specific
prefix (here: st_) followed by lowercase letter (e.g., st_square)
- For pointer types, one whitespace is put before the '*'
- Operators within expressions shall be preceded and followed by one
whitespace
- Code of then- and else-parts of if-then-else statements shall be put in
separate lines, not in the same lines as the if-condition or the keyword
"else"
- Opening braces '{' denoting the beginning of code for some if-else or loop
body shall be put at the end of the same line where the keywords "if",
"else", "for", "while" etc. occur
- Added general TACLeBench header to beginning of source code

View File

@ -0,0 +1,199 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: fir2dim
Author: Juan Martinez Velarde
Function: prime calculates whether numbers are prime.
Source: DSP-Stone
http://www.ice.rwth-aachen.de/research/tools-projects/entry/detail/dspstone/
Original name: fir2dim_float
Changes: no major functional changes
License: may be used, modified, and re-distributed freely
*/
/*
Forward declaration of functions
*/
void fir2dim_initSeed( void );
long fir2dim_randomInteger();
void fir2dim_pin_down( float *pimage, float *parray, float *pcoeff,
float *poutput );
void fir2dim_init();
int fir2dim_return();
void fir2dim_main();
int main( void );
/*
Declaration of global variables
*/
static float fir2dim_coefficients[ 3 * 3 ] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
static float fir2dim_image[ 4 * 4 ] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static float fir2dim_array[ 6 * 6 ] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static float fir2dim_output[ 4 * 4 ] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
int fir2dim_result;
/*
Initialization- and return-value-related functions
*/
void fir2dim_init()
{
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = ( unsigned char * ) &fir2dim_coefficients[ 0 ];
_Pragma( "loopbound min 36 max 36" )
for ( i = 0; i < sizeof( fir2dim_coefficients ); ++i, ++p )
*p ^= bitmask;
p = ( unsigned char * ) &fir2dim_image[ 0 ];
_Pragma( "loopbound min 64 max 64" )
for ( i = 0; i < sizeof( fir2dim_image ); ++i, ++p )
*p ^= bitmask;
p = ( unsigned char * ) &fir2dim_array[ 0 ];
_Pragma( "loopbound min 144 max 144" )
for ( i = 0; i < sizeof( fir2dim_array ); ++i, ++p )
*p ^= bitmask;
p = ( unsigned char * ) &fir2dim_output[ 0 ];
_Pragma( "loopbound min 64 max 64" )
for ( i = 0; i < sizeof( fir2dim_output ); ++i, ++p )
*p ^= bitmask;
}
int fir2dim_return()
{
return ( fir2dim_result - 14 != 0 );
}
/*
Helper functions
*/
void fir2dim_pin_down( float *pimage, float *parray, float *pcoeff,
float *poutput )
{
register float i, f;
_Pragma( "loopbound min 4 max 4" )
for ( i = 0 ; i < 4 ; i++ ) {
_Pragma( "loopbound min 4 max 4" )
for ( f = 0 ; f < 4 ; f++ )
*pimage++ = 1 ;
}
pimage = pimage - 4 * 4 ;
_Pragma( "loopbound min 9 max 9" )
for ( i = 0; i < 3 * 3; i++ )
*pcoeff++ = 1;
_Pragma( "loopbound min 6 max 6" )
for ( i = 0 ; i < 6 ; i++ )
*parray++ = 0 ;
_Pragma( "loopbound min 4 max 4" )
for ( f = 0 ; f < 4; f++ ) {
*parray++ = 0 ;
_Pragma( "loopbound min 4 max 4" )
for ( i = 0 ; i < 4 ; i++ )
*parray++ = *pimage++ ;
*parray++ = 0 ;
}
_Pragma( "loopbound min 6 max 6" )
for ( i = 0 ; i < 6 ; i++ )
*parray++ = 0 ;
_Pragma( "loopbound min 16 max 16" )
for ( i = 0 ; i < 4 * 4; i++ )
*poutput++ = 0 ;
}
/*
Main functions
*/
void _Pragma( "entrypoint" ) fir2dim_main()
{
register float *parray = &fir2dim_array[ 0 ], *parray2, *parray3 ;
register float *pcoeff = &fir2dim_coefficients[ 0 ] ;
register float *poutput = &fir2dim_output[ 0 ] ;
int k, f, i;
fir2dim_pin_down( &fir2dim_image[ 0 ], &fir2dim_array[ 0 ],
&fir2dim_coefficients[ 0 ], &fir2dim_output[ 0 ] );
poutput = &fir2dim_output[ 0 ] ;
_Pragma( "loopbound min 4 max 4" )
for ( k = 0 ; k < 4 ; k++ ) {
_Pragma( "loopbound min 4 max 4" )
for ( f = 0 ; f < 4 ; f++ ) {
pcoeff = &fir2dim_coefficients[ 0 ] ;
parray = &fir2dim_array[ k * 6 + f ] ;
parray2 = parray + 6 ;
parray3 = parray + 6 + 6 ;
*poutput = 0 ;
_Pragma( "loopbound min 3 max 3" )
for ( i = 0 ; i < 3 ; i++ )
*poutput += *pcoeff++ **parray++ ;
_Pragma( "loopbound min 3 max 3" )
for ( i = 0 ; i < 3 ; i++ )
*poutput += *pcoeff++ **parray2++ ;
_Pragma( "loopbound min 3 max 3" )
for ( i = 0 ; i < 3 ; i++ )
*poutput += *pcoeff++ **parray3++ ;
poutput++ ;
}
}
fir2dim_result = fir2dim_output[ 0 ] + fir2dim_output[ 5 ] + fir2dim_array[ 9 ];
fir2dim_pin_down( &fir2dim_image[ 0 ], &fir2dim_array[ 0 ],
&fir2dim_coefficients[ 0 ], &fir2dim_output[ 0 ] );
}
int main( void )
{
fir2dim_init();
fir2dim_main();
return ( fir2dim_return() );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,193 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: fir2dim
Author: Juan Martinez Velarde
Function: prime calculates whether numbers are prime.
Source: DSP-Stone
http://www.ice.rwth-aachen.de/research/tools-projects/entry/detail/dspstone/
Original name: fir2dim_float
Changes: no major functional changes
License: may be used, modified, and re-distributed freely
*/
/*
Forward declaration of functions
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
void fir2dim_initSeed(void);
long fir2dim_randomInteger();
void fir2dim_pin_down(float *pimage, float *parray, float *pcoeff,
float *poutput);
void fir2dim_init();
int fir2dim_return();
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
fir2dim_main();
__attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
/*
Declaration of global variables
*/
static float fir2dim_coefficients[3 * 3] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
static float fir2dim_image[4 * 4] = {0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
static float fir2dim_array[6 * 6] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static float fir2dim_output[4 * 4] = {0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
int fir2dim_result;
/*
Initialization- and return-value-related functions
*/
void
fir2dim_init() {
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = (unsigned char *) &fir2dim_coefficients[0];
__pragma_loopbound(36, 36);
for (i = 0; i < sizeof(fir2dim_coefficients); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &fir2dim_image[0];
__pragma_loopbound(64, 64);
for (i = 0; i < sizeof(fir2dim_image); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &fir2dim_array[0];
__pragma_loopbound(144, 144);
for (i = 0; i < sizeof(fir2dim_array); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &fir2dim_output[0];
__pragma_loopbound(64, 64);
for (i = 0; i < sizeof(fir2dim_output); ++i, ++p)
*p ^= bitmask;
}
int
fir2dim_return() {
return (fir2dim_result - 14 != 0);
}
/*
Helper functions
*/
void
fir2dim_pin_down(float *pimage, float *parray, float *pcoeff, float *poutput) {
register float i, f;
__pragma_loopbound(4, 4);
for (i = 0; i < 4; i++) {
__pragma_loopbound(4, 4);
for (f = 0; f < 4; f++)
*pimage++ = 1;
}
pimage = pimage - 4 * 4;
__pragma_loopbound(9, 9);
for (i = 0; i < 3 * 3; i++)
*pcoeff++ = 1;
__pragma_loopbound(6, 6);
for (i = 0; i < 6; i++)
*parray++ = 0;
__pragma_loopbound(4, 4);
for (f = 0; f < 4; f++) {
*parray++ = 0;
__pragma_loopbound(4, 4);
for (i = 0; i < 4; i++)
*parray++ = *pimage++;
*parray++ = 0;
}
__pragma_loopbound(6, 6);
for (i = 0; i < 6; i++)
*parray++ = 0;
__pragma_loopbound(16, 16);
for (i = 0; i < 4 * 4; i++)
*poutput++ = 0;
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
fir2dim_main() {
register float *parray = &fir2dim_array[0], *parray2, *parray3;
register float *pcoeff = &fir2dim_coefficients[0];
register float *poutput = &fir2dim_output[0];
int k, f, i;
fir2dim_pin_down(&fir2dim_image[0], &fir2dim_array[0],
&fir2dim_coefficients[0], &fir2dim_output[0]);
poutput = &fir2dim_output[0];
__pragma_loopbound(4, 4);
for (k = 0; k < 4; k++) {
__pragma_loopbound(4, 4);
for (f = 0; f < 4; f++) {
pcoeff = &fir2dim_coefficients[0];
parray = &fir2dim_array[k * 6 + f];
parray2 = parray + 6;
parray3 = parray + 6 + 6;
*poutput = 0;
__pragma_loopbound(3, 3);
for (i = 0; i < 3; i++)
*poutput += *pcoeff++ * *parray++;
__pragma_loopbound(3, 3);
for (i = 0; i < 3; i++)
*poutput += *pcoeff++ * *parray2++;
__pragma_loopbound(3, 3);
for (i = 0; i < 3; i++)
*poutput += *pcoeff++ * *parray3++;
poutput++;
}
}
fir2dim_result = fir2dim_output[0] + fir2dim_output[5] + fir2dim_array[9];
fir2dim_pin_down(&fir2dim_image[0], &fir2dim_array[0],
&fir2dim_coefficients[0], &fir2dim_output[0]);
}
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
fir2dim_init();
fir2dim_main();
return (fir2dim_return());
}

View File

@ -0,0 +1,201 @@
/*
This program is part of the TACLeBench benchmark suite.
Version V 2.0
Name: fir2dim
Author: Juan Martinez Velarde
Function: prime calculates whether numbers are prime.
Source: DSP-Stone
http://www.ice.rwth-aachen.de/research/tools-projects/entry/detail/dspstone/
Original name: fir2dim_float
Changes: no major functional changes
License: may be used, modified, and re-distributed freely
*/
/*
Forward declaration of functions
*/
// Wasm loop bounds
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
__attribute__((always_inline)) static inline void fir2dim_initSeed(void);
__attribute__((always_inline)) static inline long fir2dim_randomInteger();
__attribute__((always_inline)) static inline void
fir2dim_pin_down(float *pimage, float *parray, float *pcoeff, float *poutput);
__attribute__((always_inline)) static inline void fir2dim_init();
__attribute__((always_inline)) static inline int fir2dim_return();
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
fir2dim_main();
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void);
/*
Declaration of global variables
*/
static float fir2dim_coefficients[3 * 3] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
static float fir2dim_image[4 * 4] = {0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
static float fir2dim_array[6 * 6] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static float fir2dim_output[4 * 4] = {0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
int fir2dim_result;
/*
Initialization- and return-value-related functions
*/
__attribute__((always_inline)) static inline void
fir2dim_init() {
unsigned int i;
unsigned char *p;
volatile char bitmask = 0;
/*
Apply volatile XOR-bitmask to entire input array.
*/
p = (unsigned char *) &fir2dim_coefficients[0];
__pragma_loopbound(36, 36);
for (i = 0; i < sizeof(fir2dim_coefficients); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &fir2dim_image[0];
__pragma_loopbound(64, 64);
for (i = 0; i < sizeof(fir2dim_image); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &fir2dim_array[0];
__pragma_loopbound(144, 144);
for (i = 0; i < sizeof(fir2dim_array); ++i, ++p)
*p ^= bitmask;
p = (unsigned char *) &fir2dim_output[0];
__pragma_loopbound(64, 64);
for (i = 0; i < sizeof(fir2dim_output); ++i, ++p)
*p ^= bitmask;
}
__attribute__((always_inline)) static inline int
fir2dim_return() {
return (fir2dim_result - 14 != 0);
}
/*
Helper functions
*/
__attribute__((always_inline)) static inline void
fir2dim_pin_down(float *pimage, float *parray, float *pcoeff, float *poutput) {
register float i, f;
__pragma_loopbound(4, 4);
for (i = 0; i < 4; i++) {
__pragma_loopbound(4, 4);
for (f = 0; f < 4; f++)
*pimage++ = 1;
}
pimage = pimage - 4 * 4;
__pragma_loopbound(9, 9);
for (i = 0; i < 3 * 3; i++)
*pcoeff++ = 1;
__pragma_loopbound(6, 6);
for (i = 0; i < 6; i++)
*parray++ = 0;
__pragma_loopbound(4, 4);
for (f = 0; f < 4; f++) {
*parray++ = 0;
__pragma_loopbound(4, 4);
for (i = 0; i < 4; i++)
*parray++ = *pimage++;
*parray++ = 0;
}
__pragma_loopbound(6, 6);
for (i = 0; i < 6; i++)
*parray++ = 0;
__pragma_loopbound(16, 16);
for (i = 0; i < 4 * 4; i++)
*poutput++ = 0;
}
/*
Main functions
*/
__attribute__((noinline)) __attribute__((export_name("entrypoint")))
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void
fir2dim_main() {
register float *parray = &fir2dim_array[0], *parray2, *parray3;
register float *pcoeff = &fir2dim_coefficients[0];
register float *poutput = &fir2dim_output[0];
int k, f, i;
fir2dim_pin_down(&fir2dim_image[0], &fir2dim_array[0],
&fir2dim_coefficients[0], &fir2dim_output[0]);
poutput = &fir2dim_output[0];
__pragma_loopbound(4, 4);
for (k = 0; k < 4; k++) {
__pragma_loopbound(4, 4);
for (f = 0; f < 4; f++) {
pcoeff = &fir2dim_coefficients[0];
parray = &fir2dim_array[k * 6 + f];
parray2 = parray + 6;
parray3 = parray + 6 + 6;
*poutput = 0;
__pragma_loopbound(3, 3);
for (i = 0; i < 3; i++)
*poutput += *pcoeff++ * *parray++;
__pragma_loopbound(3, 3);
for (i = 0; i < 3; i++)
*poutput += *pcoeff++ * *parray2++;
__pragma_loopbound(3, 3);
for (i = 0; i < 3; i++)
*poutput += *pcoeff++ * *parray3++;
poutput++;
}
}
fir2dim_result = fir2dim_output[0] + fir2dim_output[5] + fir2dim_array[9];
fir2dim_pin_down(&fir2dim_image[0], &fir2dim_array[0],
&fir2dim_coefficients[0], &fir2dim_output[0]);
}
__attribute__((noinline)) __attribute__((export_name("main")))
__attribute__((noinline)) __attribute__((export_name("main"))) int
main(void) {
fir2dim_init();
fir2dim_main();
return (fir2dim_return());
}