diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 3d29648c1ba..085ae961cd6 100755 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -189,11 +189,11 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""): # TODO: Remove the patch when https://github.com/abseil/abseil-cpp/issues/326 is resolved # and when TensorFlow is build against CUDA 10.2 patch_file = clean_dep("//third_party:com_google_absl_fix_mac_and_nvcc_build.patch"), - sha256 = "acd93f6baaedc4414ebd08b33bebca7c7a46888916101d8c0b8083573526d070", # SHARED_ABSL_SHA - strip_prefix = "abseil-cpp-43ef2148c0936ebf7cb4be6b19927a9d9d145b8f", + sha256 = "f368a8476f4e2e0eccf8a7318b98dafbe30b2600f4e3cf52636e5eb145aba06a", # SHARED_ABSL_SHA + strip_prefix = "abseil-cpp-df3ea785d8c30a9503321a3d35ee7d35808f190d", urls = [ - "https://storage.googleapis.com/mirror.tensorflow.org/github.com/abseil/abseil-cpp/archive/43ef2148c0936ebf7cb4be6b19927a9d9d145b8f.tar.gz", - "https://github.com/abseil/abseil-cpp/archive/43ef2148c0936ebf7cb4be6b19927a9d9d145b8f.tar.gz", + "https://storage.googleapis.com/mirror.tensorflow.org/github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz", + "https://github.com/abseil/abseil-cpp/archive/df3ea785d8c30a9503321a3d35ee7d35808f190d.tar.gz", ], ) diff --git a/third_party/com_google_absl_fix_mac_and_nvcc_build.patch b/third_party/com_google_absl_fix_mac_and_nvcc_build.patch index 038e618de44..271e941bfe8 100644 --- a/third_party/com_google_absl_fix_mac_and_nvcc_build.patch +++ b/third_party/com_google_absl_fix_mac_and_nvcc_build.patch @@ -1,6 +1,6 @@ --- ./absl/time/internal/cctz/BUILD.bazel 2019-09-23 13:20:52.000000000 -0700 +++ ./absl/time/internal/cctz/BUILD.bazel.fixed 2019-09-23 13:20:48.000000000 -0700 -@@ -76,15 +76,6 @@ +@@ -74,15 +74,6 @@ "include/cctz/time_zone.h", "include/cctz/zone_info_source.h", ], @@ -14,22 +14,291 @@ - "//conditions:default": [], - }), visibility = ["//visibility:public"], - deps = [":civil_time"], - ) + deps = [ + ":civil_time", --- ./absl/strings/string_view.h 2019-09-23 13:20:52.000000000 -0700 +++ ./absl/strings/string_view.h.fixed 2019-09-23 13:20:48.000000000 -0700 -@@ -492,7 +492,14 @@ - (std::numeric_limits::max)(); - - static constexpr size_type CheckLengthInternal(size_type len) { -+#if defined(__NVCC__) && (__CUDACC_VER_MAJOR__<10 || (__CUDACC_VER_MAJOR__==10 && __CUDACC_VER_MINOR__<2)) && !defined(NDEBUG) -+ // An nvcc bug treats the original return expression as a non-constant, -+ // which is not allowed in a constexpr function. This only happens when -+ // NDEBUG is not defined. This will be fixed in the CUDA 10.2 release. -+ return len; +@@ -283,7 +283,14 @@ + // Returns the ith element of the `string_view` using the array operator. + // Note that this operator does not perform any bounds checking. + constexpr const_reference operator[](size_type i) const { ++#if defined(__NVCC__) && (__CUDACC_VER_MAJOR__ < 10 || (__CUDACC_VER_MAJOR__ == 10 && __CUDACC_VER_MINOR__ < 2)) ++ // An NVCC bug treats the original return expression as a non-constant, ++ // which is not allowed in a constexpr function. This will be fixed in the ++ // CUDA 10.2 release. ++ return ptr_[i]; +#else - return ABSL_ASSERT(len <= kMaxSize), len; + return ABSL_ASSERT(i < size()), ptr_[i]; +#endif } - const char* ptr_; + // string_view::at() +@@ -292,25 +299,46 @@ + // and an exception of type `std::out_of_range` will be thrown on invalid + // access. + constexpr const_reference at(size_type i) const { ++#if defined(__NVCC__) && (__CUDACC_VER_MAJOR__ < 10 || (__CUDACC_VER_MAJOR__ == 10 && __CUDACC_VER_MINOR__ < 2)) ++ // An NVCC bug treats the original return expression as a non-constant, ++ // which is not allowed in a constexpr function. This will be fixed in the ++ // CUDA 10.2 release. ++ return ptr_[i]; ++#else + return ABSL_PREDICT_TRUE(i < size()) + ? ptr_[i] + : ((void)base_internal::ThrowStdOutOfRange( + "absl::string_view::at"), + ptr_[i]); ++#endif + } + + // string_view::front() + // + // Returns the first element of a `string_view`. + constexpr const_reference front() const { ++#if defined(__NVCC__) && (__CUDACC_VER_MAJOR__ < 10 || (__CUDACC_VER_MAJOR__ == 10 && __CUDACC_VER_MINOR__ < 2)) ++ // An NVCC bug treats the original return expression as a non-constant, ++ // which is not allowed in a constexpr function. This will be fixed in the ++ // CUDA 10.2 release. ++ return ptr_[0]; ++#else + return ABSL_ASSERT(!empty()), ptr_[0]; ++#endif + } + + // string_view::back() + // + // Returns the last element of a `string_view`. + constexpr const_reference back() const { ++#if defined(__NVCC__) && (__CUDACC_VER_MAJOR__ < 10 || (__CUDACC_VER_MAJOR__ == 10 && __CUDACC_VER_MINOR__ < 2)) ++ // An NVCC bug treats the original return expression as a non-constant, ++ // which is not allowed in a constexpr function. This will be fixed in the ++ // CUDA 10.2 release. ++ return ptr_[size() - 1]; ++#else + return ABSL_ASSERT(!empty()), ptr_[size() - 1]; ++#endif + } + + // string_view::data() +@@ -519,7 +547,14 @@ + (std::numeric_limits::max)(); + + static constexpr size_type CheckLengthInternal(size_type len) { ++#if defined(__NVCC__) && (__CUDACC_VER_MAJOR__ < 10 || (__CUDACC_VER_MAJOR__ == 10 && __CUDACC_VER_MINOR__ < 2)) ++ // An NVCC bug treats the original return expression as a non-constant, ++ // which is not allowed in a constexpr function. This will be fixed in the ++ // CUDA 10.2 release. ++ return len; ++#else + return (void)ABSL_ASSERT(len <= kMaxSize), len; ++#endif + } + + static constexpr size_type StrlenInternal(const char* str) { +--- ./absl/container/internal/compressed_tuple.h 2020-03-04 12:57:37.000000000 -0800 ++++ ./absl/container/internal/compressed_tuple.h.fixed 2019-06-20 11:54:01.000000000 -0700 +@@ -32,7 +32,6 @@ Revert to commit 43ef2148c0936ebf7cb4be6b19927a9d9d145b8f as commit e9324d926a9189e222741fce6e676f0944661a72 includes a change not compatible with CUDA on Windows. + #ifndef ABSL_CONTAINER_INTERNAL_COMPRESSED_TUPLE_H_ + #define ABSL_CONTAINER_INTERNAL_COMPRESSED_TUPLE_H_ + +-#include + #include + #include + #include +@@ -77,110 +76,61 @@ + #endif + } + +-// We can't use EBCO on other CompressedTuples because that would mean that we +-// derive from multiple Storage<> instantiations with the same I parameter, +-// and potentially from multiple identical Storage<> instantiations. So anytime +-// we use type inheritance rather than encapsulation, we mark +-// CompressedTupleImpl, to make this easy to detect. +-struct uses_inheritance {}; +- + template + constexpr bool ShouldUseBase() { +- return std::is_class::value && std::is_empty::value && !IsFinal() && +- !std::is_base_of::value; ++ return std::is_class::value && std::is_empty::value && !IsFinal(); + } + + // The storage class provides two specializations: + // - For empty classes, it stores T as a base class. + // - For everything else, it stores T as a member. +-template ::type>()> +-#else +- bool UseBase = ShouldUseBase()> +-#endif ++template >()> + struct Storage { ++ using T = ElemT; + T value; + constexpr Storage() = default; +- template +- explicit constexpr Storage(absl::in_place_t, V&& v) +- : value(absl::forward(v)) {} ++ explicit constexpr Storage(T&& v) : value(absl::forward(v)) {} + constexpr const T& get() const& { return value; } + T& get() & { return value; } + constexpr const T&& get() const&& { return absl::move(*this).value; } + T&& get() && { return std::move(*this).value; } + }; + +-template +-struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC Storage : T { ++template ++struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC Storage ++ : ElemT { ++ using T = internal_compressed_tuple::ElemT; + constexpr Storage() = default; +- +- template +- explicit constexpr Storage(absl::in_place_t, V&& v) +- : T(absl::forward(v)) {} +- ++ explicit constexpr Storage(T&& v) : T(absl::forward(v)) {} + constexpr const T& get() const& { return *this; } + T& get() & { return *this; } + constexpr const T&& get() const&& { return absl::move(*this); } + T&& get() && { return std::move(*this); } + }; + +-template ++template + struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl; + +-template +-struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl< +- CompressedTuple, absl::index_sequence, ShouldAnyUseBase> ++template ++struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC ++ CompressedTupleImpl, absl::index_sequence> + // We use the dummy identity function through std::integral_constant to + // convince MSVC of accepting and expanding I in that context. Without it + // you would get: + // error C3548: 'I': parameter pack cannot be used in this context +- : uses_inheritance, +- Storage::value>... { +- constexpr CompressedTupleImpl() = default; +- template +- explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) +- : Storage(absl::in_place, absl::forward(args))... {} +- friend CompressedTuple; +-}; +- +-template +-struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl< +- CompressedTuple, absl::index_sequence, false> +- // We use the dummy identity function as above... +- : Storage::value, false>... { ++ : Storage, ++ std::integral_constant::value>... { + constexpr CompressedTupleImpl() = default; +- template +- explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) +- : Storage(absl::in_place, absl::forward(args))... {} +- friend CompressedTuple; ++ explicit constexpr CompressedTupleImpl(Ts&&... args) ++ : Storage, I>(absl::forward(args))... {} + }; + +-std::false_type Or(std::initializer_list); +-std::true_type Or(std::initializer_list); +- +-// MSVC requires this to be done separately rather than within the declaration +-// of CompressedTuple below. +-template +-constexpr bool ShouldAnyUseBase() { +- return decltype( +- Or({std::integral_constant()>()...})){}; +-} +- +-template +-using TupleMoveConstructible = typename std::conditional< +- std::is_reference::value, std::is_convertible, +- std::is_constructible>::type; +- + } // namespace internal_compressed_tuple + + // Helper class to perform the Empty Base Class Optimization. + // Ts can contain classes and non-classes, empty or not. For the ones that + // are empty classes, we perform the CompressedTuple. If all types in Ts are +-// empty classes, then CompressedTuple is itself an empty class. (This +-// does not apply when one or more of those empty classes is itself an empty +-// CompressedTuple.) ++// empty classes, then CompressedTuple is itself an empty class. + // + // To access the members, use member .get() function. + // +@@ -196,58 +146,36 @@ + template + class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple + : private internal_compressed_tuple::CompressedTupleImpl< +- CompressedTuple, absl::index_sequence_for, +- internal_compressed_tuple::ShouldAnyUseBase()> { ++ CompressedTuple, absl::index_sequence_for> { + private: + template + using ElemT = internal_compressed_tuple::ElemT; + +- template +- using StorageT = internal_compressed_tuple::Storage, I>; +- + public: +- // There seems to be a bug in MSVC dealing in which using '=default' here will +- // cause the compiler to ignore the body of other constructors. The work- +- // around is to explicitly implement the default constructor. +-#if defined(_MSC_VER) +- constexpr CompressedTuple() : CompressedTuple::CompressedTupleImpl() {} +-#else + constexpr CompressedTuple() = default; +-#endif +- explicit constexpr CompressedTuple(const Ts&... base) +- : CompressedTuple::CompressedTupleImpl(absl::in_place, base...) {} +- +- template ...)>>, +- internal_compressed_tuple::TupleMoveConstructible< +- Ts, Vs&&>...>::value, +- bool> = true> +- explicit constexpr CompressedTuple(Vs&&... base) +- : CompressedTuple::CompressedTupleImpl(absl::in_place, +- absl::forward(base)...) {} ++ explicit constexpr CompressedTuple(Ts... base) ++ : CompressedTuple::CompressedTupleImpl(absl::forward(base)...) {} + + template + ElemT& get() & { +- return internal_compressed_tuple::Storage, I>::get(); ++ return internal_compressed_tuple::Storage::get(); + } + + template + constexpr const ElemT& get() const& { +- return StorageT::get(); ++ return internal_compressed_tuple::Storage::get(); + } + + template + ElemT&& get() && { +- return std::move(*this).StorageT::get(); ++ return std::move(*this) ++ .internal_compressed_tuple::template Storage::get(); + } + + template + constexpr const ElemT&& get() const&& { +- return absl::move(*this).StorageT::get(); ++ return absl::move(*this) ++ .internal_compressed_tuple::template Storage::get(); + } + }; +