build: Update C++ standard from c++17 to c++20 - #525
Merged
Conversation
Upstream PyTorch raised ATen's minimum required C++ standard from 17 to 20 (pytorch/pytorch#178150), which broke the pytorch_backend build. Align this repo's TRITON_MIN_CXX_STANDARD/CMAKE_CXX_STANDARD default with that floor for consistency across the stack. TRI-1877
C++20 deprecates implicit capture of 'this' via a bare '[=]' default capture (CWG2211); with -Werror=deprecated this now fails the build after the C++17->20 bump. List 'this' explicitly alongside the existing by-value default and '&instance_mu' reference capture. TRI-1877
This was referenced Sep 9, 2026
Merged
Merged
Same class of bug just fixed in tensorrt_backend's semaphore.h and filesystem.h: a project header sharing a name with a C++ standard library header, combined with a project include directory preceding the system include path, risks a future internal #include <memory> from libstdc++ silently resolving to this project's own header. Not currently triggering a build failure (core built successfully with TRITON_MIN_CXX_STANDARD=20 in the observed CI runs), but renamed proactively given the same repo family already proved this exact pattern live once. TRI-1877
Missed in the prior memory.h/.cc -> triton_memory.h/.cc rename commit: src/test/CMakeLists.txt lists ../memory.cc/../memory.h directly as MEMORY_SRCS/MEMORY_HDRS (not via #include), which is a distinct reference path my earlier sed pass over #include statements and src/CMakeLists.txt didn't touch. Broke CMake configure with "Cannot find source file: ../memory.cc" for response_cache_test. TRI-1877
mc-nv
marked this pull request as ready for review
September 10, 2026 15:28
|
mc-nv
added a commit
that referenced
this pull request
Sep 11, 2026
* build: Update C++ standard from c++17 to c++20 Upstream PyTorch raised ATen's minimum required C++ standard from 17 to 20 (pytorch/pytorch#178150), which broke the pytorch_backend build. Align this repo's TRITON_MIN_CXX_STANDARD/CMAKE_CXX_STANDARD default with that floor for consistency across the stack. TRI-1877 * fix: explicitly capture 'this' in backend_model.cc lambda C++20 deprecates implicit capture of 'this' via a bare '[=]' default capture (CWG2211); with -Werror=deprecated this now fails the build after the C++17->20 bump. List 'this' explicitly alongside the existing by-value default and '&instance_mu' reference capture. TRI-1877 * fix: rename memory.h/.cc to avoid colliding with <memory> Same class of bug just fixed in tensorrt_backend's semaphore.h and filesystem.h: a project header sharing a name with a C++ standard library header, combined with a project include directory preceding the system include path, risks a future internal #include <memory> from libstdc++ silently resolving to this project's own header. Not currently triggering a build failure (core built successfully with TRITON_MIN_CXX_STANDARD=20 in the observed CI runs), but renamed proactively given the same repo family already proved this exact pattern live once. TRI-1877 * fix: update test/CMakeLists.txt reference after memory.cc rename Missed in the prior memory.h/.cc -> triton_memory.h/.cc rename commit: src/test/CMakeLists.txt lists ../memory.cc/../memory.h directly as MEMORY_SRCS/MEMORY_HDRS (not via #include), which is a distinct reference path my earlier sed pass over #include statements and src/CMakeLists.txt didn't touch. Broke CMake configure with "Cannot find source file: ../memory.cc" for response_cache_test. TRI-1877 * fix: use TRITON_MIN_CXX_STANDARD for python-bindings instead of hardcoded cxx_std_17 (cherry picked from commit 4809f7d)
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.
What does the PR do?
thiscapture in a lambda insrc/backend_model.cc(implicit capture via[=]is deprecated in C++20, and this repo builds with -Werror=deprecated).Checklist
<commit_type>: <Title>Commit Type:
Check the conventional commit type box here and add the label to the github PR.
Related PRs:
Where should the reviewer start?
CMakeLists.txt-src/backend_model.ccTest plan:
Caveats:
This repo's own build broke under C++20 (see the fix commit) — the deprecated-lambda-capture error was found and fixed as part of this same change, not a separate follow-up.
Background
Part of a coordinated C++17->C++20 bump across ~18 Triton component repos (TRI-1877), triggered by upstream PyTorch's ATen.h now requiring C++20.
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)