onnxruntime icon indicating copy to clipboard operation
onnxruntime copied to clipboard

Enabling c++20 on linux

Open jchen351 opened this issue 2 years ago • 9 comments

Description

Enabling c++20 on Linux Currently blocking issue:

  1. Eigen using deprecated '[=]' lambda expression.

Motivation and Context

We want the latest and the greatest features from c++20.

depends on

  • [x] https://github.com/microsoft/onnxruntime/pull/21071
  • [x] https://github.com/microsoft/onnxruntime/pull/21127
  • [x] https://github.com/microsoft/onnxruntime/pull/21482
  • [ ] Update NDK version in use-android-ndk.yml to 27

jchen351 avatar Oct 06 '23 16:10 jchen351

We cannot do it for Linux CUDA build yet. Because the compiler we use is GCC 8, which is too low.

snnn avatar Oct 06 '23 17:10 snnn

Just out of curiosity. Why do you need C++20? Would it crash onnxruntime build in my old conda environment?

wschin avatar Oct 06 '23 18:10 wschin

For your second question, no. A new C++ standard consists of two things:

  1. Core language features like constexpr/constinit, which do not need runtime support.
  2. New std header files and functions like , which do not need a new runtime library.

The first one doesn't have impact on compatibility. The second one has impacts on non-Windows/non-Linux systems like macOS/iOS. We can avoid the issue by not using the headers that are not supported by the target system.

snnn avatar Oct 06 '23 20:10 snnn

Wait this #20786 . The PR will update all GCCs to >=11. Now we still have GCC 8.

snnn avatar May 24 '24 02:05 snnn

The GCC version is updated.

snnn avatar Jun 03 '24 18:06 snnn

Just out of curiosity. Why do you need C++20? Would it crash onnxruntime build in my old conda environment?

We can use the new C++ features to write better code, and it shouldn't impact our compatibility at runtime. The language features are listed in https://gcc.gnu.org/projects/cxx-status.html in "C++20 Language Features" section

snnn avatar Jun 03 '24 21:06 snnn

depends on #21071

jchen351 avatar Jun 19 '24 18:06 jchen351

This is also dependent on #21127

jchen351 avatar Jun 21 '24 00:06 jchen351

How is it going?

snnn avatar Jul 18 '24 18:07 snnn

Now we are using NDK 27?

snnn avatar Oct 02 '24 04:10 snnn