Skip to content

[Build] Upgrade CUDA Dockerfiles from GCC 10 to GCC 12 for C++20 compatibility#44923

Merged
Harry-Chen merged 2 commits into
vllm-project:mainfrom
r-barnes:fix/gcc12-cxx20-compat
Jun 11, 2026
Merged

[Build] Upgrade CUDA Dockerfiles from GCC 10 to GCC 12 for C++20 compatibility#44923
Harry-Chen merged 2 commits into
vllm-project:mainfrom
r-barnes:fix/gcc12-cxx20-compat

Conversation

@r-barnes

@r-barnes r-barnes commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Why this is not a duplicate

Checked open PRs on 2026-06-08 with gh pr list --search "gcc-10 gcc-12" and --search "c++20 compiler" — no existing PR addresses this.

Summary

PyTorch PR #167929 raised the minimum C++ standard to C++20 and the minimum GCC version to 11.3. vLLM's main CUDA Dockerfile and nightly-torch Dockerfile both pin GCC to version 10 to suppress spurious -Wredundant-move warning spam from CUTLASS (GCC bug #92519). GCC bug #92519 was fixed in GCC 11, so the pin is no longer necessary. GCC 12 is chosen because:

  • vLLM's CPU extension builds already require and use GCC 12
  • GCC 12 is available as gcc-12 on Ubuntu 22.04 without a PPA
  • GCC 12 has more complete C++20 support than GCC 11

Changes

  • docker/Dockerfile: gcc-10 → gcc-12, updated comment
  • docker/Dockerfile.nightly_torch: gcc-10 → gcc-12, updated comment
  • CMakeLists.txt: add FATAL_ERROR if GCC < 12 (mirrors existing gate in cmake/cpu_extension.cmake)
  • docs/getting_started/installation/gpu.cuda.inc.md: add GCC ≥ 12 prerequisite note in the Full Build section

Test commands run and results

  • git diff reviewed for all four files — changes are minimal and correct
  • pre-commit run --files <changed files> — run before submission

AI assistance disclosure

This PR was developed with AI assistance (Claude Code), but I have reviewed all the changes myself and approve of them.

@mergify

mergify Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
@mergify mergify Bot added documentation Improvements or additions to documentation ci/build nvidia labels Jun 8, 2026
@r-barnes r-barnes force-pushed the fix/gcc12-cxx20-compat branch from bc402bf to 654e1e8 Compare June 8, 2026 20:32
@r-barnes

r-barnes commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@Harry-Chen - drawing your attention to another PyTorch compatibility fix (follow-up to #40380)

Comment thread docker/Dockerfile Outdated
# GCC 10 was previously pinned to suppress spurious -Wredundant-move warnings
# from CUTLASS (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519). That bug
# was fixed in GCC 11. GCC >= 12 is now required because PyTorch's C++20 headers
# (pytorch/pytorch#167929) are not compatible with GCC < 12.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think pytorch is requiring >11.3, not strictly >= 12?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PyTorch is requiring 11.3. I chose 12 because vLLM's CPU extension builds already require and use GCC 12 and it seems inconsistent to me to require two different versions of a compiler for the same project. But I'm happy to switch this to 11.3 if that's better for you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ubuntu 22.04 already has gcc 11 as the default compiler. I tend to use whatever the default from the build image unless it does not work (e.g., previously the gcc-9 case), to keep the dockerfile simple. And I also like to hear your opinion on this.

Comment thread CMakeLists.txt Outdated
set(CMAKE_HIP_STANDARD_REQUIRED ON)

# PyTorch headers require C++20; GCC < 12 has incomplete C++20 support.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as above, we should be as permissive as possible in this check

@Harry-Chen

Copy link
Copy Markdown
Member

And I think the manylinux builder (which we are using in the release pipeline) has already aligned with pytorch's compiler versions, is that right?

…mpatibility

GCC 10 was pinned in the CUDA and nightly_torch Dockerfiles to suppress
spurious -Wredundant-move warnings from CUTLASS
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519). That bug was fixed
in GCC 11. GCC >= 11.3 is now required because PyTorch's C++20 headers
(pytorch/pytorch#167929) are not compatible with GCC < 11.3.

Also adds a CMake FATAL_ERROR gate (mirroring cmake/cpu_extension.cmake)
and a prerequisite note to the CUDA build documentation.

Signed-off-by: Richard Barnes <rbarnes@meta.com>
@r-barnes r-barnes force-pushed the fix/gcc12-cxx20-compat branch from 654e1e8 to ccfe274 Compare June 9, 2026 17:07
@r-barnes

r-barnes commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@Harry-Chen : I'm not sure about the manylinux builder. I'm trying to track down this thread: pytorch/pytorch#176662 (comment) but the user was non-specific about the problems they actually encountered. Bumping your minimum compiler to the PyTorch minimum seems like a reasonable step to take. GCC 10 was released in 2020 and GCC 11 in 2022. PyTorch moved onto C++20 after support for Ubuntu 20.04 ended and, along with it, support for GCC 10.

@Harry-Chen

Copy link
Copy Markdown
Member

@Harry-Chen : I'm not sure about the manylinux builder. I'm trying to track down this thread: pytorch/pytorch#176662 (comment) but the user was non-specific about the problems they actually encountered. Bumping your minimum compiler to the PyTorch minimum seems like a reasonable step to take. GCC 10 was released in 2020 and GCC 11 in 2022. PyTorch moved onto C++20 after support for Ubuntu 20.04 ended and, along with it, support for GCC 10.

I see. The manylinux builder we are using is from pytorch: https://hub.docker.com/r/pytorch/manylinux-builder. So I believe it is a safe default to use.

@Harry-Chen Harry-Chen added the ready ONLY add when PR is ready to merge/full CI is needed label Jun 11, 2026
@github-project-automation github-project-automation Bot moved this to Ready in NVIDIA Jun 11, 2026
@Harry-Chen Harry-Chen enabled auto-merge (squash) June 11, 2026 08:08
@Harry-Chen Harry-Chen merged commit 05d9848 into vllm-project:main Jun 11, 2026
191 of 192 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Done in NVIDIA Jun 11, 2026
ryttry pushed a commit to ryttry/vllm that referenced this pull request Jun 11, 2026
…atibility (vllm-project#44923)

Signed-off-by: Richard Barnes <rbarnes@meta.com>
Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
@r-barnes r-barnes deleted the fix/gcc12-cxx20-compat branch June 11, 2026 20:06
r-barnes added a commit to r-barnes/pytorch that referenced this pull request Jun 11, 2026
Picks up vllm-project/vllm#44923, which upgrades vllm's CUDA Dockerfiles
from GCC 10 to GCC 12 to match PyTorch's C++20 requirement. Pinning to
the merge commit on vllm main (05d98482).

Test Plan:
vllm CI passed on this commit prior to and at merge into vllm main.
Saddss pushed a commit to Saddss/vllm that referenced this pull request Jun 14, 2026
…atibility (vllm-project#44923)

Signed-off-by: Richard Barnes <rbarnes@meta.com>
Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
divineearthly pushed a commit to divineearthly/vllm that referenced this pull request Jun 19, 2026
…atibility (vllm-project#44923)

Signed-off-by: Richard Barnes <rbarnes@meta.com>
Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
Signed-off-by: divineearthly <divineearthly@gmail.com>
tunglinwood pushed a commit to tunglinwood/vllm that referenced this pull request Jun 22, 2026
…atibility (vllm-project#44923)

Signed-off-by: Richard Barnes <rbarnes@meta.com>
Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
nkzhenhua pushed a commit to nkzhenhua/vllm that referenced this pull request Jun 24, 2026
…atibility (vllm-project#44923)

Signed-off-by: Richard Barnes <rbarnes@meta.com>
Co-authored-by: Shengqi Chen <harry-chen@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build documentation Improvements or additions to documentation nvidia ready ONLY add when PR is ready to merge/full CI is needed

2 participants