-
Notifications
You must be signed in to change notification settings - Fork 13.2k
ggml: riscv: add riscv spacemit backend #15288
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
ggml: riscv: add riscv spacemit backend #15288
Conversation
Change-Id: I249bdc043485d815a9c351867137bc1e27cc2e23
Change-Id: I889ed1c85fb45e62350ecde0c06f70450cadfbe2
Change-Id: I321eb200f859751727afe5cae13074dfce2bb0ce
The file format and the limitations of the riscv zba extension have been resolved. @qnixsynapse |
…o add-spacemit-backend Change-Id: I170a4a9b1b9854e164119ee0844c309b29e9632b
The PR has now been updated to the master. Could you please review it? And will it be merged soon? @ggerganov |
Change-Id: Ia20b6ec24a36638e62e0fe07cf100916a7cce3ce
…emit-backend Change-Id: I9b3c1d31cd495371c56a9e2104f9bf66139469a4
All the comments have been implemented. @ggerganov |
@alex-spacemit Thanks for the implementation and the interest. The backend can be accepted, but it would need a few changes to get into mergable state:
For more information, please check the CONTRIBUTING.md and ci/README.md documents. These were recently updated (#16113, #16116) with additional information about the points above. Let me know if you have any questions. |
Change-Id: I5dc33a0412da3d3f2d77075d8939185d3009eca2
Change-Id: I039fb02bb95270e641bc4442204e658735859d43
Change-Id: I711c1033061df1a289ea77891b2997599dfe8279
…emit-backend Change-Id: I4c52314a0836a59c85fb5c15afd58110f6dfe2d9
The revision comments are mostly implemented. Here are some sample images. @ggerganov
|
|
Change-Id: Ifb2b891e2fca57b5da604fce2ac255f27731179a
Change-Id: If0dc3ca30a958631ccca0a28b62e0b825f9fb0c3
Change-Id: Ibf2fa74c1064408974cb5b45f044d40987e5fb45
Change-Id: I80d74909941d41cb9cd09e51d8baf01c985cbfc6
7d42eb0
to
4e7ab9e
Compare
to fix the errors in CI, I added gcc ime instruction extensions for native compile, and cross compile. @ggerganov |
I don't think we need cross compile in addition to native? |
since cross compile passed, i will remove native compile later |
Change-Id: I01920afafdc73fa7424014fd648d243f8ec9e25e
What do you need? Perhaps @alitariq4589 can resolve it? |
![]() Although the Cloud-V's RISCV Machine also runs on the Bianbu OS and is based on SpacemiT K1, I think it would be better to use the public repository and public gcc-14. I don't want to make any changes to this setup. @CISC For another thing, the K3 is coming soon, and the native build is not compatible with K1, cross compile would be better. |
Are you referring to removing the native compile CI for RISC-V? Native compile is added so that the CI can run on RVV1.0 (currently banana pi f3 16GB memory) hardware for performance evaluation with RISC-V vector extension. It is not suitable for emulating RVV1.0 in QEMU and running the CI on it, as that gives no insight into execution on RVV1.0 of hardware
Is there a need for fetching apt packages from bianbu repositories? Currently, the builds are running on a podman container using Debian Trixie for reusability and the latest versions of packages released for RISC-V. Bianbu images follow LTS Ubuntu paths, so package versions are lagging a bit (like older versions of GCC and so on, etc.). I can set up the environment so that builds run on bianbu, but this will require us to create a podman/docker container for bianbu and keep it up to date every time upstream is synced with a new version of bianbu (which adds maintenance overhead 🥲 )
We are using public gcc-14, which is in upstream. Are you referring to a specific port of GCC?
I don't understand how using upstream GCC will cause a problem in native hardware CI builds and how it should work fine with emulation.
How are optimizations added for K1 going to affect K3 (or vice versa)? I am not sure I get this |
Bianbu provides an assembly parser in binutils for SpacemiT IME instructions for GCC, such as When K3 shows up, binutils that can natively compile IME instructions might be available a little later.By the way, K3 will be more suitable as a native compilation machine. ^^ |
I see... I will try to figure out a way to fetch the GCC from bianbu so that we can use it inside the current CI. I think, till then, it is okay to have it tested inside QEMU. My concern is that if GCC of Bianbu is not pushed to upstream, with time the consequence is that it will lag behind the upstream. If this goes on, then it won't be reliable in the long run.
No problem 😄 . We are constantly adding new RISC-V compute machines to Cloud-V as they arrive. |
is there any other issue with this PR, ready to be merged? @ggerganov |
Change-Id: Ic54a192019a2fd982bbd58225ce3bbc38f4053de
Change-Id: I28c42e10b6fff053bb6580926ca2353448cb042a
a4cdbdc
to
33ced1f
Compare
Co-authored-by: Sigbjørn Skjæret <[email protected]>
Co-authored-by: Sigbjørn Skjæret <[email protected]>
This pull request adds spacemit backend. Specific optimizations have been made for the SpacemiT X60 CPU. The SpacemiT IME extended instructions are used to accelerate matrix calculations for Q4_0/Q4_1/Q4_K, along with general RVV optimizations.
Q4_0
more information at build-riscv64-spacemit.md