# Copyright Advanced Micro Devices, Inc. # SPDX-License-Identifier: MIT name: Test ROCm Wheels on: workflow_dispatch: inputs: amdgpu_family: description: GPU family to test (e.g., gfx94X-dcgpu, gfx110X-all) required: true type: string default: "gfx94X-dcgpu" test_runs_on: description: Runner label to use. The selected runner should have a GPU supported by amdgpu_family required: true type: string default: "linux-gfx942-1gpu-ccs-csp-ossci-rocm" package_index_url: description: >- Full Python package index URL for use with --index-url. type: string default: "https://rocm.nightlies.amd.com/whl-multi-arch/" package_find_links_url: description: Full Python package index URL for use with --find-links (usually instead of package_index_url) type: string python_version: required: true type: string default: "3.12" rocm_version: description: ROCm version to pip install (e.g. "7.10.0a20251124") required: true type: string kpack_split: description: "'true' if this is a kpack-split flat build." type: string default: "false" container_image_name: description: >- Short, human-readable label for the container image (e.g. 'ubuntu24.04', 'ubi10', 'native'). Use 'native' (with an empty container_image_url) for native runners like Windows. type: string default: "ubuntu24.04" container_image_url: description: >- Container image reference (e.g. 'ghcr.io/rocm/no_rocm_image_ubuntu24_04@sha256:...'). Only applied when test_runs_on targets Linux. Leave empty to run directly on the runner (required for Windows and native Linux runners). type: string default: "ghcr.io/rocm/no_rocm_image_ubuntu24_04@sha256:405945a40deaff9db90b9839c0f41d4cba4a383c1a7459b28627047bf6302a26" workflow_call: inputs: amdgpu_family: required: true type: string test_runs_on: required: true type: string package_index_url: description: >- Full Python package index URL for use with --index-url. type: string package_find_links_url: type: string python_version: required: true type: string rocm_version: required: true type: string container_image_name: description: >- Short, human-readable label for the container image (e.g. 'ubuntu24.04', 'ubi10', 'native'). Callers must pass this explicitly so this workflow stays image-agnostic. Use 'native' (with an empty container_image_url) for native runners like Windows. required: true type: string container_image_url: description: >- Container image reference. Only applied when test_runs_on targets Linux. Pass an empty string to run directly on the runner (required for Windows and native Linux runners). required: true type: string repository: description: "Repository to checkout. Defaults to github.repository." type: string default: "" ref: description: "Branch, tag, or SHA to checkout. Defaults to the triggering ref." type: string default: "" permissions: contents: read run-name: Test ROCm Wheels (${{ inputs.amdgpu_family }}, py${{ inputs.python_version }}, ${{ inputs.rocm_version }}, ${{ inputs.test_runs_on }}) jobs: test_wheels: name: Test ROCm wheels | ${{ inputs.amdgpu_family }} | py${{ inputs.python_version }} | ${{ inputs.container_image_name }} if: ${{ inputs.test_runs_on != '' }} runs-on: ${{ inputs.test_runs_on }} timeout-minutes: 30 container: image: ${{ contains(inputs.test_runs_on, 'linux') && inputs.container_image_url != '' && inputs.container_image_url || null }} options: --ipc host --group-add video --device /dev/kfd --device /dev/dri --group-add 992 --group-add 110 --env-file /etc/podinfo/gha-gpu-isolation-settings --user 0:0 # Running as root, by recommendation of GitHub: https://docs.github.com/en/actions/reference/workflows-and-actions/dockerfile-support#user defaults: run: shell: bash env: VENV_DIR: ${{ github.workspace }}/.venv steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: ${{ inputs.repository || github.repository }} ref: ${{ inputs.ref }} # actions/setup-python only has prebuilt binaries for Ubuntu - name: Set up Python if: ${{ inputs.container_image_url == '' || contains(inputs.container_image_name, 'ubuntu') }} uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: ${{ inputs.python_version }} - name: Compute ROCm device extras id: device_extras run: | python build_tools/github_actions/expand_amdgpu_families.py \ --amdgpu-families "${{ inputs.amdgpu_family }}" \ --output-mode=device-extras # Key off install_libraries success (not test_libraries) so devel install/test still run - name: Install rocm[libraries] id: install_libraries run: | pkg="rocm[libraries]" if [ -n "${{ steps.device_extras.outputs.device_extras }}" ]; then pkg="${pkg%]},${{ steps.device_extras.outputs.device_extras }}]" fi python build_tools/setup_venv.py ${VENV_DIR} \ --packages "${pkg}==${{ inputs.rocm_version }}" \ --index-url=${{ inputs.package_index_url }} \ --find-links=${{ inputs.package_find_links_url }} \ --activate-in-future-github-actions-steps - name: Show installed packages (libraries) if: ${{ !cancelled() && steps.install_libraries.outcome == 'success' }} run: | pip freeze - name: Test rocm[libraries] id: test_libraries if: ${{ !cancelled() && steps.install_libraries.outcome == 'success' }} timeout-minutes: 5 run: | rocm-sdk test - name: Install rocm[libraries,devel] id: install_devel if: ${{ !cancelled() && steps.install_libraries.outcome == 'success' }} run: | pkg="rocm[libraries,devel]" if [ -n "${{ steps.device_extras.outputs.device_extras }}" ]; then pkg="${pkg%]},${{ steps.device_extras.outputs.device_extras }}]" fi python build_tools/setup_venv.py ${VENV_DIR} \ --packages "${pkg}==${{ inputs.rocm_version }}" \ --index-url=${{ inputs.package_index_url }} \ --find-links=${{ inputs.package_find_links_url }} - name: Show installed packages (libraries,devel) if: ${{ !cancelled() && steps.install_devel.outcome == 'success' }} run: | pip freeze - name: Test rocm[libraries,devel] if: ${{ !cancelled() && steps.install_devel.outcome == 'success' }} timeout-minutes: 5 run: | rocm-sdk test