name: windows-x64-gpu-vs2019
on:
push:
branches: [master]
paths:
- '.github/workflows/windows-x64-gpu-vs2019.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/windows-x64-gpu-vs2019.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
- 'tests/**'
- 'tools/**'
- '!tools/pnnx/**'
- 'examples/**'
concurrency:
group: windows-x64-gpu-vs2019-${{ github.ref }}
cancel-in-progress: true
jobs:
windows-vs2019-gpu:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: cache-protobuf
id: cache-protobuf
uses: actions/cache@v2.1.7
with:
path: "protobuf-install"
key: protobuf-windows-install
- name: protobuf
if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
7z x ./protobuf-3.11.2.zip
cd protobuf-3.11.2
mkdir build-vs2019; cd build-vs2019; cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DNCNN_BUILD_TESTS=ON ../cmake
cmake --build . --config Release -j 2
cmake --build . --config Release --target install
- name: vulkansdk
run: |
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/1.2.189.0/windows/VulkanSDK-1.2.189.0-Installer.exe?Human=true -OutFile VulkanSDK.exe
$installer = Start-Process -FilePath VulkanSDK.exe -Wait -PassThru -ArgumentList @("/S");
$installer.WaitForExit();
- name: cache-swiftshader
id: cache-swiftshader
uses: actions/cache@v2.1.7
with:
path: swiftshader-install
key: swiftshader-windows-install-20211002
- name: checkout-swiftshader
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: google/swiftshader
path: swiftshader
ref: f43b9df4c8a9959047e2e1d7e111554ab3f9a3bf
- name: checkout-swiftshader-submodules
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
run: |
cd swiftshader
git -c submodule."third_party/git-hooks".update=none submodule update --init --recursive
- name: swiftshader
if: steps.cache-swiftshader.outputs.cache-hit != 'true'
run: |
cd swiftshader
mkdir build-vs2019; cd build-vs2019
cmake -DCMAKE_INSTALL_PREFIX=install -DSWIFTSHADER_BUILD_EGL=FALSE -DSWIFTSHADER_BUILD_GLESv2=FALSE -DSWIFTSHADER_BUILD_GLES_CM=FALSE -DSWIFTSHADER_BUILD_VULKAN=TRUE -DSWIFTSHADER_BUILD_PVR=FALSE -DSWIFTSHADER_BUILD_TESTS=FALSE -DSWIFTSHADER_ENABLE_ASTC=FALSE -DSWIFTSHADER_WARNINGS_AS_ERRORS=FALSE -DREACTOR_BACKEND=Subzero -DREACTOR_DEFAULT_OPT_LEVEL=Default -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release -j 2
mkdir "$env:GITHUB_WORKSPACE/swiftshader-install"
Copy-Item -Path "Windows\*" -Destination "$env:GITHUB_WORKSPACE\swiftshader-install"
- name: build
run: |
$env:VULKAN_SDK="C:/VulkanSDK/1.2.189.0"
$env:Path+=";C:/VulkanSDK/1.2.189.0/Bin"
mkdir build; cd build
cmake -DProtobuf_INCLUDE_DIR="$env:GITHUB_WORKSPACE\protobuf-install\include" -DProtobuf_LIBRARIES="$env:GITHUB_WORKSPACE\protobuf-install\lib\libprotobuf.lib" -DProtobuf_PROTOC_EXECUTABLE="$env:GITHUB_WORKSPACE\protobuf-install\bin\protoc.exe" -DNCNN_VULKAN=ON -DNCNN_BUILD_TESTS=ON ..
cmake --build . --config Release -j 2
- name: test
run: |
Copy-Item -Path "$env:GITHUB_WORKSPACE\swiftshader-install\vulkan-1.dll" -Destination 'build\tests'
$env:Path+=";C:/VulkanSDK/1.2.189.0/Bin"
cd build; ctest -C Release --output-on-failure -j 2
- name: build-shared
run: |
$env:VULKAN_SDK="C:/VulkanSDK/1.2.189.0"
$env:Path+=";C:/VulkanSDK/1.2.189.0/Bin"
mkdir build-shared; cd build-shared
cmake -DProtobuf_INCLUDE_DIR="$env:GITHUB_WORKSPACE\protobuf-install\include" -DProtobuf_LIBRARIES="$env:GITHUB_WORKSPACE\protobuf-install\lib\libprotobuf.lib" -DProtobuf_PROTOC_EXECUTABLE="$env:GITHUB_WORKSPACE\protobuf-install\bin\protoc.exe" -DNCNN_VULKAN=ON -DNCNN_SHARED_LIB=ON -DNCNN_ENABLE_LTO=ON ..
cmake --build . --config Release -j 2