Repository navigation
[ROCM-3941] Python packaging rework: flat loader, dist-packages install, wheel build - #7822
Closed
amd-juwillia wants to merge 1 commit into
Closed
amd-juwillia wants to merge 1 commit into
amd-juwillia wants to merge 1 commit into
Conversation
This was referenced Jun 25, 2026
amd-juwillia
force-pushed
the
juwillia/py-loader-dist-packages
branch
from
June 25, 2026 18:46
e644932 to
a51c7a4
Compare
…ll, wheel build - Replace the ROCm-path-walking resolver in amdsmi_wrapper.py (and tools/generator.py, regenerated in lockstep) with a flat 3-case loader: AMDSMI_LIB_OVERRIDE, a bundled libamd_smi_python.so, then system libamd_smi.so; a _MissingLibrary sentinel keeps import tolerant. - Install the amdsmi module directly into the system python's site-packages via install(DIRECTORY) instead of pip and a .pth file; drop pip plumbing from the DEBIAN/RPM post/pre scripts and remove the python3-pip/setuptools/wheel package dependencies and setup.py.in. - Add BUILD_PYTHON_WHEEL (default OFF, requires BUILD_SHARED_LIBS): build a SONAME-isolated libamd_smi_python.so via -Bsymbolic-functions and a python_wheel target that flips the loader's system fallback off with tools/disable_system_fallback.py so the wheel never loads a system lib. - Pin the amdsmi_cli shebang to /usr/bin/python3, drop the dead cpu-handles guard, and strip the system library in Release builds. Signed-off-by: Justin Williams <Justin.Williams@amd.com>
amd-juwillia
force-pushed
the
juwillia/py-loader-dist-packages
branch
from
June 26, 2026 17:25
e91b0f8 to
50e158f
Compare
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
This was referenced Jun 28, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
amd-smishipped its Python module by having the system.deb/.rpmpostinst callpip installand drop anamdsmi.pth, with a ~200-line ROCm-path-walking loader. This drops allpip/.pthplumbing, installs the module directly into the system interpreter'ssite-packages, and adds an opt-in SONAME-isolated wheel build so a PyPI wheel can coexist in-process with the system library.Technical Details
Loader (
py-interface/amdsmi_wrapper.py,tools/generator.py— regenerated in lockstep):AMDSMI_LIB_OVERRIDE, a bundledlibamd_smi_python.so, then systemlibamd_smi.so; a_MissingLibrarysentinel keeps import tolerant.Install layout (
py-interface/CMakeLists.txt):/usr/bin/python3for its real on-sys.pathdir andinstall(DIRECTORY ...)the module there, excludinglibamd_smi*.so.Packaging (
DEBIAN/postinst.in,prerm.in,RPM/post.in,preun.in,CMakeLists.txt):.pth; drop thepython3-pip/setuptools/wheeldeps andsetup.py.in.Wheel build (
src/CMakeLists.txt,py-interface/CMakeLists.txt,tools/disable_system_fallback.py,CMakeLists.txt):BUILD_PYTHON_WHEEL(default OFF, requiresBUILD_SHARED_LIBS): a SONAME-isolatedlibamd_smi_python.solinked-Bsymbolic-functions, and apython_wheeltarget that flips_AMDSMI_ALLOW_SYSTEM_FALLBACKtoFalsein the staged wrapper so the wheel never loads a system lib.CLI / build (
amdsmi_cli/amdsmi_cli.py,amdsmi_init.py,src/CMakeLists.txt):/usr/bin/python3; drop a dead guard; strip the system lib in Release.JIRA ID
Resolves ROCM-3941
Test Plan
python3 projects/amdsmi/tools/build_wheel.py --project-dir projects/amdsmi --no-repair(mirrors the manylinux CI).Test Result
build_wheel.pybuilds clean; the wheel bundles onlylibamd_smi_python.soand ships_AMDSMI_ALLOW_SYSTEM_FALLBACK = False.import amdsmi+amdsmi_init()succeed via/usr/bin/python3with no.pth/pip across the AMD CI images.Submission Checklist