ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.
Python ai-agentsamdcomfyuidockerllama-cppllmlocal-ain8nnvidiaopen-webuiragself-hostedspeech-to-textstrix-halotext-to-speechworkflow-automation
fix(installer): no WSL NVIDIA driver warning when a Windows model server owns the GPU (#8186)
Mike Bradleycca046751499
diff --git a/ods/installers/lib/native-llm.sh b/ods/installers/lib/native-llm.shindex 395b3dcdc..377b437b5 100644--- a/ods/installers/lib/native-llm.sh+++ b/ods/installers/lib/native-llm.sh@@ -9,8 +9,9 @@# with --native-llm-url.## Expects: nothing (pure functions)-# Provides: ods_native_llm_requested(), ods_native_llm_normalize_origin(),-# ods_native_llm_container_origin(), ods_native_llm_origin_port()+# Provides: ods_native_llm_requested(), ods_native_llm_owns_host_gpu(),+# ods_native_llm_normalize_origin(), ods_native_llm_container_origin(),+# ods_native_llm_origin_port()## Modder notes:# NATIVE_LLM_BASE_URL is the origin seen from the host (loopback);@@ -23,6 +24,14 @@ ods_native_llm_requested() {[[ -n "${NATIVE_LLM_BASE_URL:-}" ]]}+# True when a Windows model server owns the host GPU: only Windows setup+# passes --native-llm-gpu-name with the native route (the AMD GPU on the AMD+# route). WSL then sees no usable GPU on purpose, so there is no GPU driver+# for this stack to repair.+ods_native_llm_owns_host_gpu() {+ ods_native_llm_requested && [[ -n "${NATIVE_LLM_GPU_NAME:-}" ]]+}+# Print an http origin without a trailing slash or /v1 (/api/v1 from the# retired Lemonade flags is accepted too). Returns 1 for anything else: a# query, credentials, another path or a non-numeric port.diff --git a/ods/installers/phases/02-detection.sh b/ods/installers/phases/02-detection.shindex 6e92b99b7..1ad98d4bf 100755--- a/ods/installers/phases/02-detection.sh+++ b/ods/installers/phases/02-detection.sh@@ -29,6 +29,8 @@# native-llm.sh gives install-core: a host-native llama-server is in use.declare -F ods_native_llm_requested >/dev/null 2>&1 \|| ods_native_llm_requested() { [[ -n "${NATIVE_LLM_BASE_URL:-}" ]]; }+declare -F ods_native_llm_owns_host_gpu >/dev/null 2>&1 \+ || ods_native_llm_owns_host_gpu() { ods_native_llm_requested && [[ -n "${NATIVE_LLM_GPU_NAME:-}" ]]; }[[ -f "${SCRIPT_DIR:-}/lib/safe-env.sh" ]] && . "$SCRIPT_DIR/lib/safe-env.sh". "$SCRIPT_DIR/installers/lib/wsl-memory.sh"@@ -212,8 +214,11 @@ log "Host architecture: ${HOST_ARCH}"# Secure Boot + NVIDIA auto-fix#-----------------------------------------------------------------------------# If detect_gpu found no working GPU, check if it's a fixable driver/Secure Boot issue-# (Only for NVIDIA — AMD APU is handled above)-if [[ "${GPU_BACKEND_FORCED_CPU:-false}" != "true" && $GPU_COUNT -eq 0 && "$GPU_BACKEND" != "amd" ]] && ! $DRY_RUN; then+# (Only for NVIDIA — AMD APU is handled above). A Windows model server owns+# the host GPU on purpose, so there is nothing to fix here (and no WSL GPU+# warning to show).+if [[ "${GPU_BACKEND_FORCED_CPU:-false}" != "true" && $GPU_COUNT -eq 0 && "$GPU_BACKEND" != "amd" ]] && ! $DRY_RUN \+ && ! ods_native_llm_owns_host_gpu; thenfix_nvidia_secure_boot || truefidiff --git a/ods/tests/ci-suite.txt b/ods/tests/ci-suite.txtindex 2e9396529..e998cbdda 100644--- a/ods/tests/ci-suite.txt+++ b/ods/tests/ci-suite.txt@@ -10,6 +10,7 @@ tests/test-inference-port-admission.shtests/contracts/test-amd-llamacpp-contracts.shtests/contracts/test-host-native-llm-contracts.shtests/contracts/test-host-native-llm-cpu-fallback.sh+tests/contracts/test-native-llm-gpu-owner.shtests/contracts/test-installer-hardening.shtests/contracts/test-docs-llama-host-port.shtests/contracts/test-llama-metrics-flag.shdiff --git a/ods/tests/contracts/test-native-llm-gpu-owner.sh b/ods/tests/contracts/test-native-llm-gpu-owner.shnew file mode 100755index 000000000..2a54b99db--- /dev/null+++ b/ods/tests/contracts/test-native-llm-gpu-owner.sh@@ -0,0 +1,55 @@+#!/usr/bin/env bash+# A Windows model server owns the host GPU when Windows setup passes+# --native-llm-gpu-name with the native route (today the AMD GPU on the AMD+# route). WSL then sees no GPU on purpose, so phase 02 must not run the NVIDIA+# driver repair, which in WSL only prints "NVIDIA GPU access is unavailable in+# WSL". This checks the predicate (installers/lib/native-llm.sh), the fallback+# isolated sourcing of phase 02 gets, and the real phase 02 driver repair+# block that uses it.+set -euo pipefail++ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+PHASE="$ROOT_DIR/installers/phases/02-detection.sh"+GPU='AMD Radeon RX 9070 XT'++fail() { echo "[FAIL] $*" >&2; exit 1; }+pass() { echo "[PASS] $*"; }++# shellcheck source=../../installers/lib/native-llm.sh+source "$ROOT_DIR/installers/lib/native-llm.sh"++owns() (+ NATIVE_LLM_BASE_URL="$1"+ NATIVE_LLM_GPU_NAME="$2"+ if ods_native_llm_owns_host_gpu; then echo yes; else echo no; fi+)+[[ "$(owns http://localhost:8080 "$GPU")" == yes ]] || fail "the native route with a Windows GPU name owns the host GPU"+[[ "$(owns http://localhost:8080 '')" == no ]] || fail "a native route without a Windows GPU name does not claim it"+[[ "$(owns '' "$GPU")" == no ]] || fail "a GPU name without the native route does not claim it"+[[ "$(owns '' '')" == no ]] || fail "no native route, no claim"+pass "ods_native_llm_owns_host_gpu: the native route plus the Windows GPU name, nothing else"++# The definition an isolated phase 02 gets agrees with it.+phase_fallback="$(awk '/^declare -F ods_native_llm_owns_host_gpu/{p=1} p{print} p && /^ \|\|/{exit}' "$PHASE")"+[[ "$phase_fallback" == *'ods_native_llm_requested && [[ -n "${NATIVE_LLM_GPU_NAME:-}" ]]'* ]] \+ || fail "phase 02's fallback predicate must match installers/lib/native-llm.sh"+pass "isolated phase 02 defines the same predicate"++# Phase 02: no NVIDIA driver repair (and no WSL GPU warning) for that GPU.+boot_block="$(awk '/^# If detect_gpu found no working GPU, check if/{p=1} p{print} p && /^fi$/{exit}' "$PHASE")"+[[ "$boot_block" == *'fix_nvidia_secure_boot || true'* ]] || fail "phase 02 driver repair block not found"+boot() (+ called=no+ fix_nvidia_secure_boot() { called=yes; return 1; }+ GPU_BACKEND_FORCED_CPU=false GPU_COUNT=0 GPU_BACKEND=cpu DRY_RUN=false+ NATIVE_LLM_BASE_URL="$1"+ NATIVE_LLM_GPU_NAME="$2"+ eval "$boot_block"+ printf '%s' "$called"+)+[[ "$(boot http://localhost:8080 "$GPU")" == no ]] || fail "the driver repair ran for a GPU the Windows server owns"+[[ "$(boot '' '')" == yes ]] || fail "a host without a GPU still gets the driver repair"+[[ "$(boot http://localhost:8080 '')" == yes ]] || fail "a native route without the Windows GPU name still gets the driver repair"+pass "phase 02 runs no NVIDIA driver repair for a GPU a Windows model server owns"++echo "native LLM GPU owner: all checks passed"