diff --git a/aten/src/ATen/NumericUtils.h b/aten/src/ATen/NumericUtils.h index 788da64b4e42..b2661baadecf 100644 --- a/aten/src/ATen/NumericUtils.h +++ b/aten/src/ATen/NumericUtils.h @@ -115,15 +115,15 @@ inline C10_HOST_DEVICE bool _isinf(at::Float8_e5m2 val) { return val.isinf(); } -inline C10_HOST_DEVICE bool _isinf(at::Float8_e4m3fn val) { +inline C10_HOST_DEVICE bool _isinf(at::Float8_e4m3fn val [[maybe_unused]]) { return false; } -inline C10_HOST_DEVICE bool _isinf(at::Float8_e5m2fnuz val) { +inline C10_HOST_DEVICE bool _isinf(at::Float8_e5m2fnuz val [[maybe_unused]]) { return false; } -inline C10_HOST_DEVICE bool _isinf(at::Float8_e4m3fnuz val) { +inline C10_HOST_DEVICE bool _isinf(at::Float8_e4m3fnuz val [[maybe_unused]]) { return false; } diff --git a/aten/src/ATen/detail/AcceleratorHooksInterface.h b/aten/src/ATen/detail/AcceleratorHooksInterface.h index 96e15e1f69da..d36e1c3f10c6 100644 --- a/aten/src/ATen/detail/AcceleratorHooksInterface.h +++ b/aten/src/ATen/detail/AcceleratorHooksInterface.h @@ -2,6 +2,7 @@ #include #include +C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wunused-parameter") namespace at { // AcceleratorHooksInterface is a shared interface provided by all @@ -42,3 +43,4 @@ struct TORCH_API AcceleratorHooksInterface { }; } // namespace at +C10_CLANG_DIAGNOSTIC_POP() diff --git a/aten/src/ATen/detail/IPUHooksInterface.h b/aten/src/ATen/detail/IPUHooksInterface.h index 593987cd23e6..8f24df4fdd2d 100644 --- a/aten/src/ATen/detail/IPUHooksInterface.h +++ b/aten/src/ATen/detail/IPUHooksInterface.h @@ -11,13 +11,13 @@ struct TORCH_API IPUHooksInterface { virtual ~IPUHooksInterface() = default; virtual const Generator& getDefaultIPUGenerator( - DeviceIndex device_index = -1) const { + DeviceIndex device_index [[maybe_unused]] = -1) const { AT_ERROR( "Cannot get the default IPU generator: the IPU backend is not " "available."); } - virtual Generator newIPUGenerator(DeviceIndex device_index = -1) const { + virtual Generator newIPUGenerator(DeviceIndex device_index [[maybe_unused]] = -1) const { AT_ERROR( "Cannot create a new IPU generator: the IPU backend is not available."); } diff --git a/aten/src/ATen/detail/MPSHooksInterface.h b/aten/src/ATen/detail/MPSHooksInterface.h index 814b5aeb72d8..a06ee40c2554 100644 --- a/aten/src/ATen/detail/MPSHooksInterface.h +++ b/aten/src/ATen/detail/MPSHooksInterface.h @@ -10,6 +10,7 @@ #include +C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wunused-parameter") namespace at { struct TORCH_API MPSHooksInterface : AcceleratorHooksInterface { @@ -107,3 +108,4 @@ TORCH_API const MPSHooksInterface& getMPSHooks(); } // namespace detail } // namespace at +C10_CLANG_DIAGNOSTIC_POP() diff --git a/aten/src/ATen/detail/XPUHooksInterface.h b/aten/src/ATen/detail/XPUHooksInterface.h index 82cc0e9ef954..b3e1f175c279 100644 --- a/aten/src/ATen/detail/XPUHooksInterface.h +++ b/aten/src/ATen/detail/XPUHooksInterface.h @@ -7,6 +7,7 @@ #include #include +C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wunused-parameter") namespace at { @@ -80,3 +81,4 @@ namespace detail { TORCH_API const XPUHooksInterface& getXPUHooks(); } // namespace detail } // namespace at +C10_CLANG_DIAGNOSTIC_POP() diff --git a/aten/src/ATen/native/mkl/LinearAlgebra.cpp b/aten/src/ATen/native/mkl/LinearAlgebra.cpp index 5e82613f4228..582de5f8213a 100644 --- a/aten/src/ATen/native/mkl/LinearAlgebra.cpp +++ b/aten/src/ATen/native/mkl/LinearAlgebra.cpp @@ -2,6 +2,7 @@ #include #include +C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wunused-parameter") #if !AT_MKL_ENABLED() namespace at { namespace native { @@ -153,3 +154,4 @@ void mkl_gemm_f16f16f32( }} // namespace at::native #endif +C10_CLANG_DIAGNOSTIC_POP() diff --git a/benchmarks/instruction_counts/definitions/standard.py b/benchmarks/instruction_counts/definitions/standard.py index c520a0a9f083..190c86a05198 100644 --- a/benchmarks/instruction_counts/definitions/standard.py +++ b/benchmarks/instruction_counts/definitions/standard.py @@ -35,7 +35,7 @@ BENCHMARKS: FlatIntermediateDefinition = flatten( // @Setup auto options_empty = c10::TensorOptions(); auto options_full = c10::TensorOptions().dtype(at::kFloat).device(at::kCPU); - auto optional_float = c10::make_optional(at::kFloat); + auto optional_float = std::make_optional(at::kFloat); // @TensorOptions overload at::empty({0}, options_empty); diff --git a/c10/core/SymNodeImpl.h b/c10/core/SymNodeImpl.h index e73d0c4ac6e1..0847af2fce53 100644 --- a/c10/core/SymNodeImpl.h +++ b/c10/core/SymNodeImpl.h @@ -9,6 +9,8 @@ #include #include +C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wunused-parameter") + namespace c10 { class SymNodeImpl; @@ -237,3 +239,5 @@ class C10_API SymNodeImpl : public c10::intrusive_ptr_target { }; } // namespace c10 + +C10_CLANG_DIAGNOSTIC_POP() diff --git a/c10/util/Half.h b/c10/util/Half.h index 99aee70bd669..53aa62eba850 100644 --- a/c10/util/Half.h +++ b/c10/util/Half.h @@ -462,7 +462,7 @@ C10_CLANG_DIAGNOSTIC_IGNORE("-Wimplicit-float-conversion") template std::enable_if_t, bool> overflows( From /*f*/, - bool strict_unsigned = false) { + bool strict_unsigned [[maybe_unused]] = false) { return false; } @@ -487,7 +487,7 @@ overflows(From f, bool strict_unsigned = false) { template std::enable_if_t, bool> overflows( From f, - bool strict_unsigned = false) { + bool strict_unsigned [[maybe_unused]] = false) { using limit = std::numeric_limits::type>; if (limit::has_infinity && std::isinf(static_cast(f))) { return false; @@ -519,10 +519,10 @@ std::enable_if_t::value, bool> overflows( // able to figure it out.) return overflows< typename scalar_value_type::type, - typename From::value_type>(f.real()) || + typename From::value_type>(f.real(), strict_unsigned) || overflows< typename scalar_value_type::type, - typename From::value_type>(f.imag()); + typename From::value_type>(f.imag(), strict_unsigned); } C10_API inline std::ostream& operator<<(std::ostream& out, const Half& value) { diff --git a/c10/util/logging_is_not_google_glog.h b/c10/util/logging_is_not_google_glog.h index 3b1b869756eb..9e9ff45948bb 100644 --- a/c10/util/logging_is_not_google_glog.h +++ b/c10/util/logging_is_not_google_glog.h @@ -52,7 +52,7 @@ class C10_API LoggerVoidify { LoggerVoidify() = default; // This has to be an operator with a precedence lower than << but // higher than ?: - void operator&(const std::ostream& s) {} + void operator&(const std::ostream& s [[maybe_unused]]) {} }; // Log a message and terminate. diff --git a/torch/csrc/api/include/torch/enum.h b/torch/csrc/api/include/torch/enum.h index debfc6c78585..02d409a3d64c 100644 --- a/torch/csrc/api/include/torch/enum.h +++ b/torch/csrc/api/include/torch/enum.h @@ -30,10 +30,10 @@ const enumtype::k##name k##name; \ } -#define TORCH_ENUM_PRETTY_PRINT(name) \ - std::string operator()(const enumtype::k##name& v) const { \ - std::string k("k"); \ - return k + #name; \ +#define TORCH_ENUM_PRETTY_PRINT(name) \ + std::string operator()(const enumtype::k##name& v [[maybe_unused]]) const { \ + std::string k("k"); \ + return k + #name; \ } // NOTE: Backstory on why we need the following two macros: