Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
Workaround gfx900 SDMA bugs
Daniel Hiltgenda3bf2335483
diff --git a/gpu/amd_linux.go b/gpu/amd_linux.goindex 61e6a0598..7637c7768 100644--- a/gpu/amd_linux.go+++ b/gpu/amd_linux.go@@ -332,6 +332,11 @@ func AMDGetGPUInfo() []RocmGPUInfo {slog.Info("skipping rocm gfx compatibility check", "HSA_OVERRIDE_GFX_VERSION", gfxOverride)}+ // Check for env var workarounds+ if name == "1002:687f" { // Vega RX 56+ gpuInfo.EnvWorkarounds = append(gpuInfo.EnvWorkarounds, [2]string{"HSA_ENABLE_SDMA", "0"})+ }+// The GPU has passed all the verification steps and is supportedresp = append(resp, gpuInfo)}diff --git a/gpu/types.go b/gpu/types.goindex 47355959c..9920db5ff 100644--- a/gpu/types.go+++ b/gpu/types.go@@ -26,6 +26,9 @@ type GpuInfo struct {// Any extra PATH/LD_LIBRARY_PATH dependencies required for the Library to operate properlyDependencyPath string `json:"lib_path,omitempty"`+ // Extra environment variables specific to the GPU as list of [key,value]+ EnvWorkarounds [][2]string `json:"envs,omitempty"`+// GPU informationID string `json:"gpu_id"` // string to use for selection of this specific GPUName string `json:"name"` // user friendly name if availablediff --git a/llm/server.go b/llm/server.goindex 6313fc327..117565ba5 100644--- a/llm/server.go+++ b/llm/server.go@@ -320,6 +320,10 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, prs.cmd.Stdout = os.Stdouts.cmd.Stderr = s.status+ envWorkarounds := [][2]string{}+ for _, gpu := range gpus {+ envWorkarounds = append(envWorkarounds, gpu.EnvWorkarounds...)+ }visibleDevicesEnv, visibleDevicesEnvVal := gpus.GetVisibleDevicesEnv()pathEnvVal := strings.Join(libraryPaths, string(filepath.ListSeparator))@@ -334,6 +338,12 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr} else if devicesNeeded && strings.EqualFold(cmp[0], visibleDevicesEnv) {s.cmd.Env[i] = visibleDevicesEnv + "=" + visibleDevicesEnvValdevicesNeeded = false+ } else if len(envWorkarounds) != 0 {+ for _, kv := range envWorkarounds {+ if strings.EqualFold(cmp[0], kv[0]) {+ s.cmd.Env[i] = kv[0] + "=" + kv[1]+ }+ }}}if pathNeeded {