You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
?gemmtr is just bli_gemmt so it should be easy to add an interface adapter. If you are willing to work on a PR then I suggest taking an existing level-3 BLAS interface (gemm, syrk, etc.) and adapting it.
I noted that there is already frame/compat/extra/bla_gemmt.h, and a symbol sgemmt_ in the compat shared object. However, the upstream does not provide that sgemmt_. Should we instead rename the gemmt into gemmtr in the compat code?
$ readelf -sW /usr/lib/x86_64-linux-gnu/blis-openmp/libblas.so.3 | grep sgemm
75: 0000000000805d50 831 FUNC GLOBAL DEFAULT 12 cblas_sgemmt
132: 0000000000807b40 2485 FUNC GLOBAL DEFAULT 12 sgemm_batch_
136: 00000000007fc470 742 FUNC GLOBAL DEFAULT 12 cblas_sgemm
234: 0000000000805950 1013 FUNC GLOBAL DEFAULT 12 cblas_sgemm_batch
249: 00000000007e2a00 2367 FUNC GLOBAL DEFAULT 12 sgemm_
380: 000000000080a290 1669 FUNC GLOBAL DEFAULT 12 sgemmt_
$ readelf -sW tmp/usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.1 | grep sgemm
24: 0000000000047d80 2941 FUNC GLOBAL DEFAULT 12 sgemmtr_
91: 0000000000010930 735 FUNC GLOBAL DEFAULT 12 cblas_sgemm
195: 0000000000047400 2417 FUNC GLOBAL DEFAULT 12 sgemm_
275: 0000000000010c10 879 FUNC GLOBAL DEFAULT 12 cblas_sgemmtr
This seems to be the minimal change to rename the sgemmt_ symbol into sgemmtr_, but I guess it will leave some mess, such as inconsistent header name, etc.
Some packages use sgemmt as an extension so that shouldn't be renamed. But, you could a) add a copy of the wrapper function with the different name, or b) create just a declaration with the new name and __attribute__((alias("..."))).
diff --git a/frame/compat/bli_blas.h b/frame/compat/bli_blas.h
index fca75e0f..e37a7e42 100644
--- a/frame/compat/bli_blas.h+++ b/frame/compat/bli_blas.h@@ -71,6 +71,7 @@
// If BLIS_ENABLE_BLAS_DEFS is defined, then we should #include the BLAS
// prototypes.
#include "bli_blas_defs.h"
+BLIS_EXPORT_BLAS void sgemmtr_ __attribute__((alias("sgemmt_")));
#else
// Even if BLAS prototypes are not to be #included into blis.h, we still
// need to #include the prototypes when compiling BLIS.
And gcc says sgemmtr_ is already defined:
make -j1 15:24
Compiling obj/generic/config/generic/bli_cntx_init_generic.o ('generic' CFLAGS for config code)
In file included from config/generic/bli_cntx_init_generic.c:35:
./frame/compat//bli_blas.h:75:23: error: ‘sgemmtr_’ defined both normally and as ‘alias’ attribute
75 | #else
| ^
compilation terminated due to -Wfatal-errors.
make: *** [Makefile:736: obj/generic/config/generic/bli_cntx_init_generic.o] Error 1
I'm confused by the preprocessor macros, and have not found where the sgemmtr_ was defined but not exported.
The prototype in the .h file should be "normal" (exactly like sgemmt but with the name changed). Then, in the .c file put the version with attribute. An alias declaration can appear only once in the library and must be in the same translation unit as the referenced symbol.
I can see both sgemmt_ and sgemmtr_ from readelf, but they points at different location, meaning the code is duplicated as expected. I'll further try to see how to make that attribute alias work.
Activity
devinamatthews commentedon Jan 24, 2025
?gemmtris justbli_gemmtso it should be easy to add an interface adapter. If you are willing to work on a PR then I suggest taking an existing level-3 BLAS interface (gemm,syrk, etc.) and adapting it.cdluminate commentedon Jan 25, 2025
Thanks for the pointer. I'll take a look
cdluminate commentedon Jan 25, 2025
I noted that there is already
frame/compat/extra/bla_gemmt.h, and a symbolsgemmt_in the compat shared object. However, the upstream does not provide thatsgemmt_. Should we instead rename thegemmtintogemmtrin the compat code?cdluminate commentedon Jan 25, 2025
This seems to be the minimal change to rename the
sgemmt_symbol intosgemmtr_, but I guess it will leave some mess, such as inconsistent header name, etc.devinamatthews commentedon Jan 25, 2025
Some packages use
sgemmtas an extension so that shouldn't be renamed. But, you could a) add a copy of the wrapper function with the different name, or b) create just a declaration with the new name and__attribute__((alias("..."))).cdluminate commentedon Jan 25, 2025
I tried the following change on master:
And gcc says
sgemmtr_is already defined:I'm confused by the preprocessor macros, and have not found where the
sgemmtr_was defined but not exported.devinamatthews commentedon Jan 26, 2025
The prototype in the .h file should be "normal" (exactly like sgemmt but with the name changed). Then, in the .c file put the version with attribute. An alias declaration can appear only once in the library and must be in the same translation unit as the referenced symbol.
cdluminate commentedon Jan 26, 2025
The following seems simple and working (I'm still trying to figure out how to make alias attribute work though).
I can see both
sgemmt_andsgemmtr_fromreadelf, but they points at different location, meaning the code is duplicated as expected. I'll further try to see how to make that attribute alias work.cdluminate commentedon Jan 26, 2025
The last remaining bit is to correctly make preprocessor concat
rtoblasname, instead of hardcoding like the follows:Now both
sgemmt_andsgemmtr_point at the save address.devinamatthews commentedon Jan 27, 2025
I think
bla_gemmtr_checkcan be removed entirely, right? If you would please put this in a PR it should be a pretty quick merge.devinamatthews commentedon Jan 27, 2025
Should the same be done for CBLAS?
Alias *gemmt_ as *gemmtr_ to fix lapack 3.12.1 compatibility. (Closes: …
cdluminate commentedon Jan 28, 2025
The PR is filed at #849 . I'll look into cblas later when I'm available.
Also alias cblas_?gemmt as cblas_?gemmtr for lapack 3.12.1 compatibil…
Alias *gemmt_ as *gemmtr_ to fix lapack 3.12.1 compatibility. (flame#849
Alias *gemmt_ as *gemmtr_ to fix lapack 3.12.1 compatibility. (#849)
Alias *gemmt_ as *gemmtr_ to fix lapack 3.12.1 compatibility. (#849)