.github/workflows/windows.yml: init #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build (Windows) | |
on: [push, workflow_dispatch] | |
jobs: | |
build-windows: | |
runs-on: windows-2022 | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
# develop | |
ref: 9cf49f92cf529aa66f8d9735dcb9da6e9e28101d | |
fetch-depth: 0 | |
- name: Setup MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Cache dependencies | |
id: cache-depend | |
uses: actions/cache@v4 | |
with: | |
path: | | |
D:/a/AMDMIGraphX/AMDMIGraphX/depend/install | |
C:/vcpkg/packages/sqlite3_x64-windows-static | |
key: ${{ runner.os }}-depend | |
- name: Create depend folder | |
if: steps.cache-depend.outputs.cache-hit != 'true' | |
run: mkdir depend | |
- name: Setup ROCm CMake modules | |
if: steps.cache-depend.outputs.cache-hit != 'true' | |
run: | | |
cd depend | |
git clone https://github.com/ROCm/rocm-cmake --depth 1 | |
cd rocm-cmake | |
cmake -S . -B build | |
cmake --install build --prefix ../install | |
- name: Setup Half library | |
if: steps.cache-depend.outputs.cache-hit != 'true' | |
run: | | |
cd depend | |
git clone https://github.com/ROCm/half --depth 1 | |
cd half | |
cmake -S . -B build -D CMAKE_PREFIX_PATH="%cd%/../install" | |
cmake --install build --prefix ../install | |
- name: Setup json library | |
if: steps.cache-depend.outputs.cache-hit != 'true' | |
run: | | |
cd depend | |
git clone https://github.com/nlohmann/json | |
cd json | |
:: follows https://github.com/AmusementClub/AMDMIGraphX/blob/develop/requirements.txt | |
git checkout v3.8.0 | |
cmake -S . -B build -D BUILD_TESTING=OFF -Wno-dev | |
cmake --install build --prefix ../install | |
- name: Setup SQLite3 library | |
if: steps.cache-depend.outputs.cache-hit != 'true' | |
run: vcpkg install sqlite3[core]:x64-windows-static | |
- name: Setup MessagePack library | |
if: steps.cache-depend.outputs.cache-hit != 'true' | |
run: | | |
cd depend | |
git clone https://github.com/msgpack/msgpack-c | |
cd msgpack-c | |
:: follows https://github.com/AmusementClub/AMDMIGraphX/blob/develop/requirements.txt | |
git checkout cpp-3.3.0 | |
:: patch for cmake msvc rt flag | |
python -c "f=open('CMakeLists.txt');lines=f.readlines();lines[0]='cmake_minimum_required(VERSION 3.15)\n';f.close();f=open('CMakeLists.txt','w');f.writelines(lines);f.close()" | |
cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release -D MSGPACK_BUILD_TESTS=OFF -D MSGPACK_BUILD_EXAMPLES=OFF -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -Wno-dev | |
cmake --build build --verbose | |
cmake --install build --prefix ../install | |
xcopy include\ ..\install\include\ /s /f /y | |
- name: Setup Protobuf library | |
if: steps.cache-depend.outputs.cache-hit != 'true' | |
run: | | |
cd depend | |
git clone https://github.com/google/protobuf | |
cd protobuf | |
:: follows onnx's recommended version | |
git checkout v3.21.12 | |
cmake -S . -B build_rel -G Ninja -D CMAKE_BUILD_TYPE=Release -D protobuf_BUILD_TESTS=OFF -D protobuf_MSVC_STATIC_RUNTIME=ON -Wno-dev | |
cmake --build build_rel --verbose | |
cmake --install build_rel --prefix ../install | |
- name: Setup rocMLIR library | |
if: steps.cache-depend.outputs.cache-hit != 'true' | |
run: | | |
cd depend | |
git clone https://github.com/ROCm/rocMLIR | |
cd rocMLIR | |
:: follows https://github.com/AmusementClub/AMDMIGraphX/blob/develop/requirements.txt | |
git checkout 26c8d17e70db4690da8db5ea60dab3d271c82c54 | |
cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Release -D CMAKE_PREFIX_PATH="%cd%/../install" -D BUILD_FAT_LIBROCKCOMPILER=ON -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -Wno-dev | |
cmake --build build | |
cmake --install build --prefix ../install | |
- name: Cache HIP SDK | |
id: cache-hip | |
uses: actions/cache@v4 | |
with: | |
path: C:\Program Files\AMD\ROCM | |
key: ${{ runner.os }}-rocm-6.1.2 | |
- name: Setup HIP | |
if: steps.cache-hip.outputs.cache-hit != 'true' | |
shell: pwsh | |
run: | | |
curl -s -o hip_installer.exe -L https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-24.Q3-WinSvr2022-For-HIP.exe | |
Start-Process hip_installer.exe -ArgumentList '-install' -NoNewWindow -Wait | |
- name: Setup MIGraphX | |
run: cmake -S . -B build -G Ninja -LA -Wno-dev | |
-D CMAKE_BUILD_TYPE=Release | |
-D CMAKE_C_COMPILER="C:/Program Files/AMD/ROCm/6.1/bin/clang.exe" | |
-D CMAKE_CXX_COMPILER="C:/Program Files/AMD/ROCm/6.1/bin/clang++.exe" | |
-D CMAKE_PREFIX_PATH="%cd%/depend/install;C:/vcpkg/packages/sqlite3_x64-windows-static" | |
-D BUILD_TESTING=OFF | |
-D hip_DIR="C:/Program Files/AMD/ROCm/6.1/lib/cmake/hip" | |
-D hiprtc_DIR="C:/Program Files/AMD/ROCm/6.1/lib/cmake/hiprtc" | |
-D HIP_PLATFORM=amd | |
-D GPU_TARGETS="gfx1030;gfx1100;gfx1101;gfx1102" | |
-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded | |
- name: Build MIGraphX | |
run: cmake --build build --verbose | |
- name: Install MIGraphX | |
run: cmake --install build --prefix migraphx-windows | |
- name: Show | |
run: ls -R migraphx-windows | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: migraphx-windows | |
retention-days: 1 | |
path: migraphx-windows | |
- name: Package | |
shell: pwsh | |
run: Compress-Archive migraphx-windows -DestinationPath migraphx-win64.zip | |
- name: Get description | |
shell: bash | |
run: | | |
echo MIGX_VERSION=`git describe` >> $GITHUB_ENV | |
echo TIME=`date -u +"%y%m%d-%H%M"` >> $GITHUB_ENV | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: migraphx-win64.zip | |
name: Build ${{ env.MIGX_VERSION }} | |
tag_name: ${{ env.MIGX_VERSION }}-${{ env.TIME }} | |
prerelease: true | |