Skip to content

fix(pack): preserve HIP CuPy when installing Ray - #414

Merged
thxCode merged 2 commits into
mainfrom
fix/rocm-vllm-cupy
Nov 5, 2026
Merged

thxCode merged 2 commits into
mainfrom
fix/rocm-vllm-cupy

Conversation

@thxCode

@thxCode thxCode commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Pack run 41944899716 stopped at the final-image check because Ray installation added cupy-cuda12x over the base image's HIP CuPy. Both distributions remained installed, and cupy.cuda.runtime.is_hip became false.

Remove the cgraph extra from the ROCm recipe while retaining Ray 2.54.0 and its client/default extras. In this pinned Ray version, cgraph's only dependency is CUDA CuPy; the graph code is included in the Ray wheel without selecting the extra. The base image continues to supply HIP CuPy. This applies to both ROCm runtime lines in the shared recipe.

Add an offline dependency-resolution regression using reduced local wheel metadata and the recipe's actual requirements. It preserves the HIP distribution and client/default dependencies, and its negative case confirms that adding cgraph reintroduces CUDA CuPy.

Validation: the new regression failed against the original recipe and passed after the change. Full pytest with the pinned auto-sync tools passed on macOS (1365 passed, 17 skipped), including the 41 ROCm helper and resolver tests; all-file hooks, strict MkDocs, and Python distribution build passed. Dockerfile static checking could not finish because the local DockerHub credentials are expired, including when retried with a temporary anonymous configuration.

No rebuilt service image or GPU execution has been validated. After merge, a new Pack invocation must use the updated source revision; rerunning the original invocation retains its old recipe.

Relates #413.

Signed-off-by: thxCode <thxcode0824@gmail.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the ray[cgraph] dependency from the ROCm Dockerfile to prevent CUDA CuPy from overwriting the base image's HIP CuPy, and adds a test to verify this dependency resolution. The feedback suggests specifying UTF-8 encoding and normalizing line endings when reading the Dockerfile in the test to avoid potential cross-platform compatibility issues.

_wheel(tmp_path, "grpcio", "1.78.0")
_wheel(tmp_path, "colorful", "0.6.0")

recipe = (ROOT / "pack/rocm/Dockerfile.vllm").read_text()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Reading the Dockerfile without specifying an encoding can lead to UnicodeDecodeError on platforms where the default encoding is not UTF-8 (such as Windows), especially since the Dockerfile contains non-ASCII characters (like the em-dash —— on line 27). Additionally, parsing the file using split strings with \n will fail if the file is checked out with CRLF (\r\n) line endings. Specifying encoding="utf-8" and normalizing line endings resolves these cross-platform compatibility issues.

Suggested change
recipe = (ROOT / "pack/rocm/Dockerfile.vllm").read_text()
recipe = (ROOT / "pack/rocm/Dockerfile.vllm").read_text(encoding="utf-8").replace("\r\n", "\n")

@thxCode thxCode Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted the encoding part: forcing an ASCII locale reproduced two UnicodeDecodeError failures, and an explicit UTF-8 read makes both existing tests pass; the encoding fixup is now pushed as d9e69acd4cb95ea87fd0f7e765b9ae7f6c3885b0. The CRLF claim is a false positive: default text reads normalize newlines, and the same tests passed against a CRLF fixture under the ASCII locale without replace(), so that suggestion remains unimplemented for reviewer judgment.

Signed-off-by: thxCode <thxcode0824@gmail.com>
@thxCode

thxCode commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Review follow-up: read 1 top-level review, 1 inline thread, 0 ordinary PR comments, and 0 suppressed findings. The top-level review summarizes the same inline finding; the inline comment contains two independently verified claims.

Item Outcome
C1a: encoding Confirmed engineering issue. With LC_ALL=C LANG=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0, both existing resolver tests failed with UnicodeDecodeError while reading the actual Dockerfile. The change in d9e69acd4cb95ea87fd0f7e765b9ae7f6c3885b0 explicitly reads UTF-8, and the same tests now pass.
C1b: CRLF False positive. Python's default text reads normalize newlines, so the existing split expressions already accept CRLF. Both existing resolver tests also passed against a CRLF Dockerfile fixture under the ASCII locale, without an explicit replacement.

Validation: both resolver cases passed under the forced ASCII locale, and both passed again against the CRLF Dockerfile fixture. Full pytest with the pinned auto-sync tools passed on macOS (1365 passed, 17 skipped); all-file hooks passed, and two make build runs produced stable generated metadata with no further tracked changes.

No upgrade-compatibility findings or pending compatibility decisions were identified. This follow-up changes one test-file read.

The fixup d9e69acd4cb95ea87fd0f7e765b9ae7f6c3885b0 is now pushed to the PR branch. The mixed thread remains open for reviewer judgment on the unimplemented CRLF suggestion; the encoding change is on the PR branch.

@thxCode
thxCode merged commit c24ac8f into main Nov 5, 2026
8 checks passed
@thxCode
thxCode deleted the fix/rocm-vllm-cupy branch November 5, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant