-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
273 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From 8caf31352140d655e2c88fb9784982c4e5db3b5b Mon Sep 17 00:00:00 2001 | ||
From: sudotac <[email protected]> | ||
Date: Sun, 6 Aug 2023 23:46:28 +0900 | ||
Subject: [PATCH] Remove MATH_NO_EXCEPT macro | ||
|
||
Signed-off-by: sudotac <[email protected]> | ||
--- | ||
.../test/providers/cpu/math/element_wise_ops_test.cc | 12 +++--------- | ||
1 file changed, 3 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc b/onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc | ||
index 04fbd05669..5ec4d915f5 100644 | ||
--- a/onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc | ||
+++ b/onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc | ||
@@ -2603,13 +2603,7 @@ TEST(MathOpTest, Mean_8) { | ||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider}); // TensorRT: Input batch size is inconsistent | ||
} | ||
|
||
-#ifdef _LIBCPP_VERSION | ||
-#define MATH_NO_EXCEPT | ||
-#else | ||
-#define MATH_NO_EXCEPT noexcept | ||
-#endif | ||
- | ||
-template <float (&op)(float value) MATH_NO_EXCEPT> | ||
+template <float (&op)(float value)> | ||
void TrigFloatTest(OpTester& test, std::initializer_list<float> input) { | ||
std::vector<int64_t> dims{static_cast<int64_t>(input.size())}; | ||
|
||
@@ -2622,7 +2616,7 @@ void TrigFloatTest(OpTester& test, std::initializer_list<float> input) { | ||
test.Run(); | ||
} | ||
|
||
-template <double (&op)(double value) MATH_NO_EXCEPT> | ||
+template <double (&op)(double value)> | ||
void TrigDoubleTest(OpTester& test, std::initializer_list<double> input, | ||
const std::unordered_set<std::string> excluded_provider_types = {}) { | ||
std::vector<int64_t> dims{static_cast<int64_t>(input.size())}; | ||
@@ -2636,7 +2630,7 @@ void TrigDoubleTest(OpTester& test, std::initializer_list<double> input, | ||
test.Run(OpTester::ExpectResult::kExpectSuccess, "", excluded_provider_types); | ||
} | ||
|
||
-template <float (&op)(float value) MATH_NO_EXCEPT> | ||
+template <float (&op)(float value)> | ||
void TrigFloat16Test(OpTester& test, std::initializer_list<float> input) { | ||
std::vector<int64_t> dims{static_cast<int64_t>(input.size())}; | ||
|
||
-- | ||
2.41.0 |
52 changes: 52 additions & 0 deletions
52
patches/onnx-0002-prevent-object-destruction-compile-error-16134.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
From b674a15d5c0133e76f3b1c4372ff4cf50d6cb608 Mon Sep 17 00:00:00 2001 | ||
From: Somdev Sangwan <[email protected]> | ||
Date: Fri, 2 Jun 2023 23:49:53 +0530 | ||
Subject: [PATCH] prevent object destruction compile error (#16134) | ||
|
||
### Description | ||
The proposed fix is to store the result of AsBlockSparse() in a variable | ||
to ensure the object isn't destroyed until the end of the current scope. | ||
|
||
### Motivation and Context | ||
"own_buffer_tensor" is a temporary object that is destroyed at the end | ||
of the expression and causes a compile error. | ||
--- | ||
onnxruntime/test/framework/sparse_kernels_test.cc | 9 ++++++--- | ||
1 file changed, 6 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/onnxruntime/test/framework/sparse_kernels_test.cc b/onnxruntime/test/framework/sparse_kernels_test.cc | ||
index 1a535144f4..b269b3231b 100644 | ||
--- a/onnxruntime/test/framework/sparse_kernels_test.cc | ||
+++ b/onnxruntime/test/framework/sparse_kernels_test.cc | ||
@@ -1815,7 +1815,8 @@ TEST(SparseTensorConversionTests, BlockSparse) { | ||
ASSERT_EQ(data_blocks.size(), data_span.size()); | ||
ASSERT_TRUE(std::equal(data_blocks.cbegin(), data_blocks.cend(), data_span.begin(), data_span.end())); | ||
|
||
- const auto& indices = own_buffer_tensor.AsBlockSparse().Indices(); | ||
+ auto block_sparse = own_buffer_tensor.AsBlockSparse(); | ||
+ const auto& indices = block_sparse.Indices(); | ||
ASSERT_EQ(indices_shape, indices.Shape()); | ||
auto indices_span = indices.DataAsSpan<int32_t>(); | ||
ASSERT_TRUE(std::equal(blocksparse_indices.cbegin(), blocksparse_indices.cend(), | ||
@@ -1834,7 +1835,8 @@ TEST(SparseTensorConversionTests, BlockSparse) { | ||
ASSERT_EQ(data_blocks.size(), data_span.size()); | ||
ASSERT_TRUE(std::equal(data_blocks.cbegin(), data_blocks.cend(), data_span.begin(), data_span.end())); | ||
|
||
- const auto& indices = user_buffer_tensor.AsBlockSparse().Indices(); | ||
+ auto block_sparse = user_buffer_tensor.AsBlockSparse(); | ||
+ const auto& indices = block_sparse.Indices(); | ||
ASSERT_EQ(indices_shape, indices.Shape()); | ||
auto indices_span = indices.DataAsSpan<int32_t>(); | ||
ASSERT_TRUE(std::equal(blocksparse_indices.cbegin(), blocksparse_indices.cend(), | ||
@@ -1855,7 +1857,8 @@ TEST(SparseTensorConversionTests, BlockSparse) { | ||
ASSERT_EQ(expected_span.size(), data_span.size()); | ||
ASSERT_TRUE(std::equal(expected_span.begin(), expected_span.end(), data_span.begin(), data_span.end())); | ||
|
||
- const auto& indices = own_buffer_tensor.AsBlockSparse().Indices(); | ||
+ auto block_sparse = own_buffer_tensor.AsBlockSparse(); | ||
+ const auto& indices = block_sparse.Indices(); | ||
ASSERT_EQ(indices_shape, indices.Shape()); | ||
auto indices_span = indices.DataAsSpan<int32_t>(); | ||
ASSERT_TRUE(std::equal(blocksparse_indices.cbegin(), blocksparse_indices.cend(), | ||
-- | ||
2.41.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
diff --git a/js/node/CMakeLists.txt b/js/node/CMakeLists.txt | ||
index 5557440..f8c8b19 100644 | ||
--- a/js/node/CMakeLists.txt | ||
+++ b/js/node/CMakeLists.txt | ||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.11) | ||
|
||
project (onnxruntime-node) | ||
|
||
-set(CMAKE_CXX_STANDARD 14) | ||
+set(CMAKE_CXX_STANDARD 17) | ||
|
||
add_compile_definitions(NAPI_VERSION=${napi_build_version}) | ||
add_compile_definitions(ORT_API_MANUAL_INIT) | ||
diff --git a/onnxruntime/python/tools/tensorrt/perf/mem_test/CMakeLists.txt b/onnxruntime/python/tools/tensorrt/perf/mem_test/CMakeLists.txt | ||
index 2d969cf..fd9de3e 100644 | ||
--- a/onnxruntime/python/tools/tensorrt/perf/mem_test/CMakeLists.txt | ||
+++ b/onnxruntime/python/tools/tensorrt/perf/mem_test/CMakeLists.txt | ||
@@ -4,7 +4,7 @@ set(CMAKE_BUILD_TYPE Debug) | ||
|
||
cmake_minimum_required (VERSION 2.6) | ||
|
||
-set(CMAKE_CXX_STANDARD 14) | ||
+set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
include_directories( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/onnxruntime/core/platform/posix/stacktrace.cc b/onnxruntime/core/platform/posix/stacktrace.cc | ||
index 76864b2..185f131 100644 | ||
--- a/onnxruntime/core/platform/posix/stacktrace.cc | ||
+++ b/onnxruntime/core/platform/posix/stacktrace.cc | ||
@@ -3,7 +3,7 @@ | ||
|
||
#include "core/common/common.h" | ||
|
||
-#if !defined(__ANDROID__) && !defined(__wasm__) && !defined(_OPSCHEMA_LIB_) && !defined(_AIX) | ||
+#if defined(__GLIBC__) && !defined(__ANDROID__) && !defined(__wasm__) && !defined(_OPSCHEMA_LIB_) && !defined(_AIX) | ||
#include <execinfo.h> | ||
#endif | ||
#include <vector> | ||
@@ -13,7 +13,7 @@ namespace onnxruntime { | ||
std::vector<std::string> GetStackTrace() { | ||
std::vector<std::string> stack; | ||
|
||
-#if !defined(NDEBUG) && !defined(__ANDROID__) && !defined(__wasm__) && !defined(_OPSCHEMA_LIB_) | ||
+#if defined(__GLIBC__) && !defined(NDEBUG) && !defined(__ANDROID__) && !defined(__wasm__) && !defined(_OPSCHEMA_LIB_) | ||
constexpr int kCallstackLimit = 64; // Maximum depth of callstack | ||
|
||
void* array[kCallstackLimit]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake | ||
index 9effd1a2db..ed15ad31aa 100644 | ||
--- a/cmake/external/onnxruntime_external_deps.cmake | ||
+++ b/cmake/external/onnxruntime_external_deps.cmake | ||
@@ -20,16 +20,16 @@ endforeach() | ||
message("Loading Dependencies ...") | ||
# ABSL should be included before protobuf because protobuf may use absl | ||
if(NOT onnxruntime_DISABLE_ABSEIL) | ||
- include(external/abseil-cpp.cmake) | ||
+ find_package(absl REQUIRED) | ||
+ set(ABSEIL_LIBS absl::inlined_vector absl::flat_hash_set | ||
+ absl::flat_hash_map absl::node_hash_set absl::node_hash_map absl::base absl::throw_delegate absl::raw_hash_set | ||
+ absl::hash absl::city absl::low_level_hash absl::raw_logging_internal) | ||
endif() | ||
+find_package(Protobuf REQUIRED) | ||
+find_package(re2 REQUIRED) | ||
+find_package(nlohmann_json REQUIRED) | ||
|
||
set(RE2_BUILD_TESTING OFF CACHE BOOL "" FORCE) | ||
-FetchContent_Declare( | ||
- re2 | ||
- URL ${DEP_URL_re2} | ||
- URL_HASH SHA1=${DEP_SHA1_re2} | ||
- FIND_PACKAGE_ARGS NAMES re2 | ||
-) | ||
|
||
if (onnxruntime_BUILD_UNIT_TESTS) | ||
# WebAssembly threading support in Node.js is still an experimental feature and | ||
@@ -163,7 +163,6 @@ if (onnxruntime_DISABLE_RTTI) | ||
set(protobuf_DISABLE_RTTI ON CACHE BOOL "Remove runtime type information in the binaries" FORCE) | ||
endif() | ||
|
||
-include(protobuf_function) | ||
#protobuf end | ||
|
||
set(ENABLE_DATE_TESTING OFF CACHE BOOL "" FORCE) | ||
@@ -303,7 +302,7 @@ FetchContent_Declare( | ||
) | ||
|
||
# The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers | ||
-onnxruntime_fetchcontent_makeavailable(Protobuf nlohmann_json mp11 re2 safeint GSL flatbuffers) | ||
+onnxruntime_fetchcontent_makeavailable(mp11 safeint GSL flatbuffers) | ||
if(NOT flatbuffers_FOUND) | ||
if(NOT TARGET flatbuffers::flatbuffers) | ||
add_library(flatbuffers::flatbuffers ALIAS flatbuffers) | ||
diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake | ||
index 9347be180d..8c60ff40f4 100644 | ||
--- a/cmake/onnxruntime_unittests.cmake | ||
+++ b/cmake/onnxruntime_unittests.cmake | ||
@@ -876,6 +876,7 @@ endif() | ||
onnxruntime_add_include_to_target(onnx_test_data_proto onnx_proto) | ||
target_include_directories(onnx_test_data_proto PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) | ||
set_target_properties(onnx_test_data_proto PROPERTIES FOLDER "ONNXRuntimeTest") | ||
+include(protobuf_function) | ||
onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${onnx_SOURCE_DIR} TARGET onnx_test_data_proto) | ||
|
||
# |