Conversation
cmake/CMakeLists.txt
Outdated
|
|
||
| target_compile_definitions(${target_name} PUBLIC -DNSYNC_ATOMIC_CPP11) | ||
| if(APPLE) | ||
| target_compile_definitions(${target_name} PRIVATE -Doptional_CONFIG_SELECT_OPTIONAL=1) |
There was a problem hiding this comment.
we can use the value optional_OPTIONAL_NONSTD, according to the docs: https://github.com/martinmoene/optional-lite#select-stdoptional-or-nonstdoptional
also, is ORT's optional.h a public header? include/onnxruntime/core/common/optional.h
if it may be included by external code, that code would need to configure it the same way. should it be a PUBLIC compile definition? #Closed
There was a problem hiding this comment.
should it be PUBLIC instead of PRIVATE?
| char* hostname = nullptr; | ||
| if (-1 == _dupenv_s(&hostname, &hostname_len, "COMPUTERNAME")) | ||
| hostname = "?"; | ||
| hostname = const_cast<char*>("?"); |
There was a problem hiding this comment.
can we avoid const_cast? #Closed
There was a problem hiding this comment.
I would prefer to leave it as a TODO as it is not related to C++ 14/17 upgrade. Currently this PR is already not small.
| #if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))) | ||
| #define IF_CONSTEXPR if constexpr | ||
| #else | ||
| #define IF_CONSTEXPR if |
There was a problem hiding this comment.
Because CUDA 10.2 doesn't support C++17 and we still need to generate CUDA 10.2 packages, please avoid to use C++17 in CUDA files(*.cu). Also, the *.h files that they include(like core/framework/float16.h). In these *.h files, we need to use such a macro until we retire the CUDA 10.2 pipelines.
There was a problem hiding this comment.
ok, can we name it ORT_IF_CONSTEXPR?
|
|
||
| // otherwise, not contiguous | ||
| return nullopt; | ||
| return std::nullopt; |
|
|
||
| const auto type_constraints = BuildKernelDefConstraintsFromTypeList<DataTypes>(); | ||
| const auto enabled_type_constraints = BuildKernelDefConstraintsFromTypeList<EnabledDataTypes>(); | ||
| #define type_constraints (BuildKernelDefConstraintsFromTypeList<DataTypes>()) |
| ApplicableMatrixReduction expected_reduction, | ||
| const optional<int>& expected_m = nullopt, | ||
| const optional<int>& expected_n = nullopt) { | ||
| const optional<int>& expected_m = std::nullopt, |
| template <typename T> | ||
| static std::vector<std::vector<T>> GetRandomValuesForMaxPool(const std::vector<TensorInfo>& infos) { | ||
| std::vector<std::vector<T>> datas(infos.size()); | ||
| std::random_device rd; |
| } | ||
|
|
||
| static Status AllocateSparseTensor(MLValue& mlvalue, const DataTypeImpl& ml_type, AllocatorPtr allocator, | ||
| static Status AllocateSparseTensor(OrtValue& mlvalue, const DataTypeImpl& ml_type, AllocatorPtr allocator, |
There was a problem hiding this comment.
Since you've made this change in a number of places, should we also rename the file ml_value.h to ort_value.h? The filename doesn't match the class it houses. Can be done in a separate PR.
There was a problem hiding this comment.
Sure. I will do it in another PR.
| inline std::string ToWideString(const std::string& s) { return s; } | ||
| #endif | ||
|
|
||
| #if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))) |
There was a problem hiding this comment.
If we're moving to C++17 for good, why do we need this condition?
There was a problem hiding this comment.
Because CUDA 10.2 doesn't support C++17 and we still need to generate CUDA 10.2 packages, we must avoid to use C++17 in CUDA files(*.cu). Also, the *.h files that they include(like core/framework/float16.h).
There was a problem hiding this comment.
Ok. thanks. Would be good to document this somewhere.
Description:
Switched the code to C++17. To build ONNX Runtime on old distros like CentOS 7, you need to install a newer GCC from additionary repos. If you build onnxruntime with the newer GCC, typically the result binary can't be distributed to other places because it depends on the new GCC's runtime libraries, something that the stock OS doesn't have. But on RHEL/CentOS, it can be better. We use Red Hat devtoolset 8/9/10 with CentOS7 building our code. The new library features(like std::filesystem) that not exists in the old C++ runtime will be statically linked into the applications with some restrictions:
GCC has dual ABI, but we can only use the old one. It means std::string is still copy-on-write and std::list::size() is still O(n). Also, if you build onnxruntime on CentOS 7 and link it with some binaries that were built on CentOS 8 or Ubuntu with the new ABI and export C++ symbols directly(instead of using a C API), the it won't work.
We still can't use std::optional. It is a limitation coming from macOS. We will solve it when we got macOS 11 build machines. It won't be too long.
Because CUDA 10.2 doesn't support C++17 and we still need to generate CUDA 10.2 packages, please avoid to use C++17 in CUDA files(*.cu). Also, the *.h files that they include(like core/framework/float16.h). You are welcome to use the new features in any *.cc files.
Also, update the minimum supported macOS version to 10.13.
Also, fix some compile warnings.
Motivation and Context