From 51e46d0b48d6f1d3ef5ddd882dddc7197b48ac14 Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 16:45:30 +0800 Subject: [PATCH 01/19] add visionos ci --- .github/workflows/visionos-cpu.yml | 73 ++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/visionos-cpu.yml diff --git a/.github/workflows/visionos-cpu.yml b/.github/workflows/visionos-cpu.yml new file mode 100644 index 000000000000..ac82a4789ccc --- /dev/null +++ b/.github/workflows/visionos-cpu.yml @@ -0,0 +1,73 @@ +name: visionos-cpu +on: + push: + branches: [master] + paths: + - '.github/workflows/visionos-cpu.yml' + - 'toolchains/ios.toolchain.cmake' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + pull_request: + branches: [master] + paths: + - '.github/workflows/visionos-cpu.yml' + - 'toolchains/ios.toolchain.cmake' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' +concurrency: + group: visionos-cpu-${{ github.ref }} + cancel-in-progress: true +env: + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer + VISIONOS_DEPLOYMENT_TARGET: '1.0' + ENABLE_BITCODE: OFF + ENABLE_ARC: OFF + ENABLE_VISIBILITY: OFF +permissions: + contents: read + +jobs: + visionos: + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + + - name: build-arm64 + run: | + mkdir build-arm64 && cd build-arm64 + cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=VISIONOS -DARCHS="arm64" \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ + .. + cmake --build . -j 3 + + visionos-simulator: + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + + - name: build-x86_64 + run: | + mkdir build-x86_64 && cd build-x86_64 + cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="x86_64" \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ + .. + cmake --build . -j 3 + - name: build-arm64 + run: | + mkdir build-arm64 && cd build-arm64 + cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="arm64" \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ + .. + cmake --build . -j 3 From 8f963b84def89821ca7fd906ecff66991b6ef94d Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 17:07:25 +0800 Subject: [PATCH 02/19] update watchos ci --- .github/workflows/watchos-cpu.yml | 91 ------------------------------- .github/workflows/watchos.yml | 79 +++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 91 deletions(-) delete mode 100644 .github/workflows/watchos-cpu.yml create mode 100644 .github/workflows/watchos.yml diff --git a/.github/workflows/watchos-cpu.yml b/.github/workflows/watchos-cpu.yml deleted file mode 100644 index adcea8103750..000000000000 --- a/.github/workflows/watchos-cpu.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: watchos-cpu -on: - push: - branches: [master] - paths: - - '.github/workflows/watchos-cpu.yml' - - 'toolchains/ios.toolchain.cmake' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' - pull_request: - branches: [master] - paths: - - '.github/workflows/watchos-cpu.yml' - - 'toolchains/ios.toolchain.cmake' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' -concurrency: - group: watchos-cpu-${{ github.ref }} - cancel-in-progress: true -env: - DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer - WATCHOS_DEPLOYMENT_TARGET: '2.0' - ENABLE_BITCODE: OFF - ENABLE_ARC: OFF - ENABLE_VISIBILITY: OFF -permissions: - contents: read - -jobs: - watchos: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - - - name: build-armv7k - run: | - mkdir build-armv7k && cd build-armv7k - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=WATCHOS -DARCHS="armv7k" \ - -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 - - name: build-arm64_32 - run: | - mkdir build-arm64_32 && cd build-arm64_32 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=WATCHOS -DARCHS="arm64_32" \ - -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 - - watchos-simulator: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - - - name: build-i386 - run: | - mkdir build-i386 && cd build-i386 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="i386" \ - -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 - - name: build-x86_64 - run: | - mkdir build-x86_64 && cd build-x86_64 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 - - name: build-arm64 - run: | - mkdir build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml new file mode 100644 index 000000000000..2ff987891249 --- /dev/null +++ b/.github/workflows/watchos.yml @@ -0,0 +1,79 @@ +name: watchos +on: + push: + branches: [master] + paths: + - '.github/workflows/watchos.yml' + - 'toolchains/ios.toolchain.cmake' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + - 'src/layer/x86/**' + pull_request: + branches: [master] + paths: + - '.github/workflows/watchos.yml' + - 'toolchains/ios.toolchain.cmake' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + - 'src/layer/x86/**' +concurrency: + group: watchos-${{ github.ref }} + cancel-in-progress: true +env: + DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer + WATCHOS_DEPLOYMENT_TARGET: '2.0' + ENABLE_BITCODE: OFF + ENABLE_ARC: OFF + ENABLE_VISIBILITY: OFF +permissions: + contents: read + +jobs: + build: + runs-on: macos-13 + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + + steps: + - uses: actions/checkout@v4 + + - name: armv7k + run: | + mkdir build-armv7k && cd build-armv7k + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" .. + cmake --build . -j 4 + - name: arm64_32 + run: | + mkdir build-arm64_32 && cd build-arm64_32 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. + cmake --build . -j 4 + + - name: simulator-i386 + run: | + mkdir build-simulator-i386 && cd build-simulator-i386 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="i386" .. + cmake --build . -j 4 + - name: simulator-x86_64 + run: | + mkdir build-simulator-x86_64 && cd build-simulator-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. + cmake --build . -j 4 + - name: simulator-arm64 + run: | + mkdir build-simulator-arm64 && cd build-simulator-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. + cmake --build . -j 4 From d018a159d74f73f6b4d6cd9b01cd3d0fb9e94646 Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 17:42:21 +0800 Subject: [PATCH 03/19] wip --- .github/workflows/visionos-cpu.yml | 20 +++--- .github/workflows/watchos.yml | 107 ++++++++++++++++++++++++++--- 2 files changed, 106 insertions(+), 21 deletions(-) diff --git a/.github/workflows/visionos-cpu.yml b/.github/workflows/visionos-cpu.yml index ac82a4789ccc..0a3cfdda7b12 100644 --- a/.github/workflows/visionos-cpu.yml +++ b/.github/workflows/visionos-cpu.yml @@ -10,16 +10,16 @@ on: - 'src/*' - 'src/layer/*' - 'src/layer/arm/**' - pull_request: - branches: [master] - paths: - - '.github/workflows/visionos-cpu.yml' - - 'toolchains/ios.toolchain.cmake' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' + # pull_request: + # branches: [master] + # paths: + # - '.github/workflows/visionos-cpu.yml' + # - 'toolchains/ios.toolchain.cmake' + # - 'CMakeLists.txt' + # - 'cmake/**' + # - 'src/*' + # - 'src/layer/*' + # - 'src/layer/arm/**' concurrency: group: visionos-cpu-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index 2ff987891249..adfbb079d31f 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -38,42 +38,127 @@ jobs: build: runs-on: macos-13 env: - COMMON_CMAKE_OPTIONS: | + OPENMP_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + -DPERL_EXECUTABLE=/usr/local/bin/perl \ + -DLIBOMP_ENABLE_SHARED=OFF \ + -DLIBOMP_OMPT_SUPPORT=OFF \ + -DLIBOMP_USE_HWLOC=OFF \ + + NCNN_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ -DENABLE_BITCODE=$ENABLE_BITCODE \ -DENABLE_ARC=$ENABLE_ARC \ -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ -DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_BUILD_TYPE=Release \ + -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ + -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ + -DOpenMP_libomp_LIBRARY="libomp.a" \ steps: - uses: actions/checkout@v4 + - name: cache-openmp + id: cache-openmp + uses: actions/cache@v4 + with: + path: openmp-install + key: openmp-watchos-install-20240401 + - name: openmp + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.2/openmp-18.1.2.src.tar.xz + tar -xf openmp-18.1.2.src.tar.xz + cd openmp-18.1.2.src + sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S + sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S + - name: openmp-armv7k + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-18.1.2.src + mkdir -p build-armv7k && cd build-armv7k + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-arm64_32 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-18.1.2.src + mkdir -p build-arm64_32 && cd build-arm64_32 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-simulator-x86_64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-18.1.2.src + mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-simulator-arm64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-18.1.2.src + mkdir -p build-simulator-arm64 && cd build-simulator-arm64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-merge-fat-library + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + mkdir -p $GITHUB_WORKSPACE/openmp-install + mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos + mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator + + cp -a openmp-18.1.2.src/build-arm64_32/install/include $GITHUB_WORKSPACE/openmp-install/watchos + mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos/lib + lipo -create \ + openmp-18.1.2.src/build-armv7k/install/lib/libomp.a \ + openmp-18.1.2.src/build-arm64_32/install/lib/libomp.a \ + -o $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a + + cp -a openmp-18.1.2.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/watchos-simulator + mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib + lipo -create \ + openmp-18.1.2.src/build-simulator-x86_64/install/lib/libomp.a \ + openmp-18.1.2.src/build-simulator-arm64/install/lib/libomp.a \ + -o $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a + + - name: install-openmp + run: | + sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/include/* $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib + + sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/include/* $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/lib + - name: armv7k run: | mkdir build-armv7k && cd build-armv7k - cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" .. + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" .. cmake --build . -j 4 - name: arm64_32 run: | mkdir build-arm64_32 && cd build-arm64_32 - cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. cmake --build . -j 4 - - name: simulator-i386 - run: | - mkdir build-simulator-i386 && cd build-simulator-i386 - cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="i386" .. - cmake --build . -j 4 - name: simulator-x86_64 run: | mkdir build-simulator-x86_64 && cd build-simulator-x86_64 - cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. cmake --build . -j 4 - name: simulator-arm64 run: | mkdir build-simulator-arm64 && cd build-simulator-arm64 - cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. cmake --build . -j 4 From 512a4d691315f6ceeed01aa2c189e3fa81744d27 Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 17:46:59 +0800 Subject: [PATCH 04/19] wip --- .github/workflows/watchos.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index adfbb079d31f..dd6d5e88d4b2 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -38,6 +38,7 @@ jobs: build: runs-on: macos-13 env: + OPENMP_VERSION: '16.0.6' OPENMP_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ @@ -75,15 +76,15 @@ jobs: - name: openmp if: steps.cache-openmp.outputs.cache-hit != 'true' run: | - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.2/openmp-18.1.2.src.tar.xz - tar -xf openmp-18.1.2.src.tar.xz - cd openmp-18.1.2.src + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + cd openmp-${{ env.OPENMP_VERSION }}.src sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S - name: openmp-armv7k if: steps.cache-openmp.outputs.cache-hit != 'true' run: | - cd openmp-18.1.2.src + cd openmp-${{ env.OPENMP_VERSION }}.src mkdir -p build-armv7k && cd build-armv7k cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" .. cmake --build . -j 4 @@ -91,7 +92,7 @@ jobs: - name: openmp-arm64_32 if: steps.cache-openmp.outputs.cache-hit != 'true' run: | - cd openmp-18.1.2.src + cd openmp-${{ env.OPENMP_VERSION }}.src mkdir -p build-arm64_32 && cd build-arm64_32 cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. cmake --build . -j 4 @@ -99,7 +100,7 @@ jobs: - name: openmp-simulator-x86_64 if: steps.cache-openmp.outputs.cache-hit != 'true' run: | - cd openmp-18.1.2.src + cd openmp-${{ env.OPENMP_VERSION }}.src mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64 cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. cmake --build . -j 4 @@ -107,7 +108,7 @@ jobs: - name: openmp-simulator-arm64 if: steps.cache-openmp.outputs.cache-hit != 'true' run: | - cd openmp-18.1.2.src + cd openmp-${{ env.OPENMP_VERSION }}.src mkdir -p build-simulator-arm64 && cd build-simulator-arm64 cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. cmake --build . -j 4 @@ -119,18 +120,18 @@ jobs: mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator - cp -a openmp-18.1.2.src/build-arm64_32/install/include $GITHUB_WORKSPACE/openmp-install/watchos + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/include $GITHUB_WORKSPACE/openmp-install/watchos mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos/lib lipo -create \ - openmp-18.1.2.src/build-armv7k/install/lib/libomp.a \ - openmp-18.1.2.src/build-arm64_32/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-armv7k/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/lib/libomp.a \ -o $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a - cp -a openmp-18.1.2.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/watchos-simulator + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/watchos-simulator mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib lipo -create \ - openmp-18.1.2.src/build-simulator-x86_64/install/lib/libomp.a \ - openmp-18.1.2.src/build-simulator-arm64/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-arm64/install/lib/libomp.a \ -o $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a - name: install-openmp From c185c01838552fdfcdf1cddd91c321b5a7e0de11 Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 17:50:00 +0800 Subject: [PATCH 05/19] wip --- .github/workflows/watchos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index dd6d5e88d4b2..ee30d2ed3b32 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -38,7 +38,7 @@ jobs: build: runs-on: macos-13 env: - OPENMP_VERSION: '16.0.6' + OPENMP_VERSION: '11.0.0' OPENMP_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ From 9093ff31dd0ea5d6280827eb7dba38cd1b678972 Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 19:08:58 +0800 Subject: [PATCH 06/19] wip --- .github/workflows/visionos-cpu.yml | 73 -------------- .github/workflows/visionos.yml | 148 +++++++++++++++++++++++++++++ .github/workflows/watchos.yml | 92 +----------------- 3 files changed, 149 insertions(+), 164 deletions(-) delete mode 100644 .github/workflows/visionos-cpu.yml create mode 100644 .github/workflows/visionos.yml diff --git a/.github/workflows/visionos-cpu.yml b/.github/workflows/visionos-cpu.yml deleted file mode 100644 index 0a3cfdda7b12..000000000000 --- a/.github/workflows/visionos-cpu.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: visionos-cpu -on: - push: - branches: [master] - paths: - - '.github/workflows/visionos-cpu.yml' - - 'toolchains/ios.toolchain.cmake' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' - # pull_request: - # branches: [master] - # paths: - # - '.github/workflows/visionos-cpu.yml' - # - 'toolchains/ios.toolchain.cmake' - # - 'CMakeLists.txt' - # - 'cmake/**' - # - 'src/*' - # - 'src/layer/*' - # - 'src/layer/arm/**' -concurrency: - group: visionos-cpu-${{ github.ref }} - cancel-in-progress: true -env: - DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer - VISIONOS_DEPLOYMENT_TARGET: '1.0' - ENABLE_BITCODE: OFF - ENABLE_ARC: OFF - ENABLE_VISIBILITY: OFF -permissions: - contents: read - -jobs: - visionos: - runs-on: macos-13 - steps: - - uses: actions/checkout@v4 - - - name: build-arm64 - run: | - mkdir build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=VISIONOS -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 - - visionos-simulator: - runs-on: macos-13 - steps: - - uses: actions/checkout@v4 - - - name: build-x86_64 - run: | - mkdir build-x86_64 && cd build-x86_64 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 - - name: build-arm64 - run: | - mkdir build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 diff --git a/.github/workflows/visionos.yml b/.github/workflows/visionos.yml new file mode 100644 index 000000000000..3fe1df876264 --- /dev/null +++ b/.github/workflows/visionos.yml @@ -0,0 +1,148 @@ +name: visionos +on: + push: + branches: [master] + paths: + - '.github/workflows/visionos.yml' + - 'toolchains/ios.toolchain.cmake' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + - 'src/layer/x86/**' + pull_request: + branches: [master] + paths: + - '.github/workflows/visionos.yml' + - 'toolchains/ios.toolchain.cmake' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + - 'src/layer/x86/**' +concurrency: + group: visionos-${{ github.ref }} + cancel-in-progress: true +env: + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer + VISIONOS_DEPLOYMENT_TARGET: '1.0' + ENABLE_BITCODE: OFF + ENABLE_ARC: OFF + ENABLE_VISIBILITY: OFF +permissions: + contents: read + +jobs: + build: + runs-on: macos-13 + env: + OPENMP_VERSION: '11.0.1' + OPENMP_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + -DPERL_EXECUTABLE=/usr/local/bin/perl \ + -DLIBOMP_ENABLE_SHARED=OFF \ + -DLIBOMP_OMPT_SUPPORT=OFF \ + -DLIBOMP_USE_HWLOC=OFF \ + + NCNN_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ + -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ + -DOpenMP_libomp_LIBRARY="libomp.a" \ + + steps: + - uses: actions/checkout@v4 + + - name: cache-openmp + id: cache-openmp + uses: actions/cache@v4 + with: + path: openmp-install + key: openmp-visionos-install-20240401 + - name: openmp + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + cd openmp-${{ env.OPENMP_VERSION }}.src + sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S + sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S + - name: openmp-arm64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-arm64 && cd build-arm64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-simulator-x86_64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-simulator-arm64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-simulator-arm64 && cd build-simulator-arm64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-merge-fat-library + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + mkdir -p $GITHUB_WORKSPACE/openmp-install + mkdir -p $GITHUB_WORKSPACE/openmp-install/visionos + mkdir -p $GITHUB_WORKSPACE/openmp-install/visionos-simulator + + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/include $GITHUB_WORKSPACE/openmp-install/visionos + mkdir -p $GITHUB_WORKSPACE/openmp-install/visionos/lib + cp openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a $GITHUB_WORKSPACE/openmp-install/visionos/lib/libomp.a + + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/visionos-simulator + mkdir -p $GITHUB_WORKSPACE/openmp-install/visionos-simulator/lib + lipo -create \ + openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-arm64/install/lib/libomp.a \ + -o $GITHUB_WORKSPACE/openmp-install/visionos-simulator/lib/libomp.a + + - name: install-openmp + run: | + sudo cp $GITHUB_WORKSPACE/openmp-install/visionos/include/* $DEVELOPER_DIR/Platforms/XROS.platform/Developer/SDKs/XROS.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/visionos/lib/libomp.a $DEVELOPER_DIR/Platforms/XROS.platform/Developer/SDKs/XROS.sdk/usr/lib + + sudo cp $GITHUB_WORKSPACE/openmp-install/visionos-simulator/include/* $DEVELOPER_DIR/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/visionos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/XRSimulator.platform/Developer/SDKs/XRSimulator.sdk/usr/lib + + - name: arm64 + run: | + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=VISIONOS -DARCHS="arm64" .. + cmake --build . -j 4 + - name: simulator-x86_64 + run: | + mkdir build-simulator-x86_64 && cd build-simulator-x86_64 + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="x86_64" .. + cmake --build . -j 4 + - name: simulator-arm64 + run: | + mkdir build-simulator-arm64 && cd build-simulator-arm64 + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="arm64" .. + cmake --build . -j 4 diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index ee30d2ed3b32..b809838b4ec1 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -26,7 +26,7 @@ concurrency: group: watchos-${{ github.ref }} cancel-in-progress: true env: - DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer WATCHOS_DEPLOYMENT_TARGET: '2.0' ENABLE_BITCODE: OFF ENABLE_ARC: OFF @@ -38,20 +38,6 @@ jobs: build: runs-on: macos-13 env: - OPENMP_VERSION: '11.0.0' - OPENMP_CMAKE_OPTIONS: | - -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ - -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ - -DENABLE_BITCODE=$ENABLE_BITCODE \ - -DENABLE_ARC=$ENABLE_ARC \ - -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_INSTALL_PREFIX=install \ - -DCMAKE_BUILD_TYPE=Release \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF \ - -DLIBOMP_OMPT_SUPPORT=OFF \ - -DLIBOMP_USE_HWLOC=OFF \ - NCNN_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ @@ -67,81 +53,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: cache-openmp - id: cache-openmp - uses: actions/cache@v4 - with: - path: openmp-install - key: openmp-watchos-install-20240401 - - name: openmp - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz - tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz - cd openmp-${{ env.OPENMP_VERSION }}.src - sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S - sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S - - name: openmp-armv7k - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-${{ env.OPENMP_VERSION }}.src - mkdir -p build-armv7k && cd build-armv7k - cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" .. - cmake --build . -j 4 - cmake --build . --target install - - name: openmp-arm64_32 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-${{ env.OPENMP_VERSION }}.src - mkdir -p build-arm64_32 && cd build-arm64_32 - cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. - cmake --build . -j 4 - cmake --build . --target install - - name: openmp-simulator-x86_64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-${{ env.OPENMP_VERSION }}.src - mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64 - cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. - cmake --build . -j 4 - cmake --build . --target install - - name: openmp-simulator-arm64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-${{ env.OPENMP_VERSION }}.src - mkdir -p build-simulator-arm64 && cd build-simulator-arm64 - cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. - cmake --build . -j 4 - cmake --build . --target install - - name: openmp-merge-fat-library - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - mkdir -p $GITHUB_WORKSPACE/openmp-install - mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos - mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator - - cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/include $GITHUB_WORKSPACE/openmp-install/watchos - mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos/lib - lipo -create \ - openmp-${{ env.OPENMP_VERSION }}.src/build-armv7k/install/lib/libomp.a \ - openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/lib/libomp.a \ - -o $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a - - cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/watchos-simulator - mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib - lipo -create \ - openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/lib/libomp.a \ - openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-arm64/install/lib/libomp.a \ - -o $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a - - - name: install-openmp - run: | - sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/include/* $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include - sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib - - sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/include/* $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include - sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/lib - - name: armv7k run: | mkdir build-armv7k && cd build-armv7k @@ -152,7 +63,6 @@ jobs: mkdir build-arm64_32 && cd build-arm64_32 cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. cmake --build . -j 4 - - name: simulator-x86_64 run: | mkdir build-simulator-x86_64 && cd build-simulator-x86_64 From 6341aed89ef607af90ca2ac69bedc3ca1b0b014b Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 19:11:28 +0800 Subject: [PATCH 07/19] wip --- .github/workflows/visionos.yml | 6 +++--- .github/workflows/watchos.yml | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/visionos.yml b/.github/workflows/visionos.yml index 3fe1df876264..845754754c2c 100644 --- a/.github/workflows/visionos.yml +++ b/.github/workflows/visionos.yml @@ -86,7 +86,7 @@ jobs: run: | cd openmp-${{ env.OPENMP_VERSION }}.src mkdir -p build-arm64 && cd build-arm64 - cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64" .. + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=VISIONOS -DARCHS="arm64" .. cmake --build . -j 4 cmake --build . --target install - name: openmp-simulator-x86_64 @@ -94,7 +94,7 @@ jobs: run: | cd openmp-${{ env.OPENMP_VERSION }}.src mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64 - cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="x86_64" .. cmake --build . -j 4 cmake --build . --target install - name: openmp-simulator-arm64 @@ -102,7 +102,7 @@ jobs: run: | cd openmp-${{ env.OPENMP_VERSION }}.src mkdir -p build-simulator-arm64 && cd build-simulator-arm64 - cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_VISIONOS -DARCHS="arm64" .. cmake --build . -j 4 cmake --build . --target install - name: openmp-merge-fat-library diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index b809838b4ec1..5da9b0f45084 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -46,9 +46,7 @@ jobs: -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ -DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_BUILD_TYPE=Release \ - -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ - -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ - -DOpenMP_libomp_LIBRARY="libomp.a" \ + -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ steps: - uses: actions/checkout@v4 From 48ef145dfe610a907b5753bff3bd22a562a49dfa Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 19:16:24 +0800 Subject: [PATCH 08/19] wip --- .github/workflows/visionos.yml | 2 +- .github/workflows/watchos.yml | 94 +++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/.github/workflows/visionos.yml b/.github/workflows/visionos.yml index 845754754c2c..90f4c8092870 100644 --- a/.github/workflows/visionos.yml +++ b/.github/workflows/visionos.yml @@ -38,7 +38,7 @@ jobs: build: runs-on: macos-13 env: - OPENMP_VERSION: '11.0.1' + OPENMP_VERSION: '14.0.6' OPENMP_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index 5da9b0f45084..4f0802852bb0 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -38,6 +38,20 @@ jobs: build: runs-on: macos-13 env: + OPENMP_VERSION: '14.0.6' + OPENMP_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + -DPERL_EXECUTABLE=/usr/local/bin/perl \ + -DLIBOMP_ENABLE_SHARED=OFF \ + -DLIBOMP_OMPT_SUPPORT=OFF \ + -DLIBOMP_USE_HWLOC=OFF \ + NCNN_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ @@ -46,11 +60,88 @@ jobs: -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ -DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_BUILD_TYPE=Release \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ + -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ + -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ + -DOpenMP_libomp_LIBRARY="libomp.a" \ steps: - uses: actions/checkout@v4 + - name: cache-openmp + id: cache-openmp + uses: actions/cache@v4 + with: + path: openmp-install + key: openmp-watchos-install-20240401 + - name: openmp + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + cd openmp-${{ env.OPENMP_VERSION }}.src + sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S + sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S + - name: openmp-armv7k + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-armv7k && cd build-armv7k + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="armv7k" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-arm64_32 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-arm64_32 && cd build-arm64_32 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-simulator-x86_64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="x86_64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-simulator-arm64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-simulator-arm64 && cd build-simulator-arm64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_WATCHOS -DARCHS="arm64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-merge-fat-library + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + mkdir -p $GITHUB_WORKSPACE/openmp-install + mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos + mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator + + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/include $GITHUB_WORKSPACE/openmp-install/watchos + mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos/lib + lipo -create \ + openmp-${{ env.OPENMP_VERSION }}.src/build-armv7k/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-arm64_32/install/lib/libomp.a \ + -o $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a + + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/watchos-simulator + mkdir -p $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib + lipo -create \ + openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-arm64/install/lib/libomp.a \ + -o $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a + + - name: install-openmp + run: | + sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/include/* $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/watchos/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/lib + + sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/include/* $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/watchos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/lib + - name: armv7k run: | mkdir build-armv7k && cd build-armv7k @@ -61,6 +152,7 @@ jobs: mkdir build-arm64_32 && cd build-arm64_32 cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. cmake --build . -j 4 + - name: simulator-x86_64 run: | mkdir build-simulator-x86_64 && cd build-simulator-x86_64 From 27ff00583baddabb684d21c589570463ebbf0722 Mon Sep 17 00:00:00 2001 From: nihuini Date: Mon, 1 Apr 2024 19:56:39 +0800 Subject: [PATCH 09/19] wip --- .github/workflows/watchos.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index 4f0802852bb0..57d87f7023aa 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -27,7 +27,7 @@ concurrency: cancel-in-progress: true env: DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer - WATCHOS_DEPLOYMENT_TARGET: '2.0' + WATCHOS_DEPLOYMENT_TARGET: '6.0' ENABLE_BITCODE: OFF ENABLE_ARC: OFF ENABLE_VISIBILITY: OFF @@ -81,6 +81,8 @@ jobs: cd openmp-${{ env.OPENMP_VERSION }}.src sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S + wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch + patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch - name: openmp-armv7k if: steps.cache-openmp.outputs.cache-hit != 'true' run: | From 5d680b855af55194f83b3e7453a0b6940fa64f37 Mon Sep 17 00:00:00 2001 From: nihui Date: Mon, 1 Apr 2024 21:47:16 +0800 Subject: [PATCH 10/19] update ios toolchain, ncnn target ilp32 --- CMakeLists.txt | 12 ++++++-- cmake/ncnn_add_layer.cmake | 4 +-- src/CMakeLists.txt | 4 +-- toolchains/ios.toolchain.cmake | 53 ++++++++++++++++++++++++---------- 4 files changed, 51 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 785e2cd39264..a67ab6afb5e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,7 +148,11 @@ if((IOS AND CMAKE_OSX_ARCHITECTURES MATCHES "arm") OR ((CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) AND (${CMAKE_GENERATOR_PLATFORM} MATCHES "^(arm|arm64)"))) set(NCNN_TARGET_ARCH arm) - if(CMAKE_SIZEOF_VOID_P EQUAL 4) + if(APPLE AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64_32") + set(NCNN_TARGET_ILP32 TRUE) + endif() + + if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT NCNN_TARGET_ILP32) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) set(CMAKE_REQUIRED_FLAGS "/arch:VFPv4") check_cxx_source_compiles("#include \nint main() { float32x4_t _a; float16x4_t _s = vcvt_f16_f32(_a); return 0; }" NCNN_COMPILER_SUPPORT_ARM_VFPV4) @@ -173,7 +177,7 @@ if((IOS AND CMAKE_OSX_ARCHITECTURES MATCHES "arm") endif() endif() - if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(CMAKE_SIZEOF_VOID_P EQUAL 8 OR NCNN_TARGET_ILP32) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) set(CMAKE_REQUIRED_FLAGS "/arch:armv8.0") check_cxx_source_compiles("#include \nint main() { float32x4_t _a; float16x4_t _s = vcvt_f16_f32(_a); return 0; }" NCNN_COMPILER_SUPPORT_ARM_VFPV4) @@ -560,7 +564,9 @@ else() endif() endif() -if(CMAKE_SIZEOF_VOID_P EQUAL 8) +if(NCNN_TARGET_ILP32) + message(STATUS "Target arch: ${NCNN_TARGET_ARCH} 64bit ilp32") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "Target arch: ${NCNN_TARGET_ARCH} 64bit") else() message(STATUS "Target arch: ${NCNN_TARGET_ARCH} 32bit") diff --git a/cmake/ncnn_add_layer.cmake b/cmake/ncnn_add_layer.cmake index 4eeedb010c7d..a41c52e4ed22 100644 --- a/cmake/ncnn_add_layer.cmake +++ b/cmake/ncnn_add_layer.cmake @@ -199,7 +199,7 @@ macro(ncnn_add_layer class) endif() endif() - if(NCNN_TARGET_ARCH STREQUAL "arm" AND CMAKE_SIZEOF_VOID_P EQUAL 4) + if(NCNN_TARGET_ARCH STREQUAL "arm" AND (CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT NCNN_TARGET_ILP32)) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) if(NCNN_VFPV4) ncnn_add_arch_opt_source(${class} vfpv4 "/arch:VFPv4 /D__ARM_FP=0x0E") @@ -215,7 +215,7 @@ macro(ncnn_add_layer class) endif() endif() - if(NCNN_TARGET_ARCH STREQUAL "arm" AND CMAKE_SIZEOF_VOID_P EQUAL 8) + if(NCNN_TARGET_ARCH STREQUAL "arm" AND (CMAKE_SIZEOF_VOID_P EQUAL 8 OR NCNN_TARGET_ILP32)) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) if(NCNN_VFPV4) ncnn_add_arch_opt_source(${class} vfpv4 " ") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9ba035b94226..d7dfe19c26e1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -470,7 +470,7 @@ if(NCNN_TARGET_ARCH STREQUAL "x86") endif() endif() -if(NCNN_TARGET_ARCH STREQUAL "arm" AND CMAKE_SIZEOF_VOID_P EQUAL 4) +if(NCNN_TARGET_ARCH STREQUAL "arm" AND (CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT NCNN_TARGET_ILP32)) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) # always enable neon for msvc arm target_compile_options(ncnn PRIVATE /D__arm__ /D__ARM_NEON) @@ -493,7 +493,7 @@ if(NCNN_TARGET_ARCH STREQUAL "arm" AND CMAKE_SIZEOF_VOID_P EQUAL 4) endif() endif() -if(NCNN_TARGET_ARCH STREQUAL "arm" AND CMAKE_SIZEOF_VOID_P EQUAL 8) +if(NCNN_TARGET_ARCH STREQUAL "arm" AND (CMAKE_SIZEOF_VOID_P EQUAL 8 OR NCNN_TARGET_ILP32)) if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" AND CMAKE_CXX_COMPILER_FRONTEND_VARIANT MATCHES "MSVC")) # always enable neon and vfpv4 for msvc arm64 target_compile_options(ncnn PRIVATE /D__arm__ /D__aarch64__ /D__ARM_NEON /D__ARM_FP=0x0E) diff --git a/toolchains/ios.toolchain.cmake b/toolchains/ios.toolchain.cmake index 44a6fa5abee6..379014166243 100644 --- a/toolchains/ios.toolchain.cmake +++ b/toolchains/ios.toolchain.cmake @@ -70,6 +70,7 @@ # WATCHOS = Build for armv7k arm64_32 for watchOS. # WATCHOSCOMBINED = Build for armv7k arm64_32 x86_64 watchOS + watchOS Simulator. Combined into FAT STATIC lib (only supported on 3.14+ of CMake with "-G Xcode" argument in combination with the "cmake --install" CMake build step) # SIMULATOR_WATCHOS = Build for x86_64 for watchOS Simulator. +# SIMULATORARM64_WATCHOS = Build for arm64 for watchOS Simulator. # MAC = Build for x86_64 macOS. # MAC_ARM64 = Build for Apple Silicon macOS. # MAC_UNIVERSAL = Combined build for x86_64 and Apple Silicon on macOS. @@ -87,7 +88,7 @@ # CMAKE_OSX_SYSROOT, but can also be manually specified (although this should # not be required). # -# DEPLOYMENT_TARGET: Minimum SDK version to target. Default 2.0 on watchOS and 9.0 on tvOS+iOS +# DEPLOYMENT_TARGET: Minimum SDK version to target. Default 6.0 on watchOS, 13.0 on tvOS+iOS/iPadOS, 11.0 on macOS, 1.0 on visionOS # # NAMED_LANGUAGE_SUPPORT: # ON (default) = Will require "enable_language(OBJC) and/or enable_language(OBJCXX)" for full OBJC|OBJCXX support @@ -113,6 +114,7 @@ # SIMULATORARM64_TVOS = arm64 # WATCHOS = armv7k arm64_32 (if applicable) # SIMULATOR_WATCHOS = x86_64 (i386 has since long been deprecated) +# SIMULATORARM64_WATCHOS = arm64 # MAC = x86_64 # MAC_ARM64 = arm64 # MAC_UNIVERSAL = x86_64 arm64 @@ -158,7 +160,7 @@ set(ENV{_IOS_TOOLCHAIN_HAS_RUN} true) list(APPEND _supported_platforms "OS" "OS64" "OS64COMBINED" "SIMULATOR" "SIMULATOR64" "SIMULATORARM64" "SIMULATOR64COMBINED" "TVOS" "TVOSCOMBINED" "SIMULATOR_TVOS" "SIMULATORARM64_TVOS" - "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS" + "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS" "SIMULATORARM64_WATCHOS" "MAC" "MAC_ARM64" "MAC_UNIVERSAL" "VISIONOS" "SIMULATOR_VISIONOS" "SIMULATOR64_VISIONOS" "MAC_CATALYST" "MAC_CATALYST_ARM64") @@ -257,10 +259,10 @@ set(NAMED_LANGUAGE_SUPPORT_INT ${NAMED_LANGUAGE_SUPPORT} CACHE BOOL if(NOT DEFINED DEPLOYMENT_TARGET) if (PLATFORM MATCHES "WATCHOS") # Unless specified, SDK version 4.0 is used by default as minimum target version (watchOS). - set(DEPLOYMENT_TARGET "4.0") + set(DEPLOYMENT_TARGET "6.0") elseif(PLATFORM STREQUAL "MAC") # Unless specified, SDK version 10.13 (High Sierra) is used by default as the minimum target version (macos). - set(DEPLOYMENT_TARGET "10.13") + set(DEPLOYMENT_TARGET "11.0") elseif(PLATFORM STREQUAL "VISIONOS" OR PLATFORM STREQUAL "SIMULATOR_VISIONOS" OR PLATFORM STREQUAL "SIMULATOR64_VISIONOS") # Unless specified, SDK version 1.0 is used by default as minimum target version (visionOS). set(DEPLOYMENT_TARGET "1.0") @@ -275,7 +277,7 @@ if(NOT DEFINED DEPLOYMENT_TARGET) set(DEPLOYMENT_TARGET "13.1") else() # Unless specified, SDK version 11.0 is used by default as the minimum target version (iOS, tvOS). - set(DEPLOYMENT_TARGET "11.0") + set(DEPLOYMENT_TARGET "13.0") endif() message(STATUS "[DEFAULTS] Using the default min-version since DEPLOYMENT_TARGET not provided!") elseif(DEFINED DEPLOYMENT_TARGET AND PLATFORM MATCHES "^MAC_CATALYST" AND ${DEPLOYMENT_TARGET} VERSION_LESS "13.1") @@ -481,6 +483,14 @@ elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") else() set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator) endif() +elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_WATCHOS") + set(SDK_NAME watchsimulator) + if(NOT ARCHS) + set(ARCHS arm64) + set(APPLE_TARGET_TRIPLE_INT arm64-apple-watchos${DEPLOYMENT_TARGET}-simulator) + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() elseif(PLATFORM_INT STREQUAL "SIMULATOR64_VISIONOS") set(SDK_NAME xrsimulator) if(NOT ARCHS) @@ -761,6 +771,7 @@ endif() set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") set(CMAKE_SHARED_LIBRARY_PREFIX "lib") set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".tbd" ".so") set(CMAKE_SHARED_MODULE_PREFIX "lib") set(CMAKE_SHARED_MODULE_SUFFIX ".so") set(CMAKE_C_COMPILER_ABI ELF) @@ -816,6 +827,9 @@ elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_TVOS") elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") set(SDK_NAME_VERSION_FLAGS "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}") + elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_WATCHOS") + set(SDK_NAME_VERSION_FLAGS + "-mwatchos-simulator-version-min=${DEPLOYMENT_TARGET}") elseif(PLATFORM_INT STREQUAL "MAC") set(SDK_NAME_VERSION_FLAGS "-mmacosx-version-min=${DEPLOYMENT_TARGET}") @@ -826,7 +840,7 @@ elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_TVOS") endif() elseif(NOT PLATFORM_INT MATCHES "^MAC_CATALYST") # Newer versions of CMake sets the version min flags correctly, skip this for Mac Catalyst targets - set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET}) + set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET} CACHE INTERNAL "Minimum OS X deployment version") endif() if(DEFINED APPLE_TARGET_TRIPLE_INT) @@ -887,35 +901,44 @@ endif() if(CMAKE_GENERATOR MATCHES "Xcode") message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as the generator. Modifying the Xcode build-settings directly instead.") else() - set(CMAKE_C_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_C_FLAGS}" CACHE INTERNAL + "Flags used by the compiler during all C build types.") set(CMAKE_C_FLAGS_DEBUG "-O0 -g ${CMAKE_C_FLAGS_DEBUG}") set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_C_FLAGS_MINSIZEREL}") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_C_FLAGS_RELWITHDEBINFO}") set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_C_FLAGS_RELEASE}") - set(CMAKE_CXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_CXX_FLAGS}" CACHE INTERNAL + "Flags used by the compiler during all CXX build types.") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${CMAKE_CXX_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_CXX_FLAGS_MINSIZEREL}") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_CXX_FLAGS_RELEASE}") if(NAMED_LANGUAGE_SUPPORT_INT) - set(CMAKE_OBJC_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJC_FLAGS}") + set(CMAKE_OBJC_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJC_FLAGS}" CACHE INTERNAL + "Flags used by the compiler during all OBJC build types.") set(CMAKE_OBJC_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJC_FLAGS_DEBUG}") set(CMAKE_OBJC_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJC_FLAGS_MINSIZEREL}") set(CMAKE_OBJC_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJC_FLAGS_RELWITHDEBINFO}") set(CMAKE_OBJC_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJC_FLAGS_RELEASE}") - set(CMAKE_OBJCXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJCXX_FLAGS}") + set(CMAKE_OBJCXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJCXX_FLAGS}" CACHE INTERNAL + "Flags used by the compiler during all OBJCXX build types.") set(CMAKE_OBJCXX_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJCXX_FLAGS_DEBUG}") set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJCXX_FLAGS_MINSIZEREL}") set(CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO}") set(CMAKE_OBJCXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJCXX_FLAGS_RELEASE}") endif() - set(CMAKE_C_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") - set(CMAKE_CXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") + set(CMAKE_C_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}" CACHE INTERNAL + "Flags used by the compiler for all C link types.") + set(CMAKE_CXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}" CACHE INTERNAL + "Flags used by the compiler for all CXX link types.") if(NAMED_LANGUAGE_SUPPORT_INT) - set(CMAKE_OBJC_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJC_LINK_FLAGS}") - set(CMAKE_OBJCXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJCXX_LINK_FLAGS}") + set(CMAKE_OBJC_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJC_LINK_FLAGS}" CACHE INTERNAL + "Flags used by the compiler for all OBJC link types.") + set(CMAKE_OBJCXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJCXX_LINK_FLAGS}" CACHE INTERNAL + "Flags used by the compiler for all OBJCXX link types.") endif() - set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -arch ${CMAKE_OSX_ARCHITECTURES} ${APPLE_TARGET_TRIPLE_FLAG}") + set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -arch ${CMAKE_OSX_ARCHITECTURES} ${APPLE_TARGET_TRIPLE_FLAG}" CACHE INTERNAL + "Flags used by the compiler for all ASM build types.") endif() ## Print status messages to inform of the current state From 4ff31e204756b6df75c4fe28aca66d9054b8c7b9 Mon Sep 17 00:00:00 2001 From: nihui Date: Mon, 1 Apr 2024 22:09:45 +0800 Subject: [PATCH 11/19] hack --- .github/workflows/watchos.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index 57d87f7023aa..6887802a5d9f 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -95,10 +95,14 @@ jobs: if: steps.cache-openmp.outputs.cache-hit != 'true' run: | cd openmp-${{ env.OPENMP_VERSION }}.src + wget https://github.com/nihui/llvm-project/commit/82ffbddacd16d4d088e7c0ffccdb58517e20ea4d.patch + patch -p2 -i 82ffbddacd16d4d088e7c0ffccdb58517e20ea4d.patch mkdir -p build-arm64_32 && cd build-arm64_32 cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. cmake --build . -j 4 cmake --build . --target install + cd .. + patch -R -p2 -i 82ffbddacd16d4d088e7c0ffccdb58517e20ea4d.patch - name: openmp-simulator-x86_64 if: steps.cache-openmp.outputs.cache-hit != 'true' run: | From 2769637cbed7074c961ecb78712e06226b7d4b55 Mon Sep 17 00:00:00 2001 From: nihui Date: Mon, 1 Apr 2024 22:17:26 +0800 Subject: [PATCH 12/19] hack --- .github/workflows/watchos.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index 6887802a5d9f..bc255c391c5b 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -95,14 +95,14 @@ jobs: if: steps.cache-openmp.outputs.cache-hit != 'true' run: | cd openmp-${{ env.OPENMP_VERSION }}.src - wget https://github.com/nihui/llvm-project/commit/82ffbddacd16d4d088e7c0ffccdb58517e20ea4d.patch - patch -p2 -i 82ffbddacd16d4d088e7c0ffccdb58517e20ea4d.patch + wget https://github.com/nihui/llvm-project/commit/fd5669f5679d8a44fe59393a0f895d371a76caba.patch + patch -p2 -i fd5669f5679d8a44fe59393a0f895d371a76caba.patch mkdir -p build-arm64_32 && cd build-arm64_32 cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. cmake --build . -j 4 cmake --build . --target install cd .. - patch -R -p2 -i 82ffbddacd16d4d088e7c0ffccdb58517e20ea4d.patch + patch -R -p2 -i fd5669f5679d8a44fe59393a0f895d371a76caba.patch - name: openmp-simulator-x86_64 if: steps.cache-openmp.outputs.cache-hit != 'true' run: | From ffa014aa80a1494e88108ba3e50e28ded791c185 Mon Sep 17 00:00:00 2001 From: nihui Date: Mon, 1 Apr 2024 22:23:26 +0800 Subject: [PATCH 13/19] hack --- .github/workflows/watchos.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index bc255c391c5b..2564fcdd161c 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -79,8 +79,6 @@ jobs: wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz cd openmp-${{ env.OPENMP_VERSION }}.src - sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S - sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch - name: openmp-armv7k From d580a3048ac2caa6ead21a70e3616ffa86ab56b3 Mon Sep 17 00:00:00 2001 From: nihui Date: Mon, 1 Apr 2024 22:28:39 +0800 Subject: [PATCH 14/19] hack --- .github/workflows/watchos.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index 2564fcdd161c..09d44e80afa0 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -79,6 +79,8 @@ jobs: wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz cd openmp-${{ env.OPENMP_VERSION }}.src + wget https://github.com/nihui/llvm-project/commit/0f09753bd22af28ad9292aa5c8d2018bc35feb5a.patch + patch -p2 -i 0f09753bd22af28ad9292aa5c8d2018bc35feb5a.patch wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch - name: openmp-armv7k From 026f899b682d54541b820a7076c3b66ed96b85aa Mon Sep 17 00:00:00 2001 From: nihuini Date: Tue, 2 Apr 2024 19:53:46 +0800 Subject: [PATCH 15/19] wip --- .github/workflows/visionos.yml | 13 +++++++++---- .github/workflows/watchos.yml | 15 +++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/visionos.yml b/.github/workflows/visionos.yml index 90f4c8092870..1238ab4bca60 100644 --- a/.github/workflows/visionos.yml +++ b/.github/workflows/visionos.yml @@ -38,7 +38,7 @@ jobs: build: runs-on: macos-13 env: - OPENMP_VERSION: '14.0.6' + OPENMP_VERSION: '18.1.2' OPENMP_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ @@ -72,15 +72,20 @@ jobs: uses: actions/cache@v4 with: path: openmp-install - key: openmp-visionos-install-20240401 + key: openmp-visionos-install-20240402 - name: openmp if: steps.cache-openmp.outputs.cache-hit != 'true' run: | + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz + tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + mv cmake-${{ env.OPENMP_VERSION }}.src cmake cd openmp-${{ env.OPENMP_VERSION }}.src - sed -i'' -e '/.size __kmp_unnamed_critical_addr/d' runtime/src/z_Linux_asm.S - sed -i'' -e 's/__kmp_unnamed_critical_addr/___kmp_unnamed_critical_addr/g' runtime/src/z_Linux_asm.S + wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch + patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch + wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch + patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch - name: openmp-arm64 if: steps.cache-openmp.outputs.cache-hit != 'true' run: | diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index 09d44e80afa0..d67f3c2aa33a 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -38,7 +38,7 @@ jobs: build: runs-on: macos-13 env: - OPENMP_VERSION: '14.0.6' + OPENMP_VERSION: '18.1.2' OPENMP_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ @@ -72,15 +72,18 @@ jobs: uses: actions/cache@v4 with: path: openmp-install - key: openmp-watchos-install-20240401 + key: openmp-watchos-install-20240402 - name: openmp if: steps.cache-openmp.outputs.cache-hit != 'true' run: | + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz + tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + mv cmake-${{ env.OPENMP_VERSION }}.src cmake cd openmp-${{ env.OPENMP_VERSION }}.src - wget https://github.com/nihui/llvm-project/commit/0f09753bd22af28ad9292aa5c8d2018bc35feb5a.patch - patch -p2 -i 0f09753bd22af28ad9292aa5c8d2018bc35feb5a.patch + wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch + patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch - name: openmp-armv7k @@ -95,14 +98,10 @@ jobs: if: steps.cache-openmp.outputs.cache-hit != 'true' run: | cd openmp-${{ env.OPENMP_VERSION }}.src - wget https://github.com/nihui/llvm-project/commit/fd5669f5679d8a44fe59393a0f895d371a76caba.patch - patch -p2 -i fd5669f5679d8a44fe59393a0f895d371a76caba.patch mkdir -p build-arm64_32 && cd build-arm64_32 cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=WATCHOS -DARCHS="arm64_32" .. cmake --build . -j 4 cmake --build . --target install - cd .. - patch -R -p2 -i fd5669f5679d8a44fe59393a0f895d371a76caba.patch - name: openmp-simulator-x86_64 if: steps.cache-openmp.outputs.cache-hit != 'true' run: | From 60f982f2ea09d0fd5a424ca1b44d245a3045cc46 Mon Sep 17 00:00:00 2001 From: nihui Date: Tue, 2 Apr 2024 22:48:38 +0800 Subject: [PATCH 16/19] wip --- .github/workflows/visionos.yml | 2 +- .github/workflows/watchos.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/visionos.yml b/.github/workflows/visionos.yml index 1238ab4bca60..c1da0d9a948a 100644 --- a/.github/workflows/visionos.yml +++ b/.github/workflows/visionos.yml @@ -80,7 +80,7 @@ jobs: tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz - mv cmake-${{ env.OPENMP_VERSION }}.src cmake + mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/ cd openmp-${{ env.OPENMP_VERSION }}.src wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch diff --git a/.github/workflows/watchos.yml b/.github/workflows/watchos.yml index d67f3c2aa33a..042c6c3ed540 100644 --- a/.github/workflows/watchos.yml +++ b/.github/workflows/watchos.yml @@ -80,7 +80,7 @@ jobs: tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz - mv cmake-${{ env.OPENMP_VERSION }}.src cmake + mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/ cd openmp-${{ env.OPENMP_VERSION }}.src wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch From 59b62c4f3b4f66406f323e74f8d647817e7bc82e Mon Sep 17 00:00:00 2001 From: nihui Date: Tue, 2 Apr 2024 22:57:32 +0800 Subject: [PATCH 17/19] wip --- .github/workflows/tvos-cpu.yml | 73 ---------------- .github/workflows/tvos.yml | 153 +++++++++++++++++++++++++++++++++ README.md | 4 +- 3 files changed, 155 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/tvos-cpu.yml create mode 100644 .github/workflows/tvos.yml diff --git a/.github/workflows/tvos-cpu.yml b/.github/workflows/tvos-cpu.yml deleted file mode 100644 index fcfa7097fd6f..000000000000 --- a/.github/workflows/tvos-cpu.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: tvos-cpu -on: - push: - branches: [master] - paths: - - '.github/workflows/tvos-cpu.yml' - - 'toolchains/ios.toolchain.cmake' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' - pull_request: - branches: [master] - paths: - - '.github/workflows/tvos-cpu.yml' - - 'toolchains/ios.toolchain.cmake' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' -concurrency: - group: tvos-cpu-${{ github.ref }} - cancel-in-progress: true -env: - DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer - TVOS_DEPLOYMENT_TARGET: '9.0' - ENABLE_BITCODE: OFF - ENABLE_ARC: OFF - ENABLE_VISIBILITY: OFF -permissions: - contents: read - -jobs: - tvos: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - - - name: build-arm64 - run: | - mkdir build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=TVOS -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 - - tvos-simulator: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - - - name: build-x86_64 - run: | - mkdir build-x86_64 && cd build-x86_64 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 - - name: build-arm64 - run: | - mkdir build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=SIMULATORARM64_TVOS -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DNCNN_OPENMP=OFF -DNCNN_THREADS=OFF \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 diff --git a/.github/workflows/tvos.yml b/.github/workflows/tvos.yml new file mode 100644 index 000000000000..989ad592fa76 --- /dev/null +++ b/.github/workflows/tvos.yml @@ -0,0 +1,153 @@ +name: tvos +on: + push: + branches: [master] + paths: + - '.github/workflows/tvos.yml' + - 'toolchains/ios.toolchain.cmake' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + - 'src/layer/x86/**' + pull_request: + branches: [master] + paths: + - '.github/workflows/tvos.yml' + - 'toolchains/ios.toolchain.cmake' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + - 'src/layer/x86/**' +concurrency: + group: tvos-${{ github.ref }} + cancel-in-progress: true +env: + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer + TVOS_DEPLOYMENT_TARGET: '9.0' + ENABLE_BITCODE: OFF + ENABLE_ARC: OFF + ENABLE_VISIBILITY: OFF +permissions: + contents: read + +jobs: + build: + runs-on: macos-13 + env: + OPENMP_VERSION: '18.1.2' + OPENMP_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + -DPERL_EXECUTABLE=/usr/local/bin/perl \ + -DLIBOMP_ENABLE_SHARED=OFF \ + -DLIBOMP_OMPT_SUPPORT=OFF \ + -DLIBOMP_USE_HWLOC=OFF \ + + NCNN_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ + -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ + -DOpenMP_libomp_LIBRARY="libomp.a" \ + + steps: + - uses: actions/checkout@v4 + + - name: cache-openmp + id: cache-openmp + uses: actions/cache@v4 + with: + path: openmp-install + key: openmp-tvos-install-20240402 + - name: openmp + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz + tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz + wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz + mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/ + cd openmp-${{ env.OPENMP_VERSION }}.src + wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch + patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch + wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch + patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch + - name: openmp-arm64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-arm64 && cd build-arm64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-simulator-x86_64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-simulator-x86_64 && cd build-simulator-x86_64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-simulator-arm64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-simulator-arm64 && cd build-simulator-arm64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="arm64" .. + cmake --build . -j 4 + cmake --build . --target install + - name: openmp-merge-fat-library + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + mkdir -p $GITHUB_WORKSPACE/openmp-install + mkdir -p $GITHUB_WORKSPACE/openmp-install/tvos + mkdir -p $GITHUB_WORKSPACE/openmp-install/tvos-simulator + + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/include $GITHUB_WORKSPACE/openmp-install/tvos + mkdir -p $GITHUB_WORKSPACE/openmp-install/tvos/lib + cp openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a $GITHUB_WORKSPACE/openmp-install/tvos/lib/libomp.a + + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/tvos-simulator + mkdir -p $GITHUB_WORKSPACE/openmp-install/tvos-simulator/lib + lipo -create \ + openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-x86_64/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-simulator-arm64/install/lib/libomp.a \ + -o $GITHUB_WORKSPACE/openmp-install/tvos-simulator/lib/libomp.a + + - name: install-openmp + run: | + sudo cp $GITHUB_WORKSPACE/openmp-install/tvos/include/* $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/tvos/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib + + sudo cp $GITHUB_WORKSPACE/openmp-install/tvos-simulator/include/* $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/tvos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/lib + + - name: arm64 + run: | + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" .. + cmake --build . -j 4 + - name: simulator-x86_64 + run: | + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" .. + cmake --build . -j 4 + - name: simulator-arm64 + run: | + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64_TVOS -DARCHS="arm64" .. + cmake --build . -j 4 diff --git a/README.md b/README.md index a4b2876a5e24..be4f7a9b60e1 100644 --- a/README.md +++ b/README.md @@ -237,7 +237,7 @@ https://github.com/Tencent/ncnn/releases/latest - [](https://github.com/Tencent/ncnn/actions?query=workflow%3Awatchos-cpu) + [](https://github.com/Tencent/ncnn/actions?query=workflow%3Awatchos) @@ -258,7 +258,7 @@ https://github.com/Tencent/ncnn/releases/latest - [](https://github.com/Tencent/ncnn/actions?query=workflow%3Atvos-cpu) + [](https://github.com/Tencent/ncnn/actions?query=workflow%3Atvos) From d805697a01ae8c591a01a2241a0644290ee92ec9 Mon Sep 17 00:00:00 2001 From: nihui Date: Tue, 2 Apr 2024 23:10:10 +0800 Subject: [PATCH 18/19] wip --- .github/workflows/tvos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tvos.yml b/.github/workflows/tvos.yml index 989ad592fa76..c8ea5111b0dd 100644 --- a/.github/workflows/tvos.yml +++ b/.github/workflows/tvos.yml @@ -41,7 +41,7 @@ jobs: OPENMP_VERSION: '18.1.2' OPENMP_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ - -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ + -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \ -DENABLE_BITCODE=$ENABLE_BITCODE \ -DENABLE_ARC=$ENABLE_ARC \ -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ @@ -54,7 +54,7 @@ jobs: NCNN_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ - -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ + -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \ -DENABLE_BITCODE=$ENABLE_BITCODE \ -DENABLE_ARC=$ENABLE_ARC \ -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ From 0e96bbc60b0eff90cafa79431c6fcc2137d02fda Mon Sep 17 00:00:00 2001 From: nihui Date: Tue, 2 Apr 2024 23:22:44 +0800 Subject: [PATCH 19/19] wip --- .github/workflows/tvos.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tvos.yml b/.github/workflows/tvos.yml index c8ea5111b0dd..88bc03734d17 100644 --- a/.github/workflows/tvos.yml +++ b/.github/workflows/tvos.yml @@ -143,11 +143,11 @@ jobs: cmake --build . -j 4 - name: simulator-x86_64 run: | - mkdir build-x86_64 && cd build-x86_64 + mkdir build-simulator-x86_64 && cd build-simulator-x86_64 cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" .. cmake --build . -j 4 - name: simulator-arm64 run: | - mkdir build-arm64 && cd build-arm64 + mkdir build-simulator-arm64 && cd build-simulator-arm64 cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64_TVOS -DARCHS="arm64" .. cmake --build . -j 4