Skip to content

Release portable Linux packages (gfx110X, dev) #972

Release portable Linux packages (gfx110X, dev)

Release portable Linux packages (gfx110X, dev) #972

name: Release portable Linux packages
on:
# Trigger from another workflow (typically to build dev packages and then test them)
workflow_call:
inputs:
release_type:
description: The type of release to build ("dev", "nightly", or "prerelease"). All developer-triggered jobs should use "dev"!
type: string
default: "dev"
package_suffix:
type: string
s3_subdir:
description: "Subdirectory to push the packages"
type: string
default: "v2"
s3_staging_subdir:
description: "Staging subdirectory to push the packages"
type: string
default: "v2-staging"
families:
description: "Comma separated list of AMD GPU families, e.g. `gfx94X,gfx103x`"
type: string
prerelease_version:
description: "(Optional) Number of the prerelease"
type: string
repository:
description: "Repository to checkout. Otherwise, defaults to `github.repository`."
type: string
ref:
description: "Branch, tag or SHA to checkout. Defaults to the reference or SHA that triggered the workflow."
type: string
# Trigger manually (typically to test the workflow or manually build a release [candidate])
workflow_dispatch:
inputs:
release_type:
description: The type of release to build ("dev", "nightly", or "prerelease"). All developer-triggered jobs should use "dev"!
type: string
default: "dev"
package_suffix:
type: string
s3_subdir:
description: "Subdirectory to push the packages"
type: string
default: "v2"
s3_staging_subdir:
description: "Staging subdirectory to push the packages"
type: string
default: "v2-staging"
families:
description: "Comma separated list of AMD GPU families, e.g. `gfx94X,gfx103x`"
type: string
prerelease_version:
description: "(Optional) Number of the prerelease"
type: string
# Trigger on a schedule to build nightly release candidates.
schedule:
# Runs at 04:00 AM UTC, which is 8:00 PM PST (UTC-8)
- cron: '0 04 * * *'
permissions:
contents: read
run-name: Release portable Linux packages (${{ inputs.families || 'default' }}, ${{ inputs.release_type || 'nightly' }})
jobs:
setup_metadata:
if: ${{ github.repository_owner == 'ROCm' || github.event_name != 'schedule' }}
runs-on: ubuntu-24.04
env:
release_type: ${{ inputs.release_type || 'nightly' }}
outputs:
version: ${{ steps.rocm_package_version.outputs.rocm_package_version }}
rpm_version: ${{ steps.rocm_native_package_version.outputs.rocm_rpm_package_version }}
deb_version: ${{ steps.rocm_native_package_version.outputs.rocm_deb_package_version }}
release_type: ${{ env.release_type }}
package_targets: ${{ steps.configure.outputs.package_targets }}
gfx_archs: ${{ steps.gfx_archs.outputs.gfx_archs }}
cloudfront_url: ${{ steps.release_information.outputs.cloudfront_url }}
cloudfront_staging_url: ${{ steps.release_information.outputs.cloudfront_staging_url }}
cloudfront_base_url: ${{ steps.release_information.outputs.cloudfront_base_url }}
s3_subdir_tar: ${{ steps.release_information.outputs.s3_subdir_tar }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || '' }}
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.12
- name: Compute package version
id: rocm_package_version
run: |
python ./build_tools/compute_rocm_package_version.py \
--release-type=${{ env.release_type }} \
--prerelease-version=${{ inputs.prerelease_version }}
- name: Compute native package version
id: rocm_native_package_version
run: |
# Compute rpm package version
# This sets the 'rocm_rpm_package_version' output
python ./build_tools/compute_rocm_package_version.py \
--release-type=${{ env.release_type }} \
--prerelease-version=${{ inputs.prerelease_version }} \
--package-type="rpm"
# Compute debian package version
# This sets the 'rocm_deb_package_version' output
python ./build_tools/compute_rocm_package_version.py \
--release-type=${{ env.release_type }} \
--prerelease-version=${{ inputs.prerelease_version }} \
--package-type="deb"
- name: Set variables for nightly release
if: ${{ env.release_type == 'nightly' }}
run: |
echo "tmp_cloudfront_url=https://rocm.nightlies.amd.com/v2" >> $GITHUB_ENV
echo "tmp_cloudfront_staging_url=https://rocm.nightlies.amd.com/v2-staging" >> $GITHUB_ENV
echo "tmp_s3_subdir_tar=''" >> $GITHUB_ENV
- name: Set variables for prerelease
if: ${{ env.release_type == 'prerelease' }}
run: |
echo "tmp_cloudfront_url=https://rocm.prereleases.amd.com/whl" >> $GITHUB_ENV
echo "tmp_cloudfront_staging_url=https://rocm.prereleases.amd.com/whl-staging" >> $GITHUB_ENV
echo "tmp_s3_subdir_tar=v3/tarball/" >> $GITHUB_ENV
- name: Set variables for development release
if: ${{ env.release_type == 'dev' }}
run: |
echo "tmp_cloudfront_url=https://rocm.devreleases.amd.com/v2" >> $GITHUB_ENV
echo "tmp_cloudfront_staging_url=https://rocm.devreleases.amd.com/v2-staging" >> $GITHUB_ENV
echo "tmp_s3_subdir_tar=''" >> $GITHUB_ENV
- name: Generate release information
id: release_information
run: |
echo "cloudfront_url=${tmp_cloudfront_url}" >> $GITHUB_OUTPUT
echo "cloudfront_staging_url=${tmp_cloudfront_staging_url}" >> $GITHUB_OUTPUT
echo "s3_subdir_tar=${tmp_s3_subdir_tar}" >> $GITHUB_OUTPUT
# TODO: Refactor to use the base URL as CloudFront URL once bucket paths (v2 vs. whl) are harmonized.
# Uses bash parameter expansion to strip off subdirectories.
echo "cloudfront_base_url=${tmp_cloudfront_url%/*}" >> $GITHUB_OUTPUT
- name: Generating package target matrix
id: configure
env:
AMDGPU_FAMILIES: ${{ inputs.families }}
THEROCK_PACKAGE_PLATFORM: "linux"
run: python ./build_tools/github_actions/fetch_package_targets.py
# - name: Generate gfx_archs list
# id: gfx_archs
# run: |
# # Parse package_targets JSON, extract amdgpu_family, strip suffix after hyphen, lowercase, join with comma
# GFX_ARCHS=$(echo '${{ steps.configure.outputs.package_targets }}' | python3 -c "
# import sys, json
# targets = json.load(sys.stdin)
# archs = [t['amdgpu_family'].split('-')[0].lower() for t in targets]
# print(','.join(archs))
# ")
# echo "gfx_archs=${GFX_ARCHS}" >> $GITHUB_OUTPUT
# echo "Generated gfx_archs: ${GFX_ARCHS}"
portable_linux_packages:
name: ${{ matrix.target_bundle.amdgpu_family }}::Build Portable Linux
# runs-on: ${{ github.repository_owner == 'ROCm' && 'azure-linux-scale-rocm' || 'ubuntu-24.04' }}
runs-on: ubuntu-24.04
continue-on-error: ${{ matrix.target_bundle.expect_failure == true }} # for GPU families that are flaky, we mark as xfail
timeout-minutes: 720 # 12 hour timeout
needs: [setup_metadata]
permissions:
contents: write
actions: write # Added permission to trigger workflows
id-token: write # Added permission for AWS S3 upload
strategy:
fail-fast: false
matrix:
target_bundle: ${{ fromJSON(needs.setup_metadata.outputs.package_targets) }}
env:
TEATIME_LABEL_GH_GROUP: 1
OUTPUT_DIR: ${{ github.workspace }}/output
BUILD_IMAGE: ghcr.io/rocm/therock_build_manylinux_x86_64@sha256:d6ae5712a9c7e8b88281d021e907b312cd8a26295b95690baef3e8dde4805858
DIST_ARCHIVE: "${{ github.workspace }}/output/therock-dist-linux-${{ matrix.target_bundle.amdgpu_family }}${{ inputs.package_suffix }}-${{ needs.setup_metadata.outputs.version }}.tar.gz"
FILE_NAME: "therock-dist-linux-${{ matrix.target_bundle.amdgpu_family }}${{ inputs.package_suffix }}-${{ needs.setup_metadata.outputs.version }}.tar.gz"
RELEASE_TYPE: "${{ needs.setup_metadata.outputs.release_type }}"
S3_BUCKET_TAR: "therock-${{ needs.setup_metadata.outputs.release_type }}-tarball"
S3_SUBDIR_TAR: ${{ needs.setup_metadata.outputs.s3_subdir_tar }}
S3_BUCKET_PY: "therock-${{ needs.setup_metadata.outputs.release_type }}-python"
S3_SUBDIR: ${{ inputs.s3_subdir || 'v2' }}
S3_STAGING_SUBDIR: ${{ inputs.s3_staging_subdir || 'v2-staging' }}
MANYLINUX: 1
EXTRA_C_COMPILER_LAUNCHER: /therock/src/build_tools/resource_info.py
EXTRA_CXX_COMPILER_LAUNCHER: /therock/src/build_tools/resource_info.py
steps:
- name: "Checking out repository"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || '' }}
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.12
# TODO: We shouldn't be using a cache on actual release branches, but it
# really helps for iteration time.
- name: Enable cache
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.OUTPUT_DIR }}/caches
key: portable-linux-package-matrix-v1-${{ matrix.target_bundle.amdgpu_family }}-${{ github.sha }}
restore-keys: |
portable-linux-package-matrix-v1-${{ matrix.target_bundle.amdgpu_family }}-
# - name: Install the AWS tool
# run: ./dockerfiles/install_awscli.sh
# - name: Fetch sources
# timeout-minutes: 30
# run: |
# # Prefetch docker container in background.
# docker pull ${{ env.BUILD_IMAGE }} &
# ./build_tools/fetch_sources.py --jobs 10
# wait
# - name: Build Projects
# run: |
# ./build_tools/linux_portable_build.py \
# --image=${{ env.BUILD_IMAGE }} \
# --output-dir=${{ env.OUTPUT_DIR }} \
# -- \
# "-DTHEROCK_AMDGPU_FAMILIES=${{ matrix.target_bundle.amdgpu_family }}"
# cd ${{ env.OUTPUT_DIR }}/build/dist/rocm
# echo "Building ${{ env.DIST_ARCHIVE }}"
# tar cfz "${{ env.DIST_ARCHIVE }}" .
# - name: Build Python Packages
# run: |
# ./build_tools/linux_portable_build.py \
# --image=${{ env.BUILD_IMAGE }} \
# --output-dir=${{ env.OUTPUT_DIR }}/packages \
# --build-python-only \
# --artifact-dir=${{ env.OUTPUT_DIR }}/build/artifacts \
# -- \
# "--version=${{ needs.setup_metadata.outputs.version }}"
# - name: Grant ownership over output directory
# if: ${{ !cancelled() }}
# run: |
# sudo chown -R $(whoami) ${{ env.OUTPUT_DIR }}
# - name: Build Report
# if: ${{ !cancelled() }}
# run: |
# echo "Full SDK du:"
# echo "------------"
# du -h -d 1 ${{ env.OUTPUT_DIR }}/build/dist/rocm
# # Analyze ninja build log to generate per-component timing report
# - name: Analyze Build Times
# if: ${{ !cancelled() }}
# env:
# THEROCK_BUILD_PROF_LOG_DIR: ${{ env.OUTPUT_DIR }}/build/logs/therock-build-prof
# run: |
# python3 build_tools/resource_info.py --finalize
# python3 build_tools/analyze_build_times.py --build-dir ${{ env.OUTPUT_DIR }}/build
# - name: Configure AWS Credentials
# if: ${{ github.repository_owner == 'ROCm' && !cancelled() }}
# uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
# with:
# aws-region: us-east-2
# role-to-assume: arn:aws:iam::692859939525:role/therock-${{ env.RELEASE_TYPE }}
# - name: Post Build Upload
# if: ${{ github.repository_owner == 'ROCm' && !cancelled() }}
# run: |
# python3 build_tools/github_actions/post_build_upload.py \
# --run-id ${{ github.run_id }} \
# --artifact-group "${{ matrix.target_bundle.amdgpu_family }}" \
# --build-dir ${{ env.OUTPUT_DIR }}/build \
# --upload \
# --job-status ${{ job.status }}
# - name: Upload Releases to staging S3
# if: ${{ github.repository_owner == 'ROCm' }}
# run: |
# aws s3 cp ${{ env.OUTPUT_DIR }}/packages/dist/ s3://${{ env.S3_BUCKET_PY }}/${{ env.S3_STAGING_SUBDIR }}/${{ matrix.target_bundle.amdgpu_family }}/ \
# --recursive --no-follow-symlinks \
# --exclude "*" \
# --include "*.whl" \
# --include "*.tar.gz"
# - name: (Re-)Generate Python package release index for staging
# if: ${{ github.repository_owner == 'ROCm' }}
# env:
# # Environment variable to be set for `manage.py`
# CUSTOM_PREFIX: "${{ env.S3_STAGING_SUBDIR }}/${{ matrix.target_bundle.amdgpu_family }}"
# run: |
# pip install boto3 packaging
# python ./build_tools/third_party/s3_management/manage.py ${{ env.CUSTOM_PREFIX }}
# ## TODO: Restrict uploading to the non-staging S3 directory until ROCm sanity checks and all validation tests have successfully passed.
# - name: Upload Releases to S3
# if: ${{ github.repository_owner == 'ROCm' }}
# run: |
# aws s3 cp ${{ env.DIST_ARCHIVE }} s3://${{ env.S3_BUCKET_TAR }}/${{ env.S3_SUBDIR_TAR }}
# aws s3 cp ${{ env.OUTPUT_DIR }}/packages/dist/ s3://${{ env.S3_BUCKET_PY }}/${{ env.S3_SUBDIR }}/${{ matrix.target_bundle.amdgpu_family }}/ \
# --recursive --no-follow-symlinks \
# --exclude "*" \
# --include "*.whl" \
# --include "*.tar.gz"
# - name: (Re-)Generate release index pages
# if: ${{ github.repository_owner == 'ROCm' }}
# env:
# # Environment variable to be set for `manage.py`
# CUSTOM_PREFIX: "${{ env.S3_SUBDIR }}/${{ matrix.target_bundle.amdgpu_family }}"
# run: |
# pip install boto3 packaging
# python ./build_tools/third_party/s3_management/manage.py ${{ env.CUSTOM_PREFIX }}
# python ./build_tools/index_generation_s3_tar.py \
# --bucket ${{ env.S3_BUCKET_TAR }} \
# --directory ${{ env.S3_SUBDIR_TAR }} \
# --upload
# - name: Trigger building PyTorch wheels
# if: ${{ github.repository_owner == 'ROCm' && matrix.target_bundle.expect_pytorch_failure == false }}
# uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
# with:
# workflow: release_portable_linux_pytorch_wheels.yml
# inputs: |
# { "amdgpu_family": "${{ matrix.target_bundle.amdgpu_family }}",
# "release_type": "${{ env.RELEASE_TYPE }}",
# "s3_subdir": "${{ env.S3_SUBDIR }}",
# "s3_staging_subdir": "${{ env.S3_STAGING_SUBDIR }}",
# "cloudfront_url": "${{ needs.setup_metadata.outputs.cloudfront_url }}",
# "cloudfront_staging_url": "${{ needs.setup_metadata.outputs.cloudfront_staging_url }}",
# "rocm_version": "${{ needs.setup_metadata.outputs.version }}",
# "ref": "${{ inputs.ref || '' }}"
# }
# - name: URL-encode .tar URL
# # TODO: Enable JAX wheels for prereleases
# if: ${{ env.RELEASE_TYPE != 'prerelease' }}
# id: url-encode-tar
# run: python -c "from urllib.parse import quote; print('tar_url=${{ needs.setup_metadata.outputs.cloudfront_base_url }}/tarball/' + quote('${{ env.FILE_NAME }}'))" >> ${GITHUB_OUTPUT}
# - name: Trigger release JAX wheels
# # TODO: Enable JAX wheels for prereleases
# if: ${{ env.RELEASE_TYPE != 'prerelease' && github.repository_owner == 'ROCm' }}
# uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
# with:
# workflow: release_portable_linux_jax_wheels.yml
# ref: ${{ inputs.ref || github.ref_name }}
# inputs: |
# { "amdgpu_family": "${{ matrix.target_bundle.amdgpu_family }}",
# "release_type": "${{ env.RELEASE_TYPE }}",
# "s3_subdir": "${{ env.S3_SUBDIR }}",
# "s3_staging_subdir": "${{ env.S3_STAGING_SUBDIR }}",
# "cloudfront_url": "${{ needs.setup_metadata.outputs.cloudfront_url }}",
# "cloudfront_staging_url": "${{ needs.setup_metadata.outputs.cloudfront_staging_url }}",
# "rocm_version": "${{ needs.setup_metadata.outputs.version }}",
# "tar_url": "${{ steps.url-encode-tar.outputs.tar_url }}",
# "ref": "${{ inputs.ref || '' }}"
# }
- name: Trigger build native rpm package
id: trigger_rpm
if: ${{ github.repository_owner == 'ROCm' }}
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
with:
workflow: build_native_linux_packages.yml
inputs: |
{ "artifact_group": "${{ matrix.target_bundle.amdgpu_family }}",
"rocm_version": "${{ needs.setup_metadata.outputs.rpm_version }}",
"release_type": "${{ env.RELEASE_TYPE }}",
"artifact_run_id": "${{ github.run_id }}",
"native_package_type": "rpm"
}
- name: Trigger build native debian package
id: trigger_deb
if: ${{ github.repository_owner == 'ROCm' }}
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
with:
workflow: build_native_linux_packages.yml
inputs: |
{ "artifact_group": "${{ matrix.target_bundle.amdgpu_family }}",
"rocm_version": "${{ needs.setup_metadata.outputs.deb_version }}",
"release_type": "${{ env.RELEASE_TYPE }}",
"artifact_run_id": "${{ github.run_id }}",
"native_package_type": "deb"
}
- name: Record successful native package triggers
id: record_native_success
if: ${{ steps.trigger_rpm.outcome == 'success' && steps.trigger_deb.outcome == 'success' }}
run: |
FAMILY="${{ matrix.target_bundle.amdgpu_family }}"
# Transform: lowercase and remove suffix after hyphen
# eg. gfx94X,gfx950-dcgpu become gfx94x and gfx950 respectively
FAMILY_CLEAN=$(echo "$FAMILY" | cut -d'-' -f1 | tr '[:upper:]' '[:lower:]')
echo "successful_family=${FAMILY_CLEAN}" >> $GITHUB_OUTPUT
echo "$FAMILY_CLEAN" > successful_family.txt
echo "Recorded successful native package trigger for: ${FAMILY_CLEAN}"
# Uploads local file successful_family.txt with directory structure successful-native-family-${{ matrix.target_bundle.amdgpu_family }}/successful_family.txt
- name: Upload successful family artifact
if: ${{ steps.record_native_success.outcome == 'success' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: successful-native-family-${{ matrix.target_bundle.amdgpu_family }}
path: successful_family.txt
retention-days: 1
# - name: Save cache
# uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
# if: ${{ !cancelled() }}
# with:
# path: ${{ env.OUTPUT_DIR }}/caches
# key: portable-linux-package-matrix-v1-${{ matrix.target_bundle.amdgpu_family }}-${{ github.sha }}
# Aggregate all GPU families that successfully triggered both RPM and DEB native package builds
aggregate_successful_native_families:
name: Aggregate Successful Native Package Families
runs-on: ubuntu-24.04
needs: [portable_linux_packages]
if: ${{ always() && needs.portable_linux_packages.result != 'cancelled' }}
permissions:
actions: write # Required to trigger workflows
outputs:
successful_native_families: ${{ steps.aggregate.outputs.successful_native_families }}
# Downloads artifacts with the directory structure:
# families/successful-native-family-${{ matrix.target_bundle.amdgpu_family }}/successful_family.txt
steps:
- name: Download all successful family artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: successful-native-family-*
path: families/
continue-on-error: true
- name: Aggregate successful families into environment variable
id: aggregate
run: |
SUCCESSFUL_NATIVE_FAMILIES=""
if [ -d "families/" ]; then
for f in families/*/successful_family.txt; do
if [ -f "$f" ]; then
FAMILY=$(cat "$f")
if [ -z "$SUCCESSFUL_NATIVE_FAMILIES" ]; then
SUCCESSFUL_NATIVE_FAMILIES="$FAMILY"
else
SUCCESSFUL_NATIVE_FAMILIES="${SUCCESSFUL_NATIVE_FAMILIES},${FAMILY}"
fi
fi
done
fi
echo "successful_native_families=${SUCCESSFUL_NATIVE_FAMILIES}" >> $GITHUB_OUTPUT
echo "Aggregated successful native package families: ${SUCCESSFUL_NATIVE_FAMILIES}"
# Call build_linux_runfile_installer.yml as a reusable workflow
build_runfile_installer:
name: Build Linux Runfile Installer
needs: [setup_metadata, aggregate_successful_native_families]
if: ${{ github.repository_owner == 'ROCm' && needs.aggregate_successful_native_families.outputs.successful_native_families != '' }}
permissions:
id-token: write # Required for AWS OIDC authentication in the called workflow
contents: read
uses: ./.github/workflows/build_linux_runfile_installer.yml
with:
rocm_version: 7.12.0~20260212
release_type: dev
gfx_archs: ${{ needs.aggregate_successful_native_families.outputs.successful_native_families }}
pull_type: nightly
pull_run_id: "21933875966"
# - name: Trigger build runfile installer
# if: ${{ github.repository_owner == 'ROCm' }}
# uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4
# with:
# workflow: build_linux_runfile_installer.yml
# # inputs: |
# # { "rocm_version": "${{ needs.setup_metadata.outputs.deb_version }}",
# # "release_type": "${{ env.RELEASE_TYPE }}",
# # "pull_type": "${{ env.RELEASE_TYPE }}",
# # "pull_run_id": "${{ github.run_id }}"
# # }
# inputs: |
# { "rocm_version": "7.12.0~20260212",
# "release_type": "dev",
# "pull_type": "nightly",
# "gfx_archs": "${{ env.SUCCESSFUL_NATIVE_FAMILIES }}",
# "pull_run_id": "21933875966"
# }