|
@@ -37,8 +37,6 @@ package llama
|
|
#include "sampling_ext.h"
|
|
#include "sampling_ext.h"
|
|
|
|
|
|
bool llamaProgressCallback(float progress, void *user_data);
|
|
bool llamaProgressCallback(float progress, void *user_data);
|
|
-extern const char *ggml_metallib_start;
|
|
|
|
-extern const char *ggml_metallib_end;
|
|
|
|
*/
|
|
*/
|
|
import "C"
|
|
import "C"
|
|
import (
|
|
import (
|
|
@@ -51,19 +49,6 @@ import (
|
|
"unsafe"
|
|
"unsafe"
|
|
)
|
|
)
|
|
|
|
|
|
-//go:embed ggml-common.h
|
|
|
|
-var ggmlCommon string
|
|
|
|
-
|
|
|
|
-//go:embed ggml-metal.metal
|
|
|
|
-var ggmlMetal string
|
|
|
|
-
|
|
|
|
-func init() {
|
|
|
|
- metal := strings.ReplaceAll(ggmlMetal, `#include "ggml-common.h"`, ggmlCommon)
|
|
|
|
- cMetal := C.CString(metal)
|
|
|
|
- C.ggml_metallib_start = cMetal
|
|
|
|
- C.ggml_metallib_end = (*C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(cMetal)) + uintptr(len(metal))))
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
func BackendInit() {
|
|
func BackendInit() {
|
|
C.llama_backend_init()
|
|
C.llama_backend_init()
|
|
}
|
|
}
|