Skip to content

feat(amdsmi): [ROCM-3941] Add manylinux wheel job to the amdsmi CI matrix - #7913

Merged
marifamd merged 13 commits into
developfrom
users/juwillia/py-wheel-build
Jul 27, 2026
Merged

marifamd merged 13 commits into
developfrom
users/juwillia/py-wheel-build

Conversation

@amd-juwillia

@amd-juwillia amd-juwillia commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Wire the SONAME-isolated wheel build into amd-smi's own per-distro CI matrix so every change is checked against a manylinux wheel build.

Technical Details

CI (.github/workflows/amdsmi-build.yml):

  • Add a manylinux-build job that runs tools/build_wheel.py with -DBUILD_PYTHON_WHEEL=ON alongside the existing build-and-test matrix.

Split 2 of 3 from #5726. Depends on #7822 (the wheel build it exercises) and is stacked on it. Both target develop, so until #7822 merges this PR's diff also shows #7822's changes; it collapses to 2 files once #7822 lands. Merge order: #7822 → this.

JIRA ID

Resolves ROCM-3941

Test Plan

  • Trigger the manylinux-build job on this branch and confirm a .whl is produced and import-smoke-tested.

Test Result

  • The manylinux job builds and installs the wheel on the ubuntu-22.04 manylinux_2_28 target.

Submission Checklist

@amd-juwillia
amd-juwillia requested a review from a team June 28, 2026 01:30
@amd-juwillia
amd-juwillia requested a review from a team as a code owner June 28, 2026 01:30
@github-actions github-actions Bot added documentation Improvements or additions to documentation project: amdsmi github actions Pull requests that update GitHub Actions code labels Jun 28, 2026
@therock-pr-bot

therock-pr-bot Bot commented Jun 28, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
🌿 Branch Name ✅ Pass —
📝 PR Title/Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ Unit Test

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@amd-juwillia
amd-juwillia force-pushed the users/juwillia/py-wheel-build branch 2 times, most recently from 32a3914 to a6f2850 Compare June 29, 2026 17:37
@marifamd
marifamd force-pushed the users/juwillia/py-wheel-build branch 2 times, most recently from 663a8b1 to eac9e6b Compare July 6, 2026 16:35
@marifamd
marifamd requested a review from geomin12 July 7, 2026 19:54

@geomin12 geomin12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems this is same as #7914 and #7912 , same comments apply here

but amdsmi code should be reviewed by amdsmi folks

@dmitrii-galantsev
dmitrii-galantsev changed the base branch from develop to users/juwillia/py-loader-dist-packages July 20, 2026 20:53
@dmitrii-galantsev
dmitrii-galantsev force-pushed the users/juwillia/py-wheel-build branch from eac9e6b to dfa7fc8 Compare July 22, 2026 00:11
@dmitrii-galantsev

dmitrii-galantsev commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Generated by Claude (AI assistant), reviewed by @dmitrii-galantsev.

Part of the ROCM-3941 chain: #7914 -> #7913 (this) -> #7912. Rebased onto the updated #7914; history rewritten and force-pushed, so please re-pull.

Fixes applied to the manylinux job:

  • runs-on: ubuntu-latest -> ubuntu-24.04 (style guide requires pinned runners).
  • Removed the redundant manual pip wheel invocation. The CMake python_wheel target is part of ALL (gated on BUILD_PYTHON_WHEEL), so the build already produces the wheel via its proper path (which runs disable_system_fallback.py). The job now just builds and asserts the .whl exists, instead of hand-rolling a second wheel that bypassed that step.
  • Split the single run: block into discrete steps (select interpreter, install prereqs, configure, build, verify) so a failure points at the right stage, per review feedback.
  • Dropped -DBUILD_TESTS=ON (the gate never runs the tests); consistent quoting.
  • CHANGELOG wording: "workflow" -> "job".

Update: rebased on the follow-up #7914 (which adds the RHEL CLI-shebang / interpreter-detection fix). No changes to this commit itself. CI green: Manylinux Gate, RHEL8, Debian10 and the wheel-build jobs all pass.

@dmitrii-galantsev
dmitrii-galantsev force-pushed the users/juwillia/py-wheel-build branch from dfa7fc8 to 4718bd1 Compare July 22, 2026 01:01
@dmitrii-galantsev
dmitrii-galantsev force-pushed the users/juwillia/py-wheel-build branch from 4718bd1 to 2122443 Compare July 22, 2026 01:08
@dmitrii-galantsev
dmitrii-galantsev force-pushed the users/juwillia/py-wheel-build branch from 2122443 to cccc84f Compare July 22, 2026 03:06
@dmitrii-galantsev
dmitrii-galantsev force-pushed the users/juwillia/py-wheel-build branch from cccc84f to 3eafae4 Compare July 22, 2026 04:49
marifamd added 7 commits July 24, 2026 09:02
…-3.8

- main() was annotated with list[str] (PEP 585), which is only valid at
  runtime on Python 3.9+. On the 3.6-3.8 interpreters AMD SMI still supports it
  raised TypeError: 'type' object is not subscriptable at import.
- The wheel build runs this tool under the system python, so an older default
  interpreter broke the build.
- Use typing.List[str], which works on every supported version.

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
- seven near-identical steps each cat one result log, which is noisy in
  the workflow and in the Actions log
- collapse them into a single step that prints each log inside a
  collapsible ::group:: block keyed by a readable label

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
- the packaging rework made the CLI import site-packages first and only
  fall back to share/amd_smi, reversing the priority from #3082
- on a multi-version ROCm host the CLI must load the amdsmi library it
  shipped with, not another version's copy earlier on sys.path
- resolve share/amd_smi (ROCM_PATH or CLI-relative) before importing, and
  fall back to site-packages only when no share copy exists

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
- sparse-checkout only projects/amdsmi and the workflows dir instead of
  the whole monorepo, so the checkout stays cheap
- keep each test-result dump as its own step so a single failure is
  directly attributable instead of buried in one grouped step
- resolve the project and runner script by their fixed sparse-checkout
  paths rather than a find plus existence guard
- drop the Uninstall step; the job runs in a --rm container that is
  discarded after the run
- note why the artifact glob matches the 99999 local version

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
- the upload feeds no downstream job; document that it exists for manual
  reviewer download so the step is not mistaken for dead weight

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
- the wheel-location check accepted any of site-packages, dist-packages or
  /opt/rocm, so it passed even when a system copy shadowed the pip install
  and never proved the pip module wins
- assert import amdsmi resolves under pip's reported install location and
  not the /opt/rocm system copy, so a coexisting system module fails the
  check instead of masking it
- document the CLI's share -> pip -> system resolution order, distinct from
  a user script where the pip install must win

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
- continue-on-error let every distro leg report success even when the
  package failed to build, install or import
- drop it so any failure on the self-hosted runner CI is visible; these
  runners are expected to be stable

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
@marifamd
marifamd force-pushed the users/juwillia/py-wheel-build branch from 6491aa1 to 9222b97 Compare July 24, 2026 14:04
marifamd and others added 3 commits July 24, 2026 09:26
- the check asserted the pip install wins, but the CI container and ROCm
  installs set PYTHONPATH=/opt/rocm/share/amd_smi, which always precedes
  site-packages, so import amdsmi resolved to the system copy and the
  assertion could never pass on RHEL/SLES/Ubuntu22
- run the check with PYTHONPATH cleared so it tests the real scripting
  scenario (a bare interpreter where pip must win), not the environment's
  path config

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
- Add a manylinux-build job to amdsmi-build.yml that builds the
  PyPI-ready wheel via cmake -DBUILD_PYTHON_WHEEL=ON inside the
  manylinux_2_28 container, alongside the existing build-and-test matrix.

Signed-off-by: Justin Williams <Justin.Williams@amd.com>
- sparse-checkout only projects/amdsmi and the workflows dir so the wheel
  gate does not clone the whole monorepo
- pip install the built wheel and import amdsmi, so the gate proves the
  wheel is installable and loads its bundled library rather than only
  checking that the .whl file exists

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
@marifamd
marifamd force-pushed the users/juwillia/py-wheel-build branch from 9222b97 to fa32a56 Compare July 24, 2026 14:31
Base automatically changed from users/juwillia/py-loader-dist-packages to develop July 27, 2026 00:08
The manylinux gate is internal CI infrastructure; the user-facing wheel
build (-DBUILD_PYTHON_WHEEL=ON) is already covered by the packaging
rework entry above it.

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
@marifamd
marifamd merged commit 6679d53 into develop Jul 27, 2026
32 of 33 checks passed
@marifamd
marifamd deleted the users/juwillia/py-wheel-build branch July 27, 2026 00:38
WBobby pushed a commit that referenced this pull request Jul 27, 2026
Reverts the manylinux wheel CI job (#7913) and the Python packaging
rework (#7914): flat loader, dist-packages install, and wheel build.
Restores the pre-rework loader in amdsmi_wrapper.py / tools/generator.py,
the pip-based DEBIAN/RPM install scriptlets, and setup.py.in; removes
pin_shebang.cmake, tools/disable_system_fallback.py, and
tests/python/test_abi_compat.py.

Accounts for changes that landed on develop after the rework merged:
- Keeps the libamd_smi.so.27 SONAME and its CHANGELOG entry from the
  27.0.0 version bump. The restored loader hardcoded the SONAME, so the
  literal is bumped from .so.26 to .so.27 in both generator.py and the
  regenerated wrapper to match AMDSMI_LIB_VERSION_MAJOR.
- Keeps the ras --cper --json no-entries fix (#8819) and its CHANGELOG
  entry; only the rework's own CHANGELOG entry is removed.

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
marifamd added a commit that referenced this pull request Jul 28, 2026
Reintroduces the manylinux wheel CI job (#7913) and the Python packaging
rework (#7914): flat loader, dist-packages install, and wheel build.
Combined here with the amd-smi CLI shebang fixes so the rework and its
follow-up corrections land as one reviewable change.

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
amd-josnarlo pushed a commit that referenced this pull request Jul 28, 2026
…trix (#7913)

- Add a manylinux-build job to amdsmi-build.yml that builds the
  PyPI-ready wheel via cmake -DBUILD_PYTHON_WHEEL=ON inside the
  manylinux_2_28 container, alongside the build-and-test matrix.
- sparse-checkout only projects/amdsmi and the workflows dir so the
  gate does not clone the whole monorepo.
- pip install the built wheel and import amdsmi so the gate proves the
  wheel is installable and loads its bundled library, not just that the
  .whl file exists.

---------

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Co-authored-by: Maisam Arif <Maisam.Arif@amd.com>
Co-authored-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
amd-josnarlo pushed a commit that referenced this pull request Jul 28, 2026
Reverts the manylinux wheel CI job (#7913) and the Python packaging
rework (#7914): flat loader, dist-packages install, and wheel build.
Restores the pre-rework loader in amdsmi_wrapper.py / tools/generator.py,
the pip-based DEBIAN/RPM install scriptlets, and setup.py.in; removes
pin_shebang.cmake, tools/disable_system_fallback.py, and
tests/python/test_abi_compat.py.

Accounts for changes that landed on develop after the rework merged:
- Keeps the libamd_smi.so.27 SONAME and its CHANGELOG entry from the
  27.0.0 version bump. The restored loader hardcoded the SONAME, so the
  literal is bumped from .so.26 to .so.27 in both generator.py and the
  regenerated wrapper to match AMDSMI_LIB_VERSION_MAJOR.
- Keeps the ras --cper --json no-entries fix (#8819) and its CHANGELOG
  entry; only the rework's own CHANGELOG entry is removed.

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
lamikr pushed a commit that referenced this pull request Jul 28, 2026
Relands the manylinux wheel CI job (#7913) and the Python packaging rework
(#7914) after they were reverted in #9339, together with the follow-up
amd-smi CLI shebang fixes so the rework and its corrections land as one
change.

Packaging rework (reintroduced):
- Install the amdsmi module into the system python's site-packages via
  install(DIRECTORY) instead of pip + a .pth file; drop the pip plumbing and
  python3-pip/setuptools/wheel deps from the DEBIAN/RPM scriptlets.
- Replace the ROCm-path-walking resolver in amdsmi_wrapper.py (and
  tools/generator.py, regenerated in lockstep) with a flat loader:
  AMDSMI_LIB_OVERRIDE, a bundled libamd_smi_python.so, then the system
  libamd_smi.so; a _MissingLibrary sentinel keeps import tolerant.
- Add BUILD_PYTHON_WHEEL (default OFF): build a SONAME-isolated
  libamd_smi_python.so and a wheel that disables the loader's system fallback.
- Stage the module under share/amd_smi for ROCM_PATH consumers and TheRock.
- Add test_abi_compat.py and the manylinux wheel CI job.

CLI shebang fixes:
- Use a portable "#!/usr/bin/env python3" shebang for the amd-smi CLI so it
  runs on relocatable installs with no /usr/bin/python3 (TheRock containers)
  and on wheel runners where /usr/bin/python3 lacks the amdsmi module.
- Stop pinning the CLI shebang to a fixed interpreter: remove pin_shebang.cmake
  and the AMDSMI_CLI_SHEBANG_INTERP derivation. The pinned absolute path became
  a hard RPM "Requires:" (e.g. /usr/libexec/platform-python3.6) that RHEL10 and
  SLES16 could not satisfy; the RPM now depends only on python(abi).
- Resolve the env-form shebang in the install-verify harness instead of running
  "/usr/bin/env -c".

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
marifamd added a commit that referenced this pull request Aug 8, 2026
Relands the manylinux wheel CI job (#7913) and the Python packaging rework
(#7914) after they were reverted in #9339, together with the follow-up
amd-smi CLI shebang fixes so the rework and its corrections land as one
change.

Packaging rework (reintroduced):
- Install the amdsmi module into the system python's site-packages via
  install(DIRECTORY) instead of pip + a .pth file; drop the pip plumbing and
  python3-pip/setuptools/wheel deps from the DEBIAN/RPM scriptlets.
- Replace the ROCm-path-walking resolver in amdsmi_wrapper.py (and
  tools/generator.py, regenerated in lockstep) with a flat loader:
  AMDSMI_LIB_OVERRIDE, a bundled libamd_smi_python.so, then the system
  libamd_smi.so; a _MissingLibrary sentinel keeps import tolerant.
- Add BUILD_PYTHON_WHEEL (default OFF): build a SONAME-isolated
  libamd_smi_python.so and a wheel that disables the loader's system fallback.
- Stage the module under share/amd_smi for ROCM_PATH consumers and TheRock.
- Add test_abi_compat.py and the manylinux wheel CI job.

CLI shebang fixes:
- Use a portable "#!/usr/bin/env python3" shebang for the amd-smi CLI so it
  runs on relocatable installs with no /usr/bin/python3 (TheRock containers)
  and on wheel runners where /usr/bin/python3 lacks the amdsmi module.
- Stop pinning the CLI shebang to a fixed interpreter: remove pin_shebang.cmake
  and the AMDSMI_CLI_SHEBANG_INTERP derivation. The pinned absolute path became
  a hard RPM "Requires:" (e.g. /usr/libexec/platform-python3.6) that RHEL10 and
  SLES16 could not satisfy; the RPM now depends only on python(abi).
- Resolve the env-form shebang in the install-verify harness instead of running
  "/usr/bin/env -c".

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation github actions Pull requests that update GitHub Actions code Not ready to Review organization: ROCm project: amdsmi

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants