Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable -Werror, with exceptions #3666

Merged
merged 3 commits into from
Jan 6, 2025
Merged

Re-enable -Werror, with exceptions #3666

merged 3 commits into from
Jan 6, 2025

Conversation

jacobhinkle
Copy link
Collaborator

@jacobhinkle jacobhinkle commented Jan 2, 2025

Stacked on #3664.

We previously disabled compiling with -Werror due to a bug in GCC 12.2 which erroneously causes the compile to fail. The relevant warnings in that case were -Wrestrict and -Wstringop-overflow:

...

    inlined from ‘nvfuser::Val* nvfuser::rules::distributeMul(nvfuser::Val*, const nvfuser::Context&)’ at /opt/pytorch/nvfuser/csrc/expr_simplifier.cpp:2414:32:
/usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775800 bytes at offsets 0 and 0 overlaps 9223372036854775793 bytes at offset 7 [-Wrestrict]
  437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

...

    inlined from ‘std::unique_ptr<nvfuser::executor_utils::caching::VectorizedTensorInfo> nvfuser::executor_utils::{anonymous}::getVectorizedTensorValidationInfo(nvfuser::kir::Kernel*)’ at /opt/pytorch/nvfuser/csrc/runtime/executor_utils.cpp:328:72:
/usr/include/c++/13/bits/stl_construct.h:97:14: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   97 |     { return ::new((void*)__location) _Tp(std::forward<_Args>(__args)...); }

In this PR, I'm adding -Werror back to the compile flags but also adding -Wno-error=restrict -Wno-error=stringop-overflow. With these, we will still get the warnings for these cases, but all other types of warnings will give us an error. This would have caught #3001 or #3664.

Previous discussion: #3001 (comment)

We previously disabled compiling with `-Werror` due to a bug in GCC 12.2
which erroneously causes the compile to fail. The relevant warnings in
that case were `-Wrestrict` and `-Wstringop-overflow`:
```
...

    inlined from ‘nvfuser::Val* nvfuser::rules::distributeMul(nvfuser::Val*, const nvfuser::Context&)’ at /opt/pytorch/nvfuser/csrc/expr_simplifier.cpp:2414:32:
/usr/include/c++/13/bits/stl_algobase.h:437:30: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775800 bytes at offsets 0 and 0 overlaps 9223372036854775793 bytes at offset 7 [-Wrestrict]
  437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

...

    inlined from ‘std::unique_ptr<nvfuser::executor_utils::caching::VectorizedTensorInfo> nvfuser::executor_utils::{anonymous}::getVectorizedTensorValidationInfo(nvfuser::kir::Kernel*)’ at /opt/pytorch/nvfuser/csrc/runtime/executor_utils.cpp:328:72:
/usr/include/c++/13/bits/stl_construct.h:97:14: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   97 |     { return ::new((void*)__location) _Tp(std::forward<_Args>(__args)...); }
```

In this PR, I'm adding `-Werror` back to the compile flags but also
adding `-Wno-error=restrict -Wno-error=stringop-overflow`. With these,
we will still get the warnings for these cases, but all other types of
warnings will give us an error. This would have caught #3001 or #3664.

Previous discussion: #3001 (comment)
@jacobhinkle
Copy link
Collaborator Author

!build

@jjsjann123
Copy link
Collaborator

Totally on board with this. Looks like CI is failing and I imagine we needed to relax quite a few more no-error in order to make CI and our build happy.

@jacobhinkle
Copy link
Collaborator Author

Totally on board with this. Looks like CI is failing and I imagine we needed to relax quite a few more no-error in order to make CI and our build happy.

Nah I just need to merge #3664. Then my local build succeeds at least.

Copy link
Collaborator

@jjsjann123 jjsjann123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamping to unblock. Let's make sure that all CI builds are successful before merging.

Thanks a lot for updating this 💯

@jacobhinkle
Copy link
Collaborator Author

!test

@jacobhinkle
Copy link
Collaborator Author

!test

@jacobhinkle jacobhinkle merged commit e9433fe into main Jan 6, 2025
42 of 43 checks passed
@jacobhinkle jacobhinkle deleted the enable_werror branch January 6, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants