Skip to content

[Question] Implement internal OpenBLAS BLAS-like C API #5340

@foxtran

Description

@foxtran

As I see it, the current use of the Fortran ABI in the C interface presents several complications:

  • Passing strings between C and Fortran requires additional arguments, which are missing in standard C ABI declarations. This has already caused issues, such as in the LTO-related bug #4128.
  • Different Fortran compilers use different ABIs for string passing, adding to the complexity.
  • Fortran name mangling varies across platforms, leading to duplicated or enumerated symbols in headers, as seen here:
    #define F77_srotg F77_GLOBAL(srotgtest,SROTGTEST)
    #define F77_srotmg F77_GLOBAL(srotmgtest,SROTMGTEST)
    #define F77_srot F77_GLOBAL(srottest,SROTTEST)
    #define F77_srotm F77_GLOBAL(srotmtest,SROTMTEST)
    #define F77_drotg F77_GLOBAL(drotgtest,DROTGTEST)
    #define F77_drotmg F77_GLOBAL(drotmgtest,DROTMGTEST)

To avoid these issues—particularly with LTO—and to simplify name mangling, I’m wondering if it would make sense to implement an internal OpenBLAS BLAS-like C ABI. This ABI could act as a central internal interface, with both the Fortran bindings (with Fortran 2003 standard) and the CBLAS interface layered on top of it.

Are there any existing considerations, discussions, or objections regarding this kind of design within the OpenBLAS project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions