fix(AI): set OLLAMA_IGPU_ENABLE on AMD provisioning so iGPUs are used (#1056)

Ollama's scheduler drops integrated GPUs unless OLLAMA_IGPU_ENABLE=1 is set.
NOMAD sets HSA_OVERRIDE_GFX_VERSION for AMD but never this flag, so AMD APUs
(780M/890M/8060S) silently fell back to CPU-only inference despite correct
/dev/kfd and /dev/dri passthrough.

Set OLLAMA_IGPU_ENABLE=1 whenever AMD acceleration is configured, on both the
install and update provisioning paths. The flag is a no-op on discrete AMD
cards, so it's safe to set unconditionally within the AMD branch. On the update
path we also strip any prior value so containers provisioned before this change
pick up the flag on their next update.

Verified on NOMAD2 (Ryzen AI 9 HX 370 / Radeon 890M): before, Ollama logged
"dropping integrated GPU" and ran on CPU; after, it reports the 890M as an
iGPU ROCm inference device and models load at 100% GPU.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Sherwood 2026-07-10 14:07:36 -07:00
parent 6a4f02dd46
commit c3ec355939
1 changed files with 12 additions and 1 deletions

View File

@ -807,6 +807,11 @@ export class DockerService {
if (hsaOverride) {
ollamaEnv.push(`HSA_OVERRIDE_GFX_VERSION=${hsaOverride}`)
}
// Ollama's scheduler drops integrated GPUs unless this is set (issue #1056), so
// AMD APUs (780M/890M/8060S) fall back to CPU-only despite correct device
// passthrough. It's a no-op on discrete AMD cards, so it's safe to set whenever
// AMD acceleration is configured.
ollamaEnv.push('OLLAMA_IGPU_ENABLE=1')
}
}
@ -1688,10 +1693,16 @@ export class DockerService {
let finalEnv = baseEnv
if (updatedAmdGpuConfigured) {
const hsaOverride = await this._resolveAmdHsaOverride()
finalEnv = baseEnv.filter((e: string) => !e.startsWith('HSA_OVERRIDE_GFX_VERSION='))
finalEnv = baseEnv.filter(
(e: string) =>
!e.startsWith('HSA_OVERRIDE_GFX_VERSION=') && !e.startsWith('OLLAMA_IGPU_ENABLE=')
)
if (hsaOverride) {
finalEnv.push(`HSA_OVERRIDE_GFX_VERSION=${hsaOverride}`)
}
// Re-assert the iGPU flag so updates from a container provisioned before the
// issue #1056 fix (which wouldn't have it in the captured env) pick it up.
finalEnv.push('OLLAMA_IGPU_ENABLE=1')
}
const newContainerConfig: any = {