Coder Social home page Coder Social logo

Comments (8)

angsch avatar angsch commented on May 20, 2024

The fastest workaround that I see is that you manually modify

CMISCFLAGS := -march=$(shell $(CC) -E frame/base/bli_riscv_detect_arch.h | grep '^[^\#]') -mabi=lp64

and revise the ABI to -mabi=lp64d.

You raise a good point here. There is not ABI detection. The RISC-V targets choose what we assumed is the most common one. For a generic rv64i target, we assumed this to be lp64.

@leekillough Do you have more thoughts on this?

from blis.

leekillough avatar leekillough commented on May 20, 2024

I will add ABI auto-detection, just like architecture auto-detection which already exists ( frame/base/bli_riscv_detect_arch.h ), but the stubs symptom is more of a toolchain issue. In my toolchain build script, I have:

build_riscv_toolchain() (
    cd -- "$RISCV/$RISCV_TOOLCHAIN"
    make -j16 linux

    if [[ $RISCV_COMPILER = llvm ]]; then
        if [[ $RISCV_SIZE = 64 ]]; then
            ln -sf stubs-lp64d.h "$RISCV/sysroot/usr/include/gnu/stubs-lp64.h"
            ln -sf stubs-lp64d.h "$RISCV/sysroot/usr/include/gnu/stubs-lp64f.h"
        else
            ln -sf stubs-ilp32d.h "$RISCV/sysroot/usr/include/gnu/stubs-ilp32.h"
            ln -sf stubs-ilp32d.h "$RISCV/sysroot/usr/include/gnu/stubs-ilp32f.h"
        fi
    fi
)

from blis.

apcameron avatar apcameron commented on May 20, 2024

The workaround of changing line 49 to -mabi=lp64d does work for me and the checks all pass but it does not use the CPU's full feature set of rv64imafdc_zicsr_zba_zbb as I think your code its restricted to rv64i so it may run slower thank it could.

from blis.

leekillough avatar leekillough commented on May 20, 2024

The code currently detects rv64imafdc and is not restricted to rv64i, but I will add zba, zbb, zbc, zbs, and zfh, since those are detectable at compile-time. Zicsr and Zifencei are not currently detectable at compile-time with the latest C API, but Q->D->F implies Zicsr.

Clang does not enable the __riscv_v or __riscv_vector macros or choose -march=...v by default, even if it's built with vectors enabled, so we use a workaround to force vectors with -march=...v in the rv32iv and rv64iv configurations.

You can test the autodetection method this way:

$CC -E frame/base/bli_riscv_detect_arch.h | grep '^[^\#]'

-DFORCE_RISCV_VECTOR is specified for rv32iv and rv64iv because Clang does not enable vectors by default even if it's capable of them.

I will submit a PR shortly.

from blis.

apcameron avatar apcameron commented on May 20, 2024

Thank you. Do you plan to create a release in the near future with the RISC V code included?

from blis.

leekillough avatar leekillough commented on May 20, 2024

Thank you. Do you plan to create a release in the near future with the RISC V code included?

I think BLIS is mostly released on a continuous integration model, so the latest master has the RISC-V code already, modulo the ABI header stub issues you've run into, and as soon as a PR is merged, it will have the changes.

from blis.

apcameron avatar apcameron commented on May 20, 2024

That is correct but some distributions like GENTOO tend to wait for an official release before providing the updated package.

from blis.

leekillough avatar leekillough commented on May 20, 2024

@apcameron: In case it wasn't clear, rv32i, rv32iv, rv64i and rv64iv are base RISC-V configurations, since 32/64-bit and vector/non-vector, are the major categories which need to be separated. They are not the -march= flags passed to the compiler. Whether a particular RISC-V target supports M, A, F, D, C, etc., is not a part of the main BLIS configuration name, but gets automatically determined and used at build-time. It would be too hard to enumerate every possible combination of RISC-V extensions into the BLIS configuration name, so there are only 4 main ones.

The BLIS RISC-V implementation intentionally does not pass floating-point to assembly functions by value, so the "base" ABI of ilp32 or lp64 should be sufficient, which is why they were used in the makefiles. If you add the stubs to the toolchain with the symlink commands I listed above, then you should not get the missing stubs build error when BLIS uses -mabi=lp64.

PR750 should make the missing headers error go away, and may negligibly improve performance by using ilp32d or lp64d when possible.

from blis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.