diff --git a/embed_darwin.go b/embed_darwin.go index 858b20e..ae3e559 100644 --- a/embed_darwin.go +++ b/embed_darwin.go @@ -19,6 +19,9 @@ var libRwkvArm []byte var libName = "librwkv-*.dylib" func getDl(gpu bool) []byte { + if gpu { + _, _ = GetGPUInfo() + } if runtime.GOARCH == "amd64" { return libRwkvAmd64 } diff --git a/embed_windows.go b/embed_windows.go index 32137f8..9bc17e6 100644 --- a/embed_windows.go +++ b/embed_windows.go @@ -32,11 +32,11 @@ var supportGpuTable = map[string][]byte{ func getDl(gpu bool) []byte { if gpu { - gpu, err := GetGPUInfo() + gpuInfo, err := GetGPUInfo() if err != nil { log.Println(err) } - if supportGpuTable[gpu] != nil { + if supportGpuTable[gpuInfo] != nil { return supportGpuTable[gpu] } else { log.Println("GPU not support, use CPU instead.") diff --git a/gpu_darwin.go b/gpu_darwin.go index 051d2aa..0ca22e4 100644 --- a/gpu_darwin.go +++ b/gpu_darwin.go @@ -1,6 +1,8 @@ // Copyright (c) seasonjs. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +//go:build darwin + package rwkv func GetGPUInfo() (string, error) { diff --git a/gpu_linux.go b/gpu_linux.go index f708948..60730bb 100644 --- a/gpu_linux.go +++ b/gpu_linux.go @@ -1,6 +1,8 @@ // Copyright (c) seasonjs. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. +//go:build linux + package rwkv func GetGPUInfo() (string, error) {