Skip to content

Commit

Permalink
[wip] Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Aug 14, 2024
1 parent 8b9c73e commit 082bf79
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 4 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/ci-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: CI Windows

on:
workflow_call:
workflow_dispatch:
pull_request:
merge_group:
push:
branches:
- main

concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit).
group: ci-build-test-cpp-windows-${{ github.event.number || github.sha }}
cancel-in-progress: true

defaults:
run:
# force bash for windows
shell: bash

jobs:
build_test_windows:
name: Build and Test (Windows, ASSERTIONS)
runs-on: windows-2019
strategy:
fail-fast: true
env:
CACHE_DIR: ${{ github.workspace }}/.container-cache
steps:
- name: "Checking out repository"
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: recursive

- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: msvc
vcvarsall: true
cmake: true
ninja: true
cppcheck: false
clangtidy: false
clangformat: false

- name: Install boost
uses: MarkusJx/install-boost@v2.4.5
id: install-boost
with:
boost_install_dir: ${{ github.workspace }}
boost_version: 1.78.0
platform_version: 2019
toolset: msvc

- name: Sync source deps
run: |
python ./sync_deps.py
- name: Enable cache
uses: actions/cache/restore@v3
with:
path: "${{ github.workspace }}/.ccache"
key: windows-build-test-cpp-asserts-v1-${{ github.sha }}
restore-keys: |
windows-build-test-cpp-
- name: Build packages
run: |
export cache_dir="${{ github.workspace }}/.ccache"
# switch to linux paths instead of windows paths
# also make into abs path
export BOOST_ROOT="/$(echo "${{ steps.install-boost.outputs.BOOST_ROOT }}" | sed -e 's/\\/\//g' -e 's/://')"
bash build_tools/ci/build_test_cpp_windows.sh
- name: Create artifacts
if: ${{ !cancelled() }}
run: |
# TODO: https://github.com/openxla/iree/issues/16230
# We should not be packaging clang and llvm-link in the default dist
# installs.
rm -f iree-install/bin/clang*
rm -f iree-install/bin/llvm-link*
tar cf iree-dist.tar -C iree-install . -C ../iree-build tools/testing/e2e/iree-e2e-matmul-test
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: windows_x86_64_release_packages
path: |
iree-dist-win64.tar
if-no-files-found: warn

- name: Save cache
uses: actions/cache/save@v3
if: ${{ !cancelled() }}
with:
path: ${{ env.CACHE_DIR }}
key: windows-build-test-cpp-asserts-v1-${{ github.sha }}
92 changes: 92 additions & 0 deletions build_tools/ci/build_test_cpp_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/bin/bash

set -eu -o errtrace

this_dir="$(cd $(dirname $0) && pwd)"
repo_root="$(cd $this_dir/../.. && pwd)"
iree_dir="$(cd $repo_root/../iree && pwd)"
build_dir="$repo_root/iree-build"
install_dir="$repo_root/iree-install"
mkdir -p "$build_dir"
build_dir="$(cd $build_dir && pwd)"
cache_dir="${cache_dir:-}"

# Setup cache dir.
if [ -z "${cache_dir}" ]; then
cache_dir="${repo_root}/.build-cache"
mkdir -p "${cache_dir}"
cache_dir="$(cd ${cache_dir} && pwd)"
fi
echo "Caching to ${cache_dir}"
mkdir -p "${cache_dir}/ccache"
mkdir -p "${cache_dir}/pip"

python="$(which python)"
echo "Using python: $python"

#export CCACHE_DIR="${cache_dir}/ccache"
#export CCACHE_MAXSIZE="700M"
#export CMAKE_C_COMPILER_LAUNCHER=ccache
#export CMAKE_CXX_COMPILER_LAUNCHER=ccache
#
## Clear ccache stats.
#ccache -z
#
## Build XRT.
#XRT_BUILD_DIR=$repo_root/xrt-build
#XRT_INSTALL_DIR=$repo_root/xrt-install
#$this_dir/build_xrt.sh $XRT_BUILD_DIR $XRT_INSTALL_DIR

echo "Building IREE"
echo "============="
echo '{
"version": 4,
"cmakeMinimumRequired": {
"major": 3,
"minor": 23,
"patch": 0
},
"include": [
"build_tools/cmake/presets/all.json"
]
}' > $iree_dir/CMakeUserPresets.json

cd $iree_dir
cmake -S "$iree_dir" -B "$build_dir" \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$install_dir" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DIREE_ENABLE_ASSERTIONS=ON \
-DIREE_BUILD_SAMPLES=OFF \
-DIREE_BUILD_PYTHON_BINDINGS=OFF \
-DIREE_BUILD_BINDINGS_TFLITE=OFF \
-DIREE_HAL_DRIVER_DEFAULTS=OFF \
-DIREE_HAL_DRIVER_LOCAL_SYNC=ON \
-DIREE_HAL_DRIVER_LOCAL_TASK=ON \
-DIREE_TARGET_BACKEND_DEFAULTS=OFF \
-DIREE_TARGET_BACKEND_LLVM_CPU=ON \
-DIREE_INPUT_TOSA=OFF \
-DIREE_INPUT_STABLEHLO=OFF \
-DIREE_CMAKE_PLUGIN_PATHS=../iree-amd-aie \
-DCMAKE_OBJECT_PATH_MAX=4096 \
-DBoost_INCLUDE_DIR=${BOOST_ROOT}/include\
-DBoost_LIBRARY_DIRS=${BOOST_ROOT}/lib
# -DIREE_EXTERNAL_HAL_DRIVERS=xrt \
# -DXRT_DIR=$XRT_INSTALL_DIR/opt/xilinx/xrt/share/cmake/XRT

echo "Building all"
echo "------------"
cmake --build "$build_dir" -- -k 0

echo "Installing"
echo "----------"
echo "Install to: $install_dir"
cmake --build "$build_dir" --target iree-install-dist

echo "CTest"
echo "-----"
ctest --test-dir "$build_dir" -R amd-aie --output-on-failure -j

# Show ccache stats.
#ccache --show-stats
2 changes: 2 additions & 0 deletions build_tools/remove_path_limit.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://stackoverflow.com/a/68353105
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
10 changes: 6 additions & 4 deletions runtime/src/iree-amd-aie/aie_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,12 @@ set_target_properties(
xaiengine
PROPERTIES COMPILE_OPTIONS "${_aie_runtime_compile_options}")
target_compile_definitions(xaiengine PRIVATE ${XAIE_DEBUG} __AIECDO__)
set(xaiengine_c_warning_ignores
-Wno-unused-but-set-variable
-Wno-incompatible-pointer-types)
target_compile_options(xaiengine PRIVATE ${xaiengine_c_warning_ignores})
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
set(xaiengine_c_warning_ignores
-Wno-unused-but-set-variable
-Wno-incompatible-pointer-types)
target_compile_options(xaiengine PRIVATE ${xaiengine_c_warning_ignores})
endif()
# For <elf.h>
target_include_directories(xaiengine PRIVATE SYSTEM ${_bootgen_source_dir})
target_link_libraries(xaiengine PRIVATE cdo_driver)
Expand Down

0 comments on commit 082bf79

Please sign in to comment.