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

Add bazel flags to silence compiler warnings we can't do anything about #835

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

mhucka
Copy link
Member

@mhucka mhucka commented Jan 4, 2025

A number of harmless warnings during compilation come from third-party things pulled in by the TFQ build rules. They involve things like unused functions, unused variables, or some deprecated constructs. The best way to fix them would be in the original source code, but in some cases this is impossible; for example, we can't change what TensorFlow 2.15.0 needs. The second best way would be to add patch rules in TFQ to adjust the code or the build rules. I spent a couple of hours trying to figure out how to that for the copy of zlib included by bazel_rules, but due to my still-limited Bazel knowledge, I wasn't able to get the patching scheme working. So, for the time being, and in consideration of the harmless nature of the warnings, the approach taken here is to add compile-time per-file flags that tell the compiler not to warn about the specific kinds of problems that we know exist in the files involved.

mhucka added 2 commits January 4, 2025 20:19
A number of harmless warnings during compilation come from third-party
things pulled in by the TFQ build rules. They involve things like
unused functions, unused variables, or (in the case of zlib) some
deprecated uses of prototypes. The best way to fix them would be in
the original source code, but in some cases this is impossible; for
example, we can't change what TensorFlow 2.15.0 needs. The second best
way would be to add patch rules in TFQ to adjust the code or the build
rules. I spent a couple of hours trying to figure out how to that for
the copy of zlib included by bazel_rules, but due to my still-limited
Bazel knowledge, I wasn't able to get the patching scheme working. So,
for the time being, and in consideration of the harmless nature of the
warnings, the approach taken here is to add compile-time per-file
flags that tell the compiler not to warn about the specific kinds of
problems that we know exist in the files involved.
@mhucka mhucka marked this pull request as ready for review January 4, 2025 22:54
@mhucka mhucka added kind/chore Maintenance & housekeeping tasks area/code-health Concerns stability, quality, technical debt, etc. labels Jan 5, 2025
@mhucka mhucka self-assigned this Jan 5, 2025
Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

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

I'm fine with this, but I think we will be taking on a losing battle as we jump through versions of dependencies, new warnings will undoubtedly arise and old ones will undoubtedly disappear. If it really bothers you I'm fine with this, but we don't want to be making too much work for ourselves here.

@mhucka
Copy link
Member Author

mhucka commented Jan 7, 2025

Yeah, you're right; this is a path of diminishing returns. For now, I mainly wanted to silence as many warnings as possible in order to make it easier to see new warnings coming from updating dependencies, updated platforms, gpu vs cpu, etc. I will try not to go gonzo with this, though :-).

@mhucka mhucka merged commit cc4136a into tensorflow:master Jan 7, 2025
6 of 7 checks passed
@mhucka mhucka mentioned this pull request Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/code-health Concerns stability, quality, technical debt, etc. kind/chore Maintenance & housekeeping tasks
Development

Successfully merging this pull request may close these issues.

2 participants