Repository navigation
build(wheel): build published wheels on manylinux_2_28 - #852
Conversation
jhchouuu
left a comment
There was a problem hiding this comment.
Tested the wheels from this branch's nightly run (40463982332). The PR does what #826 asks, and I found no regression from it. There are three suggestions below.
Wheel checks (all 4 artifacts)
- Tags are
manylinux_2_27+manylinux_2_28. - The wheel's own ELFs need at most GLIBC 2.27, GLIBCXX 3.4.22 and CXXABI 1.3.11, so EL8's GCC 8 libstdc++ is enough.
- I scanned each member's DT_VERNEED. A plain
auditwheel showon a dev box reportslinux_x86_64only because it also walks the host's Ubuntu-built ROCm libs, which the repair step excludes.
- I scanned each member's DT_VERNEED. A plain
- ROCm, libdrm and libnuma are not vendored. RUNPATH keeps
$ORIGIN:/opt/rocm/lib, and nolibmori*is duplicated under.libs. tools/verify_install.py --wheelpasses for all four.- Compared with the published
1.2.5.dev20261025, no file is lost. The 54 vendored libs (gRPC, absl, protobuf, re2, upb, OpenSSL) take it from 9 to 16 MiB compressed.
Runtime: amd_mori_nightly cp312 on 8× MI355X
Containers used the ci_run.sh flags, and the test steps followed test-wheel / test-pypi-wheel.
| Ubuntu 24.04, ROCm 7.2.4, torch 2.10, no system gRPC | AlmaLinux 8 (glibc 2.28), ROCm 7.2.4 RPMs, torch 2.14.1+rocm7.2 (pip) | |
|---|---|---|
install + verify_install.py + imports |
✅ | ✅ |
mori.umbp on the vendored gRPC, pytest tests/python/umbp/ |
✅ 105 passed | ✅ 105 passed |
pytest tests/python/ops/test_dispatch_combine_intranode.py |
✅ 359 passed | ✅ 359 passed |
EPv2 bench_ep.py with CHECK=1 (hip, bf16, EP8) |
✅ | ✅ |
pytest tests/python/shmem/test_api.py |
❌ [2], [4], [8] SIGSEGV |
same |
- The shmem failure is not caused by this PR. The published
1.2.5.dev20261025wheel fails the same three cases in the same container. It looks specific to the test machine, since this test passes in CI. - The cp312 wheel built against ROCm 7.14 loads and runs on ROCm 7.2.4.
Suggestions
- Vendored OpenSSL 1.1.1k.
- gRPC is built with
gRPC_SSL_PROVIDER=package, so auditwheel pulls EL8'slibssl/libcrypto1.1.1k into the wheel. - The 1.1.1 series is EOL. A vendored copy cannot be patched by system updates and may get flagged by scanners.
- Building gRPC with
gRPC_SSL_PROVIDER=module(BoringSSL) would avoid shipping it.
- gRPC is built with
Dockerfile.manylinuxGPU_ARCHSdefaults togfx942 gfx950.- On the 7.14 lane the device libraries are per-arch packages, and UMBP's
device_gather.hipis compiled at build time forGPU_TARGETS. - A release build with setup.py's full list (
gfx942;gfx950;gfx1250) would therefore lack the gfx1250 device libs.amdrocm-core-devel7.14-gfx1250exists in the repo. - I haven't tried that build. Nightly passes only gfx942/gfx950, so CI would not catch it.
- On the 7.14 lane the device libraries are per-arch packages, and UMBP's
- Document
gcc-c++for RHEL.- mori JIT-compiles every kernel with hipcc at run time, which needs the C++ standard headers. ROCm's RPMs don't pull them in.
- On EL8 without
gcc-c++/libstdc++-devel, every compile fails withCould not find standard C++ header 'cmath', andtest_dispatch_combine_intranode.pythen hangs until its timeout instead of failing. - A line in the README install section would help RHEL users.
Seen along the way, not from this PR
- mori
dlopens the unversionedlibmlx5.so. With only the runtimeibverbs-providers(libmlx5.so.1) installed it logsMLX5 device detected but libmlx5.so not available at runtime. - With torch 2.14,
torch.distributed._symmetric_memory.empty()returnsbase + 0x2400.Communicator.register_external_windowthen fails withccoMemImport: externalPtr ... is not the allocation base ... (offset imports unsupported). This does not happen with torch 2.10.
Not covered
I did not test:
- RHEL 9, or Ubuntu 22.04 with py3.12;
- cp310 at runtime;
- internode, IO/RDMA;
- MI300X.
🤖 Generated with Claude Code
|
Follow-up to my review above: nightly never runs the wheels on glibc 2.28.
Suggestion: a cheap 2.28 runtime check in PY=/opt/python/cp312-cp312/bin/python # the lane's interpreter
$PY -m pip install /tmp/dist-pypi/*.whl
$PY -c "import mori, mori.cco.cco, mori.io, mori.shmem, mori.umbp"
$PY -c "import ctypes, glob, os, mori; [ctypes.CDLL(p, os.RTLD_NOW) for p in glob.glob(os.path.dirname(mori.__file__) + '/lib*.so')]"
🤖 Generated with Claude Code |
- Build gRPC against its bundled BoringSSL. With the system provider, auditwheel vendored EL8's end-of-life OpenSSL 1.1.1 into the wheel, where no system update can patch it. - nightly: install the PyPI wheel in the EL8 build image and load every packaged library with RTLD_NOW. The test jobs run on Ubuntu only, and auditwheel's check is static and skips the excluded ROCm libraries. - README: RHEL needs gcc-c++ for the runtime kernel JIT; ROCm's RPMs do not pull in the C++ standard headers. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Thanks for the review! Addressed in 4512706:
|
auditwheel also added manylinux_2_27, the oldest tag the current symbols happen to meet, so the tag would move with the code. --only-plat keeps it at the policy the build image targets. Co-authored-by: Cursor <cursoragent@cursor.com>
jhchouuu
left a comment
There was a problem hiding this comment.
Thanks for the quick follow-up. 4512706 addresses everything from my first review, and I re-tested the wheels from its nightly run (40621740476).
Everything works. One packaging issue should be fixed before this publishes to PyPI: the vendored third-party licenses. The rest are suggestions.
Testing (amd_mori_nightly cp310 / cp312, i.e. the files that get published)
Each wheel was installed with pip from a uv-managed CPython in each container, so pip applies its own glibc check.
| Environment | glibc | Result |
|---|---|---|
| Amazon Linux 2 (negative control) | 2.26 | pip rejects both wheels ("not a supported wheel on this platform") ✅ |
| Ubuntu 18.04 | 2.27 | Installs. ldd -r reports 0 symbol-version errors on every ELF; all 54 vendored libs load with RTLD_NOW ✅. No GPU run: no ROCm 7 distro has glibc 2.27. |
| Debian 10 | 2.28 | Same as 18.04 ✅ |
AlmaLinux 8 + ROCm 7.2.4 runtime RPMs only (no gcc-toolset, no /usr/local gRPC) |
2.28 | Every mori/**.so and vendored lib loads with RTLD_NOW. umbp_master and umbp_standalone_server start on the vendored gRPC. UMBP pytest passes ✅ |
| AlmaLinux 8 + torch 2.14.1+rocm7.2, 8× MI355X | 2.28 | UMBP pytest 105 passed, test_dispatch_combine_intranode.py 359 passed, EPv2 bench_ep.py CHECK=1 passed ✅ |
- In all of these, the only libraries the loader cannot find are the excluded ROCm/libdrm/libnuma ones.
- The
manylinux_2_27tag is correct. The 2.27 floor comes frommemfd_createinlibmori_application.so/libmori_cco.so, and nothing needs 2.28. - The vendored
libssl/libcryptoare now BoringSSL; no OpenSSL 1.1.1k is left. - Not caused by this PR:
tests/python/shmem/test_api.py[2,4,8]SIGSEGV in my environments. The previous published nightly wheel does the same, and CI passes it.umbp_mastersegfaults when its listen address cannot be bound:master_server.cpp:1015callsserver_->Wait()on a nullBuildAndStart()result.
Needs a fix: vendored third-party code ships without its license notices
amd_mori_nightly.libs/now carries 54 third-party libraries:- abseil (Apache-2.0);
- gRPC, gpr and address_sorting (Apache-2.0; gRPC also ships a
NOTICE.txt); - protobuf, re2 and upb (BSD-3-Clause);
- BoringSSL
libssl/libcrypto(OpenSSL/ISC for the snapshot gRPC 1.51 pins); - c-ares (MIT), linked statically into
libgrpc.
dist-info/licenses/contains only mori'sLICENSE, and METADATA saysLicense-Expression: MIT.- These licenses require their copyright notice / license text (and Apache's NOTICE) to travel with binary redistributions, so every nightly upload after merge would ship without them. This is new with this PR: the Ubuntu-built wheels linked the system gRPC and vendored nothing.
- Inside the image the texts are gone too, because
docker/Dockerfile.manylinux:91deletes/tmp/grpc. - Suggestion:
- copy gRPC's
LICENSE+NOTICE.txtand theLICENSEof each linkedthird_party/*submodule (abseil-cpp, protobuf, re2, upb, address_sorting, cares, boringssl) to a fixed directory before thatrm -rf; - have
tools/build_manylinux_wheel.pyadd them under<dist-info>/licenses/with RECORD rows (_replace_memberscurrently only swaps existing members); - widen
License-Expressionto cover the bundled code.
- copy gRPC's
Suggestions (non-blocking)
-
gRPC v1.51.1 (
Dockerfile.manylinux:24) has public DoS advisories:- CVE-2023-1428 (≥1.51.0, <1.53.0: crafted headers abort the C++ core);
- CVE-2023-33953 (<1.53.2: HPACK parser memory/CPU);
- CVE-2023-4785 (TCP server DoS).
UMBP serves plaintext gRPC from
peer_service.cpp:513(inside the process that importsmori.umbp),master_server.cpp:1012andstandalone_server.cpp:508. With the library now frozen inside the wheel, a distro update can no longer patch it. v1.54.3 still pins protobuf 21.12 (the 3.21 line), so the reason on line 23 still holds. -
BoringSSL symbols are unversioned.
libcrypto-*.soexports ~2.4k OpenSSL-named symbols without symbol versions, andlibssl-*.sohas noDT_NEEDEDonlibcrypto.- With
LD_PRELOADof the systemlibssl(1.1 on EL8, 3 on Ubuntu 24.04),LD_DEBUG=bindingsshowslibgrpc'sSSL_CTX_new/SSL_newbinding to the system OpenSSL instead. - It is harmless today: UMBP only uses insecure credentials. Python's
ssl/hashlibalso work afterimport mori.umbp, since extensions loadRTLD_LOCAL. - Still, linking gRPC + BoringSSL statically into the UMBP binaries with
-Wl,--exclude-libs,ALL(orBORINGSSL_PREFIX) would remove the hazard and most of the 54 vendored files.
-
No gfx1250 code in the published wheels (pre-existing).
nightly.yml:97still exportsMORI_GPU_ARCHS='gfx942;gfx950', so UMBP's ahead-of-timeGatherFragmentsKernel(device_gather.hip) has no gfx1250 code object.- On gfx1250 it falls back to blocking
hipMemcpy: correct, but slower. - Given your note that a
gfx942;gfx950;gfx1250build works in this image, consider adding gfx1250 here, or state that published wheels deliberately leave it out.
-
setup.py:737doesn't pass-DPYTHON_EXECUTABLE={sys.executable}.src/pybind/CMakeLists.txttherefore takes the firstpython3on PATH, which in this image is always cp312 (Dockerfile.manylinux:95).build_manylinux_wheel.pyworks around it with PATH andMORI_PYBUILD_DIR. A plain/opt/python/cp310-cp310/bin/pip wheel .in the image would compile the pybind modules against 3.12 headers.- Passing the interpreter would make the workaround unnecessary.
-
build_manylinux_wheel.py:86isolates only the CMake tree.- setuptools still uses the shared in-tree
build/lib.linux-x86_64-cpython-3XX, so running the documented command on a checkout that already had a devpip install .can package stale extensions. - Example:
mori_torch_symm*.sobuilt against libtorch makesauditwheel repairfail with a confusing missing-library error. - CI is unaffected (clean checkout). A separate
--build-base, or a note in the docstring, would cover local use.
- setuptools still uses the shared in-tree
🤖 Generated with Claude Code
umbp_common now links gRPC's unsecure libraries, but the distributed tests could not see its gRPC targets and fell back to find_library(grpc++), so every test loaded both the secure and the unsecure copy of gRPC. They now run their own find_package(gRPC CONFIG) and make the same choice. Co-authored-by: Cursor <cursoragent@cursor.com>
The KIWI bindings module never links libpython, and the manylinux interpreters used for the published wheels do not ship one. Match the other mori pybind modules (#852).
Fixes #826. Wheels were built in the Ubuntu CI images and retagged from
auditwheel show, so cp310/cp312 required glibc 2.35/2.39, ruling outRHEL 8/9 and Ubuntu 22.04.
docker/Dockerfile.manylinux(manylinux_2_28 + ROCm + gRPC) andtools/build_manylinux_wheel.py, which runsauditwheel repair:ROCm, libdrm and libnuma stay external, UMBP's gRPC is vendored.
libmori_collective, missing libdl formori_jit, a libpythonrequirement, gRPC under /usr/local.
Testing: nightly test passed