Accepting request 1175546 from openSUSE:Factory:RISCV

RISCV patch

OBS-URL: https://build.opensuse.org/request/show/1175546
OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/ollama?expand=0&rev=17
This commit is contained in:
Eyad Issa 2024-05-21 11:57:06 +00:00 committed by Git OBS Bridge
parent 32d8d25838
commit 13d8dc2da7
2 changed files with 40 additions and 0 deletions

View File

@ -36,6 +36,8 @@ BuildRequires: golang(API) >= 1.22
%{sysusers_requires}
Patch24300: riscv.patch
%description
Ollama is a tool for running AI models on one's own hardware.
It offers a command-line interface and a RESTful API.

38
riscv.patch Normal file
View File

@ -0,0 +1,38 @@
Index: ollama-0.1.37/llm/llm.go
===================================================================
--- ollama-0.1.37.orig/llm/llm.go
+++ ollama-0.1.37/llm/llm.go
@@ -7,6 +7,7 @@ package llm
// #cgo windows,arm64 LDFLAGS: ${SRCDIR}/build/windows/arm64_static/libllama.a -static -lstdc++
// #cgo linux,amd64 LDFLAGS: ${SRCDIR}/build/linux/x86_64_static/libllama.a -lstdc++
// #cgo linux,arm64 LDFLAGS: ${SRCDIR}/build/linux/arm64_static/libllama.a -lstdc++
+// #cgo linux,riscv64 LDFLAGS: ${SRCDIR}/build/linux/riscv64_static/libllama.a -lstdc++
// #include <stdlib.h>
// #include "llama.h"
import "C"
Index: ollama-0.1.37/vendor/github.com/chewxy/math32/stubs_riscv64.s
===================================================================
--- /dev/null
+++ ollama-0.1.37/vendor/github.com/chewxy/math32/stubs_riscv64.s
@@ -0,0 +1,21 @@
+#include "textflag.h"
+
+// func Exp(x float32) float32
+TEXT ·Exp(SB),NOSPLIT,$0
+ JMP ·exp(SB)
+
+// func Exp2(x float32) float32
+TEXT ·Exp2(SB),NOSPLIT,$0
+ JMP ·exp2(SB)
+
+// func Log(x float32) float32
+TEXT ·Log(SB),NOSPLIT,$0
+ JMP ·log(SB)
+
+// func Remainder(x, y float32) float32
+TEXT ·Remainder(SB),NOSPLIT,$0
+ JMP ·remainder(SB)
+
+// func Sqrt(x float32) float32
+TEXT ·Sqrt(SB),NOSPLIT,$0
+ JMP ·sqrt(SB)