Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

SwiftShader for RISC-V32 #332

Open
amithmath opened this issue Feb 4, 2021 · 16 comments
Open

SwiftShader for RISC-V32 #332

amithmath opened this issue Feb 4, 2021 · 16 comments

Comments

@amithmath
Copy link

I am trying to build: https://github.com/google/swiftshader for RISC-V32 but SwiftShader requires CMAKE_CXX_STANDARD 17/c++17. I am wondering, how do I support this feature in RISC-V32?

Actually, I did google C++17 RISC-V32, I got following links for RISC-V64:

https://packages.debian.org/buster/g++-8-riscv64-linux-gnu

https://gnutoolchains.com/risc-v/

I am wondering whether is there gcc7 for RISC-V32?

@jim-wilson
Copy link
Collaborator

There is a stable gcc-7.3 for RISC-V but you are better off using a newer version. The current supported version of riscv/riscv-gnu-toolchain is gcc-10.2 for instance. Why do you need or want gcc-7? Usually people specify a minimum version, and any version after the specified minimum is also OK.

@amithmath
Copy link
Author

I am not so specific about gcc-7.3 as long as the gcc supports C++17 it's fine. So if install, from https://github.com/riscv/riscv-gnu-toolchain will I get gcc-10.2 with C++17 features? Or please let me know in which script I have to specify gcc latest version to build latest compiler....

@jim-wilson
Copy link
Collaborator

I don't follow the C++ standard. If the software builds with gcc, then it should build with 10.2 as that is the latest FSf GCC release. Keep in mind that linux software may not compile with a embedded elf compoiler, if it needs library functions not supported by the embedded elf toolchain.

riscv/riscv-gnu-toolchain is source and needs to be built. If you don't have experience building stuff it could take some time to get the build to work. There are build instructions in the README.md file. You could also try a precompiled package. Most linux distros provide a riscv64-linux compiler if you have a recent enough version of the distro. SiFive has precompiled toolchain on their web site on the software page, but only for embedded elf.

@amithmath
Copy link
Author

If you could tell me, whether this repo: https://github.com/google/swiftshader successfully compiles in latest risc-v32 gcc 10.2 or not that will be very helpful. This is for 3D engine with OpenGL support.

Many Thanks.

@jim-wilson
Copy link
Collaborator

There is no way for me to know if some random software package compiles for RISC-V.

@amithmath
Copy link
Author

amithmath commented Feb 11, 2021 via email

@amithmath
Copy link
Author

amithmath commented Feb 11, 2021 via email

@jim-wilson
Copy link
Collaborator

This was also askied in riscv-gnu-toolchain issue 840. An embedded elf compiler can't support librt because it requires OS support, and the embedded elf toolchain assumes no OS. The linux compiler does support it.

@amithmath
Copy link
Author

How to enable elf toolchain to use linux? Or Is risc-v32 hardware architecture different for elf and linux?

@jim-wilson
Copy link
Collaborator

An embedded elf toolchain assumes you are running on bare metal. A linux toolchain assumes you are running on hardware running linux. Both will produce programs that can run on a simulator. A linux system requires an MMU which not all hardware has, so it won't run on the lowest cost boards. Otherwise, the hardware is the same.

A toolchain can be either embedded elf or linux. You decide when you configure and build the toolchain. You can use --enable-linux to get a linux toolchain by default. Or you can use "make linux" to build a linux toolchain. See the README.md file.

@Jamesmelodyash
Copy link

I am wondering, does Linux run on manycore, let's say 128 RISC-V32 cores?

@amithmath
Copy link
Author

Yes, that was the good question, does does Linux run on manycore?

@amithmath
Copy link
Author

I think in order to run manycore it requires glibc rather than newlib and some modifications in DRAM libraries?

@jim-wilson
Copy link
Collaborator

New issues for new questions please. For manycore support, you need to ask a linux kernel expert. I'm a compiler expert. I only know that it works for 4 cores because that is how many cores the HiFive Unleashed has.

@amithmath
Copy link
Author

It just clicked my mind, since you are compiler expert and it works for 4 cores, same concepts can be applied to manycores? If you could point to me to HiFive Unleashed 4 cores compiler/linux kernel github repo, that will be great since HiFive has many repos...

@jim-wilson
Copy link
Collaborator

Everything you need is upstream. Link kernel sources are on kernel.org. But we do have our own open embedded/yocto layer which is github.com/sifive/meta-sifive.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants