Skip to content

[DO NOT MERGE] Amd v0.43.0 wheel#1299

Draft
josephleekl wants to merge 2 commits intoamd-v0.43.0from
amd-v0.43.0-wheel
Draft

[DO NOT MERGE] Amd v0.43.0 wheel#1299
josephleekl wants to merge 2 commits intoamd-v0.43.0from
amd-v0.43.0-wheel

Conversation

@josephleekl
Copy link
Contributor

@josephleekl josephleekl commented Dec 1, 2025

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    tests directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the .github/CHANGELOG.md file, summarizing the
    change, and including a link back to the PR.

  • Ensure that code is properly formatted by running make format.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context:
Build lightning.amdgpu wheels for v0.43.0

wheels are available in artifacts here

Description of the Change:

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@josephleekl josephleekl added the do not merge Do not merge PR until this label is removed label Dec 1, 2025
@josephleekl josephleekl changed the base branch from master to amd-v0.43.0 December 1, 2025 15:34
Comment on lines +28 to +36
if: |
github.event_name != 'pull_request' ||
(github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'ci:build_wheels'))
name: "Set wheel build matrix"
uses: ./.github/workflows/set_wheel_build_matrix.yml
with:
event_name: ${{ github.event_name }}

build_dependencies:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines +37 to +95
needs: [set_wheel_build_matrix]
strategy:
matrix:
exec_model: ["HIP"]
kokkos_version: ${{ fromJson(needs.set_wheel_build_matrix.outputs.kokkos_version) }}
rocm_version: ["7.0.3"]
container_img: ["quay.io/pypa/manylinux_2_28_x86_64"]
timeout-minutes: 45
name: Kokkos core (${{ matrix.exec_model }})
runs-on: blacksmith-4vcpu-ubuntu-2404
container: ${{ matrix.container_img }}

steps:
- name: Cache installation directories
id: kokkos-cache
uses: actions/cache@v4
with:
path: /root/Kokkos_install/${{ matrix.exec_model }}
key: ${{ matrix.container_img }}-rocm${{ matrix.rocm_version }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}

- name: Configure ROCm Repo and Install Dependencies
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
printf "[ROCm]\nname=ROCm\nbaseurl=https://repo.radeon.com/rocm/rhel8/${{ matrix.rocm_version }}/main\nenabled=1\ngpgcheck=0" > /etc/yum.repos.d/rocm.repo
dnf clean all
dnf update -y
dnf install -y cmake ninja-build git wget gcc-toolset-11 rocm-dev hipcc hip-devel rocthrust-devel rocprim-devel

echo "PATH=/opt/rh/gcc-toolset-11/root/usr/bin:$PATH" >> $GITHUB_ENV
echo "CXX=hipcc" >> $GITHUB_ENV

- name: Clone Kokkos libs
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
git clone --branch ${{ matrix.kokkos_version }} https://github.com/kokkos/kokkos.git

- name: Build Kokkos core library
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
source /opt/rh/gcc-toolset-11/enable
mkdir -p /root/Kokkos_install/${{ matrix.exec_model }}
cd kokkos

cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/root/Kokkos_install/${{ matrix.exec_model }} \
-DKokkos_ENABLE_COMPLEX_ALIGN=OFF \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_HIP=ON \
-DKokkos_ARCH_AMD_GFX942=ON \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-DCMAKE_CXX_COMPILER=hipcc \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_CXX_FLAGS="--gcc-toolchain=/opt/rh/gcc-toolset-11/root/usr" \
-DCMAKE_PREFIX_PATH="/opt/rocm" \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-G Ninja
cmake --build ./Build --verbose
cmake --install ./Build

linux-wheels-x86-64:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines 96 to 192
needs: [set_wheel_build_matrix, build_dependencies]
strategy:
fail-fast: false
matrix:
arch: [x86_64]
pl_backend: ["lightning_amdgpu"]
rocm_version: ["7.0.3"]
cibw_build: ${{ fromJson(needs.set_wheel_build_matrix.outputs.python_version_gpu) }}
exec_model: ["HIP"]
kokkos_version: ${{ fromJson(needs.set_wheel_build_matrix.outputs.kokkos_version) }}
container_img: ["quay.io/pypa/manylinux_2_28_x86_64"]
timeout-minutes: 60
name: Linux::${{ matrix.arch }} - ${{ matrix.pl_backend }} ROCm ${{ matrix.rocm_version }} (Python ${{ fromJson('{"cp311-*":"3.11","cp312-*":"3.12","cp313-*":"3.13" }')[matrix.cibw_build] }})
runs-on: blacksmith-4vcpu-ubuntu-2404
container:
image: ${{ matrix.container_img }}
options: --privileged

steps:
- name: Restoring cached dependencies
id: kokkos-cache
uses: actions/cache@v4
with:
path: /root/Kokkos_install/${{ matrix.exec_model }}
key: ${{ matrix.container_img }}-rocm${{ matrix.rocm_version }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}

- name: Checkout PennyLane-Lightning
uses: actions/checkout@v4

- name: Copy cached libraries
if: steps.kokkos-cache.outputs.cache-hit == 'true'
run: |
mkdir Kokkos
cp -rf /root/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/

- name: Install dependencies (AlmaLinux)
run: |
dnf update -y && dnf install -y podman

- name: Install dependencies (Python)
run: python3.12 -m pip install cibuildwheel~=3.1.4 tomlkit

- name: Configure pyproject.toml file
run: PL_BACKEND="${{ matrix.pl_backend }}" python3.12 scripts/configure_pyproject_toml.py

- name: Build wheels
env:
CIBW_CONTAINER_ENGINE: "podman"
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_SKIP: "*-musllinux*"

# Prepare container for build
CIBW_BEFORE_BUILD: |
printf "[ROCm]\nname=ROCm\nbaseurl=https://repo.radeon.com/rocm/rhel8/${{ matrix.rocm_version }}/main\nenabled=1\ngpgcheck=0" > /etc/yum.repos.d/rocm.repo

python -m pip install ninja cmake setuptools auditwheel~=5.0

dnf clean all
dnf install -y git wget gcc-toolset-11 rocm-dev hipcc hip-devel rocthrust-devel rocprim-devel

CIBW_ENVIRONMENT: |
PATH=/opt/rh/gcc-toolset-11/root/usr/bin:$PATH:/opt/rocm/bin \
LD_LIBRARY_PATH=/opt/rh/gcc-toolset-11/root/usr/lib64:/opt/rh/gcc-toolset-11/root/usr/lib:$LD_LIBRARY_PATH:/opt/rocm/lib \
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=hipcc -DCMAKE_CXX_FLAGS='--gcc-install-dir=/opt/rh/gcc-toolset-11/root/usr/lib/gcc/x86_64-redhat-linux/11' -DCMAKE_PREFIX_PATH=/opt/rocm"

CIBW_REPAIR_WHEEL_COMMAND_LINUX: "./bin/auditwheel repair -w {dest_dir} {wheel}"

CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD_VERBOSITY: 3

run: python3.12 -m cibuildwheel --output-dir wheelhouse

- name: Validate wheels
run: |
python3.12 -m pip install twine
python3.12 -m twine check ./wheelhouse/*.whl

- uses: actions-ecosystem/action-regex-match@main
id: rc_build
with:
text: ${{ github.event.pull_request.head.ref }}
regex: '^v[0-9]+\.[0-9]+\.[0-9]+[-_]rc$'

- uses: actions/upload-artifact@v4
if: |
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch' ||
github.ref == 'refs/heads/master' ||
steps.rc_build.outputs.match != ''
with:
name: ${{ runner.os }}-wheels-${{ matrix.pl_backend }}-${{ fromJson('{ "cp311-*":"py311","cp312-*":"py312","cp313-*":"py313" }')[matrix.cibw_build] }}-${{ matrix.arch }}-rocm${{ matrix.rocm_version }}.zip
path: ./wheelhouse/*.whl
retention-days: 1
include-hidden-files: true

upload-pypi:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
@josephleekl josephleekl added the ci:build_wheels Activate wheel building. label Dec 1, 2025
@josephleekl josephleekl marked this pull request as ready for review December 1, 2025 15:34
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2025

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.67%. Comparing base (8dfd005) to head (fd36f1b).

Additional details and impacted files
@@               Coverage Diff                @@
##           amd-v0.43.0    #1299       +/-   ##
================================================
- Coverage        91.34%   33.67%   -57.67%     
================================================
  Files              184       30      -154     
  Lines            27672     2916    -24756     
================================================
- Hits             25276      982    -24294     
+ Misses            2396     1934      -462     
Flag Coverage Δ
unit_tests 33.67% <ø> (-57.67%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

regex: '^v[0-9]+\.[0-9]+\.[0-9]+[-_]rc$'

- uses: actions/upload-artifact@v4
# if: |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporarily upload artifact for testing and upload to PyPI

@maliasadi maliasadi mentioned this pull request Dec 4, 2025
5 tasks
@josephleekl josephleekl marked this pull request as draft December 4, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:build_wheels Activate wheel building. do not merge Do not merge PR until this label is removed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant