llm: OLLAMA_IGPU_DIRECT_IO=0 opts out of forced direct I/O on integrated GPUs - #318
Conversation
…ted GPUs Upstream forces --load-mode dio for any integrated CUDA/ROCm GPU on linux and pins that it wins over use_mmap=false, so there is no way to turn it off. On gfx1151 that is an unvalidated load-path change (amd-upgrade-gate.md clause 3), suspected but never shown to cause the degeneration that holds the gate, because it arrived in the same cutover as a llama.cpp payload bump. The knob is inert by default. Set to 0 it falls through to the existing mmap preference and llama.cpp's own auto mode, which never selects direct I/O. One image can then run the gate A/B with dio on and off and nothing else different. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… is unset The existing opt-out test only ever SETS OLLAMA_IGPU_DIRECT_IO. An unset variable is what production actually runs, so a default that silently flipped to off would cost minutes per model load with every test still passing. Mutation-tested: changing IntegratedGPUDirectIO(true) to (false) turns it red. Covers rocm/ROCm/cuda/CUDA case-insensitively, and asserts a discrete device still gets no flag. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The vision-suite A/B is now done, on a healthy build, and the arms are provably differentClosing the loop on this PR's open item. Every earlier dio A/B was run on unpatched 0.34.1, where the HIP The first re-run was also invalid, and this PR's own instrumentation caught it. I ran it against the Valid run. Image built from
Fine-text 6/6 · 6/6 · 6/6, invoice 5/5 · 5/5, grounding 4/5 — identical in both arms, and both at the post-906 baseline. Conclusion: no measurable quality effect either way, so the default stays on. That is what this PR shipped, but the reasoning behind it has changed: it now rests on a quality measurement from a build whose vision path is known-good, rather than on inference from a broken one. The knob's value is as a diagnostic control — it is precisely how dio was ruled out as a cause of the gfx1151 regression before the real cause was found. Had the arms diverged against dio, this would have needed a follow-up PR flipping the default, not an edit here — the PR was already merged when the measurement completed. 🤖 Generated with Claude Code |
Adds an opt-out for the
--load-mode dioflag that ollama forces on Linux integrated CUDA/ROCm devices. Written on 2026-09-17 to satisfy gate clause 3(b); what a day of measurement since then did to its rationale is recorded below, because the honest case for it is now weaker than the one in the gate document.What it does
OLLAMA_IGPU_DIRECT_IO=0suppresses--load-mode dio. Default is unchanged (on), so this is inert unless set.Covered by
TestAppendLoadModeArgsIntegratedDirectIOOptOut, mutation-tested: replacing the guard withif trueturns it red. Verified on hardware — the dio-on runner line carries--load-mode dio, the dio-off line does not.Why the rationale changed
The AMD upgrade gate treats
--direct-ioas an unvalidated risk on gfx1151 and clause 3 asks for it to be absent, opt-out-able, or validated. This patch was the "opt-out-able" answer.Measurement since (#304 addendum, #317) has exonerated direct I/O:
prop.integrateddefect, andOLLAMA_IGPU_DIRECT_IO=0reproduces the regression exactly.GGML_CUDA_NO_PINNED=1, aborts the runner on load (signal: aborted, core dumped).So this knob is a diagnostic convenience, not a safety valve. Its real value turned out to be as an experimental control: it let us isolate dio as a variable and rule it out, which is how the gate's central suspicion of the last month was retired.
Why land it anyway
Drop it if the gate is retired or upstream exposes its own opt-out.
🤖 Generated with Claude Code