Skip to content

[2/12] Upgrade cpp_extension and cpp_builder to C++20#176659

Closed
r-barnes wants to merge 1 commit intopytorch:mainfrom
r-barnes:export-D95103085
Closed

[2/12] Upgrade cpp_extension and cpp_builder to C++20#176659
r-barnes wants to merge 1 commit intopytorch:mainfrom
r-barnes:export-D95103085

Conversation

@r-barnes
Copy link
Copy Markdown
Contributor

@r-barnes r-barnes commented Mar 5, 2026

Summary:
Update the default C++ standard from c++17 to c++20 in
torch.utils.cpp_extension and torch._inductor.cpp_builder.
This affects how user C++ extensions and inductor-generated
code are compiled.

Test Plan: Sandcastle

Reviewed By: malfet

cc @jbschlosser @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Mar 5, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/176659

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (7 Unrelated Failures)

As of commit e2812cd with merge base d87ebee (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Mar 5, 2026

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 5, 2026

@r-barnes has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95103085.

@r-barnes
Copy link
Copy Markdown
Contributor Author

r-barnes commented Mar 6, 2026

@pytorchbot rebase

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Tried to rebase and push PR #176659, but it was already up to date. Try rebasing against main by issuing:
@pytorchbot rebase -b main

@r-barnes
Copy link
Copy Markdown
Contributor Author

r-barnes commented Mar 7, 2026

@pytorchbot rebase -b main

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Successfully rebased export-D95103085 onto refs/remotes/origin/main, please pull locally before adding more changes (for example, via git checkout export-D95103085 && git pull --rebase)

Summary:

Update the default C++ standard from c++17 to c++20 in
torch.utils.cpp_extension and torch._inductor.cpp_builder.
This affects how user C++ extensions and inductor-generated
code are compiled.

Test Plan: Sandcastle

Reviewed By: desertfire, malfet

Differential Revision: D95103085
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge failed

Reason: Comment with id 4019547341 not found

Details for Dev Infra team Raised by workflow job

@r-barnes
Copy link
Copy Markdown
Contributor Author

r-barnes commented Mar 8, 2026

@pytorchbot merge -f "Failure looks like a flake, internal tests pass, changes to C++ are in Python strings, so skipped C++ format linter shouldn't be problematic"

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge failed

Reason: PR #176659 has not been reviewed yet

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@pytorchbot merge -i

(Initiating merge automatically since Phabricator Diff has merged, merging with -i because oss signals were bypassed internally)

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot bot commented Mar 8, 2026

This PR needs to be approved by an authorized maintainer before merge.

@malfet
Copy link
Copy Markdown
Contributor

malfet commented Mar 8, 2026

@pytorchbot merge -i

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Mar 8, 2026
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged while ignoring the following 1 checks: inductor / inductor-cpu-test / test (cpu_inductor_torchbench, 1, 2, linux.2xlarge.amx, unstable)

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 2 jobs have failed, first few of them are: trunk / macos-py3-arm64 / test (mps, 1, 1, macos-m1-14), trunk / macos-py3-arm64 / test (openreg, 1, 1, macos-m1-stable)

Details for Dev Infra team Raised by workflow job

@wdvr
Copy link
Copy Markdown
Contributor

wdvr commented Mar 9, 2026

@pytorchmergebot merge -i

xwang233 added a commit to xwang233/apex that referenced this pull request Mar 9, 2026
PyTorch commit ad56ff73b751 ("[2/12] Upgrade cpp_extension and
cpp_builder to C++20", pytorch/pytorch#176659) changed the default
C++ standard from C++17 to C++20 for extensions built via
torch.utils.cpp_extension. Under C++20, std::lerp from <cmath> is
visible alongside the custom lerp(float,float,float) defined in this
file. When the third argument is c10::BFloat16 (implicitly convertible
to float), the compiler finds two equally-valid overload candidates
and fails with "more than one instance of overloaded function matches".

Rename the custom lerp to _lerp to eliminate the ambiguity.

Signed-off-by: Xiao Wang <24860335+xwang233@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
crcrpar pushed a commit to NVIDIA/apex that referenced this pull request Mar 10, 2026
PyTorch commit ad56ff73b751 ("[2/12] Upgrade cpp_extension and
cpp_builder to C++20", pytorch/pytorch#176659) changed the default
C++ standard from C++17 to C++20 for extensions built via
torch.utils.cpp_extension. Under C++20, std::lerp from <cmath> is
visible alongside the custom lerp(float,float,float) defined in this
file. When the third argument is c10::BFloat16 (implicitly convertible
to float), the compiler finds two equally-valid overload candidates
and fails with "more than one instance of overloaded function matches".

Rename the custom lerp to _lerp to eliminate the ambiguity.

Signed-off-by: Xiao Wang <24860335+xwang233@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
EmanueleCoradin pushed a commit to EmanueleCoradin/pytorch that referenced this pull request Mar 30, 2026
Summary:
Update the default C++ standard from c++17 to c++20 in
torch.utils.cpp_extension and torch._inductor.cpp_builder.
This affects how user C++ extensions and inductor-generated
code are compiled.

Test Plan: Sandcastle

Reviewed By: malfet

Pull Request resolved: pytorch#176659
Approved by: https://github.com/malfet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants