SwiftShader for RISC-V32

110 views
Skip to first unread message

Vijay Holimath

unread,
Feb 3, 2021, 10:24:04 PM2/3/21
to swiftshader
Hello All,

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

Many Thanks,
-Vijay 

Nicolas Capens

unread,
Feb 3, 2021, 11:52:00 PM2/3/21
to Vijay Holimath, swiftshader
Hi Vijay,

The compiler toolchain that you use must support C++17 to compile SwiftShader. I suspect recent versions of both GCC and Clang support C++17 for RISC-V32. But I'm not so sure about runtime support, which can depend on OS features.

The biggest hurdle is probably our use of LLVM as a JIT-compiler. We only support building for x86, Arm, MIPS, and Power at the moment (only the first two are maintained by my team), but an LLVM backend for RISCV does exist so it should be feasible to update the build files. To illustrate what might be required, here's the change which enabled MIPS: https://swiftshader-review.googlesource.com/c/SwiftShader/+/21748.

Cheers,
Nicolas

--
You received this message because you are subscribed to the Google Groups "swiftshader" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swiftshader...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swiftshader/8000f771-520d-4e19-aec5-7ffccdbb218fn%40googlegroups.com.

Vijay Holimath

unread,
Feb 4, 2021, 12:14:08 AM2/4/21
to Nicolas Capens, swiftshader
Hello Nicholas,

Thanks for the quick response. Actually, I did google C++17 RISC-V32, I got following links for RISC-V64:




 I am wondering whether there is gcc7 for RISC-V32? Perhaps in my search engine I am not getting gcc 7 linux distributions....?  

Thanks,
-Vijay




Ben Clayton

unread,
Feb 4, 2021, 4:39:05 AM2/4/21
to Vijay Holimath, Nicolas Capens, swiftshader
Hi Vijay,

SwiftShader also depends on marl which currently has no first class support for RISC-V.
That said, if your target supports the ucontext APIs, you may still be able to build by setting the MARL_FIBERS_USE_UCONTEXT define:


Thanks,
Ben

Vijay Holimath

unread,
Feb 4, 2021, 6:57:06 AM2/4/21
to Ben Clayton, Nicolas Capens, swiftshader
Hello Ben,

I am trying to build SwiftShader for RISC-V32 using: https://github.com/google/swiftshader I don't whether they support uncontext APIs Or please let me know how to identify whether target supports the unconext APIs. But still it is unclear RISC-V32 supports C++17 features from GNU tool chain. 

Thanks,
-Vijay
To unsubscribe from this group and stop receiving emails from it, send an email to swiftshader+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "swiftshader" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swiftshader+unsubscribe@googlegroups.com.

Vijay Holimath

unread,
Feb 6, 2021, 12:44:27 AM2/6/21
to Ben Clayton, Nicolas Capens, swiftshader
Hello Ben and All,

I was checking the RISC-V repo, the current version is gcc 10.2 which does support C++17 features. But in this repo:  https://github.com/google/swiftshader  can you please guide me where to set  RISC-V gcc and other environment variables required to build? 

Many Thanks,
-Vijay

To unsubscribe from this group and stop receiving emails from it, send an email to swiftshader...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "swiftshader" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swiftshader...@googlegroups.com.

Vijay Holimath

unread,
Feb 7, 2021, 11:09:22 PM2/7/21
to swiftshader
Hello Nicholas and all,

I have some idea where to make changes in https://cs.opensource.google/swiftshader/SwiftShader/+/master:third_party/llvm-10.0/llvm/lib/Target/RISCV/%20does%20exist and https://swiftshader-review.googlesource.com/c/SwiftShader/+/21748 But I am wondering, where to make changes for compiler settings? Setting export CC, CXX to specific installed directory would work? How about clang and clang++ settings?

Thanks,
-Vijay

Vijay Holimath

unread,
Feb 10, 2021, 10:17:55 PM2/10/21
to swiftshader
Hi,

I was going through build/CMakeCache.txt, it seems for RISC-V32 there is no  .../lib64/librt.so I think it is built on newlib. I am wondering, is there any alternate library/file to replace for RISC-V32?

Thanks,
-Vijay

--
You received this message because you are subscribed to a topic in the Google Groups "swiftshader" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swiftshader/bkJoQRBZprM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swiftshader...@googlegroups.com.

Vijay Holimath

unread,
Feb 11, 2021, 12:05:10 AM2/11/21
to swiftshader
The RISC-V32 embedded elf compiler is not able to support librt.so, are there any alternate ways?  I am stuck.....

Look forward to your support.

Many Thanks.



Ben Clayton

unread,
Feb 12, 2021, 9:01:02 AM2/12/21
to Vijay Holimath, swiftshader
Hi Vijay,

I'm sorry for the slow reply.

I'm afraid I don't know. I have no experience with the RISC-V32 target, its toolchains, nor your embedded target environment.

I'd suggest first seeing if you can build vanilla LLVM and run the JIT example for your target. If you run into issues doing this, you're likely to get better support asking the LLVM team for help.
You'd then need to see if Marl works for your target. If you can successfully run marl's unit tests on your target, then we'll know it supports the ucontext API.
If both LLVM and marl are working on your target, then we can see what's involved in tweaking SwiftShader's build rules.

Good luck!

Cheers,
Ben

You received this message because you are subscribed to the Google Groups "swiftshader" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swiftshader...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swiftshader/CAL7Ob90ETuJS2CHhbBc7vQ3MqYo96sgsEv3Ux7wAfEOizesXkw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages