Remove unused c10/util/C++17.h inclusion and outdated checks (#120149)

This is a continued work to clean up pre-C++17 code.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/120149
Approved by: https://github.com/ezyang
This commit is contained in:
cyy 2024-02-17 14:28:17 +00:00 committed by PyTorch MergeBot
parent fac598c4ae
commit a9953a5ef3
10 changed files with 5 additions and 22 deletions

View File

@ -5,6 +5,7 @@
#include <c10/core/Backend.h> #include <c10/core/Backend.h>
#include <c10/core/ScalarType.h> #include <c10/core/ScalarType.h>
#include <memory>
namespace at { namespace at {

View File

@ -11,6 +11,7 @@
#include <c10/core/TensorOptions.h> #include <c10/core/TensorOptions.h>
#include <c10/core/UndefinedTensorImpl.h> #include <c10/core/UndefinedTensorImpl.h>
#include <c10/core/WrapDimMinimal.h> #include <c10/core/WrapDimMinimal.h>
#include <c10/util/C++17.h>
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
#include <c10/util/ExclusivelyOwned.h> #include <c10/util/ExclusivelyOwned.h>
#include <c10/util/ExclusivelyOwnedTensorTraits.h> #include <c10/util/ExclusivelyOwnedTensorTraits.h>

View File

@ -3,6 +3,7 @@
#include <ATen/core/boxing/impl/WrapFunctionIntoFunctor.h> #include <ATen/core/boxing/impl/WrapFunctionIntoFunctor.h>
#include <ATen/core/boxing/impl/WrapFunctionIntoRuntimeFunctor.h> #include <ATen/core/boxing/impl/WrapFunctionIntoRuntimeFunctor.h>
#include <c10/util/C++17.h>
#include <type_traits> #include <type_traits>
namespace c10 { namespace c10 {

View File

@ -6,8 +6,6 @@
#include <iterator> #include <iterator>
#include <limits> #include <limits>
#include <c10/util/C++17.h>
#include <ATen/cuda/cub_definitions.cuh> #include <ATen/cuda/cub_definitions.cuh>
#if USE_GLOBAL_CUB_WRAPPED_NAMESPACE() #if USE_GLOBAL_CUB_WRAPPED_NAMESPACE()

View File

@ -8,17 +8,6 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#if !defined(__clang__) && !defined(_MSC_VER) && defined(__GNUC__) && \
__GNUC__ < 5
#error \
"You're trying to build PyTorch with a too old version of GCC. We need GCC 5 or later."
#endif
#if defined(__clang__) && __clang_major__ < 4
#error \
"You're trying to build PyTorch with a too old version of Clang. We need Clang 4 or later."
#endif
#if (defined(_MSC_VER) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)) || \ #if (defined(_MSC_VER) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)) || \
(!defined(_MSC_VER) && __cplusplus < 201703L) (!defined(_MSC_VER) && __cplusplus < 201703L)
#error You need C++17 to compile PyTorch #error You need C++17 to compile PyTorch

View File

@ -15,7 +15,6 @@
/// and inspired by Half implementation from pytorch/c10/util/Half.h /// and inspired by Half implementation from pytorch/c10/util/Half.h
#include <c10/macros/Macros.h> #include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/TypeSafeSignMath.h> #include <c10/util/TypeSafeSignMath.h>
#include <c10/util/floating_point_utils.h> #include <c10/util/floating_point_utils.h>
#include <type_traits> #include <type_traits>

View File

@ -18,7 +18,6 @@
/// the existing Float8_e4m3fn implementation. /// the existing Float8_e4m3fn implementation.
#include <c10/macros/Macros.h> #include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/TypeSafeSignMath.h> #include <c10/util/TypeSafeSignMath.h>
#include <c10/util/floating_point_utils.h> #include <c10/util/floating_point_utils.h>
#include <type_traits> #include <type_traits>

View File

@ -18,7 +18,6 @@
/// the existing Float8_e4m3fn implementation. /// the existing Float8_e4m3fn implementation.
#include <c10/macros/Macros.h> #include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/TypeSafeSignMath.h> #include <c10/util/TypeSafeSignMath.h>
#include <c10/util/floating_point_utils.h> #include <c10/util/floating_point_utils.h>

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <c10/util/C++17.h>
#include <c10/util/TypeTraits.h> #include <c10/util/TypeTraits.h>
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
@ -501,10 +500,8 @@ struct map_types_to_values final {
template <class... Types> template <class... Types>
struct map_types_to_values<typelist<Types...>> final { struct map_types_to_values<typelist<Types...>> final {
template <class Func> template <class Func>
static std::tuple<c10::invoke_result_t<Func, type_<Types>>...> call( static auto call(Func&& func) {
Func&& func) { return std::tuple{std::forward<Func>(func)(type_<Types>())...};
return std::tuple<c10::invoke_result_t<Func, type_<Types>>...>{
std::forward<Func>(func)(type_<Types>())...};
} }
}; };
} // namespace detail } // namespace detail

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <c10/macros/Macros.h> #include <c10/macros/Macros.h>
#include <c10/util/C++17.h>
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
#include <torch/csrc/Export.h> #include <torch/csrc/Export.h>
#include <torch/csrc/jit/frontend/parser_constants.h> #include <torch/csrc/jit/frontend/parser_constants.h>