You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Studio: RAG embeddings warm makes the first GPU allocation in-process, so a driver-level segfault kills the backend #8474
On an AMD host whose ROCm stack does not match the silicon, the Studio backend dies with a bare Segmentation fault at startup, before any model is selected. This is the crash in #7331 (Radeon 8060S, gfx1151).
The immediate trigger there is a mismatched torch wheel, but the reason a mismatched wheel takes down the whole backend is separate and worth fixing on its own: the RAG embeddings warm makes the process's first GPU allocation eagerly, in-process, on a daemon thread, with nothing between it and a signal.
Why
_warm_rag_embedder() (studio/backend/main.py:492-503) is called from _post_warm_background_work() (main.py:629) on a daemon thread (main.py:527-535). It walks straight to SentenceTransformer(load_target, **st_kwargs) at studio/backend/core/rag/embeddings.py:382, with device = _device() set at :358.
_device() (:49-50) maps DeviceType.CUDA to "cuda", and ROCm is DeviceType.CUDA internally (hardware.py:579-580; IS_ROCM at :589-593 is display only, per the docstring at :188-195). There is no ROCm branch, no arch check, no subprocess isolation and no CPU fallback anywhere before .to(device).
The handlers that look like they cover this do not. The except Exception: pass at main.py:503 and the except Exception as st_err at embeddings.py:533 are Python handlers; a SIGSEGV inside libamdhip64 never becomes a Python exception. Signal disposition is per process, so a daemon thread's fault kills the backend and uvicorn with it. No faulthandler and no signal.signal(SIGSEGV, ...) is installed in main.py, utils/torch_warmup.py or core/rag/*.py.
This contradicts the contract that file states for itself at utils/torch_warmup.py:16-17: "never fatal, a failed stage is logged and left cold".
_build_st_backend_or_fallback (embeddings.py:522-542) already has the fallback structure. It simply cannot observe a signal from inside the same process.
One aggravating detail: _resolve_auto() (embeddings.py:497-507), the one genuinely torch-free step, calls LlamaCppBackend._get_gpu_free_memory() to choose the backend, so on an affected host it actively steers into the crash rather than away from it.
Suggested fix
Do the first .to(device) in a short-lived subprocess, or gate the warm behind a torch-free "can this device allocate" probe, and treat death by signal as a failed probe: fall back to CPU or to the llama-server embedder and log it, rather than taking the backend down.
Workaround
UNSLOTH_STUDIO_DISABLE_TORCH_WARM=1 skips the warm entirely (main.py:624).
Activity