Skip to content

Vulkan (AMD, Windows, no ReBAR): DEVICE_LOCAL|HOST_VISIBLE buffers are backed by system memory and exhaust the WDDM shared budget -> vkQueueSubmit returns ErrorOutOfDeviceMemory #30888

Open

Description

@laurentvv

Summary

ggml_vk_create_buffer_device() requests the DEVICE_LOCAL|HOST_VISIBLE|HOST_COHERENT memory type first for every device buffer and only falls back to plain DEVICE_LOCAL if that allocation fails. On a GPU without resizable BAR, that type lives in a 256 MiB heap. Buffers smaller than 256 MiB are accepted, but the driver does not place them in VRAM: the Windows kernel charges them to the process's shared (system-memory) segment. When enough of them are alive, the process exceeds its shared budget and vkQueueSubmit fails with ErrorOutOfDeviceMemory, while ggml_backend_dev_memory() still reports most of the VRAM as free.

Environment

  • GPU: AMD Radeon RX 6950 XT (16 GB), AMD proprietary driver, Windows 11, 32 GB RAM, resizable BAR off
  • Application: stable-diffusion.cpp (uses a ggml fork synced from this repository), Vulkan backend
  • Vulkan heaps (vulkaninfo):
    • heap 0: 15.73 GiB, DEVICE_LOCAL (VRAM)
    • heap 1: 15.92 GiB, system memory
    • heap 2: 256 MiB, DEVICE_LOCAL (memory type 2 = DEVICE_LOCAL|HOST_VISIBLE|HOST_COHERENT)

Observed behavior

The workload streams weights: it allocates many device buffers of 235 MB each (staged copies of model weights), keeps them alive across graph segments, and also holds a 12.2 GB pinned host pool (Vulkan_Host).

  • Per-process counters from the Windows kernel (WMI GPU Process Memory, sampled every 3 s): "shared" usage grows by exactly +235 MB per allocated buffer, while "local" usage stays flat at about 2.3 GB.
  • Shared usage reaches 16.2 GB against a DXGI shared budget of 15.5 GB (IDXGIAdapter3::QueryVideoMemoryInfo, NON_LOCAL). The next submit fails with vk::Queue::submit: ErrorOutOfDeviceMemory.
  • At the last sample before each failure: VRAM free 13.5 GB, available system RAM 7-10 GB, no TDR, no resource-exhaustion event.
  • The in-process DXGI LOCAL counter classifies these buffers as local, so it does not show the problem either.

Control experiments (same machine, same workload, same day)

configuration buffer size result kernel shared / local usage
default 235 MB (< 256 MiB) fails 3 of 3 16.2 GB / 2.3 GB
larger buffers (~890 MB, > 256 MiB, so the BAR type is rejected and the fallback is used) ~890 MB completes 12.6 GB / 10.2 GB
default buffers + GGML_VK_DISABLE_HOST_VISIBLE_VIDMEM=1 235 MB completes 12.3 GB / 10.3 GB

Prefetch and host-RAM pressure were ruled out: the failure also occurs with prefetch disabled and with several GB of RAM free.

Suggested direction

Avoid the DEVICE_LOCAL|HOST_VISIBLE type when its heap is small (for example when the heap is not larger than 256 MiB), or only request it for buffers that the CPU actually writes (staging, small buffers). Weight buffers that are only read by the GPU do not need it. The existing disable_host_visible_vidmem switch already implements the safe path; it just is not selected automatically.

Caveats

One GPU and driver tested; the placement in system memory is inferred from the kernel counters, not read from the driver. Not tested with resizable BAR enabled.

Downstream report with full logs: leejet/stable-diffusion.cpp#2166

Activity

  1. laurentvv commented on Oct 20, 2026

    @laurentvv
    Author

    Related: #27097 describes the same code path (no-ReBAR AMD, 256 MiB DEVICE_LOCAL|HOST_VISIBLE heap) with a performance symptom, and @craig-b has a detection patch there (disable the type when the host-visible heap is smaller than the main heap). This issue adds the failure mode (vkQueueSubmit OOM from shared-budget exhaustion) and the kernel-counter evidence. I can test that patch against this workload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions