From 1271783c504ccda7b1bc2a20b52ceda8228b3a38 Mon Sep 17 00:00:00 2001 From: Pablo Zimmermann Date: Thu, 19 Sep 2024 11:57:56 +0200 Subject: [PATCH 1/2] Use clang-12 to fix issue with LLVM_ABI_BREAKING_CHECKS This commit is fixing the root cause of the issue that appeared during an llvm update, and was raised in https://github.com/triton-lang/triton/pull/4212#issuecomment-2234035360. The issue was temporary fixed in https://github.com/triton-lang/triton/pull/4512, where we set LLVM_ABI_BREAKING_CHECKS to FORCE_OFF constant in order to not use a non-deterministic seed inside the hashing function (included in this llvm commit: https://github.com/llvm/llvm-project/commit/ce80c80dca45c7b4636a3e143973e2c6cbdb2884). A further investigation (with chsigg@) found that the issue is that LLVM is built with clang11, while Triton use a newer version. The ABI issue is brought up here: https://github.com/llvm/llvm-project/pull/96282#discussion_r1657919892, but the consensus seemed to be that this setup is rare. Updated the clang version to 12 in the ubuntu build fixed the issue and therefore we can revert setting LLVM_ABI_BREAKING_CHECKS constant. I am additionaly erasing LLVM_ABI_BREAKING_CHECKS in the setup of the other hardwares (it seems it was not needed) and I am splitting ubuntu and macOS configurations because it seems cleaner than having a variable that sets the compiler version for each of them. --- .github/workflows/llvm-build.yml | 34 +++++++++++++++---- .../workflows/llvm-build/almalinux.Dockerfile | 1 - cmake/llvm-hash.txt | 2 +- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/llvm-build.yml b/.github/workflows/llvm-build.yml index 4e944acbeb4a..0362cc02a27b 100644 --- a/.github/workflows/llvm-build.yml +++ b/.github/workflows/llvm-build.yml @@ -88,8 +88,34 @@ jobs: key: ${{ matrix.config.target-os }}-${{ matrix.config.arch }}-${{ env.short_llvm_commit_hash }} restore-keys: ${{ matrix.config.target-os }}-${{ matrix.config.arch }}- - - name: Configure, Build, Test, and Install LLVM (Ubuntu and macOS x64) - if: matrix.config.arch == 'x64' && (matrix.config.target-os == 'ubuntu' || matrix.config.target-os == 'macos') + - name: Configure, Build, Test, and Install LLVM (Ubuntu) + if: matrix.config.arch == 'x64' && (matrix.config.target-os == 'ubuntu') + run: > + python3 -m pip install -r llvm-project/mlir/python/requirements.txt + + cmake -GNinja -Bllvm-project/build + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_C_COMPILER=clang-12 -DCMAKE_CXX_COMPILER=clang++-12 + -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + -DCMAKE_INSTALL_PREFIX="${{ env.llvm_install_dir }}" + -DCMAKE_LINKER=lld + -DLLVM_BUILD_UTILS=ON + -DLLVM_BUILD_TOOLS=ON + -DLLVM_ENABLE_ASSERTIONS=ON + -DMLIR_ENABLE_BINDINGS_PYTHON=ON + -DLLVM_ENABLE_PROJECTS=mlir + -DLLVM_INSTALL_UTILS=ON + -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" + -DLLVM_ENABLE_TERMINFO=OFF + llvm-project/llvm + + ninja -C llvm-project/build check-mlir install + + tar czf "${{ env.llvm_install_dir }}.tar.gz" "${{ env.llvm_install_dir }}" + + + - name: Configure, Build, Test, and Install LLVM (macOS x64) + if: matrix.config.arch == 'x64' && (matrix.config.target-os == 'macos') run: > python3 -m pip install -r llvm-project/mlir/python/requirements.txt @@ -107,7 +133,6 @@ jobs: -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" -DLLVM_ENABLE_TERMINFO=OFF - -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF llvm-project/llvm ninja -C llvm-project/build check-mlir install @@ -131,7 +156,6 @@ jobs: -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" -DLLVM_ENABLE_TERMINFO=OFF - -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF llvm-project/llvm ninja -C llvm-project/build check-mlir install @@ -177,7 +201,6 @@ jobs: -DCMAKE_LINKER=$LINKER \ -DMLIR_ENABLE_BINDINGS_PYTHON=ON \ -DLLVM_ENABLE_ZSTD=OFF \ - -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF \ -DLLVM_INSTALL_UTILS=ON \ -DCMAKE_INSTALL_PREFIX="${{ env.llvm_install_dir }}" \ -DLLVM_TARGETS_TO_BUILD="AArch64;NVPTX;AMDGPU" \ @@ -228,7 +251,6 @@ jobs: -DLLVM_TARGETS_TO_BUILD="AArch64;NVPTX;AMDGPU" -DLLVM_USE_HOST_TOOLS=ON -DLLVM_ENABLE_TERMINFO=OFF - -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF llvm-project/llvm ninja -C llvm-project/build install diff --git a/.github/workflows/llvm-build/almalinux.Dockerfile b/.github/workflows/llvm-build/almalinux.Dockerfile index 6c351ba3e3b9..adf8b5cc6bd7 100644 --- a/.github/workflows/llvm-build/almalinux.Dockerfile +++ b/.github/workflows/llvm-build/almalinux.Dockerfile @@ -33,7 +33,6 @@ RUN cmake -GNinja -Bbuild \ -DLLVM_ENABLE_PROJECTS=mlir \ -DLLVM_ENABLE_TERMINFO=OFF \ -DLLVM_INSTALL_UTILS=ON \ - -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF \ -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" \ /source/llvm-project/llvm diff --git a/cmake/llvm-hash.txt b/cmake/llvm-hash.txt index aeb8c2b09e0e..f1bc5f807704 100644 --- a/cmake/llvm-hash.txt +++ b/cmake/llvm-hash.txt @@ -1 +1 @@ -36adf8ecedb64047021265a1e1730773d3b3a9e8 +c8fcfe1980999688f22a4ee53ec7c65c8c055752 From da738d4488b783a9ae73ebceab33caa62c47df70 Mon Sep 17 00:00:00 2001 From: Christian Sigg Date: Thu, 19 Sep 2024 12:04:06 +0200 Subject: [PATCH 2/2] Remove redundant parenthesis. --- .github/workflows/llvm-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/llvm-build.yml b/.github/workflows/llvm-build.yml index 0362cc02a27b..4c47277f46f0 100644 --- a/.github/workflows/llvm-build.yml +++ b/.github/workflows/llvm-build.yml @@ -89,7 +89,7 @@ jobs: restore-keys: ${{ matrix.config.target-os }}-${{ matrix.config.arch }}- - name: Configure, Build, Test, and Install LLVM (Ubuntu) - if: matrix.config.arch == 'x64' && (matrix.config.target-os == 'ubuntu') + if: matrix.config.arch == 'x64' && matrix.config.target-os == 'ubuntu' run: > python3 -m pip install -r llvm-project/mlir/python/requirements.txt @@ -115,7 +115,7 @@ jobs: - name: Configure, Build, Test, and Install LLVM (macOS x64) - if: matrix.config.arch == 'x64' && (matrix.config.target-os == 'macos') + if: matrix.config.arch == 'x64' && matrix.config.target-os == 'macos' run: > python3 -m pip install -r llvm-project/mlir/python/requirements.txt @@ -140,7 +140,7 @@ jobs: tar czf "${{ env.llvm_install_dir }}.tar.gz" "${{ env.llvm_install_dir }}" - name: Configure, Build, Test, and Install LLVM (Windows) - if: matrix.config.arch == 'x64' && (matrix.config.target-os == 'windows') + if: matrix.config.arch == 'x64' && matrix.config.target-os == 'windows' run: > python3 -m pip install -r llvm-project/mlir/python/requirements.txt