Including blis.h gives a large number of "defined but not used" warnings

14 views
Skip to first unread message

Giorgos Margaritis

unread,
Jul 2, 2020, 6:32:30 AM7/2/20
to blis-discuss
Hi all,

I have built BLIS 2.1 (unfortunately on private work network so I cannot copy logs etc) using:

./configure --enable-threading=openmp auto
make
-j `nproc`

I then create a simple main.cpp that only includes blis.h.
When I compile main.cpp with:

g++ main.cpp -Wall -lm -fopenmp -lpthread lib/haswell/libblis-mt.a

I get about 440 "defined but not used" warnings, for a corresponding number of static functions defined in blis.h header.
Should these static functions indeed be embedded in blis.h? Am I missing a flag or something during compilation?

CentOS 7.6, g++ 4.8.5, Intel i7-6800K


Thanks!

Giorgos Margaritis

unread,
Jul 2, 2020, 10:08:49 AM7/2/20
to blis-discuss
Seeing the BLIS version I use, I just realized that I was given the AMD BLIS, so I should forward my question there.
Sorry for the interrupt. :/

Devin Matthews

unread,
Jul 2, 2020, 10:31:47 AM7/2/20
to blis-d...@googlegroups.com
No problem, the same problem likely exists in "vanilla" BLIS. FWIW, the problem is because in C++ mode, "static inline" has a different meaning. This should be an easy fix in blis.h:

#ifdef __cplusplus
#define BLIS_INLINE inline
#else
#define BLIS_INLINE static inline
#endif

// use BLIS_INLINE instead of static inline

Devin Matthews
--
You received this message because you are subscribed to the Google Groups "blis-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blis-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blis-discuss/7e0b0f65-b8af-45fd-a3b7-935e8b8c11e8o%40googlegroups.com.

Field G. Van Zee

unread,
Jul 2, 2020, 2:33:49 PM7/2/20
to blis-d...@googlegroups.com
Devin,

I'm assuming we're talking about the way BLIS defines so-called "inline"
functions (typically accessor functions).

BLIS doesn't use "static inline". Instead, it simply uses "static".
Given this, how would your suggested fix change?

Field

On 7/2/20 9:31 AM, Devin Matthews wrote:
> No problem, the same problem likely exists in "vanilla" BLIS. FWIW, the
> problem is because in C++ mode, "static inline" has a different meaning.
> This should be an easy fix in blis.h:
>
> #ifdef __cplusplus
> #define BLIS_INLINE inline
> #else
> #define BLIS_INLINE static inline
> #endif
>
> // use BLIS_INLINE instead of static inline
>
> Devin Matthews
>
> On 7/2/20 9:08 AM, Giorgos Margaritis wrote:
>> Seeing the BLIS version I use, I just realized that I was given the
>> AMD BLIS, so I should forward my question there.
>> Sorry for the interrupt. :/
>>
>>
>> On Thursday, July 2, 2020 at 1:32:30 PM UTC+3, Giorgos Margaritis wrote:
>>
>> Hi all,
>>
>> I have built BLIS 2.1 (unfortunately on private work network so I
>> cannot copy logs etc) using:
>>
>> |
>> ./configure --enable-threading=openmp auto
>> make -j `nproc`
>> |
>>
>> I then create a simple main.cpp that only includes blis.h.
>> When I compile main.cpp with:
>>
>> |
>> g++main.cpp -Wall-lm -fopenmp -lpthread lib/haswell/libblis-mt.a
>> |
>>
>> I get about 440 "defined but not used" warnings, for a
>> corresponding number of static functions defined in blis.h header.
>> Should these static functions indeed be embedded in blis.h? Am I
>> missing a flag or something during compilation?
>>
>> CentOS 7.6, g++ 4.8.5, Intel i7-6800K
>>
>>
>> Thanks!
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "blis-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to blis-discuss...@googlegroups.com
>> <mailto:blis-discuss...@googlegroups.com>.
>> <https://groups.google.com/d/msgid/blis-discuss/7e0b0f65-b8af-45fd-a3b7-935e8b8c11e8o%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "blis-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blis-discuss...@googlegroups.com
> <mailto:blis-discuss...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/blis-discuss/a171efe6-f176-7616-23fe-5be9e45baa4c%40smu.edu
> <https://groups.google.com/d/msgid/blis-discuss/a171efe6-f176-7616-23fe-5be9e45baa4c%40smu.edu?utm_medium=email&utm_source=footer>.

Devin Matthews

unread,
Jul 2, 2020, 2:43:03 PM7/2/20
to blis-d...@googlegroups.com
No change, just replace "static" with "BLIS_INLINE". In C, the "inline" part does not change the linkage, and only provides a compiler hint. In C++, the "inline" is needed to get the desired properties and obviates the need for "static".

The only difference between the C and C++ situations would be that in C++ mode the functions would be subject to the One Definition Rule, but since this would only affect client code that is not a problem.

The other solution is to add __attribute__((unused)) to each definition.

Devin

Jeff Hammond

unread,
Jul 2, 2020, 2:56:11 PM7/2/20
to Devin Matthews, blis-discuss
I might just disable these warnings, since unused stuff in library code is strictly an issue for the developers of the library and should not be a concern of users.  It's admirable that users enable all the warnings for their own purposes, in which case libraries can put the users' minds at ease using the following method.


_Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") 
// BLIS header code
_Pragma("GCC diagnostic pop")

Jeff

To unsubscribe from this group and stop receiving emails from it, send an email to blis-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blis-discuss/f3d28c8e-ff8f-2019-f48e-15ba0df12a11%40smu.edu.


--

Field G. Van Zee

unread,
Jul 7, 2020, 2:29:15 PM7/7/20
to blis-d...@googlegroups.com
Giorgos,

It appears that I forgot to inform you that I submitted a commit that
attempts to fix the warnings you reported. Please try the latest commit
on the 'master' branch (72f6ed0 or later).

If you have future concerns or questions, I encourage you to let us know
by opening an issue on GitHub [1].

Thanks for your feedback.

Field

[1] https://github.com/flame/blis/issues

On 7/2/20 9:31 AM, Devin Matthews wrote:
> No problem, the same problem likely exists in "vanilla" BLIS. FWIW, the
> problem is because in C++ mode, "static inline" has a different meaning.
> This should be an easy fix in blis.h:
>
> #ifdef __cplusplus
> #define BLIS_INLINE inline
> #else
> #define BLIS_INLINE static inline
> #endif
>
> // use BLIS_INLINE instead of static inline
>
> Devin Matthews
>
> On 7/2/20 9:08 AM, Giorgos Margaritis wrote:
>> Seeing the BLIS version I use, I just realized that I was given the
>> AMD BLIS, so I should forward my question there.
>> Sorry for the interrupt. :/
>>
>>
>> On Thursday, July 2, 2020 at 1:32:30 PM UTC+3, Giorgos Margaritis wrote:
>>
>> Hi all,
>>
>> I have built BLIS 2.1 (unfortunately on private work network so I
>> cannot copy logs etc) using:
>>
>> |
>> ./configure --enable-threading=openmp auto
>> make -j `nproc`
>> |
>>
>> I then create a simple main.cpp that only includes blis.h.
>> When I compile main.cpp with:
>>
>> |
>> g++main.cpp -Wall-lm -fopenmp -lpthread lib/haswell/libblis-mt.a
>> |
>>
>> I get about 440 "defined but not used" warnings, for a
>> corresponding number of static functions defined in blis.h header.
>> Should these static functions indeed be embedded in blis.h? Am I
>> missing a flag or something during compilation?
>>
>> CentOS 7.6, g++ 4.8.5, Intel i7-6800K
>>
>>
>> Thanks!
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "blis-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to blis-discuss...@googlegroups.com
>> <mailto:blis-discuss...@googlegroups.com>.
>> <https://groups.google.com/d/msgid/blis-discuss/7e0b0f65-b8af-45fd-a3b7-935e8b8c11e8o%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "blis-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blis-discuss...@googlegroups.com
> <mailto:blis-discuss...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/blis-discuss/a171efe6-f176-7616-23fe-5be9e45baa4c%40smu.edu
> <https://groups.google.com/d/msgid/blis-discuss/a171efe6-f176-7616-23fe-5be9e45baa4c%40smu.edu?utm_medium=email&utm_source=footer>.

Giorgos Margaritis

unread,
Jul 8, 2020, 6:37:27 AM7/8/20
to Field G. Van Zee, blis-d...@googlegroups.com
Hi Field,

Just downloaded the repo, I will check this later.
Thanks again both you and Devin for your immediate response and fix!

Cheers,
Giorgos

To unsubscribe from this group and stop receiving emails from it, send an email to blis-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blis-discuss/667dc927-7d63-9742-c655-72b73ddac795%40cs.utexas.edu.
Reply all
Reply to author
Forward
0 new messages