Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add riscv64 support #68

Merged
merged 1 commit into from
Apr 12, 2022
Merged

Add riscv64 support #68

merged 1 commit into from
Apr 12, 2022

Conversation

alexfanqi
Copy link
Contributor

@alexfanqi alexfanqi commented Apr 11, 2022

Hi,

This adds riscv64 trampoline and gnu/musl ILP64/LP64 support (in lapack terms, not to be confused with riscv abi name). I tested on gentoo glibc with lapack. The trampoline assembly is universal and should also work with musl.

@staticfloat
Copy link
Member

Hello Alex, thank you for your contribution!

I'm afraid that I am very much out of my depth with RISCV. A few questions for you:

  1. Are there OpenBLAS binaries that can be tested against on RISCV? It would give me a lot of confidence if LBT could be tested against something like OpenBLAS. I know the test suite of LBT itself uses Julia, which is perhaps not the most helpful thing, considering you need LBT to build Julia..... but I can help you to compile some simple tests, it's mostly just a matter of compiling directories such as the sdot_test with the correct compiler flags.

  2. Is there a convenient QEMU setup or something that I can use to test/try this out? If we get RISCV support working well, I'd like to eventually add CI for it via a QEMU setup.

  3. Are you using LBT for your own project, or trying to port Julia or what? :D

@alexfanqi
Copy link
Contributor Author

alexfanqi commented Apr 11, 2022

Hi, thanks for the reply.

  1. yes, openblas supports riscv from 2018. Major distros all have support for riscv and should provide openblas binaries including Ubuntu, Archlinux, Fedora, etc. And thanks for the testing tips. I previously used the test commands demonstrated on the julia talk https://www.youtube.com/watch?app=desktop&v=t6hptekOR7s . I have tested with openblas
$ export LBT_DEFAULT_LIBS=/usr/lib64/libopenblas64.so
$ gcc -o sdot_test -DILP64 sdot_test.c -L../../src/build -lblastrampoline
$ export LD_LIBRARY_PATH=../../src/build
$ ./sdot_test 
C is:   1.9900
  1. I primarily use Gentoo, the stage3 tarball is directly bootable on qemu after being decompressed with minor config in /etc. For binary distros, Fedora image might be simple to setup. https://fedoraproject.org/wiki/Architectures/RISC-V/Installing. And Ubuntu as well, https://wiki.ubuntu.com/RISC-V. I also saw there is this rocksdb issue where there are lots of details setting up qemu for riscv dev.
    For ci integration afaik, PLCT lab offers free riscv hardware access by request. They have lots of sifive unmatched and d1 boards. rocksdb and prolog community are using it. https://github.com/plctlab/riscv-lab-access

  2. I am looking to port Julia by first clearing up all its dependencies, but not fully committed to it. just hope this can reduce a little bit work of others porting julia. It seems to me in the past arm gained Julia support not very difficultly. LLVM 14 also has orc jit support for riscv.

@staticfloat
Copy link
Member

Sounds good! I'll merge this, but I'd love to get some kind of RISC-V CI setup eventually.

@staticfloat staticfloat merged commit 205b3e8 into JuliaLinearAlgebra:main Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants