From fc2a6db573689f72e36b2e0dfaccef000096a35b Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Mon, 19 Dec 2022 14:25:13 -0800 Subject: [PATCH] Update absl to the latest release (#13990) ### Description Update absl to a new version ### Motivation and Context The new version contains fixes that are needed for Nvidia GPU build. Once we update it to that version, we don't need to maintain our private patches for Nvidia GPU build. --- cgmanifests/generated/cgmanifest.json | 4 +- cmake/deps.txt | 4 +- cmake/external/abseil-cpp.cmake | 6 +- cmake/external/abseil-cpp.natvis | 6 +- .../abseil/Fix_Nvidia_Build_Break.patch | 99 ------------------- cmake/patches/abseil/absl_windows.patch | 41 ++++++++ .../core/common/inlined_containers_fwd.h | 10 ++ .../templates/download-deps.yml | 4 +- 8 files changed, 63 insertions(+), 111 deletions(-) delete mode 100644 cmake/patches/abseil/Fix_Nvidia_Build_Break.patch create mode 100644 cmake/patches/abseil/absl_windows.patch diff --git a/cgmanifests/generated/cgmanifest.json b/cgmanifests/generated/cgmanifest.json index fdc6a5c4a1..e888c4952a 100644 --- a/cgmanifests/generated/cgmanifest.json +++ b/cgmanifests/generated/cgmanifest.json @@ -82,7 +82,7 @@ "component": { "type": "git", "git": { - "commitHash": "215105818dfde3174fe799600bb0f3cae233d0bf", + "commitHash": "8c0b94e793a66495e0b1f34a5eb26bd7dc672db0", "repositoryUrl": "https://github.com/abseil/abseil-cpp.git" }, "comments": "abseil_cpp" @@ -252,7 +252,7 @@ "component": { "type": "git", "git": { - "commitHash": "87c7a70688fd98fb355b8976f41425b40e4fe52f", + "commitHash": "369d6676423c2a6dbf4a5665c4b5010240d99d3c", "repositoryUrl": "https://github.com/onnx/onnx-tensorrt.git" }, "comments": "onnx_tensorrt" diff --git a/cmake/deps.txt b/cmake/deps.txt index ee487872f9..22170d66d9 100644 --- a/cmake/deps.txt +++ b/cmake/deps.txt @@ -5,9 +5,9 @@ #URLs can be either https URLs or local file paths in cmake-style(directory separator is a forward slash character). #SHA1 hashes can be generated by running sha1sum command. #If you need to change abseil's version to a different one, you may also want to update external\abseil-cpp.natvis -#since the file contains a version string: "lts_20211102". However, the file is for debugging purposes only and would +#since the file contains a version string: "lts_20220623". However, the file is for debugging purposes only and would #not affect built binaries. -abseil_cpp;https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.zip;ce61532df974d00025b1220408ce1c900d81baf2 +abseil_cpp;https://github.com/abseil/abseil-cpp/archive/refs/tags/20220623.1.zip;50c137c88965cba015dfcc8fd5d9b46d23146751 cxxopts;https://github.com/jarro2783/cxxopts/archive/3c73d91c0b04e2b59462f0a741be8c07024c1bc0.zip;6c6ca7f8480b26c8d00476e0e24b7184717fe4f0 date;https://github.com/HowardHinnant/date/archive/refs/tags/v2.4.1.zip;ea99f021262b1d804a872735c658860a6a13cc98 dlpack;https://github.com/dmlc/dlpack/archive/refs/tags/v0.6.zip;4d565dd2e5b31321e5549591d78aa7f377173445 diff --git a/cmake/external/abseil-cpp.cmake b/cmake/external/abseil-cpp.cmake index ebd5933db3..57230eb797 100644 --- a/cmake/external/abseil-cpp.cmake +++ b/cmake/external/abseil-cpp.cmake @@ -7,10 +7,10 @@ include(FetchContent) set(ABSL_PROPAGATE_CXX_STD 1) set(BUILD_TESTING 0) -if(Patch_FOUND) - set(ABSL_PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/abseil/Fix_Nvidia_Build_Break.patch) +if(Patch_FOUND AND WIN32) + set(ABSL_PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/abseil/absl_windows.patch) else() - set(ABSL_PATCH_COMMAND git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/patches/abseil/Fix_Nvidia_Build_Break.patch) + set(ABSL_PATCH_COMMAND "") endif() # NB! Advancing Abseil version changes its internal namespace, diff --git a/cmake/external/abseil-cpp.natvis b/cmake/external/abseil-cpp.natvis index dd74a92bce..e0294ba6f7 100644 --- a/cmake/external/abseil-cpp.natvis +++ b/cmake/external/abseil-cpp.natvis @@ -1,6 +1,6 @@ - + @@ -24,7 +24,7 @@ - + empty {{ size={size_} }} @@ -44,7 +44,7 @@ - + {{ {value.first}:{value.second} }} value.first diff --git a/cmake/patches/abseil/Fix_Nvidia_Build_Break.patch b/cmake/patches/abseil/Fix_Nvidia_Build_Break.patch deleted file mode 100644 index ac96dec132..0000000000 --- a/cmake/patches/abseil/Fix_Nvidia_Build_Break.patch +++ /dev/null @@ -1,99 +0,0 @@ -diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h -index 1d7d6cd..f6a7a78 100644 ---- a/absl/container/internal/inlined_vector.h -+++ b/absl/container/internal/inlined_vector.h -@@ -904,7 +904,7 @@ auto Storage::Swap(Storage* other_storage_ptr) -> void { - inlined_ptr->GetSize()); - } - ABSL_INTERNAL_CATCH_ANY { -- allocated_ptr->SetAllocation( -+ allocated_ptr->SetAllocation(Allocation - {allocated_storage_view.data, allocated_storage_view.capacity}); - ABSL_INTERNAL_RETHROW; - } -@@ -912,7 +912,7 @@ auto Storage::Swap(Storage* other_storage_ptr) -> void { - DestroyElements(inlined_ptr->GetAllocator(), - inlined_ptr->GetInlinedData(), inlined_ptr->GetSize()); - -- inlined_ptr->SetAllocation( -+ inlined_ptr->SetAllocation(Allocation - {allocated_storage_view.data, allocated_storage_view.capacity}); - } - -diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake -index a4ab1aa..dfd13fd 100644 ---- a/absl/copts/GENERATED_AbseilCopts.cmake -+++ b/absl/copts/GENERATED_AbseilCopts.cmake -@@ -129,8 +129,6 @@ list(APPEND ABSL_MSVC_FLAGS - "/wd4005" - "/wd4068" - "/wd4180" -- "/wd4244" -- "/wd4267" - "/wd4503" - "/wd4800" - ) -diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl -index a6efc98..8c4de8e 100644 ---- a/absl/copts/GENERATED_copts.bzl -+++ b/absl/copts/GENERATED_copts.bzl -@@ -130,8 +130,6 @@ ABSL_MSVC_FLAGS = [ - "/wd4005", - "/wd4068", - "/wd4180", -- "/wd4244", -- "/wd4267", - "/wd4503", - "/wd4800", - ] -diff --git a/absl/copts/copts.py b/absl/copts/copts.py -index 0d6c1ec..75fd935 100644 ---- a/absl/copts/copts.py -+++ b/absl/copts/copts.py -@@ -132,10 +132,6 @@ COPT_VARS = { - "/wd4068", # unknown pragma - # qualifier applied to function type has no meaning; ignored - "/wd4180", -- # conversion from 'type1' to 'type2', possible loss of data -- "/wd4244", -- # conversion from 'size_t' to 'type', possible loss of data -- "/wd4267", - # The decorated name was longer than the compiler limit - "/wd4503", - # forcing value to bool 'true' or 'false' (performance warning) - -diff --git a/absl/base/internal/unscaledcycleclock.h b/absl/base/internal/unscaledcycleclock.h -index 07f867a6..a4351406 100644 ---- a/absl/base/internal/unscaledcycleclock.h -+++ b/absl/base/internal/unscaledcycleclock.h -@@ -47,7 +47,7 @@ - // The following platforms have an implementation of a hardware counter. - #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \ - defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \ -- defined(_M_IX86) || defined(_M_X64) -+ defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC)) - #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1 - #else - #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 0 -diff --git a/absl/numeric/int128.h b/absl/numeric/int128.h -index c7ad96be..7a899eec 100644 ---- a/absl/numeric/int128.h -+++ b/absl/numeric/int128.h -@@ -44,7 +44,7 @@ - // builtin type. We need to make sure not to define operator wchar_t() - // alongside operator unsigned short() in these instances. - #define ABSL_INTERNAL_WCHAR_T __wchar_t --#if defined(_M_X64) -+#if defined(_M_X64) && !defined(_M_ARM64EC) - #include - #pragma intrinsic(_umul128) - #endif // defined(_M_X64) -@@ -980,7 +980,7 @@ inline uint128 operator*(uint128 lhs, uint128 rhs) { - // can be used for uint128 storage. - return static_cast(lhs) * - static_cast(rhs); --#elif defined(_MSC_VER) && defined(_M_X64) -+#elif defined(_MSC_VER) && defined(_M_X64) && !defined(_M_ARM64EC) - uint64_t carry; - uint64_t low = _umul128(Uint128Low64(lhs), Uint128Low64(rhs), &carry); - return MakeUint128(Uint128Low64(lhs) * Uint128High64(rhs) + diff --git a/cmake/patches/abseil/absl_windows.patch b/cmake/patches/abseil/absl_windows.patch new file mode 100644 index 0000000000..66ef0c5125 --- /dev/null +++ b/cmake/patches/abseil/absl_windows.patch @@ -0,0 +1,41 @@ +diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake +index a4ab1aa2..dfd13fd7 100644 +--- a/absl/copts/GENERATED_AbseilCopts.cmake ++++ b/absl/copts/GENERATED_AbseilCopts.cmake +@@ -129,8 +129,6 @@ list(APPEND ABSL_MSVC_FLAGS + "/wd4005" + "/wd4068" + "/wd4180" +- "/wd4244" +- "/wd4267" + "/wd4503" + "/wd4800" + ) +diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl +index a6efc98e..8c4de8e7 100644 +--- a/absl/copts/GENERATED_copts.bzl ++++ b/absl/copts/GENERATED_copts.bzl +@@ -130,8 +130,6 @@ ABSL_MSVC_FLAGS = [ + "/wd4005", + "/wd4068", + "/wd4180", +- "/wd4244", +- "/wd4267", + "/wd4503", + "/wd4800", + ] +diff --git a/absl/copts/copts.py b/absl/copts/copts.py +index 0d6c1ec3..75fd935f 100644 +--- a/absl/copts/copts.py ++++ b/absl/copts/copts.py +@@ -132,10 +132,6 @@ COPT_VARS = { + "/wd4068", # unknown pragma + # qualifier applied to function type has no meaning; ignored + "/wd4180", +- # conversion from 'type1' to 'type2', possible loss of data +- "/wd4244", +- # conversion from 'size_t' to 'type', possible loss of data +- "/wd4267", + # The decorated name was longer than the compiler limit + "/wd4503", + # forcing value to bool 'true' or 'false' (performance warning) diff --git a/include/onnxruntime/core/common/inlined_containers_fwd.h b/include/onnxruntime/core/common/inlined_containers_fwd.h index fe43ebefff..9e5215c2e4 100644 --- a/include/onnxruntime/core/common/inlined_containers_fwd.h +++ b/include/onnxruntime/core/common/inlined_containers_fwd.h @@ -14,12 +14,22 @@ // C4324: structure was padded due to alignment specifier // Usage of alignas causes some internal padding in places. #pragma warning(disable : 4324) +#else +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102329#c2 +#if !defined(__clang__) && defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif #endif // _MSC_VER #include #ifdef _MSC_VER #pragma warning(pop) +#else +#if !defined(__clang__) && defined(__GNUC__) +#pragma GCC diagnostic pop +#endif #endif // _MSC_VER #else diff --git a/tools/ci_build/github/azure-pipelines/templates/download-deps.yml b/tools/ci_build/github/azure-pipelines/templates/download-deps.yml index 5cbe400e9f..d38418a8cc 100644 --- a/tools/ci_build/github/azure-pipelines/templates/download-deps.yml +++ b/tools/ci_build/github/azure-pipelines/templates/download-deps.yml @@ -11,7 +11,7 @@ steps: packageType: upack feed: '/7424c8e4-5c62-490e-95c4-79446f31017c' definition: '517c4f6f-5437-4392-a70d-4f15ec5be2f0' - version: 1.0.15 + version: 1.0.16 downloadPath: $(Build.BinariesDirectory)/deps # The private ADO project @@ -22,7 +22,7 @@ steps: packageType: upack feed: '/4c7631f5-24c0-4307-8822-1aa8f180c325' definition: 'fd9dd5ad-b73e-4678-890e-edcf680dbc1a' - version: 1.0.15 + version: 1.0.16 downloadPath: $(Build.BinariesDirectory)/deps # You can add more ADO accounts at here.