-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
A lot of warnings in -Wunused-but-set-variable and Wunused-variable #1357
Comments
While I can only speak for myself, I did not see them as an immediate priority problem so far given the lack of active developers on this (mainly) volunteer project. Also when this topic last came up months ago I did not want to touch the level3 blas code as it seemed another developer was actively working on the affected functions. Fixing the warnings should be straightforward if time consuming, but I would hate to clean up harmless declarations of currently unused things that actually may be hooks already put in place for later developments. (Though most likely the majority will simply be leftovers from cut-and-paste coding.) |
Regarding the warnings arising from the fallback codes in kernel/generic, I guess I could offer the additional excuse that these are historic slips of the pen, written by Kazushige Goto a decade ago for what was then libGoto or GotoBLAS. So they have been there from the beginning of (our) time :-) |
Thanks for your quick reply.
We didn't experience problems, but it creates a very long log for our teamcity.
How about add |
Suppressing the warnings will probably draw criticism from others for sweeping things under the rug... |
One other thing to consider is that when you are doing a build with DYNAMIC_ARCH=1 to allow runtime selection of code for a wide range of cpus, you will be compiling the same source files over and over where they are shared with or without small adjustments between cpu models. So the actual number of unique files is much smaller than the impressive number of 800 warnings that will only jump up whenever support for another related cpu is added. (And the actual number of unique issues is smaller still, as the same file may contain several computations where one of the arguments is unused under certain build-time circumstances.) |
Dead code causing both warnings is optimized away with any optimizing compiler anyway. i.e fix would be cosmetic for build process but noop for code generated |
Hmm. The unused-but-set warning about n in level3_gemm3m_thread.c may point to an actual shortcoming in the code where (I think) it may theoretically create threads even for very small workloads when range_m or range_n is set and either range does not correspond to the m or n argument. (m and in particular n is calculated from the range limits, but args->m, args->n are used in the decision - I guess that translates into "for operations on submatrices, the dimensions of the entire matrix are still used to decide whether or not to multithread here"). Not sure about actual impact, at least this has been unchanged since libGoto. |
clang4 picks on a bit more like unused after increment that gcc cannot notice. I will take on those, it is mostly no-brain work. |
@martin-frbg @brada4 Thanks very much for your quick pull request! |
PaddlePaddle/Paddle#5704 compile OpenBLAS with |
That's actually
repeated for all the 18 cpu variants in the build due to some confusion if the third argument to zgeadd_k should be a float or a double. The majority claims "double", only common_param.h thinks it is a float - let me see who wins... |
I believe these warnings have been all but eliminated now, at least for the x86 DYNAMIC_ARCH case. |
@martin-frbg still the cross targets (w32 for example) are not handled. Also many -Wunused-but-set are left, I fixed only part that gcc dos not see of that class - unused-but-incremented( += etc), which made half clang warnings earlier. |
Code cleanup can continue (though it is probably best to comment offending lines instead of removing them, so that any wrong assumptions or unfinished plans remain visible, in particular in original K.Goto code). I was only suggesting that the issues within the scope of this particular ticket have been resolved. |
They are being resolved, prioritising parts that change code (and are more suspect to unearth bugs) ;) |
Also assembly kernels that get called fortran style (i.e with pointer arguments where assembly accesses RW pointed-to data) are not understood and warning gets generated. |
Which compiler are you seeing this with ? Offhand this sounds more like a compiler problem, and I am not too keen on making purely cosmetic changes all over the place just to silence a pointless warning generated by a particular compiler version that may not even affect many people. |
I agree. It is gcc |
gcc but using some uncommon warning options I assume ? With 7.2.0 at -Wall (or even with the two options from the original issue topic), I notice a handful of the newfangled "misleading indentation" warnings and a few complaints about uninitialized variables in the tests, but the vast majority of warnings now is caused by coding style issues in netlib lapack. Hence my earlier suggestion to close this issue rather than embark on a coding style witchhunt just to placate a single (perhaps overly) picky compiler. |
only out of warnings i addressed that look loke bugfixes were =0.0 and to lesser degree dead increment. Rest is plainly cosmetic. |
Actually just a dozen of libm fabs and very few type mismatch warnings are left in plain make. |
I think it is cleaned as much as possible. I will look other time at my yesterdays edits and make PR
|
clang5
|
Can't we give that a rest ? I am not even sure that fabsl would be portable across all supported platforms. |
Primary concern of unmanageable warnings is addressed on concerned platform+compiler combination as far as OpenBLAS hands could reach. I give it a rest. |
I grep our TeamCity log. There are 816
-Wunused-but-set-variable
and 386-Wunused-variable
warnings come from OpenBLAS: PaddlePaddle/Paddle#3281 (comment)Do you have any plans to fix these warnings?
Looking forward to your reply!
The text was updated successfully, but these errors were encountered: