[ssbuffer](fix) Remove fallback by name for certain kernels #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: LLVM Build | |
| on: | |
| push: | |
| paths: | |
| - cmake/llvm-hash.txt | |
| - third_party/ascend/patch/llvm_patch_*.patch | |
| - .github/workflows/llvm-build.yml | |
| - .github/workflows/build/almalinux.Dockerfile | |
| pull_request: | |
| paths: | |
| - cmake/llvm-hash.txt | |
| - third_party/ascend/patch/llvm_patch_*.patch | |
| - .github/workflows/llvm-build.yml | |
| - .github/workflows/build/almalinux.Dockerfile | |
| workflow_dispatch: | |
| concurrency: | |
| group: llvm-build-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| SCCACHE_DIR: ${{ github.workspace }}/sccache | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.config.runner }} | |
| runs-on: ${{ matrix.config.runs_on }} | |
| # Cann container provides buildx remote builder config for AlmaLinux. | |
| # Ubuntu native builds also work inside this container. | |
| container: | |
| image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:9.0.0-a3-ubuntu22.04-py3.12 | |
| timeout-minutes: 240 | |
| env: | |
| PIP_INDEX_URL: http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple | |
| PIP_TRUSTED_HOST: cache-service.nginx-pypi-cache.svc.cluster.local | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {runner: 'Ubuntu 22.04', runs_on: 'linux-amd64-cpu-4', target-os: 'ubuntu', arch: 'x64'} | |
| - {runner: 'Ubuntu 22.04 ARM64', runs_on: 'linux-aarch64-cpu-4', target-os: 'ubuntu', arch: 'arm64'} | |
| - {runner: 'AlmaLinux 8', runs_on: 'linux-amd64-cpu-4', target-os: 'almalinux', arch: 'x64'} | |
| - {runner: 'AlmaLinux 8 ARM64', runs_on: 'linux-aarch64-cpu-4', target-os: 'almalinux', arch: 'arm64'} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v5 | |
| - name: Config mirrors & install build tools | |
| if: matrix.config.target-os == 'ubuntu' | |
| shell: bash | |
| run: | | |
| sed -i 's|http://archive.ubuntu.com|http://cache-service.nginx-pypi-cache.svc.cluster.local:8081|g' /etc/apt/sources.list 2>/dev/null || true | |
| sed -i 's|http://ports.ubuntu.com|http://cache-service.nginx-pypi-cache.svc.cluster.local:8081|g' /etc/apt/sources.list 2>/dev/null || true | |
| sed -i 's|http://security.ubuntu.com|http://cache-service.nginx-pypi-cache.svc.cluster.local:8081|g' /etc/apt/sources.list 2>/dev/null || true | |
| apt-get update | |
| apt-get install -y --no-install-recommends clang lld | |
| - name: Fetch LLVM Commit Hash | |
| shell: bash | |
| run: | | |
| LLVM_COMMIT_HASH="$(cat cmake/llvm-hash.txt)" | |
| echo "Found LLVM commit hash: ${LLVM_COMMIT_HASH}" | |
| echo "llvm_commit_hash=${LLVM_COMMIT_HASH}" >> ${GITHUB_ENV} | |
| SHORT_LLVM_COMMIT_HASH="${LLVM_COMMIT_HASH:0:8}" | |
| echo "Short LLVM commit hash: ${SHORT_LLVM_COMMIT_HASH}" | |
| echo "short_llvm_commit_hash=${SHORT_LLVM_COMMIT_HASH}" >> ${GITHUB_ENV} | |
| - name: Compute Patch Hash | |
| shell: bash | |
| run: | | |
| PATCH_DIR="third_party/ascend/patch" | |
| if [ -d "${PATCH_DIR}" ] && find "${PATCH_DIR}" -maxdepth 1 -type f -name 'llvm_patch_*.patch' -print -quit | grep -q .; then | |
| PATCH_HASH=$( | |
| LC_ALL=C find "${PATCH_DIR}" -maxdepth 1 -type f -name 'llvm_patch_*.patch' -print0 \ | |
| | sort -z \ | |
| | xargs -0 cat \ | |
| | sha256sum \ | |
| | cut -d' ' -f1 \ | |
| | cut -c1-8 | |
| ) | |
| else | |
| PATCH_HASH="00000000" | |
| fi | |
| echo "Patch hash: ${PATCH_HASH}" | |
| echo "patch_hash=${PATCH_HASH}" >> ${GITHUB_ENV} | |
| INSTALL_DIR="llvm-${{ env.short_llvm_commit_hash }}-${PATCH_HASH}-${{ matrix.config.target-os }}-${{ matrix.config.arch }}" | |
| echo "LLVM installation directory name: ${INSTALL_DIR}" | |
| echo "llvm_install_dir=${INSTALL_DIR}" >> ${GITHUB_ENV} | |
| - name: Checkout LLVM | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: llvm/llvm-project | |
| path: llvm-project | |
| ref: ${{ env.llvm_commit_hash }} | |
| - name: Apply LLVM patches | |
| shell: bash | |
| run: | | |
| LLVM_SHORT="${{ env.short_llvm_commit_hash }}" | |
| PATCH_DIR="third_party/ascend/patch" | |
| if [ -d "${PATCH_DIR}" ]; then | |
| cd llvm-project | |
| for patchfile in ${GITHUB_WORKSPACE}/${PATCH_DIR}/llvm_patch_*.patch; do | |
| if [ -f "$patchfile" ]; then | |
| echo "Applying $patchfile..." | |
| git apply "$patchfile" | |
| fi | |
| done | |
| cd .. | |
| fi | |
| - name: Set up Python | |
| shell: bash | |
| run: | | |
| if command -v python3 2>/dev/null; then | |
| python3 --version | |
| elif command -v apt-get 2>/dev/null; then | |
| apt-get update && apt-get install -y python3 python3-pip | |
| python3 --version | |
| else | |
| echo "ERROR: cannot find or install python3" | |
| exit 1 | |
| fi | |
| - name: Install Prerequisites | |
| shell: bash | |
| run: | | |
| python3 -m pip install cmake ninja sccache | |
| mkdir -p ${{ env.SCCACHE_DIR }} | |
| rm -rf ${{ env.SCCACHE_DIR }}/* | |
| - name: Install lld (Ubuntu) | |
| # Linking mlir-opt with GNU ld needs 6-10GB and gets OOM-killed on the | |
| # 4-CPU pods. lld uses far less memory and is required by | |
| # -DCMAKE_LINKER=lld in the configure step below. | |
| if: matrix.config.target-os == 'ubuntu' | |
| shell: bash | |
| run: | | |
| apt-get install -y lld-15 | |
| update-alternatives --install /usr/bin/lld lld /usr/bin/lld-15 100 | |
| - name: Enable Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.SCCACHE_DIR }} | |
| key: ${{ matrix.config.target-os }}-${{ matrix.config.arch }}-${{ env.short_llvm_commit_hash }}-${{ env.patch_hash }} | |
| restore-keys: ${{ matrix.config.target-os }}-${{ matrix.config.arch }}- | |
| - name: Configure, Build, and Install LLVM (Ubuntu) | |
| if: matrix.config.target-os == 'ubuntu' | |
| shell: bash | |
| env: | |
| LLVM_INSTALL_DIR: ${{ env.llvm_install_dir }} | |
| 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 -DCMAKE_CXX_COMPILER=clang++ | |
| -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache | |
| -DCMAKE_INSTALL_PREFIX="${LLVM_INSTALL_DIR}" | |
| -DCMAKE_LINKER=lld | |
| -DLLVM_BUILD_UTILS=ON | |
| -DLLVM_BUILD_TOOLS=ON | |
| -DLLVM_ENABLE_ASSERTIONS=ON | |
| -DMLIR_ENABLE_BINDINGS_PYTHON=OFF | |
| -DLLVM_ENABLE_PROJECTS="mlir;lld" | |
| -DLLVM_INSTALL_UTILS=ON | |
| -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" | |
| -DLLVM_ENABLE_TERMINFO=OFF | |
| -DLLVM_ENABLE_ZSTD=OFF | |
| -DLLVM_PARALLEL_LINK_JOBS=1 | |
| llvm-project/llvm | |
| ninja -C llvm-project/build install | |
| tar czf "${LLVM_INSTALL_DIR}.tar.gz" "${LLVM_INSTALL_DIR}" | |
| - name: Ensure sccache dir exists | |
| if: matrix.config.target-os == 'almalinux' | |
| env: | |
| SCCACHE_DIR_PATH: ${{ env.SCCACHE_DIR }} | |
| run: | | |
| mkdir -p "${SCCACHE_DIR_PATH}" | |
| touch "${SCCACHE_DIR_PATH}/.gitkeep" | |
| - name: Build LLVM Image (AlmaLinux) | |
| if: matrix.config.target-os == 'almalinux' | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: .github/workflows/build/almalinux.Dockerfile | |
| build-args: | | |
| BASE_IMAGE=swr.cn-southwest-2.myhuaweicloud.com/modelfoundry/almalinux:8.10-20250411 | |
| llvm_dir=llvm-project | |
| target: output | |
| outputs: type=local,dest=. | |
| - name: Extract LLVM Artifacts (AlmaLinux) | |
| if: matrix.config.target-os == 'almalinux' | |
| shell: bash | |
| env: | |
| SCCACHE_DIR_PATH: ${{ env.SCCACHE_DIR }} | |
| LLVM_INSTALL_DIR: ${{ env.llvm_install_dir }} | |
| run: | | |
| rm -rf "${SCCACHE_DIR_PATH}" "${LLVM_INSTALL_DIR}" | |
| tar xzf llvm.tar.gz | |
| mv install "${LLVM_INSTALL_DIR}" | |
| tar czf "${LLVM_INSTALL_DIR}.tar.gz" "${LLVM_INSTALL_DIR}" | |
| tar xzf sccache.tar.gz | |
| rm -f llvm.tar.gz sccache.tar.gz | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: llvm-${{ matrix.config.target-os }}-${{ matrix.config.arch }} | |
| path: | | |
| ${{ github.workspace }}/llvm-*-${{ matrix.config.target-os }}-${{ matrix.config.arch }}.tar.gz | |
| - name: Setup obsutil and upload to OBS | |
| if: github.event_name == 'push' && github.repository == 'triton-lang/triton-ascend' | |
| shell: bash | |
| env: | |
| AK: ${{ secrets.OBS_AK }} | |
| SK: ${{ secrets.OBS_SK }} | |
| ARCH: ${{ matrix.config.arch == 'x64' && 'amd64' || 'arm64' }} | |
| run: | | |
| set -eu | |
| if [ -z "${AK}" ] || [ -z "${SK}" ]; then | |
| echo "OBS credentials are empty." | |
| exit 1 | |
| fi | |
| curl -fL "https://obs-community.obs.cn-north-1.myhuaweicloud.com/obsutil/current/obsutil_linux_${ARCH}.tar.gz" -o obsutil.tar.gz | |
| gzip -t obsutil.tar.gz || { echo "obsutil.tar.gz is not a valid gzip"; exit 1; } | |
| tar xzf obsutil.tar.gz | |
| rm -f obsutil.tar.gz | |
| mv obsutil_linux_* obsutil | |
| obsutil/obsutil config -i="${AK}" -k="${SK}" -e=https://obs.cn-southwest-2.myhuaweicloud.com | |
| obsutil/obsutil cp -u "${{ env.llvm_install_dir }}.tar.gz" obs://triton-ascend-artifacts/llvm-builds/ | |
| - name: Dump Sccache Statistics | |
| run: sccache --show-stats |