Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Conversation

@gn64
Copy link
Contributor

@gn64 gn64 commented May 13, 2025

Summary

Adds a safe Rust wrapper for Vulkan GPU enumeration that mirrors the SYCL request in #160 but targets the ggml_backend_vk_* APIs instead.

What’s included

  • build.rs
    • allow-lists the following symbols when the vulkan feature is enabled
      ggml_backend_vk_get_device_count, ggml_backend_vk_get_device_description,
      ggml_backend_vk_get_device_memory, ggml_backend_vk_buffer_type
  • src/backend/vulkan.rs
    • VkDeviceInfo — human-readable metadata (name, VRAM, buffer type)
    • list_devices() — returns Vec<VkDeviceInfo> in discrete-then-integrated order
  • tests
    • enumerate_must_not_panic
    • sane_device_info

Why

Selecting the optimal GPU at runtime is vital on multi-GPU rigs (e.g. dGPU + iGPU).
While ggml already exposes Vulkan back-end helpers, whisper-rs could not reach them.
This PR fills that gap and lets downstream users build zero-copy buffers on the
device returned by list_devices().

Notes

  • Feature-gated behind vulkan — no extra dependencies.
  • Verified on Windows (msvc).

@tazz4843
Copy link
Owner

tazz4843 commented Jun 8, 2025

Ran local tests on my laptop (Fedora 41, Ryzen 7 7840HS iGPU) a few weeks ago and forgot to report back here (they succeeded). Thanks for the PR :)

@tazz4843 tazz4843 merged commit f9cf506 into tazz4843:master Jun 8, 2025
11 of 13 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants