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
{{ message }}
Repository navigation
bli_?setijv accepts void* instead of floating point type #831
Could these routines be strongly typed using float/double/scomplex/dcomplex? The reason I'm asking is because the missing type breaks some scripts for generating wrappers.
Hi @ivan-pi. To what extent do you need strongly typed function prototypes? My first reaction to this was that this is just the tip of the tip of the tip of the iceberg for use of void* pointers in lieu of actual typed pointers in BLIS. Or maybe I'm missing something about your particular application setting? (cc @devinamatthews)
The application was creating Fortran interfaces from the C prototypes. The current script iterates over the parameter list and creates Fortran interface blocks such as:
interface
subroutinebli_?setijv(ar,ai,i,x,incx)
real(c_double), value :: ar, ai
integer(dim_kind), value :: i
real(?) :: x(*) ! void*integer(inc_kind), value :: incx
endsubroutine
end interface
Due to the void* x, the interface-generation script I'm writing fails here. I understand it's a hassle and just adds more work to the existing macro machinery.
Upon further thought I think it'll be better if I just introduce a Fortran version so that it can use 1-based indexing and check bounds automatically.
@fgvanzeevoid* is great for kernels since a) they're internal and b) they're typically being called through a type-erased interface anyways. For user-level typed functions, having strongly typed arguments is definitely helpful.
Confirming this is still the case on master: bli_?setijv/bli_?getijv (and the ?setijm/?getijm matrix variants) take void* x and double ar, double ai rather than typed pointers/scalars (frame/base/bli_setgetijv.h).
Strongly typing them would change the public prototypes, which is a breaking ABI/API change, so it's really a maintainer call on the preferred approach (e.g. introducing typed variants vs. changing the existing signatures, and whether to also type the ar/ai scalars). If you'd welcome a PR along those lines, I'm happy to put one together.
Activity
fgvanzee commentedon Nov 18, 2024
Hi @ivan-pi. To what extent do you need strongly typed function prototypes? My first reaction to this was that this is just the tip of the tip of the tip of the iceberg for use of
void*pointers in lieu of actual typed pointers in BLIS. Or maybe I'm missing something about your particular application setting? (cc @devinamatthews)ivan-pi commentedon Nov 19, 2024
The application was creating Fortran interfaces from the C prototypes. The current script iterates over the parameter list and creates Fortran interface blocks such as:
Due to the
void* x, the interface-generation script I'm writing fails here. I understand it's a hassle and just adds more work to the existing macro machinery.Upon further thought I think it'll be better if I just introduce a Fortran version so that it can use 1-based indexing and check bounds automatically.
devinamatthews commentedon Nov 19, 2024
Hi @ivan-pi I'm going to leave this open since you're right, it is an inconsistency. This could also affect C++ users.
devinamatthews commentedon Nov 19, 2024
@fgvanzee
void*is great for kernels since a) they're internal and b) they're typically being called through a type-erased interface anyways. For user-level typed functions, having strongly typed arguments is definitely helpful.ivan-pi commentedon Nov 19, 2024
In that case I'd just note that
void*also appears in the prototypes for??copysc,??cast[m|v],??castnzm,?fprint[m|v]and?print[m|v].devinamatthews commentedon Nov 19, 2024
Thx
EylonKrause commentedon Jun 24, 2026
Confirming this is still the case on
master:bli_?setijv/bli_?getijv(and the?setijm/?getijmmatrix variants) takevoid* xanddouble ar, double airather than typed pointers/scalars (frame/base/bli_setgetijv.h).Strongly typing them would change the public prototypes, which is a breaking ABI/API change, so it's really a maintainer call on the preferred approach (e.g. introducing typed variants vs. changing the existing signatures, and whether to also type the
ar/aiscalars). If you'd welcome a PR along those lines, I'm happy to put one together.devinamatthews commentedon Jun 24, 2026
A PR is welcome for inclusion in a future version :).
devinamatthews commentedon Jul 7, 2026
Adding a checklist for function families which need strong types:
bli_?getijm/bli_?setijmbli_?getijv/bli_?setijvbli_?copyscbli_?castmbli_?castvbli_?castnzmbli_?printmbli_?printvbli_?fprintmbli_?fprintvStrongly type the user-level ?setijv/?getijv/?setijm/?getijm routines (…