Skip to content

[RFC] Adding softfp support for ARM by a inline assembly wrapper #853

Description

@erlv

Dear OpenBLAS community,
We recently suffers from the Android default SoftFP link with hardfp OpenBLAS correctness issue while linking several libraries with OpenBLAS as #777 .

Within our team, we have successfully make the compiler and linker happy on Android by linking softfp library and hardfp OpenBLAS together with a inline assembly wrapper and a compiler wrapper. Meanwhile there is no correctness issue both in theory and by many existing tests.

I am wondering whether the upstream like such idea, and if yes, I'd like to find a way to contribute it back to OpenBLAS community.

The inline assembly wrapper is a simulator, which tries to prepare the hardfp OpenBLAS function call's register and stack parameter passing using embedd assembly when compiler compile the code with -mfloat-abi=softfp.

The reason of using inline assembly wrapper instead of direct softfp implementation are:

  1. The OpenBLAS of hardfp is written in assembly, implement a brand new softfp version requires lots of work (as @xianyi has already mentioned).
  2. Comparing to hardfp, softfp uses less register to pass the parameters, therefore even we implement the equivalent version of OpenBLAS in softfp, the performance will be a bit lower than hardfp.
  3. OpenBLAS does not depend on other libraries, therefore in theory there will be no correctness issue if we use softfp to call the interface while the OpenBLAS code is implemented as hardfp.

The compiler wrapper is basically used to get rid of the float-abi attribute in each object file within the libblas.a/libblas.so file, so that the linker does not complain the error uses VFP register arguments, output does not while link Android toolchain compiled object files with OpenBLAS on ARM.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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