Fix Windows CUDA build: guard extension_cuda compile options to CXX#20184
Conversation
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).
🔗 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 FailuresAs of commit 0d1780c with merge base 4229704 ( 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. |
This PR needs a
|
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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Land when CI passes
Problem
The Windows CUDA e2e build (
test-model-cuda-windows-e2e) fails compiling theaoti_cuda_shims.cukernels:The build fails ->
--target installnever finishes ->executorchConfig.cmakeis missing -> every example-runnerfind_package(executorch)fails -> all 6 models go red.Root cause
extension/cuda/CMakeLists.txtapplied${_common_compile_options}PUBLIC, unguarded (it expands to/wd4996on MSVC). #20158 linkedextension_cudaintoslimtensor's INTERFACE, so the flag propagatesextension_cuda -> slimtensor -> aoti_cuda_shimsinto the.cunvcc 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.