pytorch / pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration
https://pytorch.org
Other
83.99k stars 22.64k forks source link

Compiler warnings tracking #55952

Open driazati opened 3 years ago

driazati commented 3 years ago

PyTorch's build outputs a bunch of compile warnings which make it hard to sift through build logs. This task lists them out and their status. Once all these are fixed we could/should turn on -Werror (and -pedantic) so things don't pop back up in the future. This list isn't comprehensive by any means, it's just what I collected on a Linux box with the default build options. See also #56085

External

``` [2805/3029] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/jit/serialization/export.cpp.o In file included from ../third_party/onnx/onnx/defs/shape_inference.h:4, from ../third_party/onnx/onnx/defs/schema.h:24, from ../third_party/onnx/onnx/checker.h:7, from ../torch/csrc/jit/serialization/export.cpp:20: ../third_party/onnx/onnx/proto_utils.h: In instantiation of ‘bool onnx_torch::ParseProtoFromBytes(Proto*, const char*, size_t) [with Proto = onnx_torch::ModelProto; size_t = long unsigned int]’: ../torch/csrc/jit/serialization/export.cpp:952:77: required from here ../third_party/onnx/onnx/proto_utils.h:34:34: warning: ‘void google::protobuf::io::CodedInputStream::SetTotalBytesLimit(int, int)’ is deprecated: Please use the single parameter version of SetTotalBytesLimit(). The second parameter is ignored. [-Wdeprecated-declarations] coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from third_party/onnx/onnx/onnx_onnx_torch-ml.pb.h:23, from third_party/onnx/onnx/onnx-ml.pb.h:2, from ../third_party/onnx/onnx/onnx_pb.h:50, from ../torch/csrc/jit/serialization/onnx.h:3, from ../torch/csrc/jit/serialization/export.cpp:17: ../third_party/protobuf/src/google/protobuf/io/coded_stream.h:397:8: note: declared here void SetTotalBytesLimit(int total_bytes_limit, int) { ^~~~~~~~~~~~~~~~~~ ```
``` [959/3019] Building C object confu-deps/XNNPACK/CMakeFiles/XNNPACK.dir/src/f32-vscaleextexp/gen/avx512f-p5-scalef-x144.c.o In file included from ../third_party/XNNPACK/include/xnnpack.h:15:0, from ../third_party/XNNPACK/src/xnnpack/params.h:15, from ../third_party/XNNPACK/src/xnnpack/vscaleextexp.h:11, from ../third_party/XNNPACK/src/f32-vscaleextexp/gen/avx512f-p5-scalef-x144.c:16: ../third_party/pthreadpool/include/pthreadpool.h:183:2: warning: ‘pthreadpool_function_1d_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_1d_t function, ^~~~~~~~~~~~~~~~~~~~~~~~~ ../third_party/pthreadpool/include/pthreadpool.h:189:2: warning: ‘pthreadpool_function_1d_tiled_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_1d_tiled_t function, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../third_party/pthreadpool/include/pthreadpool.h:196:2: warning: ‘pthreadpool_function_2d_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_2d_t function, ^~~~~~~~~~~~~~~~~~~~~~~~~ ../third_party/pthreadpool/include/pthreadpool.h:203:2: warning: ‘pthreadpool_function_2d_tiled_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_2d_tiled_t function, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../third_party/pthreadpool/include/pthreadpool.h:212:2: warning: ‘pthreadpool_function_3d_tiled_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_3d_tiled_t function, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../third_party/pthreadpool/include/pthreadpool.h:223:2: warning: ‘pthreadpool_function_4d_tiled_t’ is deprecated [-Wdeprecated-declarations] pthreadpool_function_4d_tiled_t function, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```

Internal

``` [2756/3029] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/utils/tensor_flatten.cpp.o In file included from ../torch/csrc/utils/tensor_flatten.cpp:1: ../torch/csrc/utils/tensor_flatten.h: In member function ‘at::DeprecatedTypeProperties& torch::utils::TensorGroup::type()’: ../torch/csrc/utils/tensor_flatten.h:44:28: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replaceme nt. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations] return tensors[0].type(); ^ In file included from ../aten/src/ATen/Tensor.h:3, from ../aten/src/ATen/Context.h:4, from ../aten/src/ATen/ATen.h:9, from ../torch/csrc/utils/tensor_flatten.h:5, from ../torch/csrc/utils/tensor_flatten.cpp:1: aten/src/ATen/core/TensorBody.h:334:30: note: declared here DeprecatedTypeProperties & type() const { ^~~~ ../torch/csrc/utils/tensor_flatten.cpp: In function ‘std::vector torch::utils::take_tensors(at::Te nsorList, size_t, bool)’: ../torch/csrc/utils/tensor_flatten.cpp:31:43: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated : Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replace ment. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type() , use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations] auto& type_group = groups[tensor.type().id()]; ^ In file included from ../aten/src/ATen/Tensor.h:3, from ../aten/src/ATen/Context.h:4, from ../aten/src/ATen/ATen.h:9, from ../torch/csrc/utils/tensor_flatten.h:5, from ../torch/csrc/utils/tensor_flatten.cpp:1: aten/src/ATen/core/TensorBody.h:334:30: note: declared here DeprecatedTypeProperties & type() const { ^~~~ ```
``` [3685/5420] Building CXX object caffe2/CMakeFiles/ivalue_test.dir/__/aten/src/ATen/test/ivalue_test.cpp.o ../aten/src/ATen/test/ivalue_test.cpp: In member function ‘virtual void c10::IValueTest_getSubValues_Test::TestBody()’: ../aten/src/ATen/test/ivalue_test.cpp:615:27: warning: ‘c10::IValue::IValue(std::unordered_map) [with Key = long int; Value = at::Tensor]’ is deprecated: IValues based on std::unordered_map are slow and deprecated. Please use c10::D ict instead. [-Wdeprecated-declarations] IValue dict(std::move(m)); ^ In file included from ../aten/src/ATen/core/ivalue.h:1175, from ../aten/src/ATen/record_function.h:3, from ../aten/src/ATen/Dispatch.h:5, from ../aten/src/ATen/ATen.h:13, from ../aten/src/ATen/test/ivalue_test.cpp:1: ../aten/src/ATen/core/ivalue_inl.h:1217:8: note: declared here inline IValue::IValue(std::unordered_map v) ^~~~~~ ```
``` [4571/5420] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/__/torch/csrc/autograd/record_function_ops.cpp.o ../torch/csrc/autograd/record_function_ops.cpp: In function ‘at::Tensor torch::autograd::profiler::record_function_enter(cons t string&)’: ../torch/csrc/autograd/record_function_ops.cpp:22:78: warning: ‘at::Tensor at::cpp_custom_type_hack::create(std::unique_ptr<_ Tp>, c10::TensorOptions) [with T = at::RecordFunction]’ is deprecated: Use custom classes instead: https://pytorch.org/tutori als/advanced/torch_script_custom_classes.html [-Wdeprecated-declarations] return at::cpp_custom_type_hack::create(std::move(rec), at::TensorOptions()); ^ In file included from ../torch/csrc/autograd/record_function_ops.cpp:1: ../aten/src/ATen/cpp_custom_type_hack.h:83:8: note: declared here Tensor create(std::unique_ptr ptr, TensorOptions options) { ^~~~~~ ../torch/csrc/autograd/record_function_ops.cpp:22:78: warning: ‘at::Tensor at::cpp_custom_type_hack::create(std::unique_ptr<_ Tp>, c10::TensorOptions) [with T = at::RecordFunction]’ is deprecated: Use custom classes instead: https://pytorch.org/tutori als/advanced/torch_script_custom_classes.html [-Wdeprecated-declarations] return at::cpp_custom_type_hack::create(std::move(rec), at::TensorOptions()); ^ In file included from ../torch/csrc/autograd/record_function_ops.cpp:1: ../aten/src/ATen/cpp_custom_type_hack.h:83:8: note: declared here Tensor create(std::unique_ptr ptr, TensorOptions options) { ^~~~~~ ../torch/csrc/autograd/record_function_ops.cpp: In function ‘at::RecordFunction& torch::autograd::profiler::getRecordFunction FromTensor(const at::Tensor&)’: ../torch/csrc/autograd/record_function_ops.cpp:26:72: warning: ‘T& at::cpp_custom_type_hack::cast(const at::Tensor&) [with T = at::RecordFunction]’ is deprecated: Use custom classes instead: https://pytorch.org/tutorials/advanced/torch_script_custom_ classes.html [-Wdeprecated-declarations] auto& rec = at::cpp_custom_type_hack::cast(handle); ^ In file included from ../torch/csrc/autograd/record_function_ops.cpp:1: ../aten/src/ATen/cpp_custom_type_hack.h:69:4: note: declared here T& cast(const Tensor& packed) { ^~~~ ../torch/csrc/autograd/record_function_ops.cpp:26:72: warning: ‘T& at::cpp_custom_type_hack::cast(const at::Tensor&) [with T = at::RecordFunction]’ is deprecated: Use custom classes instead: https://pytorch.org/tutorials/advanced/torch_script_custom_ classes.html [-Wdeprecated-declarations] auto& rec = at::cpp_custom_type_hack::cast(handle); ^ In file included from ../torch/csrc/autograd/record_function_ops.cpp:1: ../aten/src/ATen/cpp_custom_type_hack.h:69:4: note: declared here T& cast(const Tensor& packed) { ^~~~ ```
``` [5176/5420] Building CXX object test_api/CMakeFiles/test_api.dir/tensor.cpp.o In file included from ../cmake/../third_party/googletest/googletest/include/gtest/gtest.h:59, from ../test/cpp/api/tensor.cpp:1: ../test/cpp/api/tensor.cpp: In function ‘void test_TorchTensorCtorSingleDimFloatingType_expected_dtype(c10::ScalarType)’: ../test/cpp/api/tensor.cpp:427:34: warning: ‘bool at::Tensor::is_variable() const’ is deprecated: Tensor.is_variable() is dep recated; everything is a variable now. (If you want to assert that variable has been appropriately handled already, use at::i mpl::variable_excluded_from_dispatch()) [-Wdeprecated-declarations] ASSERT_TRUE(tensor.is_variable()); ^ In file included from ../aten/src/ATen/TensorIndexing.h:4, from ../test/cpp/api/support.h:8, from ../test/cpp/api/tensor.cpp:2: aten/src/ATen/core/TensorBody.h:362:8: note: declared here bool is_variable() const noexcept { ^~~~~~~~~~~ In file included from ../cmake/../third_party/googletest/googletest/include/gtest/gtest.h:59, from ../test/cpp/api/tensor.cpp:1: ../test/cpp/api/tensor.cpp:436:34: warning: ‘bool at::Tensor::is_variable() const’ is deprecated: Tensor.is_variable() is dep recated; everything is a variable now. (If you want to assert that variable has been appropriately handled already, use at::i mpl::variable_excluded_from_dispatch()) [-Wdeprecated-declarations] ASSERT_TRUE(tensor.is_variable()); ^ In file included from ../aten/src/ATen/TensorIndexing.h:4, from ../test/cpp/api/support.h:8, from ../test/cpp/api/tensor.cpp:2: aten/src/ATen/core/TensorBody.h:362:8: note: declared here bool is_variable() const noexcept { ^~~~~~~~~~~ In file included from ../cmake/../third_party/googletest/googletest/include/gtest/gtest.h:59, from ../test/cpp/api/tensor.cpp:1: ../test/cpp/api/tensor.cpp:444:34: warning: ‘bool at::Tensor::is_variable() const’ is deprecated: Tensor.is_variable() is dep recated; everything is a variable now. (If you want to assert that variable has been appropriately handled already, use at::i mpl::variable_excluded_from_dispatch()) [-Wdeprecated-declarations] ASSERT_TRUE(tensor.is_variable()); ^ In file included from ../aten/src/ATen/TensorIndexing.h:4, from ../test/cpp/api/support.h:8, from ../test/cpp/api/tensor.cpp:2: aten/src/ATen/core/TensorBody.h:362:8: note: declared here bool is_variable() const noexcept { ^~~~~~~~~~~ ```

@pytorch/pytorch-dev-infra

skyline75489 commented 3 years ago

wait, am I the only one seeing all the warnings in #55034? :/

driazati commented 3 years ago

Not at all, I didn't mean this to be a complete list (and it definitely isn't right now), there's probably a bunch of things missing