From 39afa12f4e62e7bb3be95ccc6ff4d545ebc20418 Mon Sep 17 00:00:00 2001 From: "liang.he@intel.com" Date: Thu, 26 Dec 2024 06:04:02 +0000 Subject: [PATCH 1/2] add default build configuration options and enhance message output for WAMR features --- build-scripts/config_common.cmake | 155 +++++++++++++++++++++--------- 1 file changed, 108 insertions(+), 47 deletions(-) diff --git a/build-scripts/config_common.cmake b/build-scripts/config_common.cmake index 48c5f7be4b..5e3e20234c 100644 --- a/build-scripts/config_common.cmake +++ b/build-scripts/config_common.cmake @@ -162,16 +162,61 @@ if (WAMR_BUILD_LINUX_PERF EQUAL 1) endif () endif () +######################################## +# Default values +######################################## +if (NOT DEFINED WAMR_BUILD_BULK_MEMORY) + set (WAMR_BUILD_BULK_MEMORY 1) +endif () + +if (NOT DEFINED WAMR_BUILD_EXCE_HANDLING) + set (WAMR_BUILD_EXCE_HANDLING 0) +endif () + +if (NOT DEFINED WAMR_BUILD_GC) + set (WAMR_BUILD_GC 0) +endif () + +if (NOT DEFINED WAMR_BUILD_MEMORY64) + set (WAMR_BUILD_MEMORY64 0) +endif () + +if (NOT DEFINED WAMR_BUILD_MULTI_MEMORY) + set (WAMR_BUILD_MULTI_MEMORY 0) +endif () + +if (NOT DEFINED WAMR_BUILD_SHARED_MEMORY) + set(WAMR_BUILD_SHARED_MEMORY 0) +endif () + +if (NOT DEFINED WAMR_BUILD_STRINGREF) + set(WAMR_BUILD_STRINGREF 0) +endif () + +if (NOT DEFINED WAMR_BUILD_TAIL_CALL) + set (WAMR_BUILD_TAIL_CALL 0) +endif () + +######################################## +# Compilation options to marco ######################################## message ("-- Build Configurations:") message (" Build as target ${WAMR_BUILD_TARGET}") message (" CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE}) +################## running mode ################## if (WAMR_BUILD_INTERP EQUAL 1) message (" WAMR Interpreter enabled") else () message (" WAMR Interpreter disabled") endif () +if ((WAMR_BUILD_FAST_INTERP EQUAL 1) AND (WAMR_BUILD_INTERP EQUAL 1)) + add_definitions (-DWASM_ENABLE_FAST_INTERP=1) + message (" Fast interpreter enabled") +else () + add_definitions (-DWASM_ENABLE_FAST_INTERP=0) + message (" Fast interpreter disabled") +endif () if (WAMR_BUILD_AOT EQUAL 1) message (" WAMR AOT enabled") else () @@ -202,6 +247,16 @@ if (WAMR_BUILD_FAST_JIT EQUAL 1 AND WAMR_BUILD_JIT EQUAL 1 AND WAMR_BUILD_LAZY_JIT EQUAL 1) message (" Multi-tier JIT enabled") endif () +################## test modes ################## +if (WAMR_BUILD_SPEC_TEST EQUAL 1) + add_definitions (-DWASM_ENABLE_SPEC_TEST=1) + message (" spec test compatible mode is on") +endif () +if (WAMR_BUILD_WASI_TEST EQUAL 1) + add_definitions (-DWASM_ENABLE_WASI_TEST=1) + message (" wasi test compatible mode is on") +endif () +################## native ################## if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1) message (" Libc builtin enabled") else () @@ -214,13 +269,25 @@ elseif (WAMR_BUILD_LIBC_WASI EQUAL 1) else () message (" Libc WASI disabled") endif () -if ((WAMR_BUILD_FAST_INTERP EQUAL 1) AND (WAMR_BUILD_INTERP EQUAL 1)) - add_definitions (-DWASM_ENABLE_FAST_INTERP=1) - message (" Fast interpreter enabled") -else () - add_definitions (-DWASM_ENABLE_FAST_INTERP=0) - message (" Fast interpreter disabled") +if (WAMR_BUILD_THREAD_MGR EQUAL 1) + message (" Thread manager enabled") +endif () +if (WAMR_BUILD_LIB_PTHREAD EQUAL 1) + message (" Lib pthread enabled") endif () +if (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE EQUAL 1) + message (" Lib pthread semaphore enabled") +endif () +if (WAMR_BUILD_LIB_WASI_THREADS EQUAL 1) + message (" Lib wasi-threads enabled") +endif () +if (WAMR_BUILD_LIBC_EMCC EQUAL 1) + message (" Libc emcc enabled") +endif () +if (WAMR_BUILD_LIB_RATS EQUAL 1) + message (" Lib rats enabled") +endif() +################## WAMR features ################## if (WAMR_BUILD_MULTI_MODULE EQUAL 1) add_definitions (-DWASM_ENABLE_MULTI_MODULE=1) message (" Multiple modules enabled") @@ -228,24 +295,10 @@ else () add_definitions (-DWASM_ENABLE_MULTI_MODULE=0) message (" Multiple modules disabled") endif () -if (WAMR_BUILD_SPEC_TEST EQUAL 1) - add_definitions (-DWASM_ENABLE_SPEC_TEST=1) - message (" spec test compatible mode is on") -endif () -if (WAMR_BUILD_WASI_TEST EQUAL 1) - add_definitions (-DWASM_ENABLE_WASI_TEST=1) - message (" wasi test compatible mode is on") -endif () -if (NOT DEFINED WAMR_BUILD_BULK_MEMORY) - # Enable bulk memory by default - set (WAMR_BUILD_BULK_MEMORY 1) -endif () if (WAMR_BUILD_BULK_MEMORY EQUAL 1) add_definitions (-DWASM_ENABLE_BULK_MEMORY=1) - message (" Bulk memory feature enabled") else () add_definitions (-DWASM_ENABLE_BULK_MEMORY=0) - message (" Bulk memory feature disabled") endif () if (WAMR_BUILD_SHARED_MEMORY EQUAL 1) add_definitions (-DWASM_ENABLE_SHARED_MEMORY=1) @@ -265,31 +318,11 @@ if (WAMR_BUILD_MEMORY64 EQUAL 1) endif() add_definitions (-DWASM_ENABLE_MEMORY64=1) set (WAMR_DISABLE_HW_BOUND_CHECK 1) - message (" Memory64 memory enabled") endif () if (WAMR_BUILD_MULTI_MEMORY EQUAL 1) add_definitions (-DWASM_ENABLE_MULTI_MEMORY=1) - message (" Multi memory enabled") set (WAMR_BUILD_DEBUG_INTERP 0) endif () -if (WAMR_BUILD_THREAD_MGR EQUAL 1) - message (" Thread manager enabled") -endif () -if (WAMR_BUILD_LIB_PTHREAD EQUAL 1) - message (" Lib pthread enabled") -endif () -if (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE EQUAL 1) - message (" Lib pthread semaphore enabled") -endif () -if (WAMR_BUILD_LIB_WASI_THREADS EQUAL 1) - message (" Lib wasi-threads enabled") -endif () -if (WAMR_BUILD_LIBC_EMCC EQUAL 1) - message (" Libc emcc enabled") -endif () -if (WAMR_BUILD_LIB_RATS EQUAL 1) - message (" Lib rats enabled") -endif() if (WAMR_BUILD_MINI_LOADER EQUAL 1) add_definitions (-DWASM_ENABLE_MINI_LOADER=1) message (" WASM mini loader enabled") @@ -319,7 +352,6 @@ endif () if (WAMR_BUILD_SIMD EQUAL 1) if (NOT WAMR_BUILD_TARGET MATCHES "RISCV64.*") add_definitions (-DWASM_ENABLE_SIMD=1) - message (" SIMD enabled") else () message (" SIMD disabled due to not supported on target RISCV64") endif () @@ -349,16 +381,11 @@ if (WAMR_BUILD_DUMP_CALL_STACK EQUAL 1) endif () if (WAMR_BUILD_TAIL_CALL EQUAL 1) add_definitions (-DWASM_ENABLE_TAIL_CALL=1) - message (" Tail call enabled") endif () if (WAMR_BUILD_REF_TYPES EQUAL 1) add_definitions (-DWASM_ENABLE_REF_TYPES=1) - message (" Reference types enabled") -else () - message (" Reference types disabled") endif () if (WAMR_BUILD_GC EQUAL 1) - message (" GC enabled") if (WAMR_TEST_GC EQUAL 1) message(" GC testing enabled") endif() @@ -370,7 +397,6 @@ else () message (" GC performance profiling disabled") endif () if (WAMR_BUILD_STRINGREF EQUAL 1) - message (" Stringref enabled") if (NOT DEFINED WAMR_STRINGREF_IMPL_SOURCE) message (" Using WAMR builtin implementation for stringref") else () @@ -599,3 +625,38 @@ endif() if (NOT WAMR_BUILD_SANITIZER STREQUAL "") message (" Sanitizer ${WAMR_BUILD_SANITIZER} enabled") endif () + +######################################## +# Show Phase4 Wasm proposals status. +######################################## + +message ( +"------------------------------------------------------------\n" +"Phase4 Wasm Proposals:\n" +" Always-on:\n" +" Extended Constant Expressions\n" +" Multi-value\n" +" Non-trapping float-to-int conversions\n" +" Sign-extension operators\n" +" WebAssembly C and C++ API\n" +" Configurable(0 is OFF. 1 is ON):\n" +" Bulk Memory Operation: ${WAMR_BUILD_BULK_MEMORY}\n" +" Fixed-width SIMD: ${WAMR_BUILD_SIMD}\n" +" Garbage collection: ${WAMR_BUILD_GC}\n" +" Legacy Exception handling: ${WAMR_BUILD_EXCE_HANDLING}\n" +" Memory64: ${WAMR_BUILD_MEMORY64}\n" +" Multiple memories: ${WAMR_BUILD_MULTI_MEMORY}\n" +" Reference Types: ${WAMR_BUILD_REF_TYPES}\n" +" Reference-Typed Strings: ${WAMR_BUILD_STRINGREF}\n" +" Tail call: ${WAMR_BUILD_TAIL_CALL}\n" +" Thread: ${WAMR_BUILD_SHARED_MEMORY}\n" +" Typed Function References: ${WAMR_BUILD_GC}\n" +" Unsupported:\n" +" Branch Hinting\n" +" Custom Annotation Syntax in the Text Format\n" +" Exception handling\n" +" Import/Export of Mutable Globals\n" +" JS String Builtins\n" +" Relaxed SIMD\n" +"------------------------------------------------------------\n" +) \ No newline at end of file From 067f1b94d6986562f6acbc7ea46609cbc356c9c1 Mon Sep 17 00:00:00 2001 From: "liang.he@intel.com" Date: Thu, 26 Dec 2024 06:30:23 +0000 Subject: [PATCH 2/2] Add Wasm proposal status printing functionality --- product-mini/platforms/common/wasm_proposal.c | 37 +++++++++++++++++++ product-mini/platforms/common/wasm_proposal.h | 12 ++++++ product-mini/platforms/posix/main.c | 4 ++ 3 files changed, 53 insertions(+) create mode 100644 product-mini/platforms/common/wasm_proposal.c create mode 100644 product-mini/platforms/common/wasm_proposal.h diff --git a/product-mini/platforms/common/wasm_proposal.c b/product-mini/platforms/common/wasm_proposal.c new file mode 100644 index 0000000000..0e4946f0f7 --- /dev/null +++ b/product-mini/platforms/common/wasm_proposal.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2023 Amazon.com Inc. or its affiliates. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#include + +void +wasm_proposal_print_status(void) +{ + printf("Phase4 Wasm Proposals Status:\n"); + printf(" Always-on:\n"); + printf(" - Extended Constant Expressions\n"); + printf(" - Multi-value\n"); + printf(" - Non-trapping float-to-int conversions\n"); + printf(" - Sign-extension operators\n"); + printf(" - WebAssembly C and C++ API\n"); + printf(" Configurable:\n"); + printf(" - Bulk Memory Operation: %u\n", WASM_ENABLE_BULK_MEMORY); + printf(" - Fixed-Width SIMD: %u\n", WASM_ENABLE_SIMD); + printf(" - Garbage Collection: %u\n", WASM_ENABLE_GC); + printf(" - Legacy Exception Handling: %u\n", WASM_ENABLE_EXCE_HANDLING); + printf(" - Memory64: %u\n", WASM_ENABLE_MEMORY64); + printf(" - Multiple Memory: %u\n", WASM_ENABLE_MULTI_MEMORY); + printf(" - Reference Types: %u\n", WASM_ENABLE_REF_TYPES); + printf(" - Reference-Typed Strings: %u\n", WASM_ENABLE_REF_TYPES); + printf(" - Tail Call: %u\n", WASM_ENABLE_TAIL_CALL); + printf(" - Threads: %u\n", WASM_ENABLE_SHARED_MEMORY); + printf(" - Typed Function References: %u\n", WASM_ENABLE_GC); + printf(" Unsupported:\n"); + printf(" - Branch Hinting\n"); + printf(" - Custom Annotation Syntax in the Text Format\n"); + printf(" - Exception handling\n"); + printf(" - Import/Export of Mutable Globals\n"); + printf(" - JS String Builtins\n"); + printf(" - Relaxed SIMD\n"); +} \ No newline at end of file diff --git a/product-mini/platforms/common/wasm_proposal.h b/product-mini/platforms/common/wasm_proposal.h new file mode 100644 index 0000000000..346ec943fb --- /dev/null +++ b/product-mini/platforms/common/wasm_proposal.h @@ -0,0 +1,12 @@ +/* + * Copyright (C) 2023 Amazon.com Inc. or its affiliates. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#ifndef _WASM_PROPOSAL_H_ +#define _WASM_PROPOSAL_H_ + +void +wasm_proposal_print_status(void); + +#endif /* _WASM_PROPOSAL_H_ */ diff --git a/product-mini/platforms/posix/main.c b/product-mini/platforms/posix/main.c index af50223a4f..fa5dcb2c34 100644 --- a/product-mini/platforms/posix/main.c +++ b/product-mini/platforms/posix/main.c @@ -18,6 +18,8 @@ #include "../common/libc_wasi.c" #endif +#include "../common/wasm_proposal.c" + #if BH_HAS_DLFCN #include #endif @@ -798,6 +800,8 @@ main(int argc, char *argv[]) wasm_runtime_get_version(&major, &minor, &patch); printf("iwasm %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", major, minor, patch); + printf("\n"); + wasm_proposal_print_status(); return 0; } else {