Repository navigation
feat(amdsmi): [ROCM-3941] Add SONAME conflict test and build harness - #7912
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
3c25834 to
eaa8ad4
Compare
7f80227 to
f2a2de4
Compare
geomin12
left a comment
There was a problem hiding this comment.
comments regards to yml. for a workflow github action step, it should be very clear on what the failure is based on what was run. we shouldn't have to parse through a lot of logs to figure out "oh it was an install error"
i would prefer amdsmi folks to review the amdsmi related code changes
eac9e6b to
dfa7fc8
Compare
f2a2de4 to
ba6e095
Compare
Top of the ROCM-3941 chain: #7914 -> #7913 -> #7912 (this). Rebased onto the updated #7913; history rewritten and force-pushed, so please re-pull. Fixes applied to
Update: rebased on the follow-up #7914. The install-verify interpreter fix now lives in #7914 (the base layer) so every stacked PR's CI picks it up; this commit retains only its original |
dfa7fc8 to
4718bd1
Compare
ba6e095 to
02ec224
Compare
4718bd1 to
2122443
Compare
02ec224 to
3102982
Compare
2122443 to
cccc84f
Compare
3102982 to
2d1b4b0
Compare
cccc84f to
3eafae4
Compare
2d1b4b0 to
fd22606
Compare
07a1bd3 to
6491aa1
Compare
e95d2a4 to
da3a3e3
Compare
6491aa1 to
9222b97
Compare
da3a3e3 to
067bbc8
Compare
9222b97 to
fa32a56
Compare
067bbc8 to
5521e21
Compare
b422d2c to
a65f95a
Compare
6258090 to
af25984
Compare
af25984 to
6434cec
Compare
- Add run_amdsmi_pkg_conflict_test.py asserting the system libamd_smi.so and the wheel libamd_smi_python.so keep distinct SONAMEs so they never double-load in one process. - Extend run_amdsmi_build.py for the build/install/verify harness. Signed-off-by: Justin Williams <Justin.Williams@amd.com>
6434cec to
b859b76
Compare
…rework (#9033) ## Description Correctness and coverage follow-ups to the AMD SMI Python packaging rework (relanded in #9340). This branch is the packaging-hardening layer on top of the SONAME conflict test + build harness (#7912). Rebased onto `develop` after #7912 and #9340 merged; the now-upstream shebang and self-locate-loader commits were dropped, and the surviving relocatable-loader change was reconciled with develop's version (keeps develop's `len(parents) > 3` guard and adds a `try/except OSError` fall-through so a present-but-unloadable relocatable library does not shadow the system SONAME). ### Loader / wrapper - Fall through to the system library when the relocatable TheRock library exists but fails to load (missing deps). - Dedupe the wrapper `_libraries` init (the ctypesgen preamble already initializes it). - Read and write the staged wrapper as UTF-8 in `disable_system_fallback.py` so the wheel flag flip is deterministic regardless of build locale; make the staging idempotent so a rebuild that reuses the flipped copy succeeds. ### Packaging correctness - Stop the RPM from co-owning system Python directories. - Restrict package `preun`/`prerm` cleanup to a full erase (not upgrades). - Quote the install prefix when writing `ld.so.conf.d` on RPM. - Pin permissions on the installed Python module; make the operational log group-writable (not world-writable) and stop the logger from restoring world-writable permissions. - Only strip release libraries when a strip tool is available; fail the build when the system `python3` cannot be detected. ### Wheel build - Build one wheel per platform (not per interpreter), tag it `manylinux_2_28`, and verify the bundled `.so`. - Use a clean PyPI version and expose the commit as metadata. - Reject regenerating the wrapper against the wheel library; skip the system site-packages install for wheel builds. ### Tests - Loader-contract tests in `test_abi_compat.py`: preferred bundled `.so`, wheel refuses system fallback when the bundle is missing, the relocatable OSError fall-through, and an ambiguous-wrapper hard failure. Assert the idempotent no-op in the fallback double-run guard. - Guard against drift between the two installed module copies; install the dual-copy runner so its guard tests run in CI; run the wheel install-location check without a GPU. ### Verification - `cmake -DBUILD_TESTS=ON` + `make`: 0 errors, `libamd_smi.so.27` + `amdsmitst` built. - `test_abi_compat.py` (10) and `test_dual_copy_guard.py` (4): all pass. ## JIRA ID ROCM-3941 --------- Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
…7912) Add tests/run_amdsmi_pkg_conflict_test.py, which asserts that two AMD SMI packages built with different SOVERSIONs do not co-own the same libamd_smi.so.<major>, so installing one over the other cannot silently break the other's loader. Wire the ABI-compat output into the build harness: summarize_results in run_amdsmi_build.py now scans abi_compat_output.txt alongside the existing integration/unit/perf test outputs so an ABI regression surfaces in the CI summary. Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
…rework (#9033) ## Description Correctness and coverage follow-ups to the AMD SMI Python packaging rework (relanded in #9340). This branch is the packaging-hardening layer on top of the SONAME conflict test + build harness (#7912). Rebased onto `develop` after #7912 and #9340 merged; the now-upstream shebang and self-locate-loader commits were dropped, and the surviving relocatable-loader change was reconciled with develop's version (keeps develop's `len(parents) > 3` guard and adds a `try/except OSError` fall-through so a present-but-unloadable relocatable library does not shadow the system SONAME). ### Loader / wrapper - Fall through to the system library when the relocatable TheRock library exists but fails to load (missing deps). - Dedupe the wrapper `_libraries` init (the ctypesgen preamble already initializes it). - Read and write the staged wrapper as UTF-8 in `disable_system_fallback.py` so the wheel flag flip is deterministic regardless of build locale; make the staging idempotent so a rebuild that reuses the flipped copy succeeds. ### Packaging correctness - Stop the RPM from co-owning system Python directories. - Restrict package `preun`/`prerm` cleanup to a full erase (not upgrades). - Quote the install prefix when writing `ld.so.conf.d` on RPM. - Pin permissions on the installed Python module; make the operational log group-writable (not world-writable) and stop the logger from restoring world-writable permissions. - Only strip release libraries when a strip tool is available; fail the build when the system `python3` cannot be detected. ### Wheel build - Build one wheel per platform (not per interpreter), tag it `manylinux_2_28`, and verify the bundled `.so`. - Use a clean PyPI version and expose the commit as metadata. - Reject regenerating the wrapper against the wheel library; skip the system site-packages install for wheel builds. ### Tests - Loader-contract tests in `test_abi_compat.py`: preferred bundled `.so`, wheel refuses system fallback when the bundle is missing, the relocatable OSError fall-through, and an ambiguous-wrapper hard failure. Assert the idempotent no-op in the fallback double-run guard. - Guard against drift between the two installed module copies; install the dual-copy runner so its guard tests run in CI; run the wheel install-location check without a GPU. ### Verification - `cmake -DBUILD_TESTS=ON` + `make`: 0 errors, `libamd_smi.so.27` + `amdsmitst` built. - `test_abi_compat.py` (10) and `test_dual_copy_guard.py` (4): all pass. ## JIRA ID ROCM-3941 --------- Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Motivation
Guard the SONAME-distinctness invariant that lets the system and wheel libraries coexist without double-loading. (The loader/ABI-parity test ships with the loader change in #7914.)
Technical Details
Test (
tests/run_amdsmi_pkg_conflict_test.py):libamd_smi.soand the wheellibamd_smi_python.sokeep distinct SONAMEs so they never double-load in one process.Harness (
tests/amdsmi_build/run_amdsmi_build.py):JIRA ID
Resolves ROCM-3941
Test Plan
python3 projects/amdsmi/tests/run_amdsmi_pkg_conflict_test.pyTest Result
-DBUILD_PYTHON_WHEEL=ONbuild.Submission Checklist