Skip to content

Commit

Permalink
Enable Python bindings builds/tests in 'runtime' CI builds. (iree-org…
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottTodd authored Jul 19, 2024
1 parent 3fca22a commit 8b44f61
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ jobs:
run: |
./build_tools/github_actions/docker_run.sh \
--env "BUILD_PRESET=test" \
--env "IREE_BUILD_SETUP_PYTHON_VENV=${BUILD_DIR}/.venv" \
${CONTAINER} \
./build_tools/cmake/build_runtime.sh \
"${BUILD_DIR}"
Expand Down
14 changes: 10 additions & 4 deletions build_tools/cmake/build_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ set -xeuo pipefail

BUILD_DIR="${1:-${IREE_TARGET_BUILD_DIR:-build-runtime}}"
BUILD_PRESET="${BUILD_PRESET:-test}"
CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-RelWithDebInfo}"
IREE_BUILD_PYTHON_BINDINGS="${IREE_BUILD_PYTHON_BINDINGS:-ON}"

source build_tools/cmake/setup_build.sh
# Note: not using ccache since the runtime build should be fast already.
Expand All @@ -25,12 +27,16 @@ declare -a args
args=(
"-G" "Ninja"
"-B" "${BUILD_DIR}"
"-DPython3_EXECUTABLE=${IREE_PYTHON3_EXECUTABLE}"
"-DPYTHON_EXECUTABLE=${IREE_PYTHON3_EXECUTABLE}"
"-DCMAKE_BUILD_TYPE=RelWithDebInfo"

"-DIREE_BUILD_COMPILER=OFF"
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"

"-DIREE_RUNTIME_OPTIMIZATION_PROFILE=lto"
"-DIREE_FORCE_LTO_COMPAT_BINUTILS_ON_LINUX=ON"
"-DIREE_BUILD_COMPILER=OFF"

"-DIREE_BUILD_PYTHON_BINDINGS=${IREE_BUILD_PYTHON_BINDINGS}"
"-DPython3_EXECUTABLE=${IREE_PYTHON3_EXECUTABLE}"
"-DPYTHON_EXECUTABLE=${IREE_PYTHON3_EXECUTABLE}"
)

case "${BUILD_PRESET}" in
Expand Down
14 changes: 7 additions & 7 deletions compiler/bindings/python/test/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
# These tests perform linking via the Compiler API, which is only supported
# in bundled-LLVM builds at the moment (#14086).
if(IREE_BUILD_BUNDLED_LLVM)
iree_py_test(
NAME
compiler_core_test
SRCS
"compiler_core_test.py"
)
endif() # IREE_BUILD_BUNDLED_LLVM
iree_py_test(
NAME
compiler_core_test
SRCS
"compiler_core_test.py"
)
endif()

if(IREE_INPUT_TORCH)
iree_py_test(
Expand Down
4 changes: 3 additions & 1 deletion runtime/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ iree_py_test(
"tests/system_setup_test.py"
)

# These tests use compiler APIs as well as runtime APIs.
#
# These tests perform linking via the Compiler API, which is only supported
# in bundled-LLVM builds at the moment (#14086).
if(IREE_BUILD_BUNDLED_LLVM)
if(IREE_BUILD_COMPILER AND IREE_BUILD_BUNDLED_LLVM)
iree_py_test(
NAME
benchmark_test
Expand Down
5 changes: 2 additions & 3 deletions samples/py_custom_module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ if(NOT IREE_BUILD_PYTHON_BINDINGS)
return()
endif()

# These tests perform linking via the Compiler API, which is only supported
# in bundled-LLVM builds at the moment (#14086).
if(NOT IREE_BUILD_BUNDLED_LLVM)
# These tests use compiler APIs as well as runtime APIs.
if(NOT IREE_BUILD_COMPILER)
return()
endif()

Expand Down
4 changes: 1 addition & 3 deletions tests/e2e/collectives/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# These tests perform linking via the Compiler API, which is only supported
# in bundled-LLVM builds at the moment (#14086).
if(NOT IREE_BUILD_BUNDLED_LLVM OR NOT IREE_ENABLE_COLLECTIVE_RUNTIME_TESTS)
if(NOT IREE_BUILD_COMPILER OR NOT IREE_ENABLE_COLLECTIVE_RUNTIME_TESTS)
return()
endif()

Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/stablehlo_models/mnist_train_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# These tests use compiler APIs as well as runtime APIs.
#
# These tests perform linking via the Compiler API, which is only supported
# in bundled-LLVM builds at the moment (#14086).
if(NOT IREE_BUILD_BUNDLED_LLVM)
if(NOT IREE_BUILD_COMPILER OR NOT IREE_BUILD_BUNDLED_LLVM)
return()
endif()

Expand Down

0 comments on commit 8b44f61

Please sign in to comment.