fix(AI): stop forcing HSA_OVERRIDE=11.0.0 on natively-supported AMD iGPUs

The current ollama:rocm image bundles ROCm 7.2, which natively supports the
RDNA 3/3.5 mobile parts (780M gfx1103, 890M gfx1150, Strix Halo gfx1151).
Forcing HSA_OVERRIDE_GFX_VERSION=11.0.0 coerces them onto gfx1100's kernels:
unnecessary on the 890M and a source of faults on the 780M, which lacks the
gfx1100 WMMA instructions those kernels use.

- Map gfx1103/gfx1150/gfx1151 to no override (was 11.0.0) so ROCm discovers
  them natively.
- Change the no-marker default from 11.0.0 to null. A hardcoded default gets
  more wrong as ROCm adds native targets; native discovery is the safer
  forward-looking default. Hardware that still needs coercion (e.g. RDNA 2
  iGPUs on an install without the gfx marker) can force a value via the
  ai.amdHsaOverride KV.
- Keep gfx1031..gfx1036 (RDNA 2 iGPUs like the 680M) on 10.3.0 — still not
  natively supported.

Verified on NOMAD2 (Radeon 890M): after a Force Reinstall the container has
no HSA_OVERRIDE, Ollama discovers the GPU as its native gfx1150 with the
rocm_v7_2 libraries, and a model loads at 100% GPU with no faults.

Depends on #1056 context; see companion issue for the 780M follow-up.

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

View File

@ -1455,13 +1455,17 @@ export class DockerService {
* gfx1030 (RX 6800/6700/etc.), gfx1100/1101/1102 (RX 7900/7800/7600) are on AMD's
* official ROCm allowlist forcing an override on these breaks GPU discovery.
* gfx1035 / gfx1036 (RDNA 2 iGPUs like 680M) need 10.3.0 to coerce to gfx1030.
* gfx1103 / gfx1150 / gfx1151 (RDNA 3/3.5 iGPUs like 780M / 890M / Strix Halo) need 11.0.0.
* gfx1103 / gfx1150 / gfx1151 (RDNA 3/3.5 iGPUs like 780M / 890M / Strix Halo) are
* natively supported by the ROCm 7.2 the current ollama:rocm image bundles, so they
* need NO override. Forcing 11.0.0 coerces them to gfx1100's kernels unnecessary on
* the 890M and a source of faults on the 780M (gfx1100 WMMA instructions it lacks). See #1056.
*
* Resolution order:
* 1. KV `ai.amdHsaOverride` manual user override; accepts 'none' (disable) or a semver-style value.
* 2. Marker file `/app/storage/.nomad-amd-gfx` written by install_nomad.sh.
* 3. Default: '11.0.0' preserves prior behavior so existing iGPU users don't regress on
* upgrade. Discrete-card users on existing installs can opt out via the KV.
* 3. Default: none let ROCm discover the GPU natively. Users on hardware that still
* needs coercion can force a value via the KV. A hardcoded default gets more wrong
* as ROCm adds native targets, so null is the safer forward-looking default.
*
* Returns null when no override should be applied.
*/
@ -1490,8 +1494,8 @@ export class DockerService {
// install_nomad.sh. Fall through to the default.
}
logger.info('[DockerService] No AMD gfx marker; defaulting HSA override to 11.0.0 for backward compatibility')
return '11.0.0'
logger.info('[DockerService] No AMD gfx marker; applying no HSA override (native ROCm discovery)')
return null
}
private _mapGfxToHsaOverride(gfx: string): string | null {
@ -1499,15 +1503,18 @@ export class DockerService {
if (gfx === 'gfx1030' || gfx === 'gfx1100' || gfx === 'gfx1101' || gfx === 'gfx1102') {
return null
}
// RDNA 2 variants + iGPUs (gfx1031..gfx1036, e.g. Rembrandt 680M)
// RDNA 2 variants + iGPUs (gfx1031..gfx1036, e.g. Rembrandt 680M) — not natively
// supported, still need coercion to gfx1030.
if (/^gfx103[1-6]$/.test(gfx)) {
return '10.3.0'
}
// RDNA 3 / 3.5 mobile parts (Phoenix 780M = gfx1103, Strix 890M = gfx1150, Strix Halo = gfx1151)
// RDNA 3 / 3.5 mobile parts (Phoenix 780M = gfx1103, Strix 890M = gfx1150, Strix Halo =
// gfx1151) are native under ROCm 7.2 — no override (forcing 11.0.0 faults the 780M). See #1056.
if (gfx === 'gfx1103' || gfx === 'gfx1150' || gfx === 'gfx1151') {
return '11.0.0'
return null
}
return '11.0.0'
// Unknown/newer target: prefer native discovery over a coercion that's likely wrong.
return null
}
/**