build: Update C++ standard from c++17 to c++20 - #128
Merged
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
This was referenced Sep 9, 2026
Merged
Merged
Under C++20, libstdc++'s <condition_variable> transitively needs the POSIX <semaphore.h> to support std::counting_semaphore. This repo's own src/semaphore.h has the same name and sits ahead of the system include path (-I<src> precedes default system dirs), so the compiler resolved the internal #include <semaphore.h> to this project's own header instead of glibc's, which defines no POSIX semaphore symbols. That broke the C++17->20 bump build with a cascade of "sem_t does not name a type" / "condition_variable does not name a type" errors. Rename to triton_semaphore.h so it can no longer shadow the system header; harmless under C++17 since nothing pulled in <semaphore.h> there. TRI-1877
Same class of bug as the semaphore.h rename in this repo: a project header sharing a name with a C++ standard library header, combined with -I<src> preceding the system include path, means any future internal #include <filesystem> from libstdc++ (or a toolchain bump) would silently resolve to this project's own header instead. Not currently triggering a build failure, but proactively renamed given this repo already proved the pattern is live once. 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: rename semaphore.h to avoid colliding with POSIX <semaphore.h> Under C++20, libstdc++'s <condition_variable> transitively needs the POSIX <semaphore.h> to support std::counting_semaphore. This repo's own src/semaphore.h has the same name and sits ahead of the system include path (-I<src> precedes default system dirs), so the compiler resolved the internal #include <semaphore.h> to this project's own header instead of glibc's, which defines no POSIX semaphore symbols. That broke the C++17->20 bump build with a cascade of "sem_t does not name a type" / "condition_variable does not name a type" errors. Rename to triton_semaphore.h so it can no longer shadow the system header; harmless under C++17 since nothing pulled in <semaphore.h> there. TRI-1877 * fix: rename filesystem.h/.cc to avoid colliding with <filesystem> Same class of bug as the semaphore.h rename in this repo: a project header sharing a name with a C++ standard library header, combined with -I<src> preceding the system include path, means any future internal #include <filesystem> from libstdc++ (or a toolchain bump) would silently resolve to this project's own header instead. Not currently triggering a build failure, but proactively renamed given this repo already proved the pattern is live once. TRI-1877 (cherry picked from commit 38b69d0)
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?
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.txtTest plan:
Caveats:
This repo has no direct dependency on ATen/libtorch; the bump is for cross-repo C++ standard consistency, not a confirmed build break here.
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)