Skip to content

Test build sequence. #147

Test build sequence.

Test build sequence. #147

Workflow file for this run

name: Build
# Trigger the workflow on pull requests to main, ignoring documentation changes
on:
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
- "*.md"
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Set up Python environment
run: |
# Install Miniconda only if missing
if [ ! -d "/local/mnt/workspace/MLIR_build_artifacts/miniconda" ]; then
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p /local/mnt/workspace/MLIR_build_artifacts/miniconda
fi
# Activate conda
eval "$(/local/mnt/workspace/MLIR_build_artifacts/miniconda/bin/conda shell.bash hook)"
# Create or reuse environment
conda create -y -n mlir-env python=3.10
conda activate mlir-env
# Install Python dependencies
python -m pip -V
python -m pip install --no-user -r ci/requirements.txt
# Install glibc-compatible libstdcxx
conda install -y -c conda-forge libstdcxx-ng=12
# Persist environment path
echo "CONDA_ENV=/local/mnt/workspace/MLIR_build_artifacts/miniconda/envs/mlir-env" >> $GITHUB_ENV
shell: bash
- name: Cache Dependencies
uses: actions/cache@v4
with:
path: |
/local/mnt/workspace/MLIR_build_artifacts/Hexagon_SDK/6.4.0.2
/local/mnt/workspace/MLIR_build_artifacts/Tools
/local/mnt/workspace/MLIR_build_artifacts/Hexagon_KL/1.0.0/hexkl_addon
key: hexagon-mlir-artifacts-${{ runner.os }}-v1
- name: Install Tools and Dependencies if needed
run: |
if [ ! -d "/local/mnt/workspace/MLIR_build_artifacts/Hexagon_SDK/6.4.0.2" ] || [ ! -d "/local/mnt/workspace/MLIR_build_artifacts/Tools" ]; then
echo "Hexagon SDK or Tools not found in cache. Installing..."
chmod +x ./ci/setup_tools.sh
./ci/setup_tools.sh
else
echo "Hexagon SDK and Tools found in cache. Skipping installation."
fi
export HEXAGON_SDK_ROOT="/local/mnt/workspace/MLIR_build_artifacts/Hexagon_SDK/6.4.0.2"
export HEXAGON_TOOLS="/local/mnt/workspace/MLIR_build_artifacts/Tools"
export HEXKL_ROOT="/local/mnt/workspace/MLIR_build_artifacts/Hexagon_KL/1.0.0/hexkl_addon"
# Persist environment variables for future steps
echo "HEXAGON_SDK_ROOT=$HEXAGON_SDK_ROOT" >> $GITHUB_ENV
echo "HEXAGON_TOOLS=$HEXAGON_TOOLS" >> $GITHUB_ENV
echo "HEXKL_ROOT=$HEXKL_ROOT" >> $GITHUB_ENV
shell: bash
- name: Setup Submodules
run: |
chmod +x ./ci/setup_submodules.sh
./ci/setup_submodules.sh
shell: bash
# Read expected LLVM hash from the triton submodule
- name: Get Expected LLVM Hash
id: llvmhash
run: |
HASH=$(cat triton/cmake/llvm-hash.txt | tr -d '[:space:]')
echo "hash=$HASH" >> $GITHUB_OUTPUT
# Run setup script for LLVM
- name: Setup LLVM for Triton
run: |
chmod +x ./ci/setup_llvm.sh
./ci/setup_llvm.sh
export LLVM_PROJECT_BUILD_DIR="/local/mnt/workspace/MLIR_build_artifacts/llvm_triton/build/"
export HOST_TOOLCHAIN="/local/mnt/workspace/MLIR_build_artifacts/host_toolchain/"
echo "LLVM_PROJECT_BUILD_DIR=$LLVM_PROJECT_BUILD_DIR" >> $GITHUB_ENV
echo "HOST_TOOLCHAIN=$HOST_TOOLCHAIN" >> $GITHUB_ENV
shell: bash
- name: Build Triton
run: |
chmod +x ./ci/build_triton.sh
./ci/build_triton.sh
shell: bash
- name: Verify Environment Variables
run: |
echo "Using HEXAGON_SDK_ROOT=$HEXAGON_SDK_ROOT"
echo "Using HEXAGON_TOOLS=$HEXAGON_TOOLS"
echo "Using HEXKL_ROOT=$HEXKL_ROOT"
echo "Using LLVM_PROJECT_BUILD_DIR=$LLVM_PROJECT_BUILD_DIR"
shell: bash
- name: lit test - triton
env:
MINICONDA_ROOT: /local/mnt/workspace/MLIR_build_artifacts/miniconda
CONDA_ENV_PATH: /local/mnt/workspace/MLIR_build_artifacts/miniconda/envs/mlir-env
TRITON_BUILD_DIR: triton/build/cmake.linux-x86_64-cpython-3.10
GRAALPY_BIN: /local/mnt/workspace/MLIR_build_artifacts/miniconda/envs/mlir-env/lib/jvm/languages/python/bin
PYTHONNOUSERSITE: "1"
run: |
set -ex
pwd
source "$MINICONDA_ROOT/etc/profile.d/conda.sh"
conda activate "$CONDA_ENV_PATH"
cd "$TRITON_BUILD_DIR"
# Install lit into the active environment so it can be found consistently
python -m pip install --no-user --ignore-installed --force-reinstall lit
export PATH="$GRAALPY_BIN:$PATH"
lit test
shell: bash
- name: lit test - hexagon-mlir/qcom_hexagon_backend
env:
MINICONDA_ROOT: /local/mnt/workspace/MLIR_build_artifacts/miniconda
CONDA_ENV_PATH: /local/mnt/workspace/MLIR_build_artifacts/miniconda/envs/mlir-env
BACKEND_BUILD_DIR: triton/build/cmake.linux-x86_64-cpython-3.10/third_party/qcom_hexagon_backend
HEXAGON_ARCH_VERSION: "75"
GRAALPY_BIN: /local/mnt/workspace/MLIR_build_artifacts/miniconda/envs/mlir-env/lib/jvm/languages/python/bin
run: |
set -ex
pwd
source "$MINICONDA_ROOT/etc/profile.d/conda.sh"
conda activate "$CONDA_ENV_PATH"
export PATH="$GRAALPY_BIN:$PATH"
cd "$BACKEND_BUILD_DIR"
lit test --verbose
shell: bash