Fix Windows CUDA build: don't pass /openmp:experimental to nvcc - #93
Merged
Merged
Conversation
engine_runtime compiles both C++ and CUDA sources, but the MSVC
OpenMP flag was added to the whole target unconditionally:
target_compile_options(engine_runtime PRIVATE /openmp:experimental)
nvcc does not recognize /openmp:experimental and does not forward a
/-prefixed unknown to the host compiler, so it treats the token as a
second input file and aborts:
nvcc fatal : A single input file is required for a non-link phase
when an outputfile is specified
Guard the flag on COMPILE_LANGUAGE:CXX so only the C++ sources (which
need it for their OpenMP 4.0 SIMD pragmas) receive it, and the .cu
files no longer do.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
|
@CaptainArni Merged. Thank you! |
0xShug0
added a commit
that referenced
this pull request
Jul 23, 2026
engine_runtime compiles both C++ and CUDA sources, but the MSVC
OpenMP flag was added to the whole target unconditionally:
target_compile_options(engine_runtime PRIVATE /openmp:experimental)
nvcc does not recognize /openmp:experimental and does not forward a
/-prefixed unknown to the host compiler, so it treats the token as a
second input file and aborts:
nvcc fatal : A single input file is required for a non-link phase
when an outputfile is specified
Guard the flag on COMPILE_LANGUAGE:CXX so only the C++ sources (which
need it for their OpenMP 4.0 SIMD pragmas) receive it, and the .cu
files no longer do.
dleiferives
pushed a commit
to dleiferives/audio.cpp
that referenced
this pull request
Jul 25, 2026
…ug0#93) engine_runtime compiles both C++ and CUDA sources, but the MSVC OpenMP flag was added to the whole target unconditionally: target_compile_options(engine_runtime PRIVATE /openmp:experimental) nvcc does not recognize /openmp:experimental and does not forward a /-prefixed unknown to the host compiler, so it treats the token as a second input file and aborts: nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified Guard the flag on COMPILE_LANGUAGE:CXX so only the C++ sources (which need it for their OpenMP 4.0 SIMD pragmas) receive it, and the .cu files no longer do.
Anc813
pushed a commit
to Anc813/audio.cpp
that referenced
this pull request
Jul 25, 2026
…ug0#93) engine_runtime compiles both C++ and CUDA sources, but the MSVC OpenMP flag was added to the whole target unconditionally: target_compile_options(engine_runtime PRIVATE /openmp:experimental) nvcc does not recognize /openmp:experimental and does not forward a /-prefixed unknown to the host compiler, so it treats the token as a second input file and aborts: nvcc fatal : A single input file is required for a non-link phase when an outputfile is specified Guard the flag on COMPILE_LANGUAGE:CXX so only the C++ sources (which need it for their OpenMP 4.0 SIMD pragmas) receive it, and the .cu files no longer do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A CUDA release build on Windows/MSVC (
scripts/build_windows.ps1 -Preset windows-cuda-release) fails to compile the two CUDA sources inengine_runtime:Reproduced on latest
main(365b4f6) with CUDA 13.3 + MSVC (VS 2022/18).Cause
CMakeLists.txtadds the MSVC OpenMP flag toengine_runtimeunconditionally:engine_runtimealso compiles CUDA sources (istft_cuda_runtime.cu,torch_random_cuda_runtime.cu), so this flag is applied to theirnvccinvocations too. The generated compile line for a.cuobject ends with a bare/openmp:experimental:nvcc does not recognize
/openmp:experimentaland does not forward it to the host compiler (-forward-unknown-to-host-compileronly forwards--prefixed unknowns, not/-prefixed ones). It therefore parses the token as a second input file, and aborts because an output file is already specified — hence thenvcc fatalabove.Note: passing
-DOpenMP_CUDA_FLAGS=/openmp:experimentalinbuild_windows.ps1does not help, because the offending flag does not come from anOpenMP::OpenMP_CUDAtarget — it is the hard-codedtarget_compile_optionsline, which lands on every language in the target.Fix
Guard the flag on the C++ language so it never reaches nvcc:
The OpenMP 4.0 SIMD pragmas in the C++ sources (e.g.
longformer_attention.cpp) still receive the flag; the.cufiles no longer do.Verification
engine_runtimebuild fails at the two.cuobjects withnvcc fatal(above).engine_runtimeon thewindows-cuda-releasepreset — both CUDA objects compile and the target builds to completion (CUDA 13.3, MSVC, RTX 5090 /sm_120a).