Skip to content

Commit 0a4440a

Browse files
authored
Update CI toolchain; integrate LLVM at llvm/llvm-project@113f01aa82d0 (#2860)
- Integrate LLVM at llvm/llvm-project@113f01aa82d0 - Update `clang`, `clang++`, and `lld` from 14 to 20 - Clang 14 doesn't recognize the `-Wno-deprecated-literal-operator` flag, which is now set by a dependency's build config. - Update system C++ headers from `g++-12` to `libstdc++-13-dev` - The older `g++-12` system headers used language features that are now recognized as deprecated in Clang 20. - Update `python` from 3.10 to 3.11 - This now matches our minimum officially supported Python version. - Update `nanobind` from 2.4 to 2.9 - This now matches the version used by LLVM (which also happens to be the latest stable version).
1 parent 500b494 commit 0a4440a

21 files changed

+1165
-493
lines changed

.github/actions/setup-build/action.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@
1313
# limitations under the License.
1414

1515
# The setup-build action gets everything needed by buildAndTest into the workspace.
16-
name: "Setup build environment (ninja, ccache, llvm, lld)"
17-
description: "Setup build environment (ninja, ccache, llvm, lld)"
16+
name: "Setup build environment (ninja, ccache, llvm, clang, lld)"
17+
description: "Setup build environment (ninja, ccache, llvm, clang, lld)"
1818

1919
inputs:
2020
llvm-version:
2121
description: |
2222
LLVM version for checkout and build. Used for ccache value and checkout.
2323
required: true
24+
clang-version:
25+
description: |
26+
Clang and LLD version to use for compilation. Independent of LLVM version.
27+
required: false
28+
default: '20'
2429
python-version:
2530
description: |
26-
Python version to install
31+
Python version to install.
2732
required: false
28-
default: '3.10.6'
33+
default: '3.11.13'
2934
runs:
3035
# This is a composite action - has a list of steps to execute.
3136
using: "composite"
@@ -43,11 +48,30 @@ runs:
4348
- name: Install Ninja
4449
uses: llvm/actions/install-ninja@6a57890d0e3f9f35dfc72e7e48bc5e1e527cdd6c
4550

46-
# Get LLD - Improves build speed on Linux
47-
- name: Install LLD
51+
# Install up-to-date versions of Clang and LLD (plus a few related packages).
52+
# - Update Clang to support newer compiler features.
53+
# - Install LLD to improve build speed on Linux.
54+
- name: Install/update Clang and LLD
55+
shell: bash
56+
run: |
57+
wget https://apt.llvm.org/llvm.sh
58+
chmod +x llvm.sh
59+
sudo ./llvm.sh ${{ inputs.clang-version }}
60+
for program_name in "clang" "clang++" "lld"; do
61+
link_path="/usr/bin/$program_name"
62+
link_target="/usr/bin/$program_name-${{ inputs.clang-version }}"
63+
priority=200
64+
sudo update-alternatives --install \
65+
"$link_path" "$program_name" "$link_target" "$priority"
66+
done
67+
68+
# Update the system C++ headers.
69+
- name: Update system C++ headers
4870
shell: bash
4971
run: |
50-
sudo apt-get install -y lld
72+
sudo apt-add-repository ppa:ubuntu-toolchain-r/test
73+
sudo apt-get update
74+
sudo apt-get install libstdc++-13-dev
5175
5276
# Setup C++ caching using ccache.
5377
# Cache key is a combination of OS arch and LLVM version.
@@ -63,6 +87,7 @@ runs:
6387
with:
6488
python-version: ${{ inputs.python-version }}
6589
cache: 'pip' # caching pip dependencies
90+
6691
- name: Install MLIR python requirements
6792
shell: bash
6893
run: |

.github/workflows/buildAndTestCMake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
- name: Build and Test StableHLO (with Python bindings)
8989
shell: bash
9090
run: |
91-
pip install tensorflow-cpu nanobind==2.4
91+
pip install tensorflow-cpu nanobind==2.9
9292
pip install -r "$LLVM_PROJECT_DIR/mlir/python/requirements.txt"
9393
./build_tools/github_actions/ci_build_cmake.sh "$LLVM_BUILD_DIR" "$STABLEHLO_BUILD_DIR"
9494
env:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ bazel-out
33
bazel-stablehlo
44
bazel-testlogs
55
build
6+
cmake-build
67
llvm-project
78
llvm-build
89
.vscode

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,7 @@ cc_library(
12311231
strip_include_prefix = ".",
12321232
deps = [
12331233
":base",
1234+
":chlo_ops",
12341235
":stablehlo_aggressive_simplification_inc_gen",
12351236
":stablehlo_ops",
12361237
":stablehlo_pass_inc_gen",

MODULE.bazel

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ bazel_dep(name = "bazel_skylib", version = "1.3.0")
2424
bazel_dep(name = "rules_python", version = "0.30.0")
2525

2626
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
27-
28-
# There is a problem at the moment running lit using Python 3.11
29-
# Our CI system enforces Python 3.10 to get around it but we should set the toolchain
30-
# in Bazel itself to avoid this problem.
31-
# https://github.com/llvm/llvm-project/issues/75963
3227
python.toolchain(
3328
is_default = True,
34-
python_version = "3.10",
29+
python_version = "3.11",
3530
)

0 commit comments

Comments
 (0)