Skip to content

Commit

Permalink
CI: Bump LDC-LLVM to v18.1.3 (except for Android and macOS arm64) (#4604
Browse files Browse the repository at this point in the history
)

I've removed our own TLS emulation for Android, and switched to the
latest NDK (r26d). Switching to native TLS supported since Android
10/11 requires a few compiler and druntime changes; I'll follow up.

The macOS arm64 LLVM binaries were built natively on macOS 14 arm64,
with Xcode v15.3. Experiments with a native LDC build on such a macOS
14 arm64 CI runner show random 'Pure virtual function called' errors
for the compiler itself (compiled with itself). Not sure whether
these are regressions (with a failure rate of maybe very roughly
1:1000), or happening with the current cross-compiled macOS arm64
binaries too - opting for the safe variant of keeping LLVM 17 for
the macOS arm64 job.
  • Loading branch information
kinke committed Apr 13, 2024
1 parent bc00d4b commit d2498cc
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 30 deletions.
6 changes: 4 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ install_ubuntu_prerequisites_template: &INSTALL_UBUNTU_PREREQUISITES_TEMPLATE
environment:
CIRRUS_CLONE_DEPTH: 50
HOST_LDC_VERSION: 1.31.0
LLVM_VERSION: 17.0.6
LLVM_VERSION: 18.1.3
GITHUB_TOKEN: ENCRYPTED[0955bd48c8d4e5391446fc0149d0719ad0b63df27ec9e6c180a5730a5b10dc7f28f09d1383423db158d21380ee2b022a]

task:
Expand Down Expand Up @@ -248,7 +248,7 @@ task:
environment:
CI_ARCH: aarch64
CI_OS: linux
EXTRA_APT_PACKAGES: libxml2-dev p7zip-full
EXTRA_APT_PACKAGES: libxml2-dev libzstd-dev p7zip-full
EXTRA_CMAKE_FLAGS: >-
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
Expand Down Expand Up @@ -282,6 +282,8 @@ task:
# Make lld the default linker (likely with enabled assertions unfortunately)
ln -sf "$PWD/llvm/bin/ld.lld" /usr/bin/ld
ld --version
# Make sure to link libzstd statically
rm /usr/lib/aarch64-linux-gnu/libzstd.so
# Download & extract clang
download_prebuilt_clang_script: |
cd $CIRRUS_WORKING_DIR/..
Expand Down
4 changes: 3 additions & 1 deletion .github/actions/1-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ runs:
# Don't use latest gdb v10+ from Ubuntu toolchain PPA with regressions, use official v9
sudo apt-get -yq install \
git-core cmake g++-multilib \
libcurl4 libcurl4:i386 \
libcurl4 libcurl4:i386 libzstd-dev \
curl gdb=9.1-0ubuntu1 p7zip-full tzdata unzip zip python3-pip
# Make sure to link libzstd statically
sudo rm /usr/lib/x86_64-linux-gnu/libzstd.so
- name: 'Linux: Download & extract clang' # into ../clang
if: runner.os == 'Linux'
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:

env:
CLANG_VERSION: 15.0.6
LLVM_VERSION: 17.0.6
LLVM_VERSION: 18.1.3

jobs:
build-native:
Expand All @@ -37,7 +37,7 @@ jobs:
with_pgo: true

- job_name: macOS x86_64
os: macos-11
os: macos-12
arch: x86_64
bootstrap_cmake_flags: >-
-DBUILD_LTO_LIBS=ON
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Install prerequisites
uses: ./.github/actions/1-setup
with:
clang_version: ${{ runner.os == 'Windows' && '16.0.6' || env.CLANG_VERSION }}
clang_version: ${{ runner.os == 'Windows' && '18.1.3' || env.CLANG_VERSION }}
llvm_version: ${{ env.LLVM_VERSION }}
arch: ${{ matrix.arch }}
- name: Build bootstrap LDC
Expand Down Expand Up @@ -192,6 +192,7 @@ jobs:
timeout-minutes: 60
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
LLVM_VERSION: 17.0.6 # TODO
steps:
- uses: actions/checkout@v4
with:
Expand Down
42 changes: 20 additions & 22 deletions .github/workflows/supported_llvm_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
- job_name: Ubuntu 20.04, LDC-LLVM 18, latest LDC beta
os: ubuntu-20.04
host_dc: ldc-beta
llvm_version: bfcdb95c # FIXME: no usable official package available yet
# FIXME: no usable official package available yet
llvm_version: https://github.com/ldc-developers/llvm-project/releases/download/ldc-v18.1.3/llvm-18.1.3-linux-x86_64.tar.xz
- job_name: macOS 14, LLVM 17, latest LDC beta
os: macos-14
host_dc: ldc-beta
Expand Down Expand Up @@ -81,13 +82,13 @@ jobs:
python3 -m pip install --user lit
fi
python3 -c "import lit.main; lit.main.main();" --version . | head -n 1
- name: 'Linux: Install gdb and llvm-symbolizer'
- name: 'Linux: Install gdb, llvm-symbolizer and libzstd'
if: runner.os == 'Linux'
run: |
set -eux
sudo apt-get update
# Don't use latest gdb v10+ from Ubuntu toolchain PPA with regressions, use official v9
sudo apt-get install gdb=9.1-0ubuntu1 llvm
sudo apt-get install gdb=9.1-0ubuntu1 llvm libzstd-dev
- name: Try to restore cached LLVM
uses: actions/cache@v3
Expand All @@ -102,29 +103,26 @@ jobs:
echo "Already cached"
exit 0
fi
version='${{ matrix.llvm_version }}'
if [[ '${{ runner.os }}' == macOS ]]; then
if [[ "$version" =~ ^1[6-9]\. ]]; then
suffix='arm64-apple-darwin22.0'
if [[ "$version" =~ ^https:// ]]; then
url="$version"
else
if [[ '${{ runner.os }}' == macOS ]]; then
if [[ "$version" =~ ^1[6-9]\. ]]; then
suffix='arm64-apple-darwin22.0'
else
suffix='x86_64-apple-darwin'
fi
elif [[ "$version" =~ ^1[7-9]\. ]]; then
suffix='x86_64-linux-gnu-ubuntu-22.04' # LLVM 17+
elif [[ "$version" =~ ^1[3-6]\. ]]; then
suffix='x86_64-linux-gnu-ubuntu-18.04' # LLVM 13.0.1+
else
suffix='x86_64-apple-darwin'
suffix='x86_64-linux-gnu-ubuntu-16.04'
fi
elif [[ "$version" =~ ^1[7-9]\. ]]; then
suffix='x86_64-linux-gnu-ubuntu-22.04' # LLVM 17+
elif [[ "$version" =~ ^1[3-6]\. ]]; then
suffix='x86_64-linux-gnu-ubuntu-18.04' # LLVM 13.0.1+
else
suffix='x86_64-linux-gnu-ubuntu-16.04'
fi
if [[ "$version" = *.* ]]; then
url="https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/clang+llvm-$version-$suffix.tar.xz"
else # short commit SHA of ldc-developers fork
if [[ '${{ runner.os }}' == Linux ]]; then
suffix='linux-x86_64'
elif [[ '${{ runner.os }}' == macOS ]]; then
suffix='osx-arm64'
fi
url="https://github.com/ldc-developers/llvm-project/releases/download/CI/llvm-$version-$suffix.tar.xz"
fi
curl -fL --retry 3 --max-time 300 -o llvm.tar.xz "$url"
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### Big news
- Frontend, druntime and Phobos are at version [2.108.0](https://dlang.org/changelog/2.108.0.html). (#4591, #4615)
- Preliminary support for LLVM 18. (#4599, #4605, #4607)
- Support for [LLVM 18](https://releases.llvm.org/18.1.0/docs/ReleaseNotes.html). The prebuilt packages use v18.1.3 (except for Android and macOS arm64). (#4599, #4605, #4607, #4604)

#### Platform support
- Supports LLVM 11 - 18.
Expand Down
8 changes: 7 additions & 1 deletion runtime/druntime/src/rt/msvc.d
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,15 @@ version (LDC)
// The MinGW-w64 libs don't provide _(_)chkstk; fall back to the
// implementation in LLVM's builtins compiler-rt lib.
version (X86_64)
{
mixin declareAlternateName!("__chkstk", "___chkstk_ms");
}
else
mixin declareAlternateName!("_chkstk", "__chkstk"); // `__chkstk_ms` isn't the MS-compatible one!
{
// `_chkstk` and `_alloca` are the same function (and `__chkstk_ms`
// isn't the MS-compatible one!); LLVM 18 dropped the `__chkstk` alias
mixin declareAlternateName!("_chkstk", "_alloca");
}
}
else // !LDC
{
Expand Down
3 changes: 3 additions & 0 deletions tests/codegen/dcompute_cl_addrspaces_new.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// See GH issue #2709

// FIXME: hits an assertion for LLVM 18: https://github.com/llvm/llvm-project/issues/87315
// UNSUPPORTED: atleast_llvm1800 && atmost_llvm1809

// REQUIRES: target_SPIRV && atleast_llvm1600
// RUN: %ldc -c -opaque-pointers -mdcompute-targets=ocl-220 -m64 -mdcompute-file-prefix=addrspace_new -output-ll -output-o %s && FileCheck %s --check-prefix=LL < addrspace_new_ocl220_64.ll \
// RUN: && %llc addrspace_new_ocl220_64.ll -mtriple=spirv64-unknown-unknown -O0 -o - | FileCheck %s --check-prefix=SPT
Expand Down
3 changes: 3 additions & 0 deletions tests/codegen/dcompute_cl_images.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// FIXME: hits an assertion with SPIRV-LLVM-Translator for LLVM 15, see https://github.com/ldc-developers/ldc/pull/4010#issuecomment-1191820165
// XFAIL: atleast_llvm1500 && atmost_llvm1509

// FIXME: another assertion for LLVM 18: https://github.com/llvm/llvm-project/issues/87315
// UNSUPPORTED: atleast_llvm1800 && atmost_llvm1809

// RUN: %ldc -c -mdcompute-targets=ocl-220 -m64 -I%S/inputs -mdcompute-file-prefix=%t -output-ll -output-o %s && FileCheck %s < %t_ocl220_64.ll
@compute(CompileFor.deviceOnly) module dcompute_cl_images;
import ldc.dcompute;
Expand Down

0 comments on commit d2498cc

Please sign in to comment.