Skip to content

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

Open
haarika-madaka wants to merge 1 commit into
ravi9:masterfrom
haarika-madaka:feat/openvino-list-devices
Open

OpenVINO: PRD-compliant device enumeration and memory reporting for --list-devices#256
haarika-madaka wants to merge 1 commit into
ravi9:masterfrom
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.

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.

1 participant