redhat #116
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: RedHat Linux (ROCm, LLVM) | |
run-name: redhat | |
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: 'redhat.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-redhat.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: ['9.4'] | |
llvm-install: [ '/opt/rocm/llvm', '$HOME/.triton/llvm/llvm-*' ] | |
compiler: ['clang'] | |
build-type: ['Release'] | |
container: | |
image: dgaliffiamd/rocprofiler-systems:ci-base-rhel-${{ matrix.os-release }} | |
options: >- | |
--device=/dev/kfd | |
--device=/dev/dri | |
--group-add video | |
name: redhat-${{ matrix.os-release }}-${{ matrix.llvm-install == '/opt/rocm/llvm' && 'rocm' || 'triton' }}-${{ matrix.rocm-version }}-${{ matrix.compiler }}-${{ matrix.build-type }} | |
steps: | |
- name: Configure Env | |
shell: bash | |
run: | |
echo "OS_VERSION_MAJOR=$(cat /etc/os-release | grep 'VERSION_ID' | sed 's/=/ /1' | awk '{print $NF}' | sed 's/"//g' | sed 's/\./ /g' | awk '{print $1}')" >> $GITHUB_ENV && | |
env | |
- 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: | | |
python3 -m pip install --upgrade pip && | |
python3 -m pip install 'cmake==3.22' && | |
yum install -y epel-release ${{ matrix.compiler }} lld libzstd-devel libomp-devel ccache kmod libdwarf-devel python3-setuptools python3-wheel python3-devel | |
- 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: | | |
RPM_TAG=".el${OS_VERSION_MAJOR}" | |
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) )) | |
if [ "${OS_VERSION_MAJOR}" -eq 8 ]; then PERL_REPO=powertools; else PERL_REPO=crb; fi | |
dnf -y --enablerepo=${PERL_REPO} install perl-File-BaseDir | |
yum install -y https://repo.radeon.com/amdgpu-install/${{ matrix.rocm-version }}/rhel/${{ matrix.os-release }}/amdgpu-install-${ROCM_MAJOR}.${ROCM_MINOR}.${ROCM_VERSN}-1${RPM_TAG}.noarch.rpm | |
yum install -y rocm-dev rocm-llvm-devel rocm-hip-runtime-devel rocm-smi-lib rocminfo | |
if [ "${OS_VERSION_MAJOR}" -gt 8 ]; then dnf install -y libavcodec-free-devel libavformat-free-devel; fi | |
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 | |