Skip to content

Fix Windows CUDA build: guard extension_cuda compile options to CXX#20184

Merged
shoumikhin merged 2 commits into
mainfrom
oncall/fix-cuda-windows-extension-cuda-cxx-guard
Jun 10, 2026
Merged

Fix Windows CUDA build: guard extension_cuda compile options to CXX#20184
shoumikhin merged 2 commits into
mainfrom
oncall/fix-cuda-windows-extension-cuda-cxx-guard

Conversation

@shoumikhin

Copy link
Copy Markdown
Contributor

Problem

The Windows CUDA e2e build (test-model-cuda-windows-e2e) fails compiling the aoti_cuda_shims .cu kernels:

nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified

The build fails -> --target install never finishes -> executorchConfig.cmake is missing -> every example-runner find_package(executorch) fails -> all 6 models go red.

Root cause

extension/cuda/CMakeLists.txt applied ${_common_compile_options} PUBLIC, unguarded (it expands to /wd4996 on MSVC). #20158 linked extension_cuda into slimtensor's INTERFACE, so the flag propagates extension_cuda -> slimtensor -> aoti_cuda_shims into the .cu nvcc compile as a bare /wd4996, which nvcc parses as a second input file. Every other target in the CUDA stack already guards these with $<COMPILE_LANGUAGE:CXX>; this one didn't.

Fix

Guard the compile options with $<COMPILE_LANGUAGE:CXX>, matching the rest of the stack.

extension/cuda/CMakeLists.txt applied ${_common_compile_options} PUBLIC without a $<COMPILE_LANGUAGE:CXX> guard. After #20158 wired extension_cuda into slimtensor's INTERFACE (backends/aoti/CMakeLists.txt), that option (/wd4996 on MSVC) propagates transitively into the aoti_cuda_shims .cu compile. nvcc receives a bare /wd4996 and treats it as a second input, failing with 'nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified'. That breaks the Windows CUDA build and install, so executorchConfig.cmake is never produced and the e2e model runners fail at find_package(executorch).

Guard the options with $<COMPILE_LANGUAGE:CXX>, matching every other target in the CUDA stack (backends/cuda, backends/aoti).
Copilot AI review requested due to automatic review settings June 10, 2026 14:50
@pytorch-bot

pytorch-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20184

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

❌ 1 New Failure, 11 Pending, 4 Unrelated Failures

As of commit 0d1780c with merge base 4229704 (image):

NEW FAILURE - The following job has failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 10, 2026
@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

extension/cuda feeds the CUDA build (it is linked into slimtensor / aoti_cuda_backend), so changes there can break the Windows CUDA build (as #20158 did) but were not triggering this workflow. Add extension/cuda to the pull_request paths and the per-job changed-files conditions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a Windows CUDA build failure by preventing MSVC-specific common compile options (e.g., /wd4996) from propagating into CUDA (.cu) compilation units via extension_cuda’s PUBLIC compile options.

Changes:

  • Wrap extension_cuda’s propagated ${_common_compile_options} in a $<$<COMPILE_LANGUAGE:CXX>:...> generator expression so they apply only to C++ compilation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mergennachin mergennachin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Land when CI passes

@shoumikhin shoumikhin merged commit eb851a5 into main Jun 10, 2026
192 of 198 checks passed
@shoumikhin shoumikhin deleted the oncall/fix-cuda-windows-extension-cuda-cxx-guard branch June 10, 2026 16:27
@pytorch pytorch deleted a comment from pytorch-bot Bot Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants