Compare commits

...
3 Commits
5 changed files with 79 additions and 6 deletions
+23
View File
@@ -327,4 +327,27 @@ sub select_experiment {
return $multi == 1 ? @selected_experiments : $selected_experiments[0];
}
sub module_is_tacle {
my ($module) = @_;
return $module =~ /^tacle-/;
}
sub find_tacle_sources {
my ($module) = @_;
return () unless $module =~ /^tacle-([^-]+)-(.+)$/;
my ( $category, $bench ) = ( $1, $2 );
# TODO: Also have modified_sources/inline
my $src_dir =
"targets/wasm-tacle/$category/$bench/generated/modified_sources/default";
die "TACLe source not found for '$module': $src_dir\n" unless -d $src_dir;
my @srcs = sort glob("$src_dir/*.c");
die "No sources found for '$module' in '$src_dir'\n" unless @srcs;
return ( \@srcs, $src_dir );
}
1;
+26 -1
View File
@@ -232,8 +232,9 @@ sub copy_auxiliary {
my ( $module, $bd ) = @_;
my @files = (
[ 'flake.nix', "$bd/flake.nix" ],
[ 'scripts/runner.pl', "$bd/runner.pl" ],
[ 'scripts/build.pl', "$bd/build.pl" ],
[ 'scripts/compile.pl', "$bd/compile.pl" ],
[ 'scripts/runner.pl', "$bd/runner.pl" ],
[ 'targets/lib.h', "$bd/lib.h" ],
[ 'targets/linker.ld', "$bd/linker.ld" ],
[ 'targets/startup.s', "$bd/startup.s" ],
@@ -244,13 +245,37 @@ sub copy_auxiliary {
copy( $pair->[0], $pair->[1] )
or die "failed to copy $pair->[0] -> $pair->[1]: $!";
}
# Copy tacle benchs if module is from tacle-bench
if ( Util::module_is_tacle($module) ) {
my ( undef, $src_dir ) = Util::find_tacle_sources($module);
my $dst_dir = "$bd/tacle-src";
make_path($dst_dir);
for my $file ( glob("$src_dir/*.c"), glob("$src_dir/*.h") ) {
my $base = ( File::Spec->splitpath($file) )[2];
copy( $file, "$dst_dir/$base" )
or die "failed to copy $file to $dst_dir/$base: $!";
}
}
}
sub compile_wasm_module {
my ( $module, $bd ) = @_;
if ( Util::module_is_tacle($module) ) {
my ( $srcs, $inc ) = Util::find_tacle_sources($module);
Util::run(
"$wasi_root/bin/clang", @wasi_cflags,
"-Dmain=tacle_main_bullshit", "-I$inc",
"targets/wasm-module/$module.cpp", @$srcs,
'-o', "$bd/wasm_module.wasm"
);
}
else {
Util::run( "$wasi_root/bin/clang", @wasi_cflags,
"targets/wasm-module/$module.cpp",
'-o', "$bd/wasm_module.wasm" );
}
}
sub compile_wasm_aot {
+1 -1
View File
@@ -133,7 +133,7 @@ sub filter_marker_values {
}
# How much to disassemble around the address / how many lines to show
my $region_size = $cui->height() / 2 - 2;
my $region_size = int( $cui->height() / 2 ) - 2;
my $asm_region_size = $region_size + 120;
my %assembly_cache;
@@ -0,0 +1,25 @@
#include "../lib.h"
extern "C" {
void __pragma_loopbound(unsigned, unsigned) {}
void bsort_init(void);
void bsort_main(void);
int bsort_return(void);
EXPORT("wasm_module") int wasm_module(void) {
bsort_init();
fail_start_trace();
bsort_main();
fail_stop_trace();
int ret = bsort_return();
if (ret == 0) {
fail_marker_positive();
} else {
fail_marker_negative();
}
return ret;
}
}