Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BLD: Avoid "visibility attribute not supported" warning #16288

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

Merged
merged 2 commits into from
May 20, 2020

Conversation

embray
Copy link
Contributor

@embray embray commented May 18, 2020

I found that when building the latest master branch on Cygwin, while testing #16246, that thousands of warnings were generated at build time like:

numpy/core/src/npysort/binsearch.c.src: In function ‘binsearch_left_bool’:
numpy/core/src/npysort/binsearch.c.src:82:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]

Granted this is just a warning, so I don't think it's a serious issue.

It seems the test that was supposed to check for __attribute__ support was not working as expected. The #pragmas only take effect if I provide a function body--they are ignored for bare declarations. I don't know if that's by intent, or if it's a GCC issue. For reference:

$ gcc --version
gcc (GCC) 7.4.0

@embray embray force-pushed the cygwin/visibility-attribute-ignored branch from 08713c6 to 7f7d19d Compare May 18, 2020 15:56
@embray
Copy link
Contributor Author

embray commented May 18, 2020

Now getting errors like

numpy/core/src/umath/simd.inc.src: In function ‘fma_scalef_ps’:
  numpy/core/src/umath/simd.inc.src:1519:1: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]
   {
   ^
  numpy/core/src/umath/simd.inc.src:1518:1: note: The ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
   fma_scalef_ps(__m256 poly, __m256 quadrant)
   ^~~~~~~~~~~~~
  In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include/immintrin.h:41:0,
                   from numpy/core/src/umath/simd.inc.src:25,
                   from numpy/core/src/umath/loops.c.src:50:
  /usr/lib/gcc/x86_64-linux-gnu/7/include/avxintrin.h:1195:1: error: inlining failed in call to always_inline ‘_mm256_movemask_ps’: target specific option mismatch
   _mm256_movemask_ps (__m256 __A)
   ^~~~~~~~~~~~~~~~~~

I was getting this locally as well but it wasn't clear at first that this was related. Seems maybe it is.

@embray
Copy link
Contributor Author

embray commented May 18, 2020

Oh, I made a stupid bug in this commit. Rebasing again...

@@ -69,7 +69,10 @@ def check_gcc_function_attribute(cmd, attribute, name):
#pragma GCC diagnostic error "-Wattributes"
#pragma clang diagnostic error "-Wattributes"

int %s %s(void*);
int %s %s(void*)
Copy link
Member

Choose a reason for hiding this comment

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

FWIW I am not able to reproduce this on 7.3.0 or gcc-9 versions. but if this function is not behaving as its supposed to for certain compiler versions, its certainly worth fixing.

Copy link
Member

Choose a reason for hiding this comment

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

that's odd, This build error was perfectly reproducible on bionic with gcc-7.5 and gcc-9.2.

Copy link
Member

Choose a reason for hiding this comment

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

@r-devulap , not sure whats going on. my gcc version for gcc-9 is gcc 9.3.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was going to say, it could be Windows-specific. But maybe not.

@charris charris changed the title [BUG] avoid "visibility attribute not supported" warning BUG: Avoid "visibility attribute not supported" warning May 18, 2020
@seberg
Copy link
Member

seberg commented May 19, 2020

The change looks simple, but there are universal test failures along the lines of. @r-devulap since those failures are AVX related, a ping just in case you know right away what the cause is.

``` numpy/core/src/umath/simd.inc.src: In function ‘fma_scalef_ps’: 4221 numpy/core/src/umath/simd.inc.src:1519:1: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi] 4222 { 4223 ^ 4224 numpy/core/src/umath/simd.inc.src:1518:1: note: The ABI for passing parameters with 32-byte alignment has changed in GCC 4.6 4225 fma_scalef_ps(__m256 poly, __m256 quadrant) 4226 ^~~~~~~~~~~~~ 4227 In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include/immintrin.h:41:0, 4228 from numpy/core/src/umath/simd.inc.src:25, 4229 from numpy/core/src/umath/loops.c.src:50: 4230 /usr/lib/gcc/x86_64-linux-gnu/7/include/avxintrin.h:1195:1: error: inlining failed in call to always_inline ‘_mm256_movemask_ps’: target specific option mismatch 4231 _mm256_movemask_ps (__m256 __A) 4232 ^~~~~~~~~~~~~~~~~~ 4233 In file included from numpy/core/src/umath/loops.c.src:50:0: 4234 numpy/core/src/umath/simd.inc.src:1533:10: note: called from here 4235 if (_mm256_movemask_ps(denormal_mask) != 0x0000) { 4236 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4237 In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include/immintrin.h:41:0, 4238 from numpy/core/src/umath/simd.inc.src:25, 4239 from numpy/core/src/umath/loops.c.src:50: 4240 /usr/lib/gcc/x86_64-linux-gnu/7/include/avxintrin.h:404:1: error: inlining failed in call to always_inline ‘_mm256_cmp_ps’: target specific option mismatch 4241 ```

@r-devulap
Copy link
Member

You cannot omit parameters names in function definitions in C. This will fix your problem:

-        int %s %s(void*)
+        int %s %s(void* temp)

@seberg
Copy link
Member

seberg commented May 19, 2020

Thanks, shoudl have seen, I guess @embray actually may just have forgotten to push the rebase...

@embray
Copy link
Contributor Author

embray commented May 20, 2020

That's possible. When I said I was rebasing it was to fix the missing parameter name. Previously I had done it properly and it worked, so I think I accidently pushed an older version. I'll fix it in a sec.

One thing I was kinda wondering is if there was a specific reason this test function even needed to take a dummy parameter in the first place. I couldn't find any reference in the commit history as to why that was needed for this test function.

I did also find it odd that my GCC would ignore the unknown attribute on a bare declaration, but not in a function definition. I don't know if that's intentional or a GCC bug, but I couldn't find any reference to that either. I guess it doesn't bother processing the attributes unless there's an actual code module to compile.

@embray
Copy link
Contributor Author

embray commented May 20, 2020

And yes, because of the missing parameter it means all attribute tests fail, and I think that was causing the AVX-related bugs. They go away when I fix it (instead I get #16290, but that's unrelated).

@embray embray force-pushed the cygwin/visibility-attribute-ignored branch from 7f7d19d to 4ca7de9 Compare May 20, 2020 11:20
@seberg
Copy link
Member

seberg commented May 20, 2020

Weird that it shows that dependabot commit, nvm will just squash merge though. I am going to put this in, looks like it just cannot hurt to me. Thanks @embray!

@seberg seberg merged commit dcf1614 into numpy:master May 20, 2020
@seberg seberg changed the title BUG: Avoid "visibility attribute not supported" warning BLD: Avoid "visibility attribute not supported" warning May 20, 2020
@embray
Copy link
Contributor Author

embray commented May 20, 2020

@seberg Thanks!

@embray embray deleted the cygwin/visibility-attribute-ignored branch May 20, 2020 15:20
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label May 20, 2020
@charris charris added this to the 1.19.0 release milestone May 20, 2020
charris pushed a commit to charris/numpy that referenced this pull request May 22, 2020
I found that when building the latest master branch on Cygwin, while
testing numpy#16246, that thousands of warnings were generated at build time
like:

numpy/core/src/npysort/binsearch.c.src: In function
‘binsearch_left_bool’: numpy/core/src/npysort/binsearch.c.src:82:1:
warning: visibility attribute not supported in this configuration;
ignored [-Wattributes] Granted this is just a warning, so I don't think
it's a serious issue.

It seems the test that was supposed to check for __attribute__ support
was not working as expected. The #pragmas only take effect if I provide
a function body--they are ignored for bare declarations. I don't know if
that's by intent, or if it's a GCC issue. For reference:

$ gcc --version
gcc (GCC) 7.4.0
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label May 22, 2020
@charris charris removed this from the 1.19.0 release milestone May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants