fix(gpu): AMD passthrough reinstall discards an existing HSA_OVERRIDE_GFX_VERSION
Problem
On an upgraded AMD iGPU install whose Ollama container already carries a correct HSA_OVERRIDE_GFX_VERSION (set by hand, or by an older install path) but has no ai.amdHsaOverride KV and no /app/storage/.nomad-amd-gfx marker, the new CPU-fallback banner offers Fix: Reinstall. That reinstall removes the working override, so the box stays on CPU for a different reason. A second fix click with the override set in KV is needed to actually recover.
Steps to Reproduce
- AMD 780M (gfx1103) box whose
nomad_ollamawas created withHSA_OVERRIDE_GFX_VERSION=11.0.0and withoutOLLAMA_IGPU_ENABLE=1; KV hasgpu.type=amdonly, no marker file. - Upgrade to v1.35.0-rc.2. Settings > System shows the passthrough alert with Fix: Reinstall (
amdReinstallWouldChange: true,currentHsaOverride: "11.0.0"). - Click Fix: Reinstall.
Expected vs Actual
Expected: the reinstall keeps HSA_OVERRIDE_GFX_VERSION=11.0.0, adds OLLAMA_IGPU_ENABLE=1, and Ollama comes up on ROCm.
Actual: the new container has OLLAMA_IGPU_ENABLE=1 but no override. Ollama logs dropping ROCm device - no rocblas support for gfx target gfx1103, then inference compute id=cpu library=cpu.
After setting ai.amdHsaOverride=11.0.0 and clicking the fix a second time, the container has both variables and Ollama reports library=ROCm compute=gfx1100 type=iGPU - so the target state is right, the first click just discards what was already correct.
Root Cause
The desired override comes only from KV ai.amdHsaOverride or the .nomad-amd-gfx marker (docker_service.ts ~1601-1632). With neither present, diffAmdOllamaConfig (ollama_compute.ts ~159-165) treats the container's existing override as drift to be removed. Separately, amdGfxTarget / suggestedHsaOverride come back empty in this state because the parser only matches gpu_type= (ollama_compute.ts ~178), not the dropping integrated GPU ... compute=gfx1100 line Ollama emits before the iGPU is enabled.
Suggested Fix
When neither KV nor the marker specifies an override, treat an override already present on the running container as the desired value (or persist it to ai.amdHsaOverride before recreating).
Files Involved
admin/app/utils/ollama_compute.ts-diffAmdOllamaConfig, gfx target parsingadmin/app/services/docker_service.ts- HSA override resolution
Source: Crosstalk-Solutions/project-nomad