Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update C++ standard to C++17 #12337

Merged
merged 7 commits into from
Aug 11, 2022
Merged

Update C++ standard to C++17 #12337

merged 7 commits into from
Aug 11, 2022

Conversation

kparzysz-quic
Copy link
Contributor

LLVM has switched to C++17 in its development branch. Follow suit to be able to compile LLVM headers.

@tqchen
Copy link
Member

tqchen commented Aug 8, 2022

LGTM! @kparzysz-quic do you mind also post an announcement thread? So people are aware

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah so finally we are using C++17 in TVM 🎉

@kparzysz-quic
Copy link
Contributor Author

LGTM! @kparzysz-quic do you mind also post an announcement thread? So people are aware

Sure, I'll just need to resolve the build failures. I'll post the announcement once the PR is ready to merge.

@@ -36,14 +36,16 @@ concurrency:

jobs:
MacOS:
if: ${{ github.repository == 'apache/tvm' }}
if: ${{ github.repository == 'kparzysz-quic/tvm' }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this change local? Otherwise LGTM!

Copy link
Contributor Author

@kparzysz-quic kparzysz-quic Aug 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll remove it. I'm trying to figure out the macOS build failure. I'll clean this PR up before merging.

Krzysztof Parzyszek added 2 commits August 8, 2022 16:07
LLVM has switched to C++17 in its development branch. Follow suit to be
able to compile LLVM headers.
@ganler
Copy link
Contributor

ganler commented Aug 9, 2022

Great news!

Just need to carefully check the installation documents as well. For example, update "C++ 14" to "C++ 17" in https://github.com/apache/tvm/blob/fbb7b5d1a0d82acb1f581dd2ec362b4dcad2638e/docs/install/from_source.rst

In the meantime, it might be better to specify the required minimal compiler versions as the coverage to C++17 standard varies a lot in different compiler versions.

For example, if we just want to pass the "-std=c++17" flag, then the required minimals can be:

  • gcc >= 5
  • clang >= 5
  • visual studio >= 2017 15.3

However, those initial version might poorly support some useful library features like std::filesystem. For example, gcc implements filesystems as a non-experimental library in gcc-8.

Since the motivation is to compiler newer versions of LLVM, maybe we can just follow LLVM's compiler constraints.

  • Clang 5.0
  • Apple Clang 9.3
  • GCC 7.1
  • Visual Studio 2019 16.7

cc: @junrushao1994 @tqchen

Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see C++17 in TVM 🎉

Krzysztof Parzyszek added 4 commits August 9, 2022 06:05
Something seems to be wrong with the llvmdev 10.0.0 packages, since the
LLVM unit test fails on Windows. It works fine when LLVM 10 is compiled
from sources.
Copy link

@shingjan shingjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for sending the PR!

… to 10.0"

This reverts commit 5c05627.

This is no longer needed.
@kparzysz-quic kparzysz-quic merged commit 99f5e92 into apache:main Aug 11, 2022
@kparzysz-quic kparzysz-quic deleted the c++17 branch August 11, 2022 22:22
@junrushao
Copy link
Member

I would love to second @ganler that we might want to provide clearer instruction on TVM official website to make TVM more approachable to new contributors. @kparzysz-quic @tqchen would either of you mind making such a change accordingly? I'm happy to submit a PR too if you guys prefer

@kparzysz-quic
Copy link
Contributor Author

I created a #12405 with docs update. Let me know if you want to have more information in it.

Lunderberg added a commit to Lunderberg/tvm that referenced this pull request Aug 26, 2022
With C++17 enabled in apache#12337, using
structured bindings to replace cases where `std::tie` is used to
define local variables.
masahi pushed a commit that referenced this pull request Aug 29, 2022
* [Refactor] Replace std::tie with structured bindings

With C++17 enabled in #12337, using
structured bindings to replace cases where `std::tie` is used to
define local variables.

* Added missing header for <optional>

* Silenced unused variable warnings after structured bindings

This is a bug in gcc version 7, resolved in gcc 8.  While gcc version
7 is used for CI, we'll need to silence unused variable warnings
resulting from using only part of a structured binding.

More information: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81767
Lunderberg added a commit to Lunderberg/tvm that referenced this pull request Sep 2, 2022
As a follow-up to apache#12337, updating
the EMCC flags from `-std=c++14` to `-std=c++17`.
junrushao pushed a commit that referenced this pull request Sep 2, 2022
As a follow-up to #12337, updating
the EMCC flags from `-std=c++14` to `-std=c++17`.
Lunderberg added a commit to Lunderberg/tvm that referenced this pull request Sep 6, 2022
Follow-up from apache#12337 and
apache#12693, a few additional locations
that specify C++14.
Lunderberg added a commit that referenced this pull request Sep 7, 2022
Follow-up from #12337 and
#12693, updating a few additional
locations that specified C++14.
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
* Update C++ standard to C++17

LLVM has switched to C++17 in its development branch. Follow suit to be
able to compile LLVM headers.

* Clang 8.0+ also supports -faligned-new

* Make make verbose

* Use CMAKE_OSX_DEPLOYMENT_TARGET to set minimum macOS version (10.12)

* Update llvmdev version in conda to >= 11

Something seems to be wrong with the llvmdev 10.0.0 packages, since the
LLVM unit test fails on Windows. It works fine when LLVM 10 is compiled
from sources.
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
* [Refactor] Replace std::tie with structured bindings

With C++17 enabled in apache#12337, using
structured bindings to replace cases where `std::tie` is used to
define local variables.

* Added missing header for <optional>

* Silenced unused variable warnings after structured bindings

This is a bug in gcc version 7, resolved in gcc 8.  While gcc version
7 is used for CI, we'll need to silence unused variable warnings
resulting from using only part of a structured binding.

More information: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81767
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
As a follow-up to apache#12337, updating
the EMCC flags from `-std=c++14` to `-std=c++17`.
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
Follow-up from apache#12337 and
apache#12693, updating a few additional
locations that specified C++14.
mikeseven pushed a commit to mikeseven/tvm that referenced this pull request Sep 27, 2023
* Update C++ standard to C++17

LLVM has switched to C++17 in its development branch. Follow suit to be
able to compile LLVM headers.

* Clang 8.0+ also supports -faligned-new

* Make make verbose

* Use CMAKE_OSX_DEPLOYMENT_TARGET to set minimum macOS version (10.12)

* Update llvmdev version in conda to >= 11

Something seems to be wrong with the llvmdev 10.0.0 packages, since the
LLVM unit test fails on Windows. It works fine when LLVM 10 is compiled
from sources.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants