Repository navigation
fix(offload): create the shared host regions through libc where Python has no os.memfd_create - #118
Merged
Merged
Conversation
…n has no os.memfd_create A Python built against a glibc older than 2.27, as conda builds on its 2.17 sysroot, leaves out os.memfd_create even though the running glibc and kernel provide it; per-host weight sharing then failed on its first region.
1 of 8 tasks
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.
🗂️ PR Category
📝 Description
Rank-shared host weights (
offload_host_weight_sharingother thanoff) back each shared region with a memfd fromos.memfd_create. CPython only defines that function when the glibc it was built against hasmemfd_create(2.27+), and conda builds Python on a glibc 2.17 sysroot. A conda Python, as some vendor PyTorch images ship under/opt/conda, therefore has noos.memfd_createeven on a host whose glibc and kernel provide it, and the first shared region failed every rank:Without
os.memfd_create, the region is now created by the running glibc'smemfd_createthroughctypes, with the sameMFD_CLOEXECflag. A failure raisesOSErrorwith its errno, so the existingENOSPChandling (the chunk stays rank-private) applies unchanged. A Python that hasos.memfd_createtakes the same path as before.Verified on a conda Python 3.12.11 on glibc 2.39: the region is a close-on-exec
/memfd:magi_offload_*file thatposix_fallocatesizes. The newtest_a_python_without_os_memfd_create_still_creates_a_memfddeletesos.memfd_createand checks the same.ComfyUI merged the same fallback (Comfy-Org/ComfyUI#17386); vLLM has one under review (vllm-project/vllm#69731).