build(cuda): NVCC_ALLOW_UNSUPPORTED, so a host compiler newer than VS2022 is reachable - #1231
Merged
JustVugg merged 2 commits intoAug 28, 2026
Conversation
…hable
CUDA 13.1's crt/host_config.h accepts only Visual Studio 2019-2022 and
refuses anything newer outright. On a box with VS Build Tools 18
(MSVC 19.50) every nvcc target dies at the first #include:
host_config.h(164): fatal error C1189: #error: -- unsupported Microsoft
Visual Studio version! Only the versions between 2019 and 2022 (inclusive)
are supported!
That is cuda-test, cuda-dll, all of it. nvcc ships
-allow-unsupported-compiler for exactly this, but there was no way to get
one flag into the command: NVCCFLAGS is the only handle and replacing it
wholesale discards $(CUDA_GENCODE), the -ccbin set above it, and the
-Xcompiler warning form Windows specifically needs. That is the same
argument the NVCC_STD comment already makes a few lines up, so this follows
it rather than inventing a new shape.
Defaults to 0. nvcc's own wording is "may cause compilation failure or
incorrect run time execution", so running on an unsupported host compiler
stays an explicit decision by the builder, and any result produced with it
set should say so.
Verified on Windows, RTX 3090 (sm_86), CUDA 13.1, MSVC 19.50.35725:
unset : "nvcc" -O3 -std=c++17 -ftz=false -arch=sm_86 -Xcompiler=-W3 ...
-> C1189, no binary
=1 : same line plus -allow-unsupported-compiler
-> compiles, exit 0, backend_cuda_test.exe produced
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…tive Three assertions in the file that already owns this recipe's build contract. The load-bearing one is test_allow_unsupported_compiler_preserves_the_other_flags. Appending must not do what a wholesale NVCCFLAGS override does, which is silently drop the gencode and lose -ftz=false - and -ftz is a correctness flag on this recipe, not a tuning knob: the comment beside it says the fmt=8 kernels are cross-tier parity instruments and a flushed scale*subnormal contribution diverges from the CPU reference. A build that lost it would still compile and still pass, and only the parity numbers would quietly move. nvcc_compile_line() skips the `command -v "nvcc"` guard line, which a naive search for "nvcc" matches first and which contains none of the flags under test. Negative control run rather than assumed: reverting the Makefile alone fails test_allow_unsupported_compiler_is_reachable and passes the other two, which is the correct split - off-by-default and flag-preservation are both already true without the change. Full python suite: 661 tests, OK, skipped=50. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
CUDA 13.1's
crt/host_config.haccepts only Visual Studio 2019 to 2022 and refuses anything newer. On a host with VS Build Tools 18 (MSVC 19.50) every nvcc target dies at the first#include:That is
cuda-test,cuda-dll, all of it. nvcc ships-allow-unsupported-compilerfor exactly this case, but there was no way to get one flag into the command line:NVCCFLAGSis the only handle, and replacing it wholesale discards$(CUDA_GENCODE), the-ccbinset above it, and the-Xcompiler=-W3warning form Windows specifically needs.That is the same argument the
NVCC_STDcomment already makes a few lines up, so this follows its shape rather than inventing a new one.Defaults to 0 on purpose. nvcc's own wording is "may cause compilation failure or incorrect run time execution", so running on an unsupported host compiler stays an explicit decision by the builder, and any result produced with it set should say so.
What it unblocks
make cuda-testhad never completed on this machine. With the variable set, the whole recipe runs:All seven binaries built and passed on real sm_86 silicon:
Worth noting the fp8 suite carries its own negative control - the deliberately mutated LUT entry reports
1 mismatches, so the zeros above come from a test that can fail.Verification
Three tests in
tests/test_cuda_test_makefile.py, the file that already owns this recipe's build contract.The load-bearing one is
test_allow_unsupported_compiler_preserves_the_other_flags. Appending must not do what a wholesaleNVCCFLAGSoverride does, which is silently drop the gencode and lose-ftz=false- and-ftzis a correctness flag on this recipe rather than a tuning knob, per the comment beside it: the fmt=8 kernels are cross-tier parity instruments and a flushedscale*subnormalcontribution diverges from the CPU reference. A build that lost it would still compile and still pass; only the parity numbers would quietly move.Negative control run rather than assumed. Reverting the Makefile alone fails exactly one of the three:
That split is the correct one - off-by-default and flag-preservation are both already true without this change, so only the third assertion should move.
Full python suite:
Ran 661 tests, OK, skipped=50.One correction to my own first run
My first attempt reported the MXFP4 link failing with
unresolved external symbol GOMP_parallel. That was my stale base, not a defect here: I had branched from a forkdevthat was 115 commits behind and predated #1224. Rebased onto currentdev, it links and passes. Recording it because the symptom is identical to the real bug #1224 fixed, and someone hitting it should check their base before filing.Tested on Windows 11, RTX 3090 (sm_86), CUDA 13.1 V13.1.115, MSVC 19.50.35725, GNU Make 4.4.1, mingw-w64 gcc 16.2.0.