diff --git a/.github/workflows/mac-catalyst-arm64-cpu.yml b/.github/workflows/mac-catalyst-arm64-cpu.yml deleted file mode 100644 index 4a4b5bae9ed..00000000000 --- a/.github/workflows/mac-catalyst-arm64-cpu.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: mac-catalyst-arm64-cpu -on: - push: - branches: [master] - paths: - - '.github/workflows/mac-catalyst-arm64-cpu.yml' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' - pull_request: - branches: [master] - paths: - - '.github/workflows/mac-catalyst-arm64-cpu.yml' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' -concurrency: - group: mac-catalyst-arm64-cpu-${{ github.ref }} - cancel-in-progress: true -env: - DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer - MAC_CATALYST_DEPLOYMENT_TARGET: '13.1' - ENABLE_BITCODE: OFF - ENABLE_ARC: OFF - ENABLE_VISIBILITY: OFF -permissions: - contents: read - -jobs: - mac-catalyst-clang: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - - - name: cache-openmp - id: cache-openmp - uses: actions/cache@v4 - with: - path: openmp-install - key: openmp-mac-catalyst-install-20230504 - - name: openmp - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/openmp-11.0.0.src.tar.xz - tar -xf openmp-11.0.0.src.tar.xz - cd openmp-11.0.0.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-build-x86_64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-11.0.0.src - mkdir -p build-x86_64 && cd build-x86_64 - cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF .. - cmake --build . -j 3 - cmake --build . --target install - - name: openmp-build-arm64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-11.0.0.src - mkdir -p build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST_ARM64 -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF .. - cmake --build . -j 3 - cmake --build . --target install - - name: openmp-merge-fat-library - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - mkdir -p $GITHUB_WORKSPACE/openmp-install - cp -a openmp-11.0.0.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install - mkdir -p $GITHUB_WORKSPACE/openmp-install/lib - lipo -create \ - openmp-11.0.0.src/build-x86_64/install/lib/libomp.a \ - openmp-11.0.0.src/build-arm64/install/lib/libomp.a \ - -o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a - - - name: install-openmp - run: | - sudo cp $GITHUB_WORKSPACE/openmp-install/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include - sudo cp $GITHUB_WORKSPACE/openmp-install/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib - - - name: build - run: | - mkdir build && cd build - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST_ARM64 -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ - -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ - -DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. - cmake --build . -j 3 diff --git a/.github/workflows/mac-catalyst-arm64-gpu.yml b/.github/workflows/mac-catalyst-arm64-gpu.yml deleted file mode 100644 index b1141287176..00000000000 --- a/.github/workflows/mac-catalyst-arm64-gpu.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: mac-catalyst-arm64-gpu -on: - push: - branches: [master] - paths: - - '.github/workflows/mac-catalyst-arm64-gpu.yml' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' - - 'src/layer/vulkan/**' - pull_request: - branches: [master] - paths: - - '.github/workflows/mac-catalyst-arm64-gpu.yml' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/arm/**' - - 'src/layer/vulkan/**' -concurrency: - group: mac-catalyst-arm64-gpu-${{ github.ref }} - cancel-in-progress: true -env: - DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer - MAC_CATALYST_DEPLOYMENT_TARGET: '13.1' - ENABLE_BITCODE: OFF - ENABLE_ARC: OFF - ENABLE_VISIBILITY: OFF -permissions: - contents: read - -jobs: - mac-catalyst-clang-gpu: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: cache-openmp - id: cache-openmp - uses: actions/cache@v4 - with: - path: openmp-install - key: openmp-mac-catalyst-install-20230504 - - name: openmp - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/openmp-11.0.0.src.tar.xz - tar -xf openmp-11.0.0.src.tar.xz - cd openmp-11.0.0.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-build-x86_64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-11.0.0.src - mkdir -p build-x86_64 && cd build-x86_64 - cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF .. - cmake --build . -j 3 - cmake --build . --target install - - name: openmp-build-arm64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-11.0.0.src - mkdir -p build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST_ARM64 -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF .. - cmake --build . -j 3 - cmake --build . --target install - - name: openmp-merge-fat-library - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - mkdir -p $GITHUB_WORKSPACE/openmp-install - cp -a openmp-11.0.0.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install - mkdir -p $GITHUB_WORKSPACE/openmp-install/lib - lipo -create \ - openmp-11.0.0.src/build-x86_64/install/lib/libomp.a \ - openmp-11.0.0.src/build-arm64/install/lib/libomp.a \ - -o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a - - - name: install-openmp - run: | - sudo cp $GITHUB_WORKSPACE/openmp-install/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include - sudo cp $GITHUB_WORKSPACE/openmp-install/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib - - - name: build - run: | - mkdir build && cd build - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST_ARM64 -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ - -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ - -DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF .. - cmake --build . -j 3 diff --git a/.github/workflows/mac-catalyst-x64-cpu.yml b/.github/workflows/mac-catalyst-x64-cpu.yml deleted file mode 100644 index ce37229fcb3..00000000000 --- a/.github/workflows/mac-catalyst-x64-cpu.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: mac-catalyst-x64-cpu -on: - push: - branches: [master] - paths: - - '.github/workflows/mac-catalyst-x64-cpu.yml' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/x86/**' - - 'tests/**' - - 'tools/**' - - '!tools/pnnx/**' - - 'examples/**' - pull_request: - branches: [master] - paths: - - '.github/workflows/mac-catalyst-x64-cpu.yml' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/x86/**' - - 'tests/**' - - 'tools/**' - - '!tools/pnnx/**' - - 'examples/**' -concurrency: - group: mac-catalyst-x64-cpu-${{ github.ref }} - cancel-in-progress: true -env: - DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer - MAC_CATALYST_DEPLOYMENT_TARGET: '13.1' - ENABLE_BITCODE: OFF - ENABLE_ARC: OFF - ENABLE_VISIBILITY: OFF -permissions: - contents: read - -jobs: - mac-catalyst-clang: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - - - name: cache-openmp - id: cache-openmp - uses: actions/cache@v4 - with: - path: openmp-install - key: openmp-mac-catalyst-install-20230504 - - name: openmp - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/openmp-11.0.0.src.tar.xz - tar -xf openmp-11.0.0.src.tar.xz - cd openmp-11.0.0.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-build-x86_64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-11.0.0.src - mkdir -p build-x86_64 && cd build-x86_64 - cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF .. - cmake --build . -j 3 - cmake --build . --target install - - name: openmp-build-arm64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-11.0.0.src - mkdir -p build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST_ARM64 -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF .. - cmake --build . -j 3 - cmake --build . --target install - - name: openmp-merge-fat-library - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - mkdir -p $GITHUB_WORKSPACE/openmp-install - cp -a openmp-11.0.0.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install - mkdir -p $GITHUB_WORKSPACE/openmp-install/lib - lipo -create \ - openmp-11.0.0.src/build-x86_64/install/lib/libomp.a \ - openmp-11.0.0.src/build-arm64/install/lib/libomp.a \ - -o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a - - - name: install-openmp - run: | - sudo cp $GITHUB_WORKSPACE/openmp-install/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include - sudo cp $GITHUB_WORKSPACE/openmp-install/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib - - - name: build - run: | - mkdir build && cd build - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ - -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ - -DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - .. - cmake --build . -j 3 diff --git a/.github/workflows/mac-catalyst-x64-gpu.yml b/.github/workflows/mac-catalyst-x64-gpu.yml deleted file mode 100644 index 4dabc202a78..00000000000 --- a/.github/workflows/mac-catalyst-x64-gpu.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: mac-catalyst-x64-gpu -on: - push: - branches: [master] - paths: - - '.github/workflows/mac-catalyst-x64-gpu.yml' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/x86/**' - - 'src/layer/vulkan/**' - - 'tests/**' - - 'tools/**' - - '!tools/pnnx/**' - - 'examples/**' - pull_request: - branches: [master] - paths: - - '.github/workflows/mac-catalyst-x64-gpu.yml' - - 'CMakeLists.txt' - - 'cmake/**' - - 'src/*' - - 'src/layer/*' - - 'src/layer/x86/**' - - 'src/layer/vulkan/**' - - 'tests/**' - - 'tools/**' - - '!tools/pnnx/**' - - 'examples/**' -concurrency: - group: mac-catalyst-x64-gpu-${{ github.ref }} - cancel-in-progress: true -env: - DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer - MAC_CATALYST_DEPLOYMENT_TARGET: '13.1' - ENABLE_BITCODE: OFF - ENABLE_ARC: OFF - ENABLE_VISIBILITY: OFF -permissions: - contents: read - -jobs: - mac-catalyst-clang-gpu: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: cache-openmp - id: cache-openmp - uses: actions/cache@v4 - with: - path: openmp-install - key: openmp-mac-catalyst-install-20230504 - - name: openmp - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/openmp-11.0.0.src.tar.xz - tar -xf openmp-11.0.0.src.tar.xz - cd openmp-11.0.0.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-build-x86_64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-11.0.0.src - mkdir -p build-x86_64 && cd build-x86_64 - cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF .. - cmake --build . -j 3 - cmake --build . --target install - - name: openmp-build-arm64 - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - cd openmp-11.0.0.src - mkdir -p build-arm64 && cd build-arm64 - cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST_ARM64 -DARCHS="arm64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DPERL_EXECUTABLE=/usr/local/bin/perl \ - -DLIBOMP_ENABLE_SHARED=OFF -DLIBOMP_OMPT_SUPPORT=OFF -DLIBOMP_USE_HWLOC=OFF .. - cmake --build . -j 3 - cmake --build . --target install - - name: openmp-merge-fat-library - if: steps.cache-openmp.outputs.cache-hit != 'true' - run: | - mkdir -p $GITHUB_WORKSPACE/openmp-install - cp -a openmp-11.0.0.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install - mkdir -p $GITHUB_WORKSPACE/openmp-install/lib - lipo -create \ - openmp-11.0.0.src/build-x86_64/install/lib/libomp.a \ - openmp-11.0.0.src/build-arm64/install/lib/libomp.a \ - -o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a - - - name: install-openmp - run: | - sudo cp $GITHUB_WORKSPACE/openmp-install/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include - sudo cp $GITHUB_WORKSPACE/openmp-install/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib - - - name: build - run: | - mkdir build && cd build - cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" \ - -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET -DENABLE_BITCODE=$ENABLE_BITCODE -DENABLE_ARC=$ENABLE_ARC -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ - -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \ - -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \ - -DOpenMP_libomp_LIBRARY="$DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libomp.a" \ - -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install \ - -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF .. - cmake --build . -j 3 diff --git a/.github/workflows/mac-catalyst.yml b/.github/workflows/mac-catalyst.yml new file mode 100644 index 00000000000..4dcdb06a6cd --- /dev/null +++ b/.github/workflows/mac-catalyst.yml @@ -0,0 +1,143 @@ +name: mac-catalyst +on: + push: + branches: [master] + paths: + - '.github/workflows/mac-catalyst.yml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + - 'src/layer/x86/**' + - 'src/layer/vulkan/**' + pull_request: + branches: [master] + paths: + - '.github/workflows/mac-catalyst.yml' + - 'CMakeLists.txt' + - 'cmake/**' + - 'src/*' + - 'src/layer/*' + - 'src/layer/arm/**' + - 'src/layer/x86/**' + - 'src/layer/vulkan/**' +concurrency: + group: mac-catalyst-${{ github.ref }} + cancel-in-progress: true +env: + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer + MAC_CATALYST_DEPLOYMENT_TARGET: '13.1' + 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=$MAC_CATALYST_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 \ + + MOLTENVK_VERSION: 'v1.2.8' + NCNN_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$MAC_CATALYST_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" \ + -DNCNN_VULKAN=ON \ + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: cache-openmp + id: cache-openmp + uses: actions/cache@v4 + with: + path: openmp-install + key: openmp-mac-catalyst-install-20240403 + - 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-x86_64 + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-x86_64 && cd build-x86_64 + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" .. + cmake --build . -j 4 + cmake --build . --target install + - 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=MAC_CATALYST_ARM64 -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/mac-catalyst + + cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install/mac-catalyst + mkdir -p $GITHUB_WORKSPACE/openmp-install/mac-catalyst/lib + lipo -create \ + openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \ + -o $GITHUB_WORKSPACE/openmp-install/mac-catalyst/lib/libomp.a + + - name: install-openmp + run: | + sudo cp $GITHUB_WORKSPACE/openmp-install/mac-catalyst/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include + sudo cp $GITHUB_WORKSPACE/openmp-install/mac-catalyst/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib + + - name: moltenvk + run: | + wget -q https://github.com/KhronosGroup/MoltenVK/releases/download/${{ env.MOLTENVK_VERSION }}/MoltenVK-all.tar + tar -xf MoltenVK-all.tar + + - name: x86_64 + run: | + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" \ + -DVulkan_LIBRARY=$GITHUB_WORKSPACE/MoltenVK/MoltenVK/static/MoltenVK.xcframework/ios-arm64_x86_64-maccatalyst/libMoltenVK.a .. + cmake --build . -j 4 + - name: arm64 + run: | + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST_ARM64 -DARCHS="arm64" \ + -DVulkan_LIBRARY=$GITHUB_WORKSPACE/MoltenVK/MoltenVK/static/MoltenVK.xcframework/ios-arm64_x86_64-maccatalyst/libMoltenVK.a .. + cmake --build . -j 4 diff --git a/.github/workflows/tvos.yml b/.github/workflows/tvos.yml index 88bc03734d1..41c0add3a75 100644 --- a/.github/workflows/tvos.yml +++ b/.github/workflows/tvos.yml @@ -11,6 +11,7 @@ on: - 'src/layer/*' - 'src/layer/arm/**' - 'src/layer/x86/**' + - 'src/layer/vulkan/**' pull_request: branches: [master] paths: @@ -22,12 +23,13 @@ on: - 'src/layer/*' - 'src/layer/arm/**' - 'src/layer/x86/**' + - 'src/layer/vulkan/**' concurrency: group: tvos-${{ github.ref }} cancel-in-progress: true env: DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer - TVOS_DEPLOYMENT_TARGET: '9.0' + TVOS_DEPLOYMENT_TARGET: '11.0' ENABLE_BITCODE: OFF ENABLE_ARC: OFF ENABLE_VISIBILITY: OFF @@ -52,6 +54,7 @@ jobs: -DLIBOMP_OMPT_SUPPORT=OFF \ -DLIBOMP_USE_HWLOC=OFF \ + MOLTENVK_VERSION: 'v1.2.8' NCNN_CMAKE_OPTIONS: | -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \ -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \ @@ -63,16 +66,19 @@ jobs: -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_VULKAN=ON \ steps: - uses: actions/checkout@v4 + with: + submodules: true - name: cache-openmp id: cache-openmp uses: actions/cache@v4 with: path: openmp-install - key: openmp-tvos-install-20240402 + key: openmp-tvos-install-20240403 - name: openmp if: steps.cache-openmp.outputs.cache-hit != 'true' run: | @@ -94,6 +100,14 @@ jobs: cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" .. cmake --build . -j 4 cmake --build . --target install + - name: openmp-arm64e + if: steps.cache-openmp.outputs.cache-hit != 'true' + run: | + cd openmp-${{ env.OPENMP_VERSION }}.src + mkdir -p build-arm64e && cd build-arm64e + cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64e" .. + cmake --build . -j 4 + cmake --build . --target install - name: openmp-simulator-x86_64 if: steps.cache-openmp.outputs.cache-hit != 'true' run: | @@ -119,7 +133,10 @@ jobs: 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 + lipo -create \ + openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \ + openmp-${{ env.OPENMP_VERSION }}.src/build-arm64e/install/lib/libomp.a \ + -o $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 @@ -136,18 +153,32 @@ jobs: 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: moltenvk + run: | + wget -q https://github.com/KhronosGroup/MoltenVK/releases/download/${{ env.MOLTENVK_VERSION }}/MoltenVK-all.tar + tar -xf MoltenVK-all.tar + - name: arm64 run: | mkdir build-arm64 && cd build-arm64 - cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" .. + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" \ + -DVulkan_LIBRARY=$GITHUB_WORKSPACE/MoltenVK/MoltenVK/static/MoltenVK.xcframework/tvos-arm64_arm64e/libMoltenVK.a .. + cmake --build . -j 4 + - name: arm64e + run: | + mkdir build-arm64e && cd build-arm64e + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64e" \ + -DVulkan_LIBRARY=$GITHUB_WORKSPACE/MoltenVK/MoltenVK/static/MoltenVK.xcframework/tvos-arm64_arm64e/libMoltenVK.a .. 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_TVOS -DARCHS="x86_64" .. + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" \ + -DVulkan_LIBRARY=$GITHUB_WORKSPACE/MoltenVK/MoltenVK/static/MoltenVK.xcframework/tvos-arm64_x86_64-simulator/libMoltenVK.a .. cmake --build . -j 4 - name: simulator-arm64 run: | mkdir build-simulator-arm64 && cd build-simulator-arm64 - cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64_TVOS -DARCHS="arm64" .. + cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64_TVOS -DARCHS="arm64" \ + -DVulkan_LIBRARY=$GITHUB_WORKSPACE/MoltenVK/MoltenVK/static/MoltenVK.xcframework/tvos-arm64_x86_64-simulator/libMoltenVK.a .. cmake --build . -j 4 diff --git a/README.md b/README.md index be4f7a9b60e..aa05b040192 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ https://github.com/Tencent/ncnn/releases/latest - [](https://github.com/Tencent/ncnn/actions?query=workflow%3Amac-catalyst-arm64-gpu) + [](https://github.com/Tencent/ncnn/actions?query=workflow%3Amac-catalyst) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d7dfe19c26e..487fb26d852 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -302,25 +302,22 @@ if(NCNN_VULKAN) endif() # Support mac platform static library compilation - if(NOT NCNN_SHARED_LIB AND APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS") - find_library(CoreFoundation NAMES CoreFoundation) + # https://github.com/KhronosGroup/MoltenVK/blob/main/Docs/MoltenVK_Runtime_UserGuide.md#optionally-link-to-required-system-libraries + if(NOT NCNN_SHARED_LIB AND APPLE) + find_library(Metal NAMES Metal) find_library(Foundation NAMES Foundation) find_library(QuartzCore NAMES QuartzCore) find_library(CoreGraphics NAMES CoreGraphics) - find_library(Cocoa NAMES Cocoa) - find_library(Metal NAMES Metal) - find_library(IOKit NAMES IOKit) find_library(IOSurface NAMES IOSurface) - list(APPEND vulkan_dependent_LINK_LIBRARIES - ${Metal} - ${IOKit} - ${IOSurface} - ${QuartzCore} - ${CoreGraphics} - ${Cocoa} - ${Foundation} - ${CoreFoundation} - ) + list(APPEND vulkan_dependent_LINK_LIBRARIES ${Metal} ${Foundation} ${QuartzCore} ${CoreGraphics} ${IOSurface}) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + find_library(IOKit NAMES IOKit) + list(APPEND vulkan_dependent_LINK_LIBRARIES ${IOKit}) + endif() + if(IOS OR CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS") + find_library(UIKit NAMES UIKit) + list(APPEND vulkan_dependent_LINK_LIBRARIES ${UIKit}) + endif() target_link_libraries(ncnn PRIVATE ${vulkan_dependent_LINK_LIBRARIES}) endif()