Skip to content

Commit

Permalink
Add CI pipelines and clean up the code a little bit (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
snnn authored Sep 23, 2024
1 parent 6e0a089 commit 6b30b94
Show file tree
Hide file tree
Showing 20 changed files with 1,166 additions and 552 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Linux_CI
on:
push:
branches:
- main
- rel-*
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Linux_x64_gcc_ubuntu24_release:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
cmake --workflow --preset linux_gcc_release_workflow
Linux_x64_gcc_ubuntu22_release:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
cmake --workflow --preset linux_gcc_release_workflow
Linux_x64_gcc_ubuntu24_debug:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
cmake --workflow --preset linux_gcc_debug_workflow
Linux_x64_clang_ubuntu24_debug:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
cmake --workflow --preset linux_clang_debug_workflow
Linux_x64_gcc_ubuntu24_debug_asan:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
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
make -j $(nproc) all
ctest --output-on-failure
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
make -j $(nproc) all
ctest --output-on-failure
31 changes: 31 additions & 0 deletions .github/workflows/macos_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: MacOS_CI
on:
push:
branches:
- main
- rel-*
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# The following one doesn't work on macos-12. It has some compiling errors related to std::date
MacOS14_arm64_release:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
cmake --workflow --preset macos_arm64_release_workflow
MacOS14_universal2_release:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- run: |
set -e -x
rm -rf build
cmake --workflow --preset macos_universal2_release_workflow
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ 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_BROWSER_TESTS "Build all executables as html files" OFF)

option(MLAS_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING "Enable this option to turn on exception catching" OFF)

if(MLAS_ENABLE_WEBASSEMBLY_BROWSER_TESTS)
#The variable cannot be set from cmake command line because otherwise emscripten's toolchain file will override it.
set(CMAKE_EXECUTABLE_SUFFIX ".html")
endif()
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()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_link_options("-gsource-map" "-sASSERTIONS=2")
endif()
endif()

include(cmake/external_deps.cmake)
include_directories(${eigen_SOURCE_DIR})
Expand All @@ -50,6 +73,10 @@ add_subdirectory(src)
if(TARGET onnxruntime_mlas_arm64)
list(APPEND ONNXRUNTIME_MLAS_LIBS onnxruntime_mlas_arm64)
endif()
if(TARGET onnxruntime_mlas_x86_64)
list(APPEND ONNXRUNTIME_MLAS_LIBS onnxruntime_mlas_x86_64)
endif()
message("ONNXRUNTIME_MLAS_LIBS: ${ONNXRUNTIME_MLAS_LIBS}")

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests)
Expand Down
Loading

0 comments on commit 6b30b94

Please sign in to comment.