Skip to content

Conversation

@mattip
Copy link
Collaborator

@mattip mattip commented Dec 10, 2025

  • I updated the package version in pyproject.toml and made sure the first 3 numbers match git describe --tags --abbrev=8 in OpenBLAS at the OPENBLAS_COMMIT. If I did not update OPENBLAS_COMMIT, I incremented the wheel build number (i.e. 0.3.29.0.0 to 0.3.29.0.1)

This is a proof of concept that works to hide functions from exposing them from the shared object on posix

  • Use CFLAGS+=-fhidden to hide by default
  • Add __attribute__ ((visibility ("default"))) in all the exported function definitions
  • Use NO_LAPACKE=1 to avoid building (and exporting) legacy lapack routines

For me this solves numpy/numpy#30299, it no longer segfaults. Although when I look at ltrace I still see that a global openblas is overriding the function dgemm_kernel_HASWELL in the call to scipy_cblas_dgemm64_ at NumPy import.

@mattip
Copy link
Collaborator Author

mattip commented Dec 11, 2025

global openblas is overriding the function dgemm_kernel_HASWELL

I added the hidden directive to the PROLOGUE macro for assembler code, and in doing so discovered that there is assembler code for

  • int lsame(char *a, char *b) which compares *a == *b
  • FLOAT cabs(FLOAT *a) which does fabs(a[0]) + fabs(a[1]).

Both these functions have generic equivalents in the kernels/generics directory, and I checked on Compiler Explorer that modern compilers generate equivalent assembler to the hand-created assembler in the non-generic directories. So rather than create a special non-hidden assembler PROLOGUE macro, I set the build to use the generic C versions, which can easily be marked with the visible attribute.

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.

1 participant