mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 06:55:07 +00:00
Fix some compile issues of samples (#690)
Fix compile errors of workloads due to emsdk version upgrade, enable BUILD_TARGET auto set for some samples, and call wasm_runtime_init_thread_env() for in thread routine which was created by pthread_create but not runtime in spawn-thread sample. Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
parent
541f577164
commit
0db04e0b8f
|
@ -21,16 +21,36 @@ set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
|||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
# WAMR features switch
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
|
||||
# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||
set (WAMR_BUILD_TARGET "AARCH64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
|
||||
set (WAMR_BUILD_TARGET "RISCV64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
set (WAMR_BUILD_INTERP 1)
|
||||
set (WAMR_BUILD_AOT 1)
|
||||
set (WAMR_BUILD_JIT 0)
|
||||
set (WAMR_BUILD_LIBC_BUILTIN 1)
|
||||
|
||||
if (NOT MSVC)
|
||||
set (WAMR_BUILD_LIBC_WASI 1)
|
||||
endif ()
|
||||
set (WAMR_BUILD_FAST_INTERP 0)
|
||||
|
||||
if (NOT MSVC)
|
||||
# linker flags
|
||||
|
|
|
@ -24,7 +24,7 @@ int main(int argc, char *argv_main[])
|
|||
static char global_heap_buf[512 * 1024];
|
||||
char *buffer, error_buf[128];
|
||||
int opt;
|
||||
char * wasm_path;
|
||||
char * wasm_path = NULL;
|
||||
|
||||
wasm_module_t module = NULL;
|
||||
wasm_module_inst_t module_inst = NULL;
|
||||
|
@ -148,7 +148,8 @@ int main(int argc, char *argv_main[])
|
|||
goto fail;
|
||||
}
|
||||
|
||||
float ret_val = *(float*)argv;
|
||||
float ret_val;
|
||||
memcpy(&ret_val, argv, sizeof(float));
|
||||
printf("Native finished calling wasm function generate_float(), returned a float value: %ff\n", ret_val );
|
||||
|
||||
// Next we will pass a buffer to the WASM function
|
||||
|
@ -157,7 +158,7 @@ int main(int argc, char *argv_main[])
|
|||
// must allocate buffer from wasm instance memory space (never use pointer from host runtime)
|
||||
wasm_buffer = wasm_runtime_module_malloc(module_inst, 100, (void**)&native_buffer);
|
||||
|
||||
*(float*)argv2 = ret_val; // the first argument
|
||||
memcpy(argv2, &ret_val, sizeof(float)); // the first argument
|
||||
argv2[1] = wasm_buffer; // the second argument is the wasm buffer address
|
||||
argv2[2] = 100; // the third argument is the wasm buffer size
|
||||
argv2[3] = 3; // the last argument is the digits after decimal point for converting float to string
|
||||
|
|
|
@ -15,13 +15,33 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
|||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
# WAMR features switch
|
||||
set(WAMR_BUILD_TARGET "X86_64")
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
|
||||
# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||
set (WAMR_BUILD_TARGET "AARCH64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
|
||||
set (WAMR_BUILD_TARGET "RISCV64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
set(WAMR_BUILD_INTERP 1)
|
||||
set(WAMR_BUILD_AOT 0)
|
||||
set(WAMR_BUILD_JIT 0)
|
||||
set(WAMR_BUILD_LIBC_BUILTIN 1)
|
||||
set(WAMR_BUILD_LIBC_WASI 0)
|
||||
set(WAMR_BUILD_FAST_INTERP 0)
|
||||
set(WAMR_BUILD_MULTI_MODULE 1)
|
||||
|
||||
# compiling and linking flags
|
||||
|
|
|
@ -15,7 +15,28 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
|||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
# WAMR features switch
|
||||
set(WAMR_BUILD_TARGET "X86_64")
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
|
||||
# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||
set (WAMR_BUILD_TARGET "AARCH64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
|
||||
set (WAMR_BUILD_TARGET "RISCV64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
set(WAMR_BUILD_INTERP 1)
|
||||
set(WAMR_BUILD_AOT 1)
|
||||
set(WAMR_BUILD_JIT 0)
|
||||
|
|
|
@ -10,10 +10,6 @@ else()
|
|||
enable_language (ASM_MASM)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif()
|
||||
|
||||
################ runtime settings ################
|
||||
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
|
||||
if (APPLE)
|
||||
|
@ -25,7 +21,27 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
|||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
# WAMR features switch
|
||||
set(WAMR_BUILD_TARGET "X86_64")
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
|
||||
# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||
set (WAMR_BUILD_TARGET "AARCH64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
|
||||
set (WAMR_BUILD_TARGET "RISCV64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
if(NOT DEFINED WAMR_BUILD_INTERP)
|
||||
set(WAMR_BUILD_INTERP 1)
|
||||
|
|
|
@ -15,7 +15,28 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
|||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
# WAMR features switch
|
||||
set(WAMR_BUILD_TARGET "X86_64")
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
|
||||
# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||
set (WAMR_BUILD_TARGET "AARCH64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
|
||||
set (WAMR_BUILD_TARGET "RISCV64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
set(WAMR_BUILD_INTERP 1)
|
||||
set(WAMR_BUILD_AOT 1)
|
||||
set(WAMR_BUILD_JIT 0)
|
||||
|
|
|
@ -23,9 +23,15 @@ void *thread(void* arg)
|
|||
wasm_function_inst_t func;
|
||||
uint32 argv[2];
|
||||
|
||||
if (!wasm_runtime_init_thread_env()) {
|
||||
printf("failed to initialize thread environment");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
func = wasm_runtime_lookup_function(module_inst, "sum", NULL);
|
||||
if (!func) {
|
||||
printf("failed to lookup function sum");
|
||||
wasm_runtime_destroy_thread_env();
|
||||
return NULL;
|
||||
}
|
||||
argv[0] = thread_arg->start;
|
||||
|
@ -34,9 +40,11 @@ void *thread(void* arg)
|
|||
/* call the WASM function */
|
||||
if (!wasm_runtime_call_wasm(exec_env, func, 2, argv)) {
|
||||
printf("%s\n", wasm_runtime_get_exception(module_inst));
|
||||
wasm_runtime_destroy_thread_env();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wasm_runtime_destroy_thread_env();
|
||||
return (void *)(uintptr_t)argv[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,9 @@ endif()
|
|||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
################ runtime settings ################
|
||||
|
||||
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
|
||||
if (APPLE)
|
||||
add_definitions(-DBH_PLATFORM_DARWIN)
|
||||
|
@ -24,7 +26,23 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
|||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
# WAMR features switch
|
||||
set(WAMR_BUILD_TARGET "X86_64")
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
|
||||
# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
||||
set (WAMR_BUILD_TARGET "AARCH64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
|
||||
set (WAMR_BUILD_TARGET "RISCV64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
else ()
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if(NOT DEFINED WAMR_BUILD_INTERP)
|
||||
set(WAMR_BUILD_INTERP 1)
|
||||
|
|
|
@ -14,13 +14,42 @@ for details, the script includes below steps:
|
|||
[latest release](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz)
|
||||
to */opt/wasi-sdk*
|
||||
|
||||
``` bash
|
||||
$ wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/${WASI_SDK_FILE}
|
||||
$ tar zxf ${WASI_SDK_FILE} -C /opt
|
||||
$ ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk
|
||||
```
|
||||
|
||||
- **wabt**. Install
|
||||
[latest release](https://github.com/WebAssembly/wabt/releases/download/1.0.20/wabt-1.0.20-ubuntu.tar.gz)
|
||||
to */opt/wabt* or */opt/wabt-1.0.20*
|
||||
[latest release](https://github.com/WebAssembly/wabt/releases/download/1.0.23/wabt-1.0.23-ubuntu.tar.gz)
|
||||
to */opt/wabt*
|
||||
|
||||
``` bash
|
||||
$ wget https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/${WABT_FILE}
|
||||
$ tar zxf ${WABT_FILE} -C /opt
|
||||
$ ln -sf /opt/wabt-${WABT_VER} /opt/wabt
|
||||
```
|
||||
|
||||
- **emsdk**. Refer to [the guide](https://emscripten.org/docs/getting_started/downloads.html). Don't forget to activate
|
||||
emsdk and set up environment variables. Verify it with `echo ${EMSDK}`.
|
||||
emsdk and set up environment variables. Verify it with `echo ${EMSDK}`. Please be sure to install and activate the building
|
||||
of 2.0.12
|
||||
|
||||
``` bash
|
||||
$ cd /opt
|
||||
$ git clone https://github.com/emscripten-core/emsdk.git
|
||||
$ cd emsdk
|
||||
$ git pull
|
||||
$ ./emsdk install 2.0.12
|
||||
$ ./emsdk activate 2.0.12
|
||||
$ echo "source /opt/emsdk/emsdk_env.sh" >> "${HOME}"/.bashrc
|
||||
```
|
||||
|
||||
- **binaryen**. Install
|
||||
[latest release](https://github.com/WebAssembly/binaryen/releases/download/version_97/binaryen-version_97-x86_64-linux.tar.gz)
|
||||
to */opt/binaryen* or */opt/binaryen-version_97*
|
||||
[latest release](https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-linux.tar.gz)
|
||||
to */opt/binaryen*
|
||||
|
||||
``` bash
|
||||
$ wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/${BINARYEN_FILE}
|
||||
$ tar zxf ${BINARYEN_FILE} -C /opt
|
||||
$ ln -sf /opt/binaryen-${BINARYEN_VER} /opt/binaryen
|
||||
```
|
||||
|
|
|
@ -20,7 +20,7 @@ include(ExternalProject)
|
|||
ExternalProject_Add(xnnpack
|
||||
PREFIX xnnpack
|
||||
GIT_REPOSITORY https://github.com/google/XNNPACK.git
|
||||
GIT_TAG master
|
||||
GIT_TAG 90f520b6482bb99ac1bbfb71be1382f6c9b83241
|
||||
GIT_PROGRESS ON
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/xnnpack
|
||||
UPDATE_COMMAND git checkout .
|
||||
|
@ -28,62 +28,62 @@ ExternalProject_Add(xnnpack
|
|||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/xnnpack
|
||||
&& bazel --output_user_root=build_user_output build -c opt --config=wasm
|
||||
//:qs8_gemm_bench
|
||||
//:qs8_requantization_bench
|
||||
//:qu8_gemm_bench
|
||||
//:qu8_requantization_bench
|
||||
//:f16_igemm_bench
|
||||
//:f16_gemm_bench
|
||||
//:f16_spmm_bench
|
||||
//:f32_igemm_bench
|
||||
//:f16_relu_bench
|
||||
//:f32_conv_hwc_bench
|
||||
//:f32_conv_hwc2chw_bench
|
||||
//:f16_dwconv_bench
|
||||
//:f32_dwconv_bench
|
||||
//:f32_dwconv2d_chw_bench
|
||||
//:f32_gemm_bench
|
||||
//:f32_hswish_bench
|
||||
//:f32_raddexpminusmax_bench
|
||||
//:f32_raddextexp_bench
|
||||
//:f32_raddstoreexpminusmax_bench
|
||||
//:f32_relu_bench
|
||||
//:f32_rmax_bench
|
||||
//:f32_sigmoid_bench
|
||||
//:f32_spmm_bench
|
||||
//:f32_softmax_bench
|
||||
//:f32_velu_bench
|
||||
//:f32_vscaleexpminusmax_bench
|
||||
//:f32_vscaleextexp_bench
|
||||
//:f32_vsqrt_bench
|
||||
//:f32_im2col_gemm_bench
|
||||
//:rounding_bench
|
||||
//:average_pooling_bench
|
||||
//:bankers_rounding_bench
|
||||
//:ceiling_bench
|
||||
//:channel_shuffle_bench
|
||||
//:convolution_bench
|
||||
//:deconvolution_bench
|
||||
//:elu_bench
|
||||
//:floor_bench
|
||||
//:global_average_pooling_bench
|
||||
//:hardswish_bench
|
||||
//:max_pooling_bench
|
||||
//:sigmoid_bench
|
||||
//:prelu_bench
|
||||
//:softmax_bench
|
||||
//:square_root_bench
|
||||
//:truncation_bench
|
||||
//:f32_dwconv_e2e_bench
|
||||
//:f32_gemm_e2e_bench
|
||||
//:qs8_gemm_e2e_bench
|
||||
//:end2end_bench
|
||||
//:f32_exp_ulp_eval
|
||||
//:f32_expminus_ulp_eval
|
||||
//:f32_expm1minus_ulp_eval
|
||||
//:f32_extexp_ulp_eval
|
||||
//:f32_sigmoid_ulp_eval
|
||||
//:f32_sqrt_ulp_eval
|
||||
//:qs8_gemm_bench.wasm
|
||||
//:qs8_requantization_bench.wasm
|
||||
//:qu8_gemm_bench.wasm
|
||||
//:qu8_requantization_bench.wasm
|
||||
//:f16_igemm_bench.wasm
|
||||
//:f16_gemm_bench.wasm
|
||||
//:f16_spmm_bench.wasm
|
||||
//:f32_igemm_bench.wasm
|
||||
//:f16_relu_bench.wasm
|
||||
//:f32_conv_hwc_bench.wasm
|
||||
//:f32_conv_hwc2chw_bench.wasm
|
||||
//:f16_dwconv_bench.wasm
|
||||
//:f32_dwconv_bench.wasm
|
||||
//:f32_dwconv2d_chw_bench.wasm
|
||||
//:f32_gemm_bench.wasm
|
||||
//:f32_hswish_bench.wasm
|
||||
//:f32_raddexpminusmax_bench.wasm
|
||||
//:f32_raddextexp_bench.wasm
|
||||
//:f32_raddstoreexpminusmax_bench.wasm
|
||||
//:f32_relu_bench.wasm
|
||||
//:f32_rmax_bench.wasm
|
||||
//:f32_sigmoid_bench.wasm
|
||||
//:f32_spmm_bench.wasm
|
||||
//:f32_softmax_bench.wasm
|
||||
//:f32_velu_bench.wasm
|
||||
//:f32_vscaleexpminusmax_bench.wasm
|
||||
//:f32_vscaleextexp_bench.wasm
|
||||
//:f32_vsqrt_bench.wasm
|
||||
//:f32_im2col_gemm_bench.wasm
|
||||
//:rounding_bench.wasm
|
||||
//:average_pooling_bench.wasm
|
||||
//:bankers_rounding_bench.wasm
|
||||
//:ceiling_bench.wasm
|
||||
//:channel_shuffle_bench.wasm
|
||||
//:convolution_bench.wasm
|
||||
//:deconvolution_bench.wasm
|
||||
//:elu_bench.wasm
|
||||
//:floor_bench.wasm
|
||||
//:global_average_pooling_bench.wasm
|
||||
//:hardswish_bench.wasm
|
||||
//:max_pooling_bench.wasm
|
||||
//:sigmoid_bench.wasm
|
||||
//:prelu_bench.wasm
|
||||
//:softmax_bench.wasm
|
||||
//:square_root_bench.wasm
|
||||
//:truncation_bench.wasm
|
||||
//:f32_dwconv_e2e_bench.wasm
|
||||
//:f32_gemm_e2e_bench.wasm
|
||||
//:qs8_gemm_e2e_bench.wasm
|
||||
//:end2end_bench.wasm
|
||||
//:f32_exp_ulp_eval.wasm
|
||||
//:f32_expminus_ulp_eval.wasm
|
||||
//:f32_expm1minus_ulp_eval.wasm
|
||||
//:f32_extexp_ulp_eval.wasm
|
||||
//:f32_sigmoid_ulp_eval.wasm
|
||||
//:f32_sqrt_ulp_eval.wasm
|
||||
#--sandbox_debug
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xnnpack/bazel-out/wasm-opt/bin/
|
||||
|
|
|
@ -16,10 +16,51 @@ index ec740f38..2c193244 100644
|
|||
+build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
|
||||
+
|
||||
diff --git a/BUILD.bazel b/BUILD.bazel
|
||||
index ae4108bc..1c11fac2 100644
|
||||
index 1f2b15a8..e7abf838 100644
|
||||
--- a/BUILD.bazel
|
||||
+++ b/BUILD.bazel
|
||||
@@ -5038,7 +5038,6 @@ xnnpack_benchmark(
|
||||
@@ -4996,7 +4996,7 @@ xnnpack_cc_library(
|
||||
######################### Benchmarks for micro-kernels #########################
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "qs8_gemm_bench",
|
||||
+ name = "qs8_gemm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/gemm.h",
|
||||
"bench/qs8-gemm.cc",
|
||||
@@ -5007,7 +5007,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "qs8_requantization_bench",
|
||||
+ name = "qs8_requantization_bench.wasm",
|
||||
srcs = [
|
||||
"bench/qs8-requantization.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5017,7 +5017,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "qu8_gemm_bench",
|
||||
+ name = "qu8_gemm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/gemm.h",
|
||||
"bench/qu8-gemm.cc",
|
||||
@@ -5028,7 +5028,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "qu8_requantization_bench",
|
||||
+ name = "qu8_requantization_bench.wasm",
|
||||
srcs = [
|
||||
"bench/qu8-requantization.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5038,11 +5038,10 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f16_igemm_bench",
|
||||
+ name = "f16_igemm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f16-igemm.cc",
|
||||
"bench/conv.h",
|
||||
|
@ -27,7 +68,66 @@ index ae4108bc..1c11fac2 100644
|
|||
"src/xnnpack/AlignedAllocator.h",
|
||||
] + MICROKERNEL_BENCHMARK_HDRS,
|
||||
deps = MICROKERNEL_BENCHMARK_DEPS + [
|
||||
@@ -5120,7 +5119,6 @@ xnnpack_benchmark(
|
||||
@@ -5052,7 +5051,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f16_gemm_bench",
|
||||
+ name = "f16_gemm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f16-gemm.cc",
|
||||
"bench/gemm.h",
|
||||
@@ -5064,7 +5063,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f16_spmm_bench",
|
||||
+ name = "f16_spmm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f16-spmm.cc",
|
||||
"bench/spmm.h",
|
||||
@@ -5074,7 +5073,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_igemm_bench",
|
||||
+ name = "f32_igemm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-igemm.cc",
|
||||
"bench/conv.h",
|
||||
@@ -5087,7 +5086,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f16_relu_bench",
|
||||
+ name = "f16_relu_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f16-relu.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5096,7 +5095,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_conv_hwc_bench",
|
||||
+ name = "f32_conv_hwc_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-conv-hwc.cc",
|
||||
"bench/dconv.h",
|
||||
@@ -5108,7 +5107,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_conv_hwc2chw_bench",
|
||||
+ name = "f32_conv_hwc2chw_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-conv-hwc2chw.cc",
|
||||
"bench/dconv.h",
|
||||
@@ -5120,11 +5119,10 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f16_dwconv_bench",
|
||||
+ name = "f16_dwconv_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f16-dwconv.cc",
|
||||
"bench/dwconv.h",
|
||||
|
@ -35,10 +135,422 @@ index ae4108bc..1c11fac2 100644
|
|||
"src/xnnpack/AlignedAllocator.h",
|
||||
] + MICROKERNEL_BENCHMARK_HDRS,
|
||||
deps = MICROKERNEL_BENCHMARK_DEPS + [
|
||||
@@ -5134,7 +5132,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_dwconv_bench",
|
||||
+ name = "f32_dwconv_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-dwconv.cc",
|
||||
"bench/dwconv.h",
|
||||
@@ -5147,7 +5145,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_dwconv2d_chw_bench",
|
||||
+ name = "f32_dwconv2d_chw_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-dwconv2d-chw.cc",
|
||||
"bench/dwconv.h",
|
||||
@@ -5160,7 +5158,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_gemm_bench",
|
||||
+ name = "f32_gemm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-gemm.cc",
|
||||
"bench/gemm.h",
|
||||
@@ -5171,7 +5169,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_hswish_bench",
|
||||
+ name = "f32_hswish_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-hswish.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5180,7 +5178,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_raddexpminusmax_bench",
|
||||
+ name = "f32_raddexpminusmax_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-raddexpminusmax.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5189,7 +5187,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_raddextexp_bench",
|
||||
+ name = "f32_raddextexp_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-raddextexp.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5198,7 +5196,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_raddstoreexpminusmax_bench",
|
||||
+ name = "f32_raddstoreexpminusmax_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-raddstoreexpminusmax.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5207,7 +5205,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_relu_bench",
|
||||
+ name = "f32_relu_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-relu.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5216,7 +5214,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_rmax_bench",
|
||||
+ name = "f32_rmax_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-rmax.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5225,7 +5223,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_sigmoid_bench",
|
||||
+ name = "f32_sigmoid_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-sigmoid.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5234,7 +5232,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_spmm_bench",
|
||||
+ name = "f32_spmm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-spmm.cc",
|
||||
"bench/spmm.h",
|
||||
@@ -5244,7 +5242,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_softmax_bench",
|
||||
+ name = "f32_softmax_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-softmax.cc",
|
||||
] + MICROKERNEL_BENCHMARK_HDRS,
|
||||
@@ -5253,7 +5251,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_velu_bench",
|
||||
+ name = "f32_velu_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-velu.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5262,7 +5260,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_vscaleexpminusmax_bench",
|
||||
+ name = "f32_vscaleexpminusmax_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-vscaleexpminusmax.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5271,7 +5269,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_vscaleextexp_bench",
|
||||
+ name = "f32_vscaleextexp_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-vscaleextexp.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5280,7 +5278,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_vsqrt_bench",
|
||||
+ name = "f32_vsqrt_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-vsqrt.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5289,7 +5287,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_im2col_gemm_bench",
|
||||
+ name = "f32_im2col_gemm_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-im2col-gemm.cc",
|
||||
"bench/conv.h",
|
||||
@@ -5302,7 +5300,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "rounding_bench",
|
||||
+ name = "rounding_bench.wasm",
|
||||
srcs = [
|
||||
"bench/rounding.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5314,7 +5312,7 @@ xnnpack_benchmark(
|
||||
########################### Benchmarks for operators ###########################
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "average_pooling_bench",
|
||||
+ name = "average_pooling_bench.wasm",
|
||||
srcs = ["bench/average-pooling.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5322,7 +5320,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "bankers_rounding_bench",
|
||||
+ name = "bankers_rounding_bench.wasm",
|
||||
srcs = ["bench/bankers-rounding.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5330,7 +5328,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "ceiling_bench",
|
||||
+ name = "ceiling_bench.wasm",
|
||||
srcs = ["bench/ceiling.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5338,13 +5336,13 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "channel_shuffle_bench",
|
||||
+ name = "channel_shuffle_bench.wasm",
|
||||
srcs = ["bench/channel-shuffle.cc"],
|
||||
deps = OPERATOR_BENCHMARK_DEPS,
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "convolution_bench",
|
||||
+ name = "convolution_bench.wasm",
|
||||
srcs = ["bench/convolution.cc"],
|
||||
copts = xnnpack_optional_tflite_copts() + xnnpack_optional_armcl_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5352,7 +5350,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "deconvolution_bench",
|
||||
+ name = "deconvolution_bench.wasm",
|
||||
srcs = ["bench/deconvolution.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5360,7 +5358,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "elu_bench",
|
||||
+ name = "elu_bench.wasm",
|
||||
srcs = ["bench/elu.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5368,7 +5366,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "floor_bench",
|
||||
+ name = "floor_bench.wasm",
|
||||
srcs = ["bench/floor.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5376,13 +5374,13 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "global_average_pooling_bench",
|
||||
+ name = "global_average_pooling_bench.wasm",
|
||||
srcs = ["bench/global-average-pooling.cc"],
|
||||
deps = OPERATOR_BENCHMARK_DEPS,
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "hardswish_bench",
|
||||
+ name = "hardswish_bench.wasm",
|
||||
srcs = ["bench/hardswish.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5390,13 +5388,13 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "max_pooling_bench",
|
||||
+ name = "max_pooling_bench.wasm",
|
||||
srcs = ["bench/max-pooling.cc"],
|
||||
deps = OPERATOR_BENCHMARK_DEPS,
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "sigmoid_bench",
|
||||
+ name = "sigmoid_bench.wasm",
|
||||
srcs = ["bench/sigmoid.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5404,7 +5402,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "prelu_bench",
|
||||
+ name = "prelu_bench.wasm",
|
||||
srcs = ["bench/prelu.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5412,7 +5410,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "softmax_bench",
|
||||
+ name = "softmax_bench.wasm",
|
||||
srcs = ["bench/softmax.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5420,7 +5418,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "square_root_bench",
|
||||
+ name = "square_root_bench.wasm",
|
||||
srcs = ["bench/square-root.cc"],
|
||||
copts = xnnpack_optional_tflite_copts(),
|
||||
tags = ["nowin32"],
|
||||
@@ -5428,7 +5426,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "truncation_bench",
|
||||
+ name = "truncation_bench.wasm",
|
||||
srcs = ["bench/truncation.cc"],
|
||||
deps = OPERATOR_BENCHMARK_DEPS,
|
||||
)
|
||||
@@ -5620,7 +5618,7 @@ cc_library(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_dwconv_e2e_bench",
|
||||
+ name = "f32_dwconv_e2e_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-dwconv-e2e.cc",
|
||||
"bench/end2end.h",
|
||||
@@ -5635,7 +5633,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_gemm_e2e_bench",
|
||||
+ name = "f32_gemm_e2e_bench.wasm",
|
||||
srcs = [
|
||||
"bench/f32-gemm-e2e.cc",
|
||||
"bench/end2end.h",
|
||||
@@ -5650,7 +5648,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "qs8_gemm_e2e_bench",
|
||||
+ name = "qs8_gemm_e2e_bench.wasm",
|
||||
srcs = [
|
||||
"bench/qs8-gemm-e2e.cc",
|
||||
"bench/end2end.h",
|
||||
@@ -5663,7 +5661,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "end2end_bench",
|
||||
+ name = "end2end_bench.wasm",
|
||||
srcs = ["bench/end2end.cc"],
|
||||
deps = [
|
||||
":XNNPACK",
|
||||
@@ -5690,7 +5688,7 @@ xnnpack_benchmark(
|
||||
#################### Accuracy evaluation for math functions ####################
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_exp_ulp_eval",
|
||||
+ name = "f32_exp_ulp_eval.wasm",
|
||||
srcs = [
|
||||
"eval/f32-exp-ulp.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5702,7 +5700,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_expminus_ulp_eval",
|
||||
+ name = "f32_expminus_ulp_eval.wasm",
|
||||
srcs = [
|
||||
"eval/f32-expminus-ulp.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5714,7 +5712,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_expm1minus_ulp_eval",
|
||||
+ name = "f32_expm1minus_ulp_eval.wasm",
|
||||
srcs = [
|
||||
"eval/f32-expm1minus-ulp.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5726,7 +5724,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_extexp_ulp_eval",
|
||||
+ name = "f32_extexp_ulp_eval.wasm",
|
||||
srcs = [
|
||||
"eval/f32-extexp-ulp.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5738,7 +5736,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_sigmoid_ulp_eval",
|
||||
+ name = "f32_sigmoid_ulp_eval.wasm",
|
||||
srcs = [
|
||||
"eval/f32-sigmoid-ulp.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
@@ -5750,7 +5748,7 @@ xnnpack_benchmark(
|
||||
)
|
||||
|
||||
xnnpack_benchmark(
|
||||
- name = "f32_sqrt_ulp_eval",
|
||||
+ name = "f32_sqrt_ulp_eval.wasm",
|
||||
srcs = [
|
||||
"eval/f32-sqrt-ulp.cc",
|
||||
"src/xnnpack/AlignedAllocator.h",
|
||||
diff --git a/WORKSPACE b/WORKSPACE
|
||||
index 4fa1aa2f..86040d42 100644
|
||||
index 4fa1aa2f..6181aab2 100644
|
||||
--- a/WORKSPACE
|
||||
+++ b/WORKSPACE
|
||||
@@ -5,8 +5,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
# Bazel rule definitions
|
||||
http_archive(
|
||||
name = "rules_cc",
|
||||
- strip_prefix = "rules_cc-master",
|
||||
- urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"],
|
||||
+ strip_prefix = "rules_cc-main",
|
||||
+ urls = ["https://github.com/bazelbuild/rules_cc/archive/main.zip"],
|
||||
)
|
||||
|
||||
# Google Test framework, used by most unit-tests.
|
||||
@@ -19,8 +19,8 @@ http_archive(
|
||||
# Google Benchmark library, used in micro-benchmarks.
|
||||
http_archive(
|
||||
name = "com_google_benchmark",
|
||||
- strip_prefix = "benchmark-master",
|
||||
- urls = ["https://github.com/google/benchmark/archive/master.zip"],
|
||||
+ strip_prefix = "benchmark-1.5.3",
|
||||
+ urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.5.3.zip"],
|
||||
)
|
||||
|
||||
# FP16 library, used for half-precision conversions
|
||||
@@ -89,3 +89,18 @@ android_ndk_repository(name = "androidndk")
|
||||
|
||||
# Android SDK location and API is auto-detected from $ANDROID_HOME environment variable
|
||||
|
@ -87,10 +599,25 @@ index 10345032..0e926fca 100644
|
|||
":windows_x86_64_msys": ["-lshlwapi"],
|
||||
"//conditions:default": [],
|
||||
diff --git a/emscripten.bzl b/emscripten.bzl
|
||||
index 0a0caedf..d28afa30 100644
|
||||
index 0a0caedf..aafe3199 100644
|
||||
--- a/emscripten.bzl
|
||||
+++ b/emscripten.bzl
|
||||
@@ -23,15 +23,28 @@ def xnnpack_emscripten_benchmark_linkopts():
|
||||
@@ -6,6 +6,7 @@ def xnnpack_emscripten_minimal_linkopts():
|
||||
"-s ASSERTIONS=0",
|
||||
"-s ERROR_ON_UNDEFINED_SYMBOLS=1",
|
||||
"-s EXIT_RUNTIME=1",
|
||||
+ "--oformat=wasm",
|
||||
]
|
||||
|
||||
def xnnpack_emscripten_test_linkopts():
|
||||
@@ -17,21 +18,36 @@ def xnnpack_emscripten_test_linkopts():
|
||||
"-s EXIT_RUNTIME=1",
|
||||
"-s ALLOW_MEMORY_GROWTH=1",
|
||||
"--pre-js $(location :preamble.js.lds)",
|
||||
+ "--oformat=wasm",
|
||||
]
|
||||
|
||||
def xnnpack_emscripten_benchmark_linkopts():
|
||||
"""Emscripten-specific linkopts for benchmarks."""
|
||||
return [
|
||||
"-s ASSERTIONS=1",
|
||||
|
@ -108,6 +635,7 @@ index 0a0caedf..d28afa30 100644
|
|||
+ "-Wl,--export=__data_end",
|
||||
+ "-Wl,--export=malloc",
|
||||
+ "-Wl,--export=free",
|
||||
+ "--oformat=wasm",
|
||||
]
|
||||
|
||||
def xnnpack_emscripten_deps():
|
||||
|
|
|
@ -1,95 +1,44 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
cmake_minimum_required (VERSION 2.8...3.16)
|
||||
|
||||
project(bwa_wasm)
|
||||
|
||||
################ WASI-SDK ################
|
||||
find_path(WASI_SDK_HOME
|
||||
NAMES wasi-sdk
|
||||
PATHS /opt/
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
if (NOT WASI_SDK_HOME)
|
||||
message(FATAL_ERROR
|
||||
"can not find wasi-sdk. "
|
||||
"please download it from "
|
||||
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz "
|
||||
"and install it under /opt/wasi-sdk"
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# check clang version
|
||||
execute_process(COMMAND
|
||||
${WASI_SDK_HOME}/wasi-sdk/bin/clang --version
|
||||
OUTPUT_VARIABLE clang_full_version_string
|
||||
)
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
|
||||
CLANG_VERSION_STRING ${clang_full_version_string}
|
||||
)
|
||||
message("cur clang version is ${CLANG_VERSION_STRING}")
|
||||
if(CLANG_VERSION_STRING VERSION_LESS 11.0)
|
||||
message(FATAL_ERROR
|
||||
"please install latest wai-sdk to get a clang-11 at least"
|
||||
)
|
||||
endif()
|
||||
|
||||
################ EMCC ################
|
||||
if(NOT DEFINED ENV{EMSDK})
|
||||
message(FATAL_ERROR
|
||||
"can not find emsdk. "
|
||||
"please refer to https://emscripten.org/docs/getting_started/downloads.html "
|
||||
"and install it, "
|
||||
"or active emsdk by 'source ./emsdk_env.sh'"
|
||||
)
|
||||
endif()
|
||||
|
||||
################ BINARYEN ################
|
||||
find_program(WASM_OPT
|
||||
NAMES wasm-opt
|
||||
PATHS /opt/binaryen-version_97/bin /opt/binaryen/bin
|
||||
)
|
||||
|
||||
if (NOT WASM_OPT)
|
||||
message(FATAL_ERROR
|
||||
"can not find wasm-opt. "
|
||||
"please download it from "
|
||||
"https://github.com/WebAssembly/binaryen/releases/download/version_97/binaryen-version_97-x86_64-linux.tar.gz "
|
||||
"and install it under /opt"
|
||||
)
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/preparation.cmake)
|
||||
|
||||
#######################################
|
||||
include(ExternalProject)
|
||||
|
||||
################ HEADERS ################
|
||||
set(EMSDK_SYSTEM_HEADERS "$ENV{EMSDK}/upstream/emscripten/system/include")
|
||||
set(EMSDK_SSE_HEADERS "${EMSDK_SYSTEM_HEADERS}/SSE")
|
||||
set(EMSDK_LIBC_HEADERS "${EMSDK_SYSTEM_HEADERS}/libc")
|
||||
ExternalProject_Add(headers_from_emcc
|
||||
PREFIX headers
|
||||
SOURCE_DIR "$ENV{EM_CACHE}/sysroot/include"
|
||||
SOURCE_DIR ${EMSDK_SYSTEM_HEADERS}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND mkdir -p ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE
|
||||
&& ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys
|
||||
&& ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/include/emscripten
|
||||
# copy emscripten SSE header files
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/compat/immintrin.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_SYSTEM_HEADERS}/wasm_simd128.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_SSE_HEADERS}/immintrin.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
# SSE
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/compat/xmmintrin.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_SSE_HEADERS}/xmmintrin.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
# SSE2
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/compat/emmintrin.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_SSE_HEADERS}/emmintrin.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
# SSE4.1
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/compat/smmintrin.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_SSE_HEADERS}/smmintrin.h ${CMAKE_CURRENT_SOURCE_DIR}/include/SSE/
|
||||
# a fake empty header to aovid further depenency
|
||||
&& ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_SOURCE_DIR}/include/emscripten/emscripten.h
|
||||
# copy emscripten pthread related header files
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/pthread.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/signal.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/netdb.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/sys/wait.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys/
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/sys/socket.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/pthread.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/signal.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/netdb.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/sys/wait.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/sys/socket.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys/
|
||||
)
|
||||
|
||||
################ libz ################
|
||||
|
|
76
samples/workload/cmake/preparation.cmake
Normal file
76
samples/workload/cmake/preparation.cmake
Normal file
|
@ -0,0 +1,76 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
################ WASI-SDK ################
|
||||
find_path(WASI_SDK_HOME
|
||||
NAMES wasi-sdk
|
||||
PATHS /opt/
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
if (NOT WASI_SDK_HOME)
|
||||
message(FATAL_ERROR
|
||||
"can not find wasi-sdk. "
|
||||
"please download it from "
|
||||
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz "
|
||||
"and install it under /opt/wasi-sdk"
|
||||
)
|
||||
else()
|
||||
message(STATUS
|
||||
"Detecting wasi-sdk info: ${WASI_SDK_HOME}/wasi-sdk"
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# check clang version
|
||||
execute_process(COMMAND
|
||||
${WASI_SDK_HOME}/wasi-sdk/bin/clang --version
|
||||
OUTPUT_VARIABLE clang_full_version_string
|
||||
)
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
|
||||
CLANG_VERSION_STRING ${clang_full_version_string}
|
||||
)
|
||||
message(STATUS "Detecting clang versoin: ${CLANG_VERSION_STRING}")
|
||||
if(CLANG_VERSION_STRING VERSION_LESS 11.0)
|
||||
message(FATAL_ERROR
|
||||
"please install latest wai-sdk to get a clang-11 at least"
|
||||
)
|
||||
endif()
|
||||
|
||||
################ EMCC ################
|
||||
if(NOT DEFINED ENV{EMSDK})
|
||||
message(FATAL_ERROR
|
||||
"can not find emsdk. "
|
||||
"please refer to https://emscripten.org/docs/getting_started/downloads.html "
|
||||
"and install it, "
|
||||
"or active emsdk by 'source ./emsdk_env.sh'"
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Detecting EMSDK info: $ENV{EMSDK}")
|
||||
|
||||
### check if the emsdk is 2.0.12
|
||||
### upstream/.emsdk_version should be releases-upstream-dcf819a7821f8db0c8f15ac336fea8960ec204f5-64bit
|
||||
file(STRINGS "$ENV{EMSDK}/upstream/.emsdk_version" EMSDK_VERSION)
|
||||
if(NOT (${EMSDK_VERSION} STREQUAL "releases-upstream-dcf819a7821f8db0c8f15ac336fea8960ec204f5-64bit"))
|
||||
message(FATAL_ERROR "please install emsdk 2.0.12")
|
||||
endif()
|
||||
|
||||
################ BINARYEN ################
|
||||
find_program(WASM_OPT
|
||||
NAMES wasm-opt
|
||||
PATHS /opt/binaryen-version_101/bin /opt/binaryen/bin
|
||||
)
|
||||
|
||||
if (NOT WASM_OPT)
|
||||
message(FATAL_ERROR
|
||||
"can not find wasm-opt. "
|
||||
"please download it from "
|
||||
"https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-linux.tar.gz "
|
||||
"and install it under /opt"
|
||||
)
|
||||
else()
|
||||
message(STATUS
|
||||
"Detecting EMSDK info: $ENV{EMSDK}"
|
||||
)
|
||||
endif()
|
|
@ -4,19 +4,10 @@ RUN apt update \
|
|||
&& apt install -y lsb-release software-properties-common build-essential \
|
||||
wget curl git tree zip unzip
|
||||
|
||||
#
|
||||
# install clang and llvm
|
||||
# COPY llvm.sh /tmp
|
||||
# RUN apt update \
|
||||
# && apt install -y lsb-release wget software-properties-common build-essential \
|
||||
# && cd /tmp \
|
||||
# && chmod a+x llvm.sh \
|
||||
# && ./llvm.sh 11
|
||||
|
||||
ARG WASI_SDK_VER=12
|
||||
ARG WABT_VER=1.0.20
|
||||
ARG WABT_VER=1.0.23
|
||||
ARG CMAKE_VER=3.16.2
|
||||
ARG BINARYEN_VER=version_97
|
||||
ARG BINARYEN_VER=version_101
|
||||
|
||||
#
|
||||
# install wasi-sdk
|
||||
|
@ -52,8 +43,8 @@ RUN cd /opt \
|
|||
&& git clone https://github.com/emscripten-core/emsdk.git \
|
||||
&& cd emsdk \
|
||||
&& git pull \
|
||||
&& ./emsdk install latest \
|
||||
&& ./emsdk activate latest \
|
||||
&& ./emsdk install 2.0.12 \
|
||||
&& ./emsdk activate 2.0.12 \
|
||||
&& echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
|
||||
|
||||
#
|
||||
|
@ -73,6 +64,9 @@ RUN cd /opt/bazelisk/bin/ \
|
|||
&& chmod a+x bazelisk \
|
||||
&& ln -sf /opt/bazelisk/bin/bazelisk /usr/local/bin/bazel
|
||||
|
||||
RUN apt update \
|
||||
&& apt install -y python2.7-minimal
|
||||
|
||||
#
|
||||
# Clean up
|
||||
RUN apt-get autoremove -y \
|
||||
|
|
|
@ -10,9 +10,9 @@ if [[ ! -d ${BUILD_CONTENT} ]]; then
|
|||
fi
|
||||
|
||||
readonly WASI_SDK_VER=12
|
||||
readonly WABT_VER=1.0.20
|
||||
readonly WABT_VER=1.0.23
|
||||
readonly CMAKE_VER=3.16.2
|
||||
readonly BINARYEN_VER=version_97
|
||||
readonly BINARYEN_VER=version_101
|
||||
readonly BAZELISK_VER=1.7.5
|
||||
|
||||
cd ${BUILD_CONTENT} || exit
|
||||
|
@ -24,10 +24,6 @@ if [[ ! -f wabt-${WABT_VER}-ubuntu.tar.gz ]]; then
|
|||
wget https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz
|
||||
fi
|
||||
|
||||
# if [[ ! -f llvm.sh ]]; then
|
||||
# wget https://apt.llvm.org/llvm.sh
|
||||
# fi
|
||||
|
||||
if [[ ! -f cmake-${CMAKE_VER}-Linux-x86_64.sh ]]; then
|
||||
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh
|
||||
fi
|
||||
|
@ -36,7 +32,7 @@ if [[ ! -f binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz ]]; then
|
|||
wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz
|
||||
fi
|
||||
|
||||
if [[ ! -f bazelisk-linux-amd64.sh ]]; then
|
||||
if [[ ! -f bazelisk-linux-amd64 ]]; then
|
||||
wget https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64
|
||||
fi
|
||||
cd - > /dev/null || exit
|
||||
|
@ -48,10 +44,10 @@ docker build \
|
|||
--build-arg WABT_VER=${WABT_VER} \
|
||||
--build-arg CMAKE_VER=${CMAKE_VER} \
|
||||
--build-arg BINARYEN_VER=${BINARYEN_VER} \
|
||||
-t clang_env:0.1 -f "${DOCKERFILE_PATH}"/Dockerfile ${BUILD_CONTENT} \
|
||||
-t wamr_workload_env:0.1 -f "${DOCKERFILE_PATH}"/Dockerfile ${BUILD_CONTENT} \
|
||||
&& docker run --rm \
|
||||
--name workload_w_clang \
|
||||
--mount type=bind,source="$(pwd)",target=/data/project \
|
||||
-w /data/project \
|
||||
clang_env:0.1 \
|
||||
wamr_workload_env:0.1 \
|
||||
/bin/bash -c /build.sh
|
||||
|
|
|
@ -5,52 +5,7 @@ cmake_minimum_required (VERSION 3.0)
|
|||
|
||||
project(bench-meshoptimizer)
|
||||
|
||||
################ WASI-SDK ################
|
||||
find_path(WASI_SDK_HOME
|
||||
NAMES wasi-sdk
|
||||
PATHS /opt/
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
if (NOT WASI_SDK_HOME)
|
||||
message(FATAL_ERROR
|
||||
"can not find wasi-sdk. "
|
||||
"please download it from "
|
||||
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz "
|
||||
"and install it under /opt/wasi-sdk"
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# check clang version
|
||||
execute_process(COMMAND
|
||||
${WASI_SDK_HOME}/wasi-sdk/bin/clang --version
|
||||
OUTPUT_VARIABLE clang_full_version_string
|
||||
)
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
|
||||
CLANG_VERSION_STRING ${clang_full_version_string}
|
||||
)
|
||||
message("cur clang version is ${CLANG_VERSION_STRING}")
|
||||
if(CLANG_VERSION_STRING VERSION_LESS 11.0)
|
||||
message(FATAL_ERROR
|
||||
"please install latest wai-sdk to get a clang-11 at least"
|
||||
)
|
||||
endif()
|
||||
|
||||
################ BINARYEN ################
|
||||
find_program(WASM_OPT
|
||||
NAMES wasm-opt
|
||||
PATHS /opt/binaryen-version_97/bin /opt/binaryen/bin
|
||||
)
|
||||
|
||||
if (NOT WASM_OPT)
|
||||
message(FATAL_ERROR
|
||||
"can not find wasm-opt. "
|
||||
"please download it from "
|
||||
"https://github.com/WebAssembly/binaryen/releases/download/version_97/binaryen-version_97-x86_64-linux.tar.gz "
|
||||
"and install it under /opt"
|
||||
)
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/preparation.cmake)
|
||||
|
||||
################ MESHOPTIMIZER ################
|
||||
include(ExternalProject)
|
||||
|
|
|
@ -32,7 +32,7 @@ $ em++ tools/codecbench.cpp src/vertexcodec.cpp src/vertexfilter.cpp \
|
|||
src/spatialorder.cpp src/allocator.cpp src/vcacheanalyzer.cpp \
|
||||
src/vfetchoptimizer.cpp src/overdrawoptimizer.cpp src/simplifier.cpp \
|
||||
src/stripifier.cpp -O3 -msimd128 \
|
||||
-s TOTAL_MEMORY=268435456 -s "EXPORTED_FUNCTIONS=['_main']" \
|
||||
-s TOTAL_MEMORY=268435456 \
|
||||
-o codecbench.wasm
|
||||
$ ls -l codecbench.wasm
|
||||
```
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
readonly BUILD_CONTENT="/tmp/build_content"
|
||||
readonly WASI_SDK_VER=12
|
||||
readonly WASI_SDK_FILE="wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz"
|
||||
readonly WABT_VER=1.0.20
|
||||
readonly WABT_VER=1.0.23
|
||||
readonly WABT_FILE="wabt-${WABT_VER}-ubuntu.tar.gz"
|
||||
readonly CMAKE_VER=3.16.2
|
||||
readonly CMAKE_FILE="cmake-${CMAKE_VER}-Linux-x86_64.sh"
|
||||
readonly BINARYEN_VER=version_97
|
||||
readonly BINARYEN_VER=version_101
|
||||
readonly BINARYEN_FILE="binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz"
|
||||
readonly BAZEL_VER=3.7.0
|
||||
readonly BAZEL_FILE=bazel-${BAZEL_VER}-installer-linux-x86_64.sh
|
||||
|
@ -28,17 +28,6 @@ function install_deps() {
|
|||
build-essential git tree zip unzip
|
||||
}
|
||||
|
||||
#
|
||||
# install clang
|
||||
#function install_clang() {
|
||||
# if [[ ! -f llvm.sh ]]; then
|
||||
# wget https://apt.llvm.org/llvm.sh
|
||||
# fi
|
||||
#
|
||||
# chmod a+x llvm.sh
|
||||
# ./llvm.sh 11
|
||||
#}
|
||||
|
||||
#
|
||||
# install wasi-sdk
|
||||
function install_wasi-sdk() {
|
||||
|
@ -81,8 +70,8 @@ function install_emsdk() {
|
|||
git clone https://github.com/emscripten-core/emsdk.git
|
||||
cd emsdk
|
||||
git pull
|
||||
./emsdk install latest
|
||||
./emsdk activate latest
|
||||
./emsdk install 2.0.12
|
||||
./emsdk activate 2.0.12
|
||||
echo "source /opt/emsdk/emsdk_env.sh" >> "${HOME}"/.bashrc
|
||||
}
|
||||
|
||||
|
@ -120,12 +109,12 @@ if DEBUG; then
|
|||
"$@"
|
||||
else
|
||||
install_deps \
|
||||
&& install_wasi-sdk \
|
||||
&& install_wabt \
|
||||
&& install_bazel \
|
||||
&& install_binaryen \
|
||||
&& install_cmake \
|
||||
&& install_emsdk \
|
||||
&& install_binaryen \
|
||||
&& install_bazel
|
||||
&& install_wabt \
|
||||
&& install_wasi-sdk
|
||||
fi
|
||||
cd - > /dev/null || exit
|
||||
DEBUG && set +xevu
|
||||
|
|
|
@ -5,8 +5,8 @@ This sample demonstrates how to build [tensorflow](https://github.com/tensorflow
|
|||
```bash
|
||||
git clone https://github.com/emscripten-core/emsdk.git
|
||||
cd emsdk
|
||||
./emsdk install latest
|
||||
./emsdk activate latest
|
||||
./emsdk install 2.0.12
|
||||
./emsdk activate 2.0.12
|
||||
```
|
||||
And set up ensdk environment:
|
||||
```bash
|
||||
|
@ -26,4 +26,4 @@ to build tensorflow and run it with iwasm, which basically contains the followin
|
|||
- build tf-lite with emcc compiler
|
||||
- build iwasm with pthread enable and include libiary under libc-emcc
|
||||
- run benchmark model with iwasm:
|
||||
--max-secs 300: means the max training time cost is 5 minutes, you can adjust by yourself
|
||||
--max-secs 300: means the max training time cost is 5 minutes, you can adjust it by yourself
|
||||
|
|
|
@ -17,7 +17,7 @@ fi
|
|||
|
||||
set -xe
|
||||
|
||||
EMSDK_WASM_DIR="$EM_CACHE/sysroot/lib/wasm32-emscripten"
|
||||
EMSDK_WASM_DIR="${EMSDK}/upstream/emscripten/cache/wasm"
|
||||
BUILD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
OUT_DIR="${BUILD_SCRIPT_DIR}/out"
|
||||
TENSORFLOW_DIR="${BUILD_SCRIPT_DIR}/tensorflow"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
cmake_minimum_required (VERSION 2.8...3.16)
|
||||
|
||||
project(testavx)
|
||||
|
||||
|
|
|
@ -1,77 +1,34 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
cmake_minimum_required (VERSION 2.8...3.16)
|
||||
|
||||
project(av1_wasm)
|
||||
|
||||
################ WASI-SDK ################
|
||||
find_path(WASI_SDK_HOME
|
||||
NAMES wasi-sdk
|
||||
PATHS /opt/
|
||||
REQUIRED
|
||||
)
|
||||
|
||||
if (NOT WASI_SDK_HOME)
|
||||
message(FATAL_ERROR
|
||||
"can not find wasi-sdk. "
|
||||
"please download it from "
|
||||
"https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz "
|
||||
"and install it under /opt/wasi-sdk"
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# check clang version
|
||||
execute_process(COMMAND
|
||||
${WASI_SDK_HOME}/wasi-sdk/bin/clang --version
|
||||
OUTPUT_VARIABLE clang_full_version_string
|
||||
)
|
||||
string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1"
|
||||
CLANG_VERSION_STRING ${clang_full_version_string}
|
||||
)
|
||||
message("cur clang version is ${CLANG_VERSION_STRING}")
|
||||
if(CLANG_VERSION_STRING VERSION_LESS 11.0)
|
||||
message(FATAL_ERROR
|
||||
"please install latest wai-sdk to get a clang-11 at least"
|
||||
)
|
||||
endif()
|
||||
|
||||
################ BINARYEN ################
|
||||
find_program(WASM_OPT
|
||||
NAMES wasm-opt
|
||||
PATHS /opt/binaryen-version_97/bin /opt/binaryen/bin
|
||||
)
|
||||
|
||||
if (NOT WASM_OPT)
|
||||
message(FATAL_ERROR
|
||||
"can not find wasm-opt. "
|
||||
"please download it from "
|
||||
"https://github.com/WebAssembly/binaryen/releases/download/version_97/binaryen-version_97-x86_64-linux.tar.gz "
|
||||
"and install it under /opt"
|
||||
)
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/preparation.cmake)
|
||||
|
||||
#######################################
|
||||
include(ExternalProject)
|
||||
|
||||
################ HEADERS ################
|
||||
set(EMSDK_SYSTEM_HEADERS "$ENV{EMSDK}/upstream/emscripten/system/include")
|
||||
set(EMSDK_LIBC_HEADERS "${EMSDK_SYSTEM_HEADERS}/libc")
|
||||
ExternalProject_Add(headers_from_emcc
|
||||
PREFIX headers
|
||||
SOURCE_DIR "$ENV{EM_CACHE}/sysroot/include"
|
||||
SOURCE_DIR "${EMSDK_SYSTEM_HEADERS}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys
|
||||
&& ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/include/libc/bits
|
||||
# copy emscripten pthread related header files
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/pthread.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/signal.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/netdb.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/sys/wait.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys/
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/sys/socket.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/pthread.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/signal.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/netdb.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/sys/wait.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys/
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/sys/socket.h ${CMAKE_CURRENT_SOURCE_DIR}/include/pthread/sys/
|
||||
# copy emscripten setjmp headers
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EM_CACHE}/sysroot/include/setjmp.h ${CMAKE_CURRENT_SOURCE_DIR}/include/libc/setjmp.h
|
||||
&& ${CMAKE_COMMAND} -E copy $ENV{EMSDK}/upstream/emscripten/system/lib/libc/musl/arch/emscripten/bits/setjmp.h ${CMAKE_CURRENT_SOURCE_DIR}/include/libc/bits/setjmp.h
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_LIBC_HEADERS}/setjmp.h ${CMAKE_CURRENT_SOURCE_DIR}/include/libc/setjmp.h
|
||||
&& ${CMAKE_COMMAND} -E copy ${EMSDK_SYSTEM_HEADERS}/../lib/libc/musl/arch/emscripten/bits/setjmp.h ${CMAKE_CURRENT_SOURCE_DIR}/include/libc/bits/setjmp.h
|
||||
)
|
||||
|
||||
################ av1 ################
|
||||
|
|
|
@ -17,7 +17,7 @@ fi
|
|||
|
||||
set -xe
|
||||
|
||||
EMSDK_WASM_DIR="$EM_CACHE/sysroot/lib/wasm32-emscripten"
|
||||
EMSDK_WASM_DIR="${EMSDK}/upstream/emscripten/cache/wasm"
|
||||
BUILD_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
OUT_DIR="${BUILD_SCRIPT_DIR}/out"
|
||||
WASM_AV1_DIR="${BUILD_SCRIPT_DIR}/wasm-av1"
|
||||
|
|
Loading…
Reference in New Issue
Block a user