mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
[1/N] Fix Wunused-parameter warnings (#130924)
Before we can turn Wunused-parameter into an error Pull Request resolved: https://github.com/pytorch/pytorch/pull/130924 Approved by: https://github.com/ezyang
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <c10/core/Device.h>
|
||||
#include <c10/core/Stream.h>
|
||||
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()
|
||||
|
@ -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.");
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
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()
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <ATen/core/Generator.h>
|
||||
#include <ATen/detail/AcceleratorHooksInterface.h>
|
||||
|
||||
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()
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <ATen/native/mkl/LinearAlgebra.h>
|
||||
#include <ATen/Config.h>
|
||||
|
||||
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()
|
||||
|
@ -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);
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
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()
|
||||
|
@ -462,7 +462,7 @@ C10_CLANG_DIAGNOSTIC_IGNORE("-Wimplicit-float-conversion")
|
||||
template <typename To, typename From>
|
||||
std::enable_if_t<std::is_same_v<From, bool>, 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 <typename To, typename From>
|
||||
std::enable_if_t<std::is_floating_point_v<From>, bool> overflows(
|
||||
From f,
|
||||
bool strict_unsigned = false) {
|
||||
bool strict_unsigned [[maybe_unused]] = false) {
|
||||
using limit = std::numeric_limits<typename scalar_value_type<To>::type>;
|
||||
if (limit::has_infinity && std::isinf(static_cast<double>(f))) {
|
||||
return false;
|
||||
@ -519,10 +519,10 @@ std::enable_if_t<is_complex<From>::value, bool> overflows(
|
||||
// able to figure it out.)
|
||||
return overflows<
|
||||
typename scalar_value_type<To>::type,
|
||||
typename From::value_type>(f.real()) ||
|
||||
typename From::value_type>(f.real(), strict_unsigned) ||
|
||||
overflows<
|
||||
typename scalar_value_type<To>::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) {
|
||||
|
@ -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.
|
||||
|
@ -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:
|
||||
|
Reference in New Issue
Block a user