Default to C++20, pin embedded backends to C++17#20438
Conversation
PyTorch has moved to C++20 and ExecuTorch's PyTorch-facing targets (_portable_lib, util, wheel config) are already built as C++20. Raise the repo-wide default in the top-level CMakeLists and .buckconfig to match. The embedded backends build the portable runtime without PyTorch, so their constraint is the cross-toolchain, not the standard the host uses. Pin cadence, cortex_m, arm, nxp, and mediatek to C++17 so they keep building on toolchains (e.g. Xtensa) that lack full C++20 support, regardless of the new default.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20438
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
|
@pytorchbot label "release notes: none" |
|
I think we'd rather keep one C++ standard level. I've opened #20468 to discuss raising the standard to C++20. |
|
@rascani We can not move all code to cpp 20 due to device environment limits. |
Summary
PyTorch has moved to C++20 and ExecuTorch's PyTorch-facing targets (_portable_lib, util, wheel config) are already built as C++20. Raise the repo-wide default in the top-level CMakeLists and .buckconfig to match.
The embedded backends build the portable runtime without PyTorch, so their constraint is the cross-toolchain, not the standard the host uses. Pin cadence, cortex_m, arm, nxp, and mediatek to C++17 so they keep building on toolchains (e.g. Xtensa) that lack full C++20 support, regardless of the new default.
Test plan
No new test is required.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani