-
Notifications
You must be signed in to change notification settings - Fork 411
Add RISC-V port #503
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
base: master
Are you sure you want to change the base?
Add RISC-V port #503
Conversation
…ommit ca0e0b4e.
common/simd/riscv/emulation.h
Outdated
rm = 0b01; | ||
} | ||
|
||
asm volatile("csrw vxrm,%0" :: "r"(rm)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think _mm_setcsr is for floating point rounding modes. So this should be a write to frm
not vxrm
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update SSE2RVV to include the proper implementation.
Any plans to get this moving forward? |
We don't have the resources to test and maintain a RISC-V port at the moment. We'd be happy to accept this PR, but make it clear in the documentation and build scripts that for now, this is considered experimental. |
Maybe we can test this on Spacemit K1 chip or wait for SG2044, they both have RVV 1.0 support. |
The port is based on pattonkan/sse2rvv@ca0e0b4, which for now supports SSE2 and SSE4.2 that embree uses. It is verified using Ubuntu 24.04.1 RISC-V preinstalled server image from https://cdimage.ubuntu.com/releases/24.04/release/ with QEMU on Ubuntu 24.04.
Note this is just the initial port of RVV and has a limitation for VLEN=128 only. We expect further performance improvement from porting the other extensions.
Test steps:
Follow https://wiki.ubuntu.com/RISC-V/QEMU to install required packages and run the QEMU using the following command with vector extension enabled:
Use clang-18 to build embree in QEMU guest
sudo apt update; sudo apt install cmake libtbb-dev libglfw3-dev clang-18
cd embree; mkdir build; cd build; cmake -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 ..; make -j4; sudo make install
Untar the archive https://github.com/RenderKit/embree/releases/download/v4.3.3/embree-4.3.3-testing.tar.gz to /usr/local and run tests
cd /usr/local/testing; sudo cmake -B build -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_COMPILER=clang-18 -DEMBREE_TESTING_INTENSITY=1; sudo cmake --build build --target test
The results are:
Running embree_bvh_builder alone is passed, and running embree_verify will have a segmentation fault in SSE4.2.regression_static_memory_monitor from libtbb for an invalid register value. Use regex to select only the test is passed though. This doesn't seem relate to the port and can be listed as a known issue.