Skip to content

OpenVINO: PRD-compliant device enumeration and memory reporting for --list-devices - #256

Merged
ravi9 merged 2 commits into
ravi9:dev_backend_openvinofrom
haarika-madaka:feat/openvino-list-devices
Sep 29, 2026
Merged

ravi9 merged 2 commits into
ravi9:dev_backend_openvinofrom
haarika-madaka:feat/openvino-list-devices

Conversation

@haarika-madaka

Copy link
Copy Markdown

Summary

This PR implements PRD-compliant OpenVINO device enumeration and memory reporting for --list-devices, scoped to ggml/src/ggml-openvino/ only.

What changed

  1. Device enumeration and registration
  • Registers one GGML backend device per physical OpenVINO device returned by get_available_devices().
  • Filters virtual routing devices by prefix: AUTO, MULTI, HETERO.
  • Sorts device identifiers lexicographically for deterministic output.
  • Uses exact OpenVINO identifiers as backend device names (no alias synthesis, no normalization).
  1. Device selection behavior
  • Preserves existing selected device behavior (GGML_OPENVINO_DEVICE with fallback).
  • Keeps runtime log line:
    • OpenVINO: using device <...>
  • Ensures execution remains bound to the selected OpenVINO device by returning false in supports_op for non-selected registered devices.
  1. Device descriptions
  • Uses FULL_DEVICE_NAME as device description.
  • For NPU, appends architecture when available:
    • <FULL_DEVICE_NAME> (NPU <DEVICE_ARCHITECTURE>)
  • Falls back to device identifier on property query failure.
  1. Memory reporting (PRD-compliant)
  • CPU:
    • Uses existing system RAM path (current behavior).
  • GPU:
    • Total = GPU_DEVICE_TOTAL_MEM_SIZE
    • Free = total - sum(GPU_MEMORY_STATISTICS allocations)
  • NPU:
    • Total = NPU_DEVICE_TOTAL_MEM_SIZE
    • Free = total - NPU_DEVICE_ALLOC_MEM_SIZE
  • Robust fallback:
    • If required properties are unavailable, reports 0 MiB total and 0 MiB free for that device.
  • Does not use GPU_DEVICE_MAX_ALLOC_MEM_SIZE.

Scope

Changes are limited to:

  • ggml/src/ggml-openvino/ggml-openvino.cpp
  • ggml/src/ggml-openvino/ggml-openvino-extra.cpp
  • ggml/src/ggml-openvino/ggml-openvino-extra.h

No changes outside OpenVINO backend files.

Validation

Built and ran:

cmake --build build/ReleaseOV --parallel
./build/ReleaseOV/bin/llama-bench --list_devices

Observed output format:

OpenVINO: using device CPU
Available devices:
  CPU: Intel(R) Core(TM) Ultra 7 258V (31623 MiB, 31623 MiB free)
  GPU: Intel(R) Arc(TM) Graphics (iGPU) (29276 MiB, 29276 MiB free)
  NPU: Intel(R) AI Boost (NPU 4000) (31623 MiB, 31623 MiB free)

Notes

  • Device identity is strictly the OpenVINO identifier string.
  • Registration order is deterministic and does not affect device selection semantics.
  • Multi-device execution is not introduced; registration is for discovery/listing.

@ravi9
ravi9 changed the base branch from master to dev_backend_openvino August 4, 2026 05:42
@ravi9

ravi9 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

@haarika-madaka - All our dev happen in ravi9:dev_backend_openvino. So dev PRs need to be merged into it.
Please rebase your branch with dev_backend_openvino.

@haarika-madaka
haarika-madaka force-pushed the feat/openvino-list-devices branch from e87e859 to cdb0cf3 Compare August 7, 2026 02:00
@wine99
wine99 force-pushed the dev_backend_openvino branch 3 times, most recently from 678ba21 to 16f69ac Compare August 18, 2026 01:01
@ravi9
ravi9 force-pushed the dev_backend_openvino branch from eb54a50 to 04b5691 Compare August 18, 2026 14:43
@haarika-madaka
haarika-madaka force-pushed the feat/openvino-list-devices branch from cdb0cf3 to e7e55e5 Compare August 24, 2026 05:13
@haarika-madaka

Copy link
Copy Markdown
Author

@ravi9 Can you please take a look at this PR, I have rebased appropriately. Thanks

@ravi9
ravi9 force-pushed the dev_backend_openvino branch 2 times, most recently from d691121 to 407e209 Compare August 25, 2026 16:53
@ravi9
ravi9 force-pushed the feat/openvino-list-devices branch from e7e55e5 to c349ad1 Compare August 25, 2026 20:44
@wine99
wine99 force-pushed the dev_backend_openvino branch from 01d5a57 to 40d3fdd Compare August 28, 2026 01:36
@ravi9
ravi9 force-pushed the dev_backend_openvino branch 2 times, most recently from fd9bc04 to 33237ab Compare September 3, 2026 21:10
@ravi9
ravi9 force-pushed the dev_backend_openvino branch from 37b4e1d to 926ef68 Compare September 14, 2026 17:49
@wine99
wine99 force-pushed the dev_backend_openvino branch from 0365b00 to 37b53fd Compare September 16, 2026 08:07
@ravi9
ravi9 force-pushed the dev_backend_openvino branch from 40a2a96 to 972d231 Compare September 17, 2026 17:37
@mostafafaheem
mostafafaheem force-pushed the feat/openvino-list-devices branch from c349ad1 to a5603ff Compare September 20, 2026 17:30
@ravi9
ravi9 marked this pull request as draft September 22, 2026 16:07
@haarika-madaka
haarika-madaka force-pushed the feat/openvino-list-devices branch from a5603ff to 0d15bbe Compare September 22, 2026 16:41
@ravi9
ravi9 requested a review from mostafafaheem September 22, 2026 18:28
@ravi9

ravi9 commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Related: ggml-org#29124

@haarika-madaka
haarika-madaka marked this pull request as ready for review September 28, 2026 03:32
haarika-madaka and others added 2 commits September 29, 2026 03:11
- Only the device selected by GGML_OPENVINO_DEVICE reports as GPU; the
  other OpenVINO devices report as IGPU so llama.cpp does not offload to
  them. Initializing a non-selected device logs a warning.
- Name devices OPENVINO<i> again and show the OpenVINO id in the
  description. Raw "CPU" names shadowed the ggml CPU backend.
- Support GPU.N: create the OpenCL queue on OpenVINO's own context for
  the selected device, and replace "GPU"/"NPU" string comparisons with
  ggml_openvino_is_gpu()/ggml_openvino_is_npu().
- An unavailable GGML_OPENVINO_DEVICE is now an error that lists the
  available devices, instead of silently falling back to CPU.
- Memory: cap iGPU/NPU free memory at system available memory, fall back
  to system memory instead of 0/0 when the plugin lacks memory
  properties, and ignore host USM allocations in GPU usage.
- Initialize the device config once under a lock, even if OpenCL setup
  fails.
- Fix supports_op return type for non-selected devices (build error).
@ravi9
ravi9 force-pushed the feat/openvino-list-devices branch from 0d15bbe to 0bbd7f1 Compare September 29, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants