Skip to content

build: Update C++ standard from c++17 to c++20 (#128) - #129

Merged
mc-nv merged 1 commit into
r26.09from
mchornyi/TRI-1877/cherry-pick-r26.09-std-20
Sep 11, 2026
Merged

build: Update C++ standard from c++17 to c++20 (#128)#129
mc-nv merged 1 commit into
r26.09from
mchornyi/TRI-1877/cherry-pick-r26.09-std-20

Conversation

@mc-nv

@mc-nv mc-nv commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Cherry-pick of the C++17->C++20 standard bump (TRI-1877) onto r26.09.

  • 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 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

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 preceding the system include path, means any future
internal #include 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)

* 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)
@mc-nv mc-nv added cherry-pick Cherry-picked from another branch build Build system or external dependencies (build: PRs) labels Sep 11, 2026
@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the C++20 requirement and both private-header renames are internally consistent.

Summary

  • Requests the cxx_std_20 compile feature for the backend target.
  • Renames the private semaphore header and updates all active includes.
  • Renames the private filesystem implementation and updates the shared-library loader dependency.
  • Preserves the existing semaphore, filesystem, and runtime-loading behavior.

Reviews (1) · Last reviewed commit: "build: Update C++ standard from c++17 to..."

@mc-nv mc-nv self-assigned this Sep 11, 2026
@mc-nv
mc-nv merged commit 4266a75 into r26.09 Sep 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Build system or external dependencies (build: PRs) cherry-pick Cherry-picked from another branch

Development

Successfully merging this pull request may close these issues.

2 participants