Skip to content

Generated Backend

Generated Backend #1

name: AMD Fork Tests
on:
workflow_dispatch:
pull_request:
branches:
- main
- triton-mlir
concurrency:
group: "fork_${{ github.ref }}"
cancel-in-progress: true
jobs:
Runner-Preparation:
runs-on: ubuntu-latest
outputs:
matrix-required: ${{ steps.set-matrix.outputs.matrix-required }}
steps:
- name: Prepare runner matrix
id: set-matrix
run: |
if [ x"${{ github.repository }}" == x"ROCmSoftwarePlatform/triton" ]; then
echo '::set-output name=matrix-required::[["self-hosted", "rocm"]]'
else
echo '::set-output name=matrix-required::["ubuntu-latest"]'
fi
Fork-Tests:
needs: Runner-Preparation
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ${{fromJson(needs.Runner-Preparation.outputs.matrix-required)}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear cache
run: |
rm -rf ~/.triton
- name: Update PATH
run: |
echo "PATH=${HOME}/.local/bin:${PATH}" >> "${GITHUB_ENV}"
- name: Prerequisite
run: |
apt update
apt install -y libpython3-dev python3-pip git wget
# get rocm related utilities
wget https://repo.radeon.com/amdgpu-install/5.5/ubuntu/jammy/amdgpu-install_5.5.50500-1_all.deb
apt-get install -y ./amdgpu-install_5.5.50500-1_all.deb
amdgpu-install -y --usecase=rocm --no-dkms
# remove unused packages to free some disk space
cp /opt/rocm/llvm/bin/ld.lld .
apt purge -y rocblas rocm-llvm
mkdir -p /opt/rocm/llvm/bin
mv ld.lld /opt/rocm/llvm/bin/ld.lld
# install pytorch
pip3 install torch==2.0.1 --index-url https://download.pytorch.org/whl/rocm5.4.2
# uninstall system triton to eliminate conflicts with testing version
pip3 uninstall -y pytorch-triton-rocm
- name: Install Triton
run: |
cd python
pip3 install ninja
# Install in system, because need to override system triton. Otherwise lit tests will use wrong version
DEBUG=TRUE TRITON_USE_ROCM=TRUE TRITON_USE_ASSERT_ENABLED_LLVM=TRUE python3 -m pip install --no-build-isolation -vvv -e .
- name: Run Unit Tests
run: |
pytest -n 32 --capture=tee-sys -rfs --verbose "python/test/unit/language/test_core_amd.py"
- name: Run lit tests
run: |
python3 -m pip install lit
cd python
LIT_TEST_DIR="build/$(ls build | grep -i cmake)/test"
if [ ! -d "${LIT_TEST_DIR}" ]; then
echo "Could not find '${LIT_TEST_DIR}'" ; exit -1
fi
lit -v "${LIT_TEST_DIR}"
- name: Run CXX unittests
run: |
cd python
cd "build/$(ls build | grep -i cmake)"
ctest