go-skynet / go-llama.cpp

LLama.cpp golang bindings
MIT License
658 stars 80 forks source link

Seffault #143

Open jrideout opened 1 year ago

jrideout commented 1 year ago

After about 4 prompts using the example, I consistently receive a segfault:

fatal error: fault
[signal SIGSEGV: segmentation violation code=0x2 addr=0xbfacdf55be89910f pc=0x102e2d35c]

goroutine 1 [running]:
runtime.throw({0x102edbd79?, 0x102de029c?})
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/panic.go:1047 +0x40 fp=0x140000af350 sp=0x140000af320 pc=0x102e07c40
runtime.sigpanic()
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/signal_unix.go:855 +0x1a8 fp=0x140000af390 sp=0x140000af350 pc=0x102e1d2b8
runtime.(*_type).string(0xbfacdf55be8990e7)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/type.go:55 +0x1c fp=0x140000af3c0 sp=0x140000af3a0 pc=0x102e2d35c
runtime.(*TypeAssertionError).Error(0x14000110030)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/error.go:39 +0x7c fp=0x140000af4d0 sp=0x140000af3c0 pc=0x102dddecc
runtime.preprintpanics(0x140000260a0?)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/panic.go:581 +0x74 fp=0x140000af540 sp=0x140000af4d0 pc=0x102e06b54
panic({0x102f15e80, 0x14000110030})
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/panic.go:985 +0x3b4 fp=0x140000af600 sp=0x140000af540 pc=0x102e078a4
runtime.panicdottypeE(0xbfacdf55be8990e7, 0x102f21ec0, 0x102f14480)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/iface.go:262 +0x6c fp=0x140000af630 sp=0x140000af600 pc=0x102de04bc
fmt.newPrinter()
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/fmt/print.go:152 +0x90 fp=0x140000af660 sp=0x140000af630 pc=0x102e67d30
fmt.Fprint({0x102f26df8, 0x140000b6008}, {0x140000af6e8, 0x1, 0x1})
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/fmt/print.go:261 +0x30 fp=0x140000af6b0 sp=0x140000af660 pc=0x102e68150
fmt.Print(...)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/fmt/print.go:272
main.main.func1({0x1400001c960?, 0x1400009a180?})
    /Users/jrideout/proj/go-llama.cpp/examples/main.go:48 +0x58 fp=0x140000af700 sp=0x140000af6b0 pc=0x102e74828
github.com/go-skynet/go-llama%2ecpp.tokenCallback(0x140000af7a8?, 0x140000021a0?)
    /Users/jrideout/proj/go-llama.cpp/llama.go:262 +0x10c fp=0x140000af760 sp=0x140000af700 pc=0x102e7374c
_cgoexp_fb2af0aad2c5_tokenCallback(0x16d02ae98)
    _cgo_gotypes.go:297 +0x2c fp=0x140000af780 sp=0x140000af760 pc=0x102e73aac
runtime.cgocallbackg1(0x102e73a80, 0x140000af960?, 0x0)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/cgocall.go:315 +0x248 fp=0x140000af860 sp=0x140000af780 pc=0x102dda308
runtime.cgocallbackg(0x140000af938?, 0x102e31468?, 0x140000021a0?)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/cgocall.go:234 +0xdc fp=0x140000af8f0 sp=0x140000af860 pc=0x102dda03c
runtime.cgocallbackg(0x102e73a80, 0x16d02ae98, 0x0)
    <autogenerated>:1 +0x1c fp=0x140000af920 sp=0x140000af8f0 pc=0x102e3770c
runtime.cgocallback(0x140000af998, 0x102e72118, 0x102e74ad4)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/asm_arm64.s:1094 +0xa0 fp=0x140000af950 sp=0x140000af920 pc=0x102e35a00
runtime.systemstack_switch()
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/asm_arm64.s:200 +0x8 fp=0x140000af960 sp=0x140000af950 pc=0x102e334d8
runtime.cgocall(0x102e74ad4, 0x140000af9d8)
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/cgocall.go:167 +0x74 fp=0x140000af9a0 sp=0x140000af960 pc=0x102dd9f04
github.com/go-skynet/go-llama%2ecpp._Cfunc_llama_predict(0x10bb04080, 0x12400c200, 0x140000d0400, 0x1)
    _cgo_gotypes.go:224 +0x38 fp=0x140000af9d0 sp=0x140000af9a0 pc=0x102e72118
github.com/go-skynet/go-llama%2ecpp.(*LLama).Predict.func2(0x102edbdab?, 0x140000afbd0?, {0x140000d0400, 0x1?, 0x140000afa68?}, 0x102e639bc?)
    /Users/jrideout/proj/go-llama.cpp/llama.go:211 +0x90 fp=0x140000afa20 sp=0x140000af9d0 pc=0x102e73310
github.com/go-skynet/go-llama%2ecpp.(*LLama).Predict(0x140000a4018, {0x140000d8000, 0x84}, {0x140000afe80, 0x7, 0x0?})
    /Users/jrideout/proj/go-llama.cpp/llama.go:211 +0x26c fp=0x140000afce0 sp=0x140000afa20 pc=0x102e72fec
main.main()
    /Users/jrideout/proj/go-llama.cpp/examples/main.go:47 +0x670 fp=0x140000aff70 sp=0x140000afce0 pc=0x102e74300
runtime.main()
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/proc.go:250 +0x248 fp=0x140000affd0 sp=0x140000aff70 pc=0x102e0a288
runtime.goexit()
    /opt/homebrew/Cellar/go/1.20.6/libexec/src/runtime/asm_arm64.s:1172 +0x4 fp=0x140000affd0 sp=0x140000affd0 pc=0x102e35ad4
jrideout commented 1 year ago

Note that I am using a Metal build on an M2 Mac