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

Enabling c++20 on linux #17816

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
81fbc65
Trying out c++20 on linux
jchen351 Oct 6, 2023
c72c40e
Enabling "set_property(TARGET onnxruntime_test_all APPEND_STRING PROP…
jchen351 Oct 6, 2023
512cd4d
Revert "Enabling "set_property(TARGET onnxruntime_test_all APPEND_STR…
jchen351 Oct 6, 2023
e9fd1ef
Merge branch 'main' into Cjian/linux_c++20
jchen351 Oct 13, 2023
a3a69d0
ignore "-Werror=deprecated" for Eigen CXX11 Tensor
jchen351 Oct 13, 2023
2e795b4
-Wdeprecated-declarations
jchen351 Oct 13, 2023
1a7efec
Merge branch 'refs/heads/main' into Cjian/linux_c++20
jchen351 May 24, 2024
c46ab4a
Merge remote-tracking branch 'origin/main' into Cjian/linux_c++20
snnn Jun 3, 2024
11f8d5b
Merge branch 'refs/heads/main' into Cjian/linux_c++20
jchen351 Jun 3, 2024
107788f
#pragma GCC diagnostic ignored "-Wdeprecated"
jchen351 Jun 3, 2024
7646254
#pragma GCC diagnostic ignored "-Wdeprecated"
jchen351 Jun 3, 2024
661a465
TreeAggregatorMin
jchen351 Jun 3, 2024
450d994
#pragma GCC diagnostic ignored "-Wdeprecated"
jchen351 Jun 4, 2024
168beb8
[=
jchen351 Jun 6, 2024
3736658
qembed_layer_norm.cc:97:50
jchen351 Jun 6, 2024
89d8e59
Merge branch 'refs/heads/main' into Cjian/linux_c++20
jchen351 Jun 17, 2024
2d6abd5
is_trivial
jchen351 Jun 17, 2024
c66de02
Merge branch 'refs/heads/main' into Cjian/linux_c++20
jchen351 Jun 19, 2024
31cb371
Merge remote-tracking branch 'refs/remotes/origin/main' into Cjian/li…
jchen351 Jun 20, 2024
d3a385a
Merge remote-tracking branch 'origin/main' into Cjian/linux_c++20
jchen351 Jun 20, 2024
41c821e
onnxruntime/core/session/inference_session.cc lintrunner
jchen351 Jun 20, 2024
cc3f411
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
jchen351 Jun 20, 2024
84122a5
#if __cplusplus >= 202002L
jchen351 Jun 20, 2024
5244cc4
std::function<void()> run_fn = [=, this]() {
jchen351 Jun 20, 2024
0e10f73
std::function<void()> run_fn = [this]() {
jchen351 Jun 20, 2024
c669ead
std::function<void()> run_fn = [this]() {
jchen351 Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ include(FetchContent)
include(CheckFunctionExists)

# TODO: update this once all system adapt c++20
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_CXX_STANDARD 20)
else()
set(CMAKE_CXX_STANDARD 17)
Expand Down
1 change: 1 addition & 0 deletions include/onnxruntime/core/common/eigen_common_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// error: ignoring attributes on template argument "Eigen::PacketType<const float, Eigen::DefaultDevice>::type {aka __vector(4) float}" [-Werror=ignored-attributes]
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#if __GNUC__ >= 6
#pragma GCC diagnostic ignored "-Wignored-attributes"
#endif
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/contrib_ops/cpu/bert/embed_layer_norm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Status EmbedLayerNorm<T>::Compute(OpKernelContext* context) const {

int n = batch_size * sequence_length;
concurrency::ThreadPool::TryBatchParallelFor(
context->GetOperatorThreadPool(), n, [=, &failed](ptrdiff_t index) {
context->GetOperatorThreadPool(), n, [=, this, &failed](ptrdiff_t index) {
int word_col_index = input_ids_data[index];
if (word_col_index < 0 || word_col_index >= word_embedding_length) {
failed.store(true, std::memory_order_release);
Expand Down
10 changes: 5 additions & 5 deletions onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,11 @@
template <typename InputType, typename ThresholdType, typename OutputType>
class TreeAggregatorMax : public TreeAggregator<InputType, ThresholdType, OutputType> {
public:
TreeAggregatorMax<InputType, ThresholdType, OutputType>(size_t n_trees,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All other similar class like TreeAggregatorMin and TreeAggregatorSum does not include type qualifier.

const int64_t& n_targets_or_classes,
POST_EVAL_TRANSFORM post_transform,
const std::vector<ThresholdType>& base_values) : TreeAggregator<InputType, ThresholdType, OutputType>(n_trees, n_targets_or_classes,
post_transform, base_values) {}
TreeAggregatorMax(size_t n_trees,
const int64_t& n_targets_or_classes,
POST_EVAL_TRANSFORM post_transform,
const std::vector<ThresholdType>& base_values) : TreeAggregator<InputType, ThresholdType, OutputType>(n_trees, n_targets_or_classes,

Check warning on line 332 in onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Lines should be <= 120 characters long [whitespace/line_length] [2] Raw Output: onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h:332: Lines should be <= 120 characters long [whitespace/line_length] [2]
post_transform, base_values) {}

Check warning on line 333 in onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Lines should be <= 120 characters long [whitespace/line_length] [2] Raw Output: onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h:333: Lines should be <= 120 characters long [whitespace/line_length] [2]

// 1 output

Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/session/inference_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2748,7 +2748,7 @@
if (!tp || concurrency::ThreadPool::DegreeOfParallelism(tp) < 2) {
return ORT_MAKE_STATUS(ONNXRUNTIME, INVALID_ARGUMENT, "intra op thread pool must have at least one thread for RunAsync");
}
std::function<void()> run_fn = [=]() {
std::function<void()> run_fn = [=,this]() {

Check warning on line 2751 in onnxruntime/core/session/inference_session.cc

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Missing space after , [whitespace/comma] [3] Raw Output: onnxruntime/core/session/inference_session.cc:2751: Missing space after , [whitespace/comma] [3]
Copy link
Member

Choose a reason for hiding this comment

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

Use clang-format to format this code

Status status = Status::OK();
ORT_TRY {
if (run_options) {
Expand Down
Loading