[PR #12664] [MERGED] vulkan: Add memory detection for Intel GPU using DXGI+PDH #13908

Closed
opened 2026-04-13 00:40:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/12664
Author: @virajwad
Created: 10/16/2025
Status: Merged
Merged: 11/4/2025
Merged by: @dhiltgen

Base: mainHead: dxgi_pdh_free_memory_detection


📝 Commits (10+)

  • e49b6e5 PDH free memory skeleton
  • 0981b18 Add PDH printing
  • 2a67678 Merge branch 'main' into dxgi_pdh_free_memory_detection
  • 1c6ea16 Add LUID support for Vulkan
  • 7fd349f wire luid from ggml-vulkan to mem-dxgi-pdh file
  • 88f220e Fix to ggml-impl
  • cec8fb4 Continue skeleton
  • de9696c Implemented ggml_dxgi_pdh_get_device_memory
  • 70b60dc fix comments
  • 23bac36 Fix - change value GB to bytes

📊 Changes

5 files changed (+747 additions, -3 deletions)

View changed files

llama/patches/0031-Add-memory-detection-using-DXGI-PDH.patch (+420 -0)
📝 ml/backend/ggml/ggml/src/CMakeLists.txt (+1 -0)
📝 ml/backend/ggml/ggml/src/ggml-impl.h (+3 -0)
📝 ml/backend/ggml/ggml/src/ggml-vulkan/ggml-vulkan.cpp (+26 -3)
ml/backend/ggml/ggml/src/mem_dxgi_pdh.cpp (+297 -0)

📄 Description

PR that uses DXGI + PDH to return free and total memory of any GPU adapter on the system (Windows 10/11 specific)

  • First draft of code implementation
  • LUID not matching between Vulkan and DXGI
  • Check total memory is reported correctly
  • Check free memory is reported correctly
  • Dynamic vs Static Linking
  • Should we remove some of the LOG_DEBUGs?
  • Check if we should increase sampling (set to 3 samples in 10 ms interval currently)
  • Modify to be used vendor-agnostic
  • Resolve all PR feedback
  • Confirm Windows, Linux, and MacOS can build
  • Generate patch file
  • Test final time
  • CI check

Outside the app, I tested DXGI + PDH in sample code on the following systems (and it worked well):

  • Meteor Lake w/ Windows 11 and 101.7029 driver
  • Tiger Lake w/ Windows 11 and an old (arbitrary) 100.9955 driver
  • Kaby Lake (7th gen) w/ Windows 10 Build 1903

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/12664 **Author:** [@virajwad](https://github.com/virajwad) **Created:** 10/16/2025 **Status:** ✅ Merged **Merged:** 11/4/2025 **Merged by:** [@dhiltgen](https://github.com/dhiltgen) **Base:** `main` ← **Head:** `dxgi_pdh_free_memory_detection` --- ### 📝 Commits (10+) - [`e49b6e5`](https://github.com/ollama/ollama/commit/e49b6e570b06a4393be4d69357ab5bf847cd4318) PDH free memory skeleton - [`0981b18`](https://github.com/ollama/ollama/commit/0981b186a42c017bf4b3c51670b1b6bf514a472b) Add PDH printing - [`2a67678`](https://github.com/ollama/ollama/commit/2a676788d6d0c165d42b740c14593aa400e5b1db) Merge branch 'main' into dxgi_pdh_free_memory_detection - [`1c6ea16`](https://github.com/ollama/ollama/commit/1c6ea1614d6c3913a913f5a468103a95243eda46) Add LUID support for Vulkan - [`7fd349f`](https://github.com/ollama/ollama/commit/7fd349f86cf4fc33b76c0aa5cae15ad42466b786) wire luid from ggml-vulkan to mem-dxgi-pdh file - [`88f220e`](https://github.com/ollama/ollama/commit/88f220ec6ef3b5c52bc290a5d5158c58c8c9eb8d) Fix to ggml-impl - [`cec8fb4`](https://github.com/ollama/ollama/commit/cec8fb47befce0a669de95d18fdb346b420e8dbf) Continue skeleton - [`de9696c`](https://github.com/ollama/ollama/commit/de9696cc7535848c79b87e09deb15a42825873dc) Implemented ggml_dxgi_pdh_get_device_memory - [`70b60dc`](https://github.com/ollama/ollama/commit/70b60dca3b3510279d8f899e2c05a7bcea9cf7be) fix comments - [`23bac36`](https://github.com/ollama/ollama/commit/23bac368171a2fb7a963bf55699ebe4d3aafcb5e) Fix - change value GB to bytes ### 📊 Changes **5 files changed** (+747 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `llama/patches/0031-Add-memory-detection-using-DXGI-PDH.patch` (+420 -0) 📝 `ml/backend/ggml/ggml/src/CMakeLists.txt` (+1 -0) 📝 `ml/backend/ggml/ggml/src/ggml-impl.h` (+3 -0) 📝 `ml/backend/ggml/ggml/src/ggml-vulkan/ggml-vulkan.cpp` (+26 -3) ➕ `ml/backend/ggml/ggml/src/mem_dxgi_pdh.cpp` (+297 -0) </details> ### 📄 Description PR that uses DXGI + PDH to return free and total memory of any GPU adapter on the system (Windows 10/11 specific) - [x] First draft of code implementation - [x] LUID not matching between Vulkan and DXGI - [x] Check total memory is reported correctly - [x] Check free memory is reported correctly - [x] Dynamic vs Static Linking - [x] Should we remove some of the LOG_DEBUGs? - [x] Check if we should increase sampling (set to 3 samples in 10 ms interval currently) - [x] Modify to be used vendor-agnostic - [x] Resolve all PR feedback - [x] Confirm Windows, Linux, and MacOS can build - [x] Generate patch file - [x] Test final time - [x] CI check Outside the app, I tested DXGI + PDH in sample code on the following systems (and it worked well): - Meteor Lake w/ Windows 11 and 101.7029 driver - Tiger Lake w/ Windows 11 and an old (arbitrary) 100.9955 driver - Kaby Lake (7th gen) w/ Windows 10 Build 1903 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 00:40:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#13908