llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

MTP with --device Vulkan0 uses ROCm instead of requested Vulkan when both backends are enabled

Open danjanjan opened this issue 6 months ago • 2 comments

Description

When building with both ROCm and Vulkan backends enabled in the same binary, and running llama-server with --device Vulkan0 --spec-type draft-mtp, the MTP (Multi-Token Prediction) feature uses ROCm instead of the requested Vulkan device, causing device mismatch and disabling MTP.

Steps to reproduce

  1. Build with both backends enabled (e.g., -DGGML_VULKAN=ON -DGGML_HIP=ON)
  2. Run: llama-server --device Vulkan0 --spec-type draft-mtp --model <model>
  3. Log shows: layer 0 is assigned to device Vulkan0 but the fused Gated Delta Net tensor is assigned to device ROCm0 fused Gated Delta Net (autoregressive) not supported, set to disabled

Expected behavior

  • When --device Vulkan0 is specified, MTP should use Vulkan0
  • The scheduler should respect the user's device preference

Actual behavior

  • MTP uses ROCm device despite --device Vulkan0 request
  • Device mismatch causes MTP to be disabled

Environment

  • GPU: AMD Radeon RX 7900 XTX (any dual-backend setup)
  • Backends: ROCm + Vulkan (both enabled)
  • llama.cpp: latest master

Code location

src/llama-context.cpp in sched_reserve() function (~line 480). The code simply disables MTP on device mismatch instead of respecting the user's requested device.

danjanjan avatar May 17 '26 11:05 danjanjan

Hi @danjanjan ,

The issue is that sched_reserve() assigns the GDN tensor to ROCm0 by default when both backends are loaded, causing the device mismatch.

Workaround: hide ROCm devices at runtime so Vulkan is the only backend: ROCR_VISIBLE_DEVICES= HIP_VISIBLE_DEVICES= llama-server --device Vulkan0 --spec-type draft-mtp ... If the empty value doesn't work on your ROCm version, try ROCR_VISIBLE_DEVICES=-1 HIP_VISIBLE_DEVICES=-1.

Kaihui-AMD avatar May 18 '26 06:05 Kaihui-AMD

I can confirm this class of issue is very relevant from the user side.

On my AMD setup (R9700 + Qwen3.6-27B-MTP), the reliable path was to avoid dual-backend ambiguity entirely: I pin a HIP-only runtime for the real run and keep Vulkan as a separate fallback / test path.

That does not fix the underlying scheduler problem here, but it matches the reported behavior: once both backends are present, the speculative / MTP path can end up effectively choosing ROCm even when the user asked for Vulkan.

So I agree with the issue description: --device Vulkan0 should constrain the speculative path as well, not just the main layer placement.

The current env-var workaround makes sense, but from an operator perspective a backend-specific binary or a hard backend isolation mechanism is the only thing that felt predictable.

KaiFelixBennett avatar May 28 '26 09:05 KaiFelixBennett