Skip to content

Commit

Permalink
Validate halide build on Windows
Browse files Browse the repository at this point in the history
Configure meson build system to scan for msvc compiler toolchain.
Compile everything. Run unit tests.
  • Loading branch information
antonysigma committed Jul 18, 2024
1 parent 8d68f49 commit 7e95166
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 39 deletions.
35 changes: 16 additions & 19 deletions .github/workflows/compile-halide-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Compile Halide C++ on Windows/Linux

on:
push:
branches: [ master ]
branches: [ master, validate-halide-compile-windows ]
pull_request:
types: [edited, submitted]

Expand All @@ -15,29 +15,25 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest, windows-latest, macos-latest]
#os: [ubuntu-20.04, ubuntu-latest, windows-latest, macos-latest]
os: [windows-latest]
# TODO(Antony): add Python 3.9 to test the Meson build system support
python-version: [3.8]
python-version: ["3.10"]

steps:
- name: Fetch sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install gcc toolchain
run: sudo apt-get install build-essential
if: startsWith(matrix.os, 'ubuntu') == true

- name: Install MSVC toolchain
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
if: startsWith(matrix.os, 'windows') == true

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -49,18 +45,19 @@ jobs:
key: ${{ runner.os }}-meson-cache
path: proximal/halide/subprojects/packagecache/

- name: Resolve C++ build dependencies
- name: Resolve C++ build dependencies (non-Windows)
run: meson setup proximal/halide proximal/halide/build
if: startsWith(matrix.os, 'window') == false

- name: Resolve C++ build dependencies (msvc toolchain)
run: meson setup --vsenv proximal/halide proximal/halide/build
if: startsWith(matrix.os, 'window') == true

- name: Build ProxImaL-codegen
run: ninja -C proximal/halide/build ladmm-runtime
# TODO(Antony): Resolve "missing DLLs" in Windows Docker environment.
if: startsWith(matrix.os, 'window') == false
run: meson compile -C proximal/halide/build ladmm-runtime:alias

- name: Build Python interfaces
run: ninja -C proximal/halide/build python_interface
if: startsWith(matrix.os, 'window') == false
run: meson compile -C proximal/halide/build python_interface

- name: Run test suite
run: ninja -C proximal/halide/build test
if: startsWith(matrix.os, 'window') == false
run: meson test -C proximal/halide/build --suite codegen
27 changes: 14 additions & 13 deletions proximal/halide/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,16 @@ if get_option('build_nlm')
}
endif


if build_machine.system() == 'windows'
env = { 'PATH': halide_library_path }
env = { 'PATH': halide_toolchain.get_variable('halide_dll_path')}
object_file_ext = 'obj'
statlib_file_ext = 'lib'
dynamiclib_file_ext = 'dll'
else
env = { 'LD_LIBRARY_PATH': halide_library_path }
object_file_ext = 'o'
statlib_file_ext = 'a'
dynamiclib_file_ext = 'so'
endif

proximal_python_interface = []
Expand All @@ -154,21 +155,21 @@ foreach p : pipeline_name
if cuda_toolchain.found() and p['autoschedule']
compile_cmd += [
'target=host-cuda',
'-p', 'autoschedule_li2018',
'autoscheduler=Li2018',
'autoscheduler.parallelism=32',
#'-p', 'autoschedule_li2018',
#'autoscheduler=Li2018',
#'autoscheduler.parallelism=32',
]
elif p['autoschedule']
compile_cmd += [
'target=host',
'-p', 'autoschedule_mullapudi2016',
'autoscheduler=Mullapudi2016',
# Maximum level of CPU core, or GPU threads available
'autoscheduler.parallelism=4',
# Size of last level (L2) cache
'autoscheduler.last_level_cache_size=6291000',
# Ratio of the cache read cost to compute cost
'autoscheduler.balance=40',
#'-p', '@0@/libautoschedule_mullapudi2016.@1@'.format(halide_library_path, dynamiclib_file_ext),
#'autoscheduler=Mullapudi2016',
## Maximum level of CPU core, or GPU threads available
#'autoscheduler.parallelism=4',
## Size of last level (L2) cache
#'autoscheduler.last_level_cache_size=6291000',
## Ratio of the cache read cost to compute cost
#'autoscheduler.balance=40',
]
else
compile_cmd += [
Expand Down
13 changes: 6 additions & 7 deletions proximal/halide/src/user-problem/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,18 @@ solver_bin = custom_target(
'ladmm_iter.h',
],
input: solver_generator,
env: env,
command: [
solver_generator,
'-o', meson.current_build_dir(),
'-g', 'ladmm_iter',
'-e', 'static_library,h,stmt_html',
'-e', 'static_library,h',
'target=' + halide_target,

'-p', 'autoschedule_mullapudi2016',
'autoscheduler=Mullapudi2016',
'autoscheduler.parallelism=4',
'autoscheduler.last_level_cache_size=6291000',
'autoscheduler.balance=40',
#'-p', '@0@/libautoschedule_mullapudi2016.@1@'.format(halide_library_path, dynamiclib_file_ext),
#'autoscheduler=Mullapudi2016',
#'autoscheduler.parallelism=4',
#'autoscheduler.last_level_cache_size=6291000',
#'autoscheduler.balance=40',

'n_iter=1', # number of ADMM iterations before checking convergence
'mu=0.333', # Problem scaling factor. Defaults to 1 / sqrt( || K || ).
Expand Down
3 changes: 3 additions & 0 deletions proximal/halide/subprojects/packagefiles/halide/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ halide_inc = include_directories('include')

if build_machine.system() == 'windows'
halide_library_path = meson.current_source_dir() / 'lib/Release'
# Halide.dll is in a different path, why?
halide_dll_path = meson.current_source_dir() / 'bin/Release'
else
halide_library_path = meson.current_source_dir() / 'lib'
endif

halide_lib = cc.find_library('Halide', dirs: halide_library_path)

halide_generator_dep = declare_dependency(
Expand Down

0 comments on commit 7e95166

Please sign in to comment.