• Stefy Lanza (nextime / spora )'s avatar
    engines: process-isolate GGUF from torch on NVIDIA (fix CUDA-context poisoning) · 2fae0beb
    Stefy Lanza (nextime / spora ) authored
    llama.cpp's CUDA backend and PyTorch sharing one process corrupt the CUDA context:
    after a GGUF model runs on an NVIDIA card, the next torch kernel dies with
    "CUDA error: invalid argument". Seen in a township match — a gemma GGUF served a
    chat completion on the nvidia engine, then the next Z-Image (diffusers) image gen
    crashed in its Qwen3 text-encoder's sdpa mask (padding_mask.all()). Every Z-Image
    run before llama.cpp touched CUDA succeeded; the first one after crashed. Evict+swap
    in one process can't fix it — torch holds the (now-corrupted) context for the
    process lifetime.
    
    Fix: when GPUs are auto-detected and server.isolate_gguf_engine is True (default),
    each NVIDIA torch engine gets a co-located sibling gguf engine on the SAME card
    (own process -> own CUDA context). The torch engine drops the `gguf` capability and
    serves transformers/diffusers; the sibling (backend=nvidia so GGUF takes the proven
    CUDA-llama path, capabilities={gguf}) serves llama.cpp. Routing is already
    capability-based, so GGUF goes to the gguf engine and HF/diffusers to the torch
    engine. Both are real engine subprocesses, so the front's routing, VRAM/eviction and
    thermal (cooperative pause + SIGSTOP on the process group) apply unchanged — and
    SIGSTOPping the gguf engine no longer freezes the torch engine.
    
    Ignored when engine_specs is set (declare the split yourself). Disable with
    server.isolate_gguf_engine=false. Design + trade-offs (extra torch context, no
    cross-engine eviction on a shared card) in docs/gguf-process-isolation.md.
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01RdMufYvtTbtGDWsiZVoXce
    2fae0beb
Name
Last commit
Last update
codai Loading commit data...
docs Loading commit data...
packaging Loading commit data...
samples Loading commit data...
tests Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
AI.PROMPT Loading commit data...
CODERAI_API_DOCUMENTATION.md Loading commit data...
CoderAI.gif Loading commit data...
DISTRIBUTION.md Loading commit data...
LICENSE.md Loading commit data...
MULTIMODAL_CAPABILITIES.md Loading commit data...
MULTIMODAL_UI_EXAMPLES.md Loading commit data...
README.md Loading commit data...
build-oci.sh Loading commit data...
build.ps1 Loading commit data...
build.sh Loading commit data...
coderai Loading commit data...
coderai-broker-implementation-reference.md Loading commit data...
coderai-integration.md Loading commit data...
commands Loading commit data...
osxbuild.sh Loading commit data...
package-oci.sh Loading commit data...
package-tarball.sh Loading commit data...
requirements-nvidia.txt Loading commit data...
requirements-vulkan.txt Loading commit data...
requirements.txt Loading commit data...
run-oci.sh Loading commit data...
smoke-test-oci.sh Loading commit data...
todo.md Loading commit data...
video_editor.config.json Loading commit data...