Skip to content

Commit

Permalink
Update absl (#21300)
Browse files Browse the repository at this point in the history
Our macOS pipeline are failing because of a build error in absl.
However, the bug fix we need is not available in the latest ABSL
release.

Here  is the issue: abseil/abseil-cpp#1536
And here is the fix:
abseil/abseil-cpp@779a356

GTests uses ABSL. But this ABSL target also depends on GTest. So, it is
a circular dependency. We should be able to avoid that by avoid building
tests for ABSL. However, the version we are using has a problem with
that: it has cmake target that still depends on GTest even when testing
is disabled.

It's strange that we suddenly hit this problem and it only happens on macOS.
  • Loading branch information
snnn authored and sumitsays committed Aug 8, 2024
1 parent 3871274 commit 4a9600e
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cgmanifests/generated/cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"component": {
"type": "git",
"git": {
"commitHash": "4a2c63365eff8823a5221db86ef490e828306f9d",
"commitHash": "f46495ea96f68fc3f6c394f099b2992743f6ff7f",
"repositoryUrl": "https://github.com/abseil/abseil-cpp.git"
},
"comments": "abseil_cpp"
Expand Down
21 changes: 15 additions & 6 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,12 @@ else()
check_cxx_compiler_flag(-Wunused-variable HAS_UNUSED_VARIABLE)
check_cxx_compiler_flag(-Wuseless-cast HAS_USELESS_CAST)
check_cxx_compiler_flag(-Wstringop-overflow HAS_STRINGOP_OVERFLOW)
if(onnxruntime_ENABLE_TRAINING_APIS)
check_cxx_compiler_flag(-Wdangling-reference HAS_DANGLING_REFERENCE)
if(HAS_DANGLING_REFERENCE)
list(APPEND ORT_WARNING_FLAGS -Wno-dangling-reference)
endif()
endif()
check_function_exists(reallocarray HAS_REALLOCARRAY)
if (NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND onnxruntime_target_platform STREQUAL "aarch64")
check_cxx_compiler_flag(-march=armv8.2-a+bf16 HAS_ARM64_BFLOAT16)
Expand Down Expand Up @@ -819,8 +825,8 @@ if (onnxruntime_USE_QNN)
file(GLOB QNN_LIB_FILES LIST_DIRECTORIES false "${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/libQnn*.so" "${onnxruntime_QNN_HOME}/lib/${QNN_ARCH_ABI}/Qnn*.dll")
if (${QNN_ARCH_ABI} STREQUAL "aarch64-windows-msvc" OR ${QNN_ARCH_ABI} STREQUAL "arm64x-windows-msvc")
file(GLOB EXTRA_HTP_LIB LIST_DIRECTORIES false "${onnxruntime_QNN_HOME}/lib/hexagon-v68/unsigned/libQnnHtpV68Skel.so"
"${onnxruntime_QNN_HOME}/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so"
"${onnxruntime_QNN_HOME}/lib/hexagon-v73/unsigned/libqnnhtpv73.cat")
"${onnxruntime_QNN_HOME}/lib/hexagon-v73/unsigned/libQnnHtpV73Skel.so"
"${onnxruntime_QNN_HOME}/lib/hexagon-v73/unsigned/libqnnhtpv73.cat")
list(APPEND QNN_LIB_FILES ${EXTRA_HTP_LIB})
endif()
message(STATUS "QNN lib files: " ${QNN_LIB_FILES})
Expand Down Expand Up @@ -1031,6 +1037,9 @@ function(onnxruntime_set_compile_flags target_name)
foreach(FLAG ${ORT_WARNING_FLAGS})
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${FLAG}>")
endforeach()
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 13 AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wno-maybe-uninitialized>")
endif()
if (onnxruntime_USE_CUDA)
foreach(FLAG ${ORT_WARNING_FLAGS})
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options ${FLAG}>")
Expand Down Expand Up @@ -1172,11 +1181,11 @@ if (onnxruntime_USE_ACL OR onnxruntime_USE_ACL_1902 OR onnxruntime_USE_ACL_1905
if (onnxruntime_USE_ACL_2002)
add_definitions(-DACL_2002=1)
else()
if (onnxruntime_USE_ACL_2308)
add_definitions(-DACL_2308=1)
else()
if (onnxruntime_USE_ACL_2308)
add_definitions(-DACL_2308=1)
else()
add_definitions(-DACL_1905=1)
endif()
endif()
endif()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# NOTE: You must run deps_update_and_upload.py and generate_cgmanifest.py when ready to test your changes in a CI.
# See https://microsoft.sharepoint.com/teams/ONNX2/_layouts/OneNote.aspx?id=%2Fteams%2FONNX2%2FShared%20Documents%2FNotebooks%2FONNX%20Ecosystem%20Team%20Notebook&wd=target%28Development.one%7C63D3AB47-51D1-4A62-9965-66882234BD44%2FAdd%20or%20update%20a%20dependency%20in%20deps.txt%7C0E9ED71D-89D5-40FA-B05F-C0123289C591%2F%29
#
abseil_cpp;https://github.com/abseil/abseil-cpp/archive/refs/tags/20240116.0.zip;bc2cec6baaad67fcb6c0c38972b687d4797927e9
abseil_cpp;https://github.com/abseil/abseil-cpp/archive/f46495ea96f68fc3f6c394f099b2992743f6ff7f.zip;0e2b6d1dc7f0a808d1e23f7dd985f7bc18d52cbc
coremltools;https://github.com/apple/coremltools/archive/refs/tags/7.1.zip;f1bab0f30966f2e217d8e01207d518f230a1641a
cxxopts;https://github.com/jarro2783/cxxopts/archive/3c73d91c0b04e2b59462f0a741be8c07024c1bc0.zip;6c6ca7f8480b26c8d00476e0e24b7184717fe4f0
date;https://github.com/HowardHinnant/date/archive/refs/tags/v3.0.1.zip;2dac0c81dc54ebdd8f8d073a75c053b04b56e159
Expand Down
51 changes: 43 additions & 8 deletions cmake/patches/abseil/absl_windows.patch
Original file line number Diff line number Diff line change
@@ -1,34 +1,69 @@
diff --git a/absl/base/attributes.h b/absl/base/attributes.h
index 5ea5ee3e..f4949898 100644
--- a/absl/base/attributes.h
+++ b/absl/base/attributes.h
@@ -559,7 +559,7 @@
#undef ABSL_ATTRIBUTE_UNUSED
#define ABSL_ATTRIBUTE_UNUSED __attribute__((__unused__))
#else
-#define ABSL_ATTRIBUTE_UNUSED
+#define ABSL_ATTRIBUTE_UNUSED [[maybe_unused]]
#endif

// ABSL_ATTRIBUTE_INITIAL_EXEC
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h
index d4fe8f5c..27418d13 100644
--- a/absl/container/internal/raw_hash_set.h
+++ b/absl/container/internal/raw_hash_set.h
@@ -1924,7 +1924,7 @@ HashtablezInfoHandle SampleHashtablezInfo(size_t sizeof_slot, size_t sizeof_key,
// In SOO, we sample on the first insertion so if this is an empty SOO case
// (e.g. when reserve is called), then we still need to sample.
if (kSooEnabled && was_soo && c.size() == 0) {
- return Sample(sizeof_slot, sizeof_key, sizeof_value, SooCapacity());
+ return Sample(sizeof_slot, sizeof_key, sizeof_value, (int16_t)SooCapacity());
}
// For non-SOO cases, we sample whenever the capacity is increasing from zero
// to non-zero.
@@ -3525,7 +3525,7 @@ class raw_hash_set {
assert(is_soo());
if (!ShouldSampleHashtablezInfo<CharAlloc>()) return HashtablezInfoHandle{};
return Sample(sizeof(slot_type), sizeof(key_type), sizeof(value_type),
- SooCapacity());
+ (int16_t)SooCapacity());
}

inline void destroy_slots() {
diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake
index a4ab1aa2..dfd13fd7 100644
index da2282fe..4c7fc26f 100644
--- a/absl/copts/GENERATED_AbseilCopts.cmake
+++ b/absl/copts/GENERATED_AbseilCopts.cmake
@@ -129,8 +129,6 @@ list(APPEND ABSL_MSVC_FLAGS
@@ -181,8 +181,6 @@ list(APPEND ABSL_MSVC_FLAGS
"/wd4005"
"/wd4068"
"/wd4180"
- "/wd4244"
- "/wd4267"
"/wd4503"
"/wd4800"
)
"/DNOMINMAX"
diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl
index a6efc98e..8c4de8e7 100644
index b9e0071e..dd8410ec 100644
--- a/absl/copts/GENERATED_copts.bzl
+++ b/absl/copts/GENERATED_copts.bzl
@@ -130,8 +130,6 @@ ABSL_MSVC_FLAGS = [
@@ -182,8 +182,6 @@ ABSL_MSVC_FLAGS = [
"/wd4005",
"/wd4068",
"/wd4180",
- "/wd4244",
- "/wd4267",
"/wd4503",
"/wd4800",
]
"/DNOMINMAX",
diff --git a/absl/copts/copts.py b/absl/copts/copts.py
index e6e11949..0aa7d868 100644
index 2d85ac74..4875d668 100644
--- a/absl/copts/copts.py
+++ b/absl/copts/copts.py
@@ -115,10 +115,6 @@ MSVC_WARNING_FLAGS = [
@@ -118,10 +118,6 @@ MSVC_WARNING_FLAGS = [
"/wd4068", # unknown pragma
# qualifier applied to function type has no meaning; ignored
"/wd4180",
Expand Down
3 changes: 3 additions & 0 deletions onnxruntime/core/providers/qnn/builder/qnn_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ std::ostream& operator<<(std::ostream& out, const Qnn_Tensor_t& tensor) {
}
out << ")";
out << " memType=" << GetQnnTensorMemType(tensor);
// TODO: the code below has compilation errors with the latest ABSL
#if 0
if (GetQnnTensorMemType(tensor) == QNN_TENSORMEMTYPE_RAW) {
if (GetQnnTensorDataType(tensor) == QNN_DATATYPE_FLOAT_32) {
operator<< <float>(out, GetQnnTensorClientBuf(tensor));
Expand All @@ -335,6 +337,7 @@ std::ostream& operator<<(std::ostream& out, const Qnn_Tensor_t& tensor) {
operator<< <int8_t>(out, GetQnnTensorClientBuf(tensor));
}
}
#endif
out << " quantizeParams:" << GetQnnTensorQParams(tensor);
return out;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ steps:
packageType: upack
feed: '/7424c8e4-5c62-490e-95c4-79446f31017c'
definition: '517c4f6f-5437-4392-a70d-4f15ec5be2f0'
version: 1.0.164
version: 1.0.165
downloadPath: $(Build.BinariesDirectory)/deps

# The private ADO project
Expand All @@ -22,7 +22,7 @@ steps:
packageType: upack
feed: '/4c7631f5-24c0-4307-8822-1aa8f180c325'
definition: 'fd9dd5ad-b73e-4678-890e-edcf680dbc1a'
version: 1.0.164
version: 1.0.165
downloadPath: $(Build.BinariesDirectory)/deps

# You can add more ADO accounts at here.

0 comments on commit 4a9600e

Please sign in to comment.