Tons of compiler warnings since PyTorch 1.3.0

Ever since PyTorch 1.3.0 (I think), I get a bunch of compiler warnings around torch/csrc/api/include/torch/nn/functional/padding.h and /torch/csrc/autograd/profiler.h when compiling C++ and CUDA extensions. What’s the issue here? Is it something I can address or is this a PyTorch issue? It doesn’t seem to affect functionality when using the compiled extensions, but the compiler warnings are kind of annoying. At the very least, I’m hoping to understand where they’re coming from.

Here is an example output for a module:

building '_my_extension' extension
gcc -pthread -B /path/to/my/extension/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iext_modules/include -I/path/to/my/extension/lib/python3.7/site-packages/torch/include -I/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/path/to/my/extension/lib/python3.7/site-packages/torch/include/TH -I/path/to/my/extension/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/path/to/my/extension/include/python3.7m -c ext_modules/src/nn/cpp/convolution_layer.cpp -o build/temp.linux-x86_64-3.7/ext_modules/src/nn/cpp/convolution_layer.o -fopenmp -O3 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_my_extension -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -Iext_modules/include -I/path/to/my/extension/lib/python3.7/site-packages/torch/include -I/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/path/to/my/extension/lib/python3.7/site-packages/torch/include/TH -I/path/to/my/extension/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/path/to/my/extension/include/python3.7m -c ext_modules/src/nn/cuda/convolution_layer.cu -o build/temp.linux-x86_64-3.7/ext_modules/src/nn/cuda/convolution_layer.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' --gpu-architecture=compute_61 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_my_extension -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
/path/to/my/extension/lib/python3.7/site-packages/torch/include/c10/core/TensorTypeSet.h(44): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(14): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(15): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(15): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(15): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(18): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(19): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(19): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(19): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(23): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(24): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(24): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(24): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/autograd/profiler.h(97): warning: attribute "__visibility__" does not apply here

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/autograd/profiler.h(112): warning: attribute "__visibility__" does not apply here

/path/to/my/extension/lib/python3.7/site-packages/torch/include/c10/core/TensorTypeSet.h(44): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(14): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(15): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(15): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(15): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(18): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(19): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(19): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(19): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(23): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(24): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(24): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/functional/padding.h(24): warning: integer conversion resulted in a change of sign

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/autograd/profiler.h(97): warning: attribute "__visibility__" does not apply here

/path/to/my/extension/lib/python3.7/site-packages/torch/include/torch/csrc/autograd/profiler.h(112): warning: attribute "__visibility__" does not apply here

cc @yf225 is the idea here that these should be fixed and we would accept PR fixing them?

@albanD Yes 100% :smiley: @marcman411 Please let us know if you are interested in submitting a PR to fix them, thanks!

1 Like