Repository navigation
Conversation
PR Status: in progressTo become ready for review, please address automated review on your PR either with a code/PR description change. If a review comment is irrelevant, react with 👎 on that specific comment to reject it, and leave a short reply explaining why. The change must pass any running CI and existing failures must be classified as unrelated (see status below in this comment). Passing automated review does not guarantee that this PR will be merged. It still requires maintainer review and may be closed if its design or direction does not align with the project. To minimize iteration time, feel free to run the pr-review skill from the repo locally. To trigger a fresh automated review, make a new push or comment @pytorchbot review. To bypass automated review, please add the "no automated review" label. ✅ AUTOMATED REVIEW - Ready for human review:
Findings (4): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/199665
Note: Links to docs will display an error until the docs builds have been completed. ❌ 13 New Failures, 3 Cancelled Jobs, 1 Unclassified FailureAs of commit 8c791e0 with merge base db0d290 ( NEW FAILURES - The following jobs have failed:
UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
CANCELLED JOBS - The following jobs were cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@pytorchbot label "release notes: rocm" |
9f34241 to
5fb5b8a
Compare
|
Rechecked with torch 2.16.0a0+rocm10.2.0a20261007 (HIP 7.17.26401): the issue still reproduces, and the branch still merges cleanly into current main. @jeffdaily @jithunnair-amd could you please approve the CI workflows and take a look when you have a moment? |
5fb5b8a to
8c791e0
Compare
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
HI @thiagocrepaldi please target these fixes for 2.16.0 release these do not affect wheels and are not eligible to 1.5.1 release |
This PR was reopened (likely due to being reverted), so your approval was removed. Please request another review.
|
|
thanks @atalman, but the PR should make into |
There was a problem hiding this comment.
Automated review of 8c791e0: nothing blocking; ready for human review.
The PR fixes hipify() on Windows. Three include rewrites now go through _to_unix_path, and when relpath raises ValueError because the paths are on different drives, the new code falls back to the source file's drive root. The review's Recommendation is Approve with only non-blocking points, and it suggests a follow-up for the drive-root renaming issue.
⚪ 4 non-blocking findings
pytorch/torch/utils/hipify/hipify_python.py
Line 156 in 8c791e0
Non-blocking: the cross-drive fallback renames every directory below the drive root. The fallback returns (drive + os.sep, <whole path below the drive root>). That whole path goes through get_hip_file_path, which does substring replacements in the directory part: cudahip, CUDAHIP, THCTHH. For example, D:workcuda_opskernel.cu with the build dir on C: is written to a new directory, D:workhip_opskernel.hip, created by clean_ctx.makedirs. Quoted includes of local headers that are not hipified then no longer resolve. This contradicts the PR body's claim that the .hip file still lands next to the source. It is not a regression, since this case used to raise ValueError. Suggested fix: in the fallback only, anchor at os.path.dirname(abs_path) and pass just the file name. That keeps the output next to the source, and include rewrites still work because they are built from hipified_path.
pytorch/torch/utils/hipify/hipify_python.py
Line 886 in 8c791e0
Non-blocking: normalise separators in get_hip_file_path instead of at each caller. The backslash fixed here comes from os.path.join inside get_hip_file_path (:603, :608). Normalising its return value would cover every caller. Note that get_hip_file_path is in all, so external callers on Windows would then get / instead of .
Line 798 in 8c791e0
Non-blocking: test_hipify_extension_sources mostly passes with or without the fix. On Linux and macOS it passes either way, because relpath never raises there and _to_unix_path does nothing. On Windows, only the "ATen/hip/HIPContext.h" assertion depends on the fix, through the :886 change. The 'helper_hip.cuh' assertion goes through :927, which already called _to_unix_path before this PR. No test reaches the changed CurrentState.INITIALIZED branch (:917-925), which needs a circular or self include. The comment "Mirrors the hipify call in _jit_compile" overstates the match: the real call also passes ignores=, clean_ctx=, _canonicalize_hip_source(...) and a realpath'd build dir.
Line 832 in 8c791e0
Non-blocking: test_hipify_rel_path_without_common_root only checks that join(base, rel) rebuilds the path. On POSIX splitdrive returns '', so it effectively only checks that a leading / is stripped. It never runs get_hip_file_path or preprocessor. Its own input, cuda/kernel.cu, would expose the drive-root renaming issue if it asserted dirname(join(base, get_hip_file_path(rel, True))) == dirname(path). No test runs preprocessor with relpath raising, so reverting :843 or :920 to os.path.join(output_directory, ...) would go unnoticed.
This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
Issue being fixed
Fixes #199664
BC-breaking?
No
Summary (human written only)
This fixes
hipify()on Windows, where extension source files and headers were not being hipified correctly, causing JIT-built HIP extensions to fail. It also fixes a secondary crash when the source files and build directory are on different drives. The fixes were tested successfully with ROCm and DeepSpeed.Agent details (if applicable)
Prepared with Claude; I reviewed the change and reran the tests myself.
cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang