Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn committed Sep 22, 2024
1 parent ef41cde commit 516f15b
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 51 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,38 @@ jobs:
- run: |
set -e -x
rm -rf build
cmake --workflow --preset linux_gcc_debug_asan_workflow
cmake --workflow --preset linux_gcc_debug_asan_workflow
Linux_wasm_debug_asan:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
mkdir -p build
cd build
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source emsdk_env.sh
cd ..
CFLAGS="-O0 -g -fsanitize=address" CXXFLAGS="-O0 -g -fsanitize=address" emcmake cmake .. -DCMAKE_BUILD_TYPE=Debug -DMLAS_ENABLE_WEBASSEMBLY_THREADS=ON
ctest
Linux_wasm_release:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
mkdir -p build
cd build
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source emsdk_env.sh
cd ..
CFLAGS="-O2 -DNDEBUG -g" CXXFLAGS="-O2 -DNDEBUG -g" emcmake cmake .. -DCMAKE_BUILD_TYPE=Release -DMLAS_ENABLE_WEBASSEMBLY_THREADS=ON
ctest
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ find_package(Threads)

set(ONNXRUNTIME_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(ONNXRUNTIME_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
option(MLAS_ENABLE_WEBASSEMBLY_THREADS "Enable this option to create WebAssembly byte codes with multi-threads support" OFF)
option(MLAS_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING "Enable this option to turn on exception catching" OFF)

message("CFLAGS: ${CMAKE_C_FLAGS}")
message("CXXFLAGS: ${CMAKE_CXX_FLAGS}")
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
if(MLAS_ENABLE_WEBASSEMBLY_THREADS)
add_compile_options("-pthread" "-Wno-pthreads-mem-growth")
add_link_options("-pthread")
endif()
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-fwasm-exceptions>")
add_link_options("-fwasm-exceptions")
if(MLAS_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING)
add_link_options("-fwasm-exceptions" "-sNO_DISABLE_EXCEPTION_CATCHING")
endif()
endif()

include(cmake/external_deps.cmake)
include_directories(${eigen_SOURCE_DIR})
Expand Down
184 changes: 184 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,82 @@
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-fsanitize=address",
"CMAKE_CXX_STANDARD": "20"
}
},
{
"name": "emscripten_debug",
"displayName": "emscripten debug",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_FLAGS": "-ggdb3 -O0",
"CMAKE_CXX_FLAGS": "-ggdb3 -O0",
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_CXX_STANDARD": "20"
},
"environment": {
"CC": "emcc",
"CXX": "em++"
}
},
{
"name": "emscripten_debug_asan",
"displayName": "emscripten debug asan",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_FLAGS": "-ggdb3 -O0 -fsanitize=address",
"CMAKE_CXX_FLAGS": "-ggdb3 -O0 -fsanitize=address",
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_CXX_STANDARD": "20"
},
"environment": {
"CC": "emcc",
"CXX": "em++"
}
},
{
"name": "emscripten_release",
"displayName": "emscripten release",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe",
"CMAKE_CXX_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe",
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map",
"CMAKE_CXX_STANDARD": "20"
},
"environment": {
"CC": "emcc",
"CXX": "em++"
}
},
{
"name": "emscripten_release_asan",
"displayName": "emscripten release asan",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build/default",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe -fsanitize=address",
"CMAKE_CXX_FLAGS": "-DNDEBUG -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -O3 -pipe -fsanitize=address",
"CMAKE_EXE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-gsource-map -fsanitize=address",
"CMAKE_CXX_STANDARD": "20"
},
"environment": {
"CC": "emcc",
"CXX": "em++"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -504,6 +580,26 @@
"name": "macos_x86_64_release_asan",
"configurePreset": "macos_x86_64_release_asan",
"configuration": "Release"
},
{
"name": "emscripten_debug",
"configurePreset": "emscripten_debug",
"configuration": "Debug"
},
{
"name": "emscripten_debug_asan",
"configurePreset": "emscripten_debug_asan",
"configuration": "Debug"
},
{
"name": "emscripten_release",
"configurePreset": "emscripten_release",
"configuration": "Release"
},
{
"name": "emscripten_release_asan",
"configurePreset": "emscripten_release_asan",
"configuration": "Release"
}
],
"testPresets": [
Expand Down Expand Up @@ -601,6 +697,26 @@
"name": "macos_x86_64_release_asan",
"configuration": "Release",
"configurePreset": "macos_x86_64_release_asan"
},
{
"name": "emscripten_debug",
"configuration": "Debug",
"configurePreset": "emscripten_debug"
},
{
"name": "emscripten_debug_asan",
"configuration": "Debug",
"configurePreset": "emscripten_debug_asan"
},
{
"name": "emscripten_release",
"configuration": "Release",
"configurePreset": "emscripten_release"
},
{
"name": "emscripten_release_asan",
"configuration": "Release",
"configurePreset": "emscripten_release_asan"
}
],
"workflowPresets": [
Expand Down Expand Up @@ -926,6 +1042,74 @@
"name": "macos_x86_64_release"
}
]
},
{
"name": "emscripten_debug_asan_workflow",
"steps": [
{
"type": "configure",
"name": "emscripten_debug_asan"
},
{
"type": "build",
"name": "emscripten_debug_asan"
},
{
"type": "test",
"name": "emscripten_debug_asan"
}
]
},
{
"name": "emscripten_debug_workflow",
"steps": [
{
"type": "configure",
"name": "emscripten_debug"
},
{
"type": "build",
"name": "emscripten_debug"
},
{
"type": "test",
"name": "emscripten_debug"
}
]
},
{
"name": "emscripten_release_asan_workflow",
"steps": [
{
"type": "configure",
"name": "emscripten_release_asan"
},
{
"type": "build",
"name": "emscripten_release_asan"
},
{
"type": "test",
"name": "emscripten_release_asan"
}
]
},
{
"name": "emscripten_release_workflow",
"steps": [
{
"type": "configure",
"name": "emscripten_release"
},
{
"type": "build",
"name": "emscripten_release"
},
{
"type": "test",
"name": "emscripten_release"
}
]
}
]
}
Loading

0 comments on commit 516f15b

Please sign in to comment.