[AMD] Fix aiter import failure in ROCm Docker images#22363
Open
vvagaytsev wants to merge 1 commit intosgl-project:mainfrom
Open
[AMD] Fix aiter import failure in ROCm Docker images#22363vvagaytsev wants to merge 1 commit intosgl-project:mainfrom
aiter import failure in ROCm Docker images#22363vvagaytsev wants to merge 1 commit intosgl-project:mainfrom
Conversation
`pip install -e .` in strict editable mode registers a custom import finder at the end of `sys.meta_path`. Since `WORKDIR` is `/sgl-workspace`, the default `PathFinder` finds the git repo directory `/sgl-workspace/aiter/` (no `__init__.py`) via cwd first and resolves it as a namespace package, shadowing the editable finder that has the correct path mapping. Switch to `pip install --config-settings editable_mode=compat -e .` which writes a `.pth` path entry instead of a finder, matching the behavior of the previous `setup.py develop` approach.
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the pip install commands in docker/rocm.Dockerfile to use --config-settings editable_mode=compat for editable installations. The review comments highlight that the sh -c wrappers are redundant and potentially unsafe due to unquoted variable expansion, and suggest that the manual PYTHONPATH export may no longer be necessary. However, as these comments lack specific code suggestions to address the identified risks, I have no further feedback to provide.
Author
|
/tag-and-rerun-ci |
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
This should fix #22279.
Problem
The
v0.5.10-rocm*-mi35xDocker images fail on startup with error (whenSGLANG_USE_AITER=1):Both
rocm700androcm720images are affected in 0.5.10, because starting from #19203 (it was merged after 0.5.9 release) the images use the samerocm.Dockerfile.Root Cause
Commit 2e76824 (see #20195) changed
aiterinstallation frompython setup.py developtopython setup.py build_ext --inplace+pip install -e ..The old
setup.py developused the egg-link mechanism, which added/sgl-workspace/aiterdirectly tosys.pathvia a.pthfile. Modernpip install -e .(strict editable mode) instead registers a custom import finder appended to the end ofsys.meta_path.Since the image's
WORKDIRis/sgl-workspace, the defaultPathFinder(which runs before the editable finder) discovers/sgl-workspace/aiter/- the git repo root directory - viacwd('' insys.path). Because the repo root has no__init__.py, Python resolves it as a namespace package and stops searching. The editable finder, which has the correct mapping (aiter → /sgl-workspace/aiter/aiter), is never consulted.The result:
aiterimports as an empty namespace package (__file__=None, loader=None), and none of the actual package contents (includingdynamic_per_tensor_quant) are available.Modifications
Use
pip install --config-settings editable_mode=compat -e .instead ofpip install -e .. Compat editable mode writes a simple.pthpath entry (/sgl-workspace/aiter) intosite-packages, whichPathFinderprocesses before falling back tocwd. This makesPathFinderfind/sgl-workspace/aiter/aiter/__init__.pycorrectly — the same reliable mechanism thatsetup.py developused previously.Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci