diff --git a/.github/workflows/buildAndTestCMake.yml b/.github/workflows/buildAndTestCMake.yml index 2cdb0725c40..77c9b6fd894 100644 --- a/.github/workflows/buildAndTestCMake.yml +++ b/.github/workflows/buildAndTestCMake.yml @@ -37,11 +37,6 @@ jobs: # Only run scheduled CI on main repo if: (github.repository == 'openxla/stablehlo' || github.event_name != 'schedule') name: "cmake-build ${{ github.event_name == 'schedule' && '(llvm-project@HEAD)' || ''}}" - env: - LLVM_PROJECT_DIR: "llvm-project" - LLVM_BUILD_DIR: "llvm-build" - STABLEHLO_BUILD_DIR: "stablehlo-build" - STABLEHLO_PYTHON_BUILD_DIR: "stablehlo-python-build" strategy: fail-fast: false runs-on: ${{ github.repository == 'openxla/stablehlo' && 'ubuntu-22.04-64core' || 'ubuntu-22.04' }} @@ -66,14 +61,6 @@ jobs: with: llvm-version: ${{ steps.llvm-version.outputs.version }} - - name: Configure and Build LLVM - shell: bash - run: | - ./build_tools/github_actions/ci_build_cmake_llvm.sh "$LLVM_PROJECT_DIR" "$LLVM_BUILD_DIR" - env: - CMAKE_BUILD_TYPE: Release - MLIR_ENABLE_BINDINGS_PYTHON: ON - - name: Fix kernel mmap rnd bits # Asan in llvm 14 provided in ubuntu 22.04 is incompatible with # high-entropy ASLR in much newer kernels that GitHub runners are @@ -84,16 +71,9 @@ jobs: - name: Build and Test StableHLO (with AddressSanitizer) shell: bash run: | - ./build_tools/github_actions/ci_build_cmake.sh "$LLVM_BUILD_DIR" "$STABLEHLO_BUILD_DIR" - env: - CMAKE_BUILD_TYPE: Release - STABLEHLO_ENABLE_BINDINGS_PYTHON: OFF - STABLEHLO_ENABLE_SANITIZER: address + cmake --build --preset debug --target check-stablehlo-ci - name: Build and Test StableHLO (with Python bindings) shell: bash run: | - ./build_tools/github_actions/ci_build_cmake.sh "$LLVM_BUILD_DIR" "$STABLEHLO_BUILD_DIR" - env: - CMAKE_BUILD_TYPE: Release - STABLEHLO_ENABLE_BINDINGS_PYTHON: ON + cmake --build --preset debug-python --target check-stablehlo-ci diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d659c670bd..6fa0c198b77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ elseif(NOT STABLEHLO_BUILD_EMBEDDED) set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/llvm-project/bin) set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/llvm-project/lib) set(LLVM_TOOLS_BINARY_DIR ${CMAKE_BINARY_DIR}/llvm-project/bin) - + list(APPEND CMAKE_MESSAGE_INDENT " ") set(_BUNDLED_LLVM_CMAKE_SOURCE_SUBDIR "llvm-project/llvm") add_subdirectory("${_BUNDLED_LLVM_CMAKE_SOURCE_SUBDIR}" "llvm-project" EXCLUDE_FROM_ALL) diff --git a/build_tools/github_actions/ci_build_cmake.sh b/build_tools/github_actions/ci_build_cmake.sh deleted file mode 100755 index 25a6536fa1f..00000000000 --- a/build_tools/github_actions/ci_build_cmake.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# Copyright 2020 The TensorFlow Authors. All Rights Reserved. -# Copyright 2022 The StableHLO Authors. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is similar to build_mlir.sh, but passes different flags for -# caching in GitHub Actions. - -# This file gets called on build directory where resources are placed -# during `ci_configure`, and builds stablehlo in the directory specified -# by the second argument. - -set -o errexit -set -o nounset -set -o pipefail - -if [[ $# -ne 2 ]] ; then - echo "Usage: $0 " - exit 1 -fi - -LLVM_BUILD_DIR="$1" -STABLEHLO_BUILD_DIR="$2" -CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-RelWithDebInfo}" - -# Turn on building Python bindings -STABLEHLO_ENABLE_BINDINGS_PYTHON="${STABLEHLO_ENABLE_BINDINGS_PYTHON:-OFF}" -# Turn on building Sanitizers -# Note: This is not congruent with building python bindings -STABLEHLO_ENABLE_SANITIZER="${STABLEHLO_ENABLE_SANITIZER:-OFF}" - -# Configure StableHLO -# CMAKE_PLATFORM_NO_VERSIONED_SONAME Disables generation of "version soname" -# (i.e. libFoo.so.), which causes pure -# duplication of various shlibs for Python wheels. -cmake -GNinja \ - -B"$STABLEHLO_BUILD_DIR" \ - -DLLVM_ENABLE_LLD=ON \ - -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \ - -DLLVM_ENABLE_ASSERTIONS=ON \ - -DMLIR_DIR="$LLVM_BUILD_DIR/lib/cmake/mlir" \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DSTABLEHLO_ENABLE_STRICT_BUILD=ON \ - -DCMAKE_PLATFORM_NO_VERSIONED_SONAME:BOOL=ON \ - -DSTABLEHLO_ENABLE_SANITIZER="$STABLEHLO_ENABLE_SANITIZER" \ - -DSTABLEHLO_ENABLE_BINDINGS_PYTHON="$STABLEHLO_ENABLE_BINDINGS_PYTHON" - -# Build and Test StableHLO -cd "$STABLEHLO_BUILD_DIR" || exit -ninja check-stablehlo-ci diff --git a/build_tools/github_actions/ci_build_cmake_llvm.sh b/build_tools/github_actions/ci_build_cmake_llvm.sh deleted file mode 100755 index 5bfe5c33928..00000000000 --- a/build_tools/github_actions/ci_build_cmake_llvm.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# Copyright 2020 The TensorFlow Authors. All Rights Reserved. -# Copyright 2022 The StableHLO Authors. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This file is similar to build_mlir.sh, but passes different flags for -# caching in GitHub Actions to improve build speeds. - -set -o errexit -set -o nounset -set -o pipefail - -if [[ $# -ne 2 ]] ; then - echo "Usage: $0 " - exit 1 -fi - -# LLVM source -LLVM_SRC_DIR="$1" -LLVM_BUILD_DIR="$2" - -CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-RelWithDebInfo}" -# Turn on building Python bindings -MLIR_ENABLE_BINDINGS_PYTHON="${MLIR_ENABLE_BINDINGS_PYTHON:-OFF}" - -# Configure LLVM -# LLVM_VERSION_SUFFIX to get rid of that annoying af git on the end of .17git -# CMAKE_PLATFORM_NO_VERSIONED_SONAME Disables generation of "version soname" -# (i.e. libFoo.so.), which causes pure -# duplication of various shlibs for Python wheels. -cmake -GNinja \ - "-H$LLVM_SRC_DIR/llvm" \ - "-B$LLVM_BUILD_DIR" \ - -DLLVM_INSTALL_UTILS=ON \ - -DLLVM_ENABLE_LLD=ON \ - -DLLVM_ENABLE_PROJECTS=mlir \ - -DLLVM_TARGETS_TO_BUILD=host \ - -DLLVM_INCLUDE_TOOLS=ON \ - -DMLIR_ENABLE_BINDINGS_PYTHON="${MLIR_ENABLE_BINDINGS_PYTHON}" \ - -DLLVM_ENABLE_BINDINGS=OFF \ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_INCLUDE_TESTS=OFF \ - -DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \ - -DLLVM_ENABLE_ASSERTIONS=On \ - -DLLVM_VERSION_SUFFIX="" \ - -DCMAKE_PLATFORM_NO_VERSIONED_SONAME:BOOL=ON \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -# Build LLVM/MLIR -cmake --build "$LLVM_BUILD_DIR" --target all