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

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:
chriscrosstalk 2026-07-18 12:02:58 -05:00 committed by GitHub
parent fca1a48c85
commit 60fffdab82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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 = {