Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ubuntu

ubuntu #100

Workflow file for this run

name: Ubuntu Linux (ROCm, LLVM)
run-name: ubuntu
on:
push:
branches: [ main ]
paths-ignore:
- '*.md'
- 'docs/**'
pull_request:
branches: [ main ]
paths-ignore:
- '*.md'
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-llvm-install:
runs-on: ubuntu-latest
outputs:
needs-rebuild: ${{ steps.check.outputs.needs-rebuild }}
artifact-run-id: ${{ steps.get-run-id.outputs.result }}
steps:
- name: Clone Triton
timeout-minutes: 5
shell: bash
run: |
export TRITON_BUILD_WITH_CLANG_LLD=true &&
export TRITON_BUILD_WITH_CCACHE=true &&
git clone https://github.com/triton-lang/triton.git ~/triton
- name: Get latest artifact id
uses: actions/github-script@v7
id: get-run-id
continue-on-error: true
with:
result-encoding: string
script: |
const workflowRuns = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'ubuntu.yml',
per_page: 100 // Adjust as needed to check more runs
});
for (const run of workflowRuns.data.workflow_runs) {
const jobs = await github.rest.actions.listJobsForWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id
});
const artifactJob = jobs.data.jobs.find(job => job.name === 'trigger-llvm-build / build');
if (artifactJob && artifactJob.conclusion === 'success') {
return run.id;
}
}
throw new Error('No runs found with a successful artifact job');
- name: Download llvm hash
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: llvm-hash
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ steps.get-run-id.outputs.result }}
path: ~/
# NOTE: COMMENTING OUT FOR FIXED TRITON VERSION
# - name: Cross check lasest LLVM with artifact version
# id: check
# shell: bash
# run: |
# echo "llvm-hash-latest=$(cat ~/triton/cmake/llvm-hash.txt)" &&
# if [ ! -f ~/llvm-hash.txt ]; then
# echo "-1" > ~/llvm-hash.txt
# fi &&
# echo "llvm-hash-existing=$(cat ~/llvm-hash.txt)" &&
# if [ "$(cat ~/triton/cmake/llvm-hash.txt)" == "$(cat ~/llvm-hash.txt)" ]; then
# echo "needs-rebuild=false" >> "$GITHUB_OUTPUT"
# else
# echo "needs-rebuild=true" >> "$GITHUB_OUTPUT"
# fi
- name: Check for (expected) artifact
id: check
shell: bash
run: |
if [ -f ~/llvm-hash.txt ]; then
existing_hash=$(cat ~/llvm-hash.txt)
if [ "$existing_hash" != "7ba6768df8181bc270763333969d4a1d6cc2e160" ]; then
echo "needs-rebuild=true" >> "$GITHUB_OUTPUT"
else
echo "needs-rebuild=false" >> "$GITHUB_OUTPUT"
fi
else
echo "needs-rebuild=true" >> "$GITHUB_OUTPUT"
fi
echo "artifact-run-id=${{ steps.get-run-id.outputs.result }}"
trigger-llvm-build:
if: ${{ needs.check-llvm-install.outputs.needs-rebuild == 'true' }}
needs: check-llvm-install
uses: ./.github/workflows/build-triton-ubuntu.yml
build:
needs: [trigger-llvm-build, check-llvm-install]
if: ${{ always() && !failure() && !cancelled() }}
runs-on: [mi100]
strategy:
fail-fast: false
matrix:
rocm-version: [ '6.3', '6.4' ]
os-release: [ '22.04', '24.04' ]
llvm-install: [ '/opt/rocm/llvm', '$HOME/.triton/llvm/llvm-*' ]
compiler: ['clang']
build-type: ['Release']
container:
image: dgaliffiamd/rocprofiler-systems:ci-base-ubuntu-${{ matrix.os-release }}
options: >-
--device=/dev/kfd
--device=/dev/dri
--group-add video
name: ubuntu-${{ matrix.os-release }}-${{ matrix.llvm-install == '/opt/rocm/llvm' && 'rocm' || 'triton' }}-${{ matrix.rocm-version }}-${{ matrix.compiler }}-${{ matrix.build-type }}
steps:
- name: Determine artifact-run-id
id: determine-artifact
shell: bash
run: |
if [[ "${{ needs.check-llvm-install.outputs.needs-rebuild }}" == "true" ]]; then
echo "artifact-run-id=${{ needs.trigger-llvm-build.outputs.artifact-run-id }}" >> $GITHUB_ENV
else
echo "artifact-run-id=${{ needs.check-llvm-install.outputs.artifact-run-id }}" >> $GITHUB_ENV
fi
- name: Download Triton artifact
if: ${{ matrix.llvm-install == '$HOME/.triton/llvm/llvm-*' }}
uses: actions/download-artifact@v4
with:
name: triton-assets
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.artifact-run-id }}
path: ~/
- name: Unzip Triton assets
if: ${{ matrix.llvm-install == '$HOME/.triton/llvm/llvm-*' }}
run: |
tar -xzvf ~/triton_assets.tar.gz -C ~/ &&
ls -la ~/
- name: Resolve LLVM install path
if: ${{ matrix.llvm-install == '$HOME/.triton/llvm/llvm-*' }}
shell: bash
run: |
if [[ "${{ matrix.llvm-install }}" == *"llvm-*" ]]; then
RESOLVED_PATH=$(find $HOME/.triton/llvm -maxdepth 1 -type d -name "llvm-*ubuntu-x64" | head -n 1)
if [[ -z "$RESOLVED_PATH" ]]; then
echo "Error: No matching LLVM install path found!" >&2
exit 1
fi
echo "llvm-install=$RESOLVED_PATH" >> $GITHUB_ENV
else
echo "llvm-install=${{ matrix.llvm-install }}" >> $GITHUB_ENV
fi
- name: Check Triton download
if: ${{ matrix.llvm-install == '$HOME/.triton/llvm/llvm-*' }}
run: |
ls -la ~/ &&
ls -Ra ~/.triton
- name: Clone repo
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.CLONE_TOKEN }}
- name: Install packages
timeout-minutes: 25
uses: nick-fields/retry@v3
with:
timeout_minutes: 25
max_attempts: 5
command: |
apt-get update &&
apt-get install -y software-properties-common &&
apt-get upgrade -y &&
apt-get install -y build-essential git wget ${{ matrix.compiler }} lld libzstd-dev libomp-dev ccache libdwarf-dev python3-dev
- name: Install ROCm Packages
timeout-minutes: 25
if: ${{ matrix.rocm-version != '0.0' }}
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 30
timeout_minutes: 25
max_attempts: 5
shell: bash
command: |
ROCM_VERSION=${{ matrix.rocm-version }}
ROCM_MAJOR=$(echo ${ROCM_VERSION} | sed 's/\./ /g' | awk '{print $1}')
ROCM_MINOR=$(echo ${ROCM_VERSION} | sed 's/\./ /g' | awk '{print $2}')
ROCM_VERSN=$(( (${ROCM_MAJOR}*10000)+(${ROCM_MINOR}*100) ))
echo "ROCM_MAJOR=${ROCM_MAJOR} ROCM_MINOR=${ROCM_MINOR} ROCM_VERSN=${ROCM_VERSN}"
if [ "${{ matrix.os-release }}" == "22.04" ]; then
OS_CODENAME="jammy"
elif [ "${{ matrix.os-release }}" == "24.04" ]; then
OS_CODENAME="noble"
else
echo "Unsupported OS release: ${{ matrix.os-release }}" >&2
exit 1
fi
wget -q https://repo.radeon.com/amdgpu-install/${{ matrix.rocm-version }}/ubuntu/${OS_CODENAME}/amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get install -y ./amdgpu-install_${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1_all.deb
apt-get update -y
apt-get install -y {rocm-dev,rocm-llvm-dev,rocm-hip-runtime-dev,rocm-smi-lib,rocminfo}${ROCM_VERSION}
echo "/opt/rocm/bin" >> $GITHUB_PATH
echo "ROCM_PATH=/opt/rocm" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/rocm/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
- name: Verify visible devices
continue-on-error: true
run: |
rocminfo
- name: Build and install
timeout-minutes: 25
shell: bash
run: |
git config --global --add safe.directory ${PWD} &&
mkdir -p /opt/logduration &&
cmake --version &&
mkdir -p build &&
if [ "${{ matrix.llvm-install }}" == "/opt/rocm/llvm" ]; then
cmake -DCMAKE_INSTALL_PREFIX=/opt/logduration -DCMAKE_PREFIX_PATH=${ROCM_PATH} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_VERBOSE_MAKEFILE=ON -S . -B build
else
cmake -DCMAKE_INSTALL_PREFIX=/opt/logduration -DCMAKE_PREFIX_PATH=${ROCM_PATH} -DTRITON_LLVM=${{ env.llvm-install }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_VERBOSE_MAKEFILE=ON -S . -B build
fi
cmake --build build --target install