Skip to content

Warning triage #236

Closed
Closed

Description

@stellaraccident

The OSS build is producing quite a bit of warnings that we should triage. We should first match the warning flags with what we use upstream and then see about what to do with the rest.

I'm addition, I submitted a change to bazel to disable the bulk of the warnings it generates for tensorflow. Not sure what version that will roll out to but we'll get it eventually.

Activity

  1. added
    infrastructure
    on Mar 19, 2020
  2. benvanik commented on Mar 26, 2020

    @benvanik
    Collaborator

    cmake/clang:

    [45/2519] Building CXX object third_party/abseil-cpp/absl/time/CMakeFiles/absl_time_zone.dir/internal/cctz/src/time_zone_libc.cc.o
    ../third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc:166:22: warning: declaration shadows a local variable [-Wshadow]
            if (std::tm* tmp = local_time(&lo, &tm)) {
                         ^
    ../third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc:156:18: note: previous declaration is here
        if (std::tm* tmp = local_time(&mid, &tm)) {
                     ^
    ../third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc:191:9: warning: result of comparison 'const std::int_fast64_t' (aka 'const long') < -9223372036854775808 is always false [-Wtautological-type-limit-compare]
      if (s < std::numeric_limits<std::time_t>::min()) {
          ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc:195:9: warning: result of comparison 'const std::int_fast64_t' (aka 'const long') > 9223372036854775807 is always false [-Wtautological-type-limit-compare]
      if (s > std::numeric_limits<std::time_t>::max()) {
          ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc:82:6: warning: unused function template 'tm_gmtoff' [-Wunused-template]
    auto tm_gmtoff(const T& tm) -> decltype(tm.__tm_gmtoff) {
         ^
    ../third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc:100:6: warning: unused function template 'tm_zone' [-Wunused-template]
    auto tm_zone(const T& tm) -> decltype(tm.__tm_zone) {
         ^
    5 warnings generated.
    

    may be worth disabling warnings for abseil or doing an upstream change

  3. benvanik commented on Mar 26, 2020

    @benvanik
    Collaborator

    All of these came from the same few macros I believe; I'll see if I can either make the compiler shut up with a code change or disable that warning:

    [802/2519] Building CXX object iree/modules/tensorlist/CMakeFiles/iree_modules_tensorlist_native_module.dir/native_module.cc.o
    In file included from ../iree/modules/tensorlist/native_module.cc:26:
    ../iree/base/ref_ptr.h:334:55: warning: offset of on non-standard-layout type 'iree::(anonymous namespace)::TensorList' [-Winvalid-offsetof]
      static constexpr size_t offsetof_counter() { return offsetof(T, counter_); }
                                                          ^           ~~~~~~~~
    /usr/include/clang/6.0.1/include/stddef.h:120:24: note: expanded from macro 'offsetof'
    #define offsetof(t, d) __builtin_offsetof(t, d)
                           ^                     ~
    ../iree/modules/tensorlist/native_module.cc:256:3: note: in instantiation of member function 'iree::RefObject<iree::(anonymous namespace)::TensorList>::offsetof_counter' requested here
      IREE_VM_REGISTER_CC_TYPE(TensorList, "tensorlist.list",
      ^
    ../iree/vm/types.h:47:39: note: expanded from macro 'IREE_VM_REGISTER_CC_TYPE'
      descriptor.offsetof_counter = type::offsetof_counter(); \
                                          ^
    1 warning generated.
    
  4. benvanik commented on Mar 26, 2020

    @benvanik
    Collaborator

    Once the conv kernel is working in linalg/spirv we can remove our dep on glslang entirely!

    [875/2519] Building CXX object third_party/glslang/glslang/CMakeFiles/glslang.dir/MachineIndependent/Initialize.cpp.o
    ../third_party/glslang/glslang/MachineIndependent/Initialize.cpp:128:16: warning: unused variable 'ClassV1FOCV' [-Wunused-const-variable]
    const ArgClass ClassV1FOCV  = (ArgClass)(ClassV1 | ClassFO  | ClassCV);
                   ^
    ../third_party/glslang/glslang/MachineIndependent/Initialize.cpp:129:16: warning: unused variable 'ClassV1CV' [-Wunused-const-variable]
    const ArgClass ClassV1CV    = (ArgClass)(ClassV1 | ClassCV);
                   ^
    2 warnings generated.
    
  5. benvanik commented on Mar 26, 2020

    @benvanik
    Collaborator

    Hmm this is a weird one - VkDeviceSize is typedefed to uint64_t, which I thought this would be ok with as stdint.h declares uint64_t as typedef unsigned long long uint64_t;. This may be spurious, and another place we could disable third-party warnings.

    [935/2519] Building CXX object iree/hal/vulkan/CMakeFiles/iree_hal_vulkan_vma_allocator.dir/internal_vk_mem_alloc.cc.o
    In file included from ../iree/hal/vulkan/internal_vk_mem_alloc.cc:66:
    ../third_party/vulkan_memory_allocator/src/vk_mem_alloc.h:11744:70: warning: format specifies type 'unsigned long long' but the argument has type 'VkDeviceSize' (aka 'unsigned long') [-Wformat]
                        VMA_DEBUG_LOG("    Created new block Size=%llu", newBlockSize);
                                                                  ~~~~   ^~~~~~~~~~~~
                                                                  %lu
    ../iree/hal/vulkan/internal_vk_mem_alloc.cc:46:47: note: expanded from macro 'VMA_DEBUG_LOG'
    #define VMA_DEBUG_LOG(...) ABSL_RAW_LOG(INFO, __VA_ARGS__)
                                                  ^~~~~~~~~~~
    ../third_party/abseil-cpp/absl/base/internal/raw_logging.h:49:52: note: expanded from macro 'ABSL_RAW_LOG'
                                             __LINE__, __VA_ARGS__);               \
                                                       ^~~~~~~~~~~
    In file included from ../iree/hal/vulkan/internal_vk_mem_alloc.cc:66:
    ../third_party/vulkan_memory_allocator/src/vk_mem_alloc.h:14433:122: warning: format specifies type 'unsigned long long' but the argument has type 'VkDeviceSize' (aka 'unsigned long') [-Wformat]
        VMA_DEBUG_LOG("  AllocateMemory: MemoryTypeIndex=%u, AllocationCount=%zu, Size=%llu", memTypeIndex, allocationCount, size);
                                                                                       ~~~~                                  ^~~~
                                                                                       %lu
    ../iree/hal/vulkan/internal_vk_mem_alloc.cc:46:47: note: expanded from macro 'VMA_DEBUG_LOG'
    #define VMA_DEBUG_LOG(...) ABSL_RAW_LOG(INFO, __VA_ARGS__)
                                                  ^~~~~~~~~~~
    ../third_party/abseil-cpp/absl/base/internal/raw_logging.h:49:52: note: expanded from macro 'ABSL_RAW_LOG'
                                             __LINE__, __VA_ARGS__);               \
                                                       ^~~~~~~~~~~
    2 warnings generated.
    
  6. benvanik commented on Mar 26, 2020

    @benvanik
    Collaborator

    bazel/clang:

    Many unused functions. I'd actually like to keep this on (for now) and actually delete these. If you have a static function and aren't calling it such that it's provably dead, should just delete it.

    INFO: From Compiling iree/compiler/Dialect/Shape/IR/ShapeOps.cpp [for host]:
    iree/compiler/Dialect/Shape/IR/ShapeOps.cpp:43:26: warning: unused function 'getDimTypeRange' [-Wunused-function]
    static RepeatRange<Type> getDimTypeRange(RankedShapeType type) {
                             ^
    iree/compiler/Dialect/Shape/IR/ShapeOps.cpp:50:26: warning: unused function 'getDimTypeDynamicRange' [-Wunused-function]
    static RepeatRange<Type> getDimTypeDynamicRange(RankedShapeType type) {
                             ^
    2 warnings generated.
    
  7. benvanik commented on Mar 26, 2020

    @benvanik
    Collaborator

    cmake/msvc:

    Yeah, this needs to be fixed upstream - I will likely silence for now:

    [build] D:\Dev\iree\third_party\llvm-project\llvm\include\llvm/IR/User.h(48): warning C4141: 'inline': used more than once
    
  8. benvanik commented on Mar 26, 2020

    @benvanik
    Collaborator

    These are actually legit and need to be fixed:

    [build] D:\Dev\iree\iree\vm\context.c(226): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
    [build] D:\Dev\iree\iree\vm\context.c(270): warning C4244: 'return': conversion from 'const intptr_t' to 'int32_t', possible loss of data
    [build] D:\Dev\iree\iree\vm\context.c(343): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
    [build] D:\Dev\iree\iree\vm\context.c(423): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
    
  9. benvanik commented on Mar 26, 2020

    @benvanik
    Collaborator

    cmake/msvc:

    Many files have this; worth just disabling the warning for llvm if they don't seem to care:

    [build] D:\Dev\iree\third_party\llvm-project\llvm\include\llvm/Support/Windows/WindowsSupport.h(31): warning C4005: 'WIN32_LEAN_AND_MEAN': macro redefinition
    [build] D:\Dev\iree\third_party\llvm-project\llvm\lib\Support\InitLLVM.cpp: note: see previous definition of 'WIN32_LEAN_AND_MEAN'
    
  10. benvanik commented on Mar 27, 2020

    @benvanik
    Collaborator

    Issue in @google/benchmark for their c4244 warning: google/benchmark#949

  11. added this to the Infrastructure Fixit milestone on Apr 15, 2020
  12. benvanik commented on Apr 15, 2020

    @benvanik
    Collaborator

    google/benchmark#949 has landed; I'll bump the submodule version.

  13. added a commit that references this issue on May 6, 2020
  14. benvanik commented on Nov 22, 2020

    @benvanik
    Collaborator

    #3874 fixed a large majority of these. If more remain we should file issues and work through them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    infrastructure

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions