Refactor fast-interpreter SIMD compilation flags (#4261)

- enable SIMD flag by default unless hardware limitation
- use SIMDE flag to control fast-interpreter behavior
This commit is contained in:
liang.he 2025-05-14 10:38:30 +08:00 committed by GitHub
parent 26aa4830e9
commit f0a8286863
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 21 deletions

View File

@ -377,10 +377,7 @@ else ()
message (" Wakeup of blocking operations enabled")
endif ()
if (WAMR_BUILD_SIMD EQUAL 1)
if (WAMR_BUILD_FAST_INTERP EQUAL 1 AND WAMR_BUILD_SIMDE EQUAL 0)
set(SIMD_ENABLED 0)
message(" SIMD disabled for fast-interp as simde is not being built")
elseif (WAMR_BUILD_TARGET MATCHES "RISCV64.*")
if (WAMR_BUILD_TARGET MATCHES "RISCV64.*")
set(SIMD_ENABLED 0)
message (" SIMD disabled due to not supported on target RISCV64")
else()

View File

@ -155,16 +155,6 @@ if (WAMR_BUILD_LIB_RATS EQUAL 1)
include (${IWASM_DIR}/libraries/lib-rats/lib_rats.cmake)
endif ()
if (WAMR_BUILD_SIMD EQUAL 1 AND WAMR_BUILD_FAST_INTERP EQUAL 1)
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
message(STATUS "SIMDe doesnt support platform " ${WAMR_BUILD_PLATFORM})
set(WAMR_BUILD_SIMDE 0)
else()
include (${IWASM_DIR}/libraries/simde/simde.cmake)
set (WAMR_BUILD_SIMDE 1)
endif()
endif ()
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
include (${WAMR_ROOT_DIR}/build-scripts/involve_boringssl.cmake)
endif ()
@ -178,6 +168,18 @@ endif ()
# include the build config template file
include (${CMAKE_CURRENT_LIST_DIR}/config_common.cmake)
if (WAMR_BUILD_SIMD EQUAL 1 AND WAMR_BUILD_FAST_INTERP EQUAL 1)
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
message(STATUS "SIMDe doesnt support platform " ${WAMR_BUILD_PLATFORM})
set(WAMR_BUILD_SIMDE 0)
else()
include (${IWASM_DIR}/libraries/simde/simde.cmake)
set (WAMR_BUILD_SIMDE 1)
endif()
else()
set(WAMR_BUILD_SIMDE 0)
endif ()
include_directories (${IWASM_DIR}/include)
file (GLOB header

View File

@ -152,11 +152,12 @@ bool
is_valid_value_type_for_interpreter(uint8 value_type)
{
#if (WASM_ENABLE_WAMR_COMPILER == 0) && (WASM_ENABLE_JIT == 0) \
&& (WASM_ENABLE_FAST_INTERP == 0)
&& (WASM_ENABLE_SIMDE == 0)
/*
* Note: regardless of WASM_ENABLE_SIMD, our interpreters don't have
* SIMD implemented. It's safer to reject v128, especially for the
* fast interpreter.
* Note: regardless of WASM_ENABLE_SIMD, our classic interpreters don't
* have SIMD implemented.
*
* WASM_ENABLE_SIMDE is used to control SIMD feaure in fast interpreter
*/
if (value_type == VALUE_TYPE_V128)
return false;

View File

@ -3565,7 +3565,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
HANDLE_OP_END();
}
#if WASM_ENABLE_SIMD != 0
#if WASM_ENABLE_SIMDE != 0
HANDLE_OP(EXT_OP_SET_LOCAL_FAST_V128)
HANDLE_OP(EXT_OP_TEE_LOCAL_FAST_V128)
{
@ -3619,7 +3619,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
GET_I64_FROM_ADDR((uint32 *)global_addr));
HANDLE_OP_END();
}
#if WASM_ENABLE_SIMD != 0
#if WASM_ENABLE_SIMDE != 0
HANDLE_OP(WASM_OP_GET_GLOBAL_V128)
{
global_idx = read_uint32(frame_ip);
@ -4956,7 +4956,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
HANDLE_OP_END();
}
#if WASM_ENABLE_SIMD != 0
#if WASM_ENABLE_SIMDE != 0
HANDLE_OP(EXT_OP_COPY_STACK_TOP_V128)
{
addr1 = GET_OFFSET();