Skip to content

Fix windows builds with TheRock which doesn't accept "/Zc:preprocessor" TheRock#4463#9475

Merged
NicolasHug merged 2 commits into
pytorch:mainfrom
astrelsky:therock_windows_hipcc
Apr 15, 2026
Merged

Fix windows builds with TheRock which doesn't accept "/Zc:preprocessor" TheRock#4463#9475
NicolasHug merged 2 commits into
pytorch:mainfrom
astrelsky:therock_windows_hipcc

Conversation

@astrelsky
Copy link
Copy Markdown
Contributor

This fixes the recent build failures on windows using rocm due to #9465 where hipcc is used in place of nvcc and uses clang which does not accept /Zc:preprocessor. See #9465 (comment)

Fixes ROCm/TheRock#4463

I have confirmed this fixes the build locally.

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 12, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9475

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

⏳ 7 Pending, 2 Unrelated Failures

As of commit 3bddf04 with merge base b9ee001 (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Apr 12, 2026

Hi @astrelsky!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the cla signed label Apr 12, 2026
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented Apr 12, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@astrelsky
Copy link
Copy Markdown
Contributor Author

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

I'm not sure why I had to sign it for BOTH torch and vision if it is supposed to cover all Meta open source projects.

I quoted the bot for context.

@astrelsky
Copy link
Copy Markdown
Contributor Author

I'm going go on a whim and say that the macos failures are unrelated to this change. 😂

@NicolasHug
Copy link
Copy Markdown
Member

CC @tinglvv @atalman could you please take a look? This is related to #9465

@srinivamd
Copy link
Copy Markdown

Thanks for the fix — the IS_ROCM guard correctly prevents -Xcompiler /Zc:preprocessor from being passed to hipcc/clang, which resolves the build failure in ROCm/TheRock#4463.

One minor issue: -DCCCL_IGNORE_MSVC_TRADITIONAL_PREPROCESSOR_WARNING is left outside the if not IS_ROCM block and will still be passed to hipcc. It won't cause a build failure (clang ignores unknown -D flags), but it's a CCCL/CUDA-specific suppression flag and has no meaning for ROCm builds. Suggest moving it inside the guard:

if "nvcc" in extra_compile_args:
    if not IS_ROCM:
        extra_compile_args["nvcc"].append("-Xcompiler")
        extra_compile_args["nvcc"].append("/Zc:preprocessor")
        extra_compile_args["nvcc"].append("-DCCCL_IGNORE_MSVC_TRADITIONAL_PREPROCESSOR_WARNING")

The two macOS CI failures (TestErase::test_transform_image_correctness) appear unrelated to this change. The fix itself is otherwise correct and ready for review.

@astrelsky
Copy link
Copy Markdown
Contributor Author

astrelsky commented Apr 13, 2026

Thanks for the fix — the IS_ROCM guard correctly prevents -Xcompiler /Zc:preprocessor from being passed to hipcc/clang, which resolves the build failure in ROCm/TheRock#4463.

One minor issue: -DCCCL_IGNORE_MSVC_TRADITIONAL_PREPROCESSOR_WARNING is left outside the if not IS_ROCM block and will still be passed to hipcc. It won't cause a build failure (clang ignores unknown -D flags), but it's a CCCL/CUDA-specific suppression flag and has no meaning for ROCm builds. Suggest moving it inside the guard:

if "nvcc" in extra_compile_args:
    if not IS_ROCM:
        extra_compile_args["nvcc"].append("-Xcompiler")
        extra_compile_args["nvcc"].append("/Zc:preprocessor")
        extra_compile_args["nvcc"].append("-DCCCL_IGNORE_MSVC_TRADITIONAL_PREPROCESSOR_WARNING")

The two macOS CI failures (TestErase::test_transform_image_correctness) appear unrelated to this change. The fix itself is otherwise correct and ready for review.

Oh, thank you. I didn't realize that was CCCL/CUDA-specific, since it's a preprocessor macro and could be used somewhere in the code. Fixing momentarily. Done.

@astrelsky astrelsky force-pushed the therock_windows_hipcc branch from a01c261 to 3627665 Compare April 13, 2026 21:31
@astrelsky astrelsky force-pushed the therock_windows_hipcc branch from 3627665 to fe221d0 Compare April 13, 2026 21:33
@jeffdaily
Copy link
Copy Markdown

@NicolasHug or @atalman would you please review/land this PR? It's blocking our ROCm Windows builds. Thanks.

@NicolasHug NicolasHug merged commit 8ad7115 into pytorch:main Apr 15, 2026
55 of 57 checks passed
@github-actions
Copy link
Copy Markdown

Hey @NicolasHug!

You merged this PR, but no labels were added.
The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue] Windows PyTorch nightly wheel build fails: torchvision roi_align_kernel_hip.cpp compile breaks and setup.py bdist_wheel exits 1`

4 participants