[PR #5593] [CLOSED] Support intel igpus #58538

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

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/5593
Author: @zhewang1-intc
Created: 7/10/2024
Status: Closed

Base: mainHead: support_intel_igpus


📝 Commits (10+)

📊 Changes

9 files changed (+304 additions, -218 deletions)

View changed files

📝 envconfig/config.go (+3 -0)
📝 gpu/cpu_common.go (+5 -0)
📝 gpu/gpu.go (+40 -6)
📝 gpu/gpu_info_oneapi.c (+18 -0)
📝 gpu/gpu_info_oneapi.h (+1 -0)
📝 gpu/types.go (+3 -2)
llm/generate/gen_oneapi.ps1 (+55 -0)
📝 llm/generate/gen_windows.ps1 (+6 -210)
llm/generate/gen_windows_utils.ps1 (+173 -0)

📄 Description

Hi, I’m submitted this PR to enable Intel iGPU through the OLLAMA_INTEL_IGPU environment variable.

Due to the limitations of Intel’s foundation software (details can be seen in this issue), it is currently impossible to directly obtain the total vram and available vram of the iGPU.

For Intel iGPU, the maximum available iGPU vram is roughly half of the total ram. Therefore, as a workaround, this PR adds the OLLAMA_INTEL_USED_SYSTEM_VRAM environment variable to set the size of the used VRAM that is shared with the host. In this PR, the size of iGPU’s freeMemory is designed to be totalram/2-IntelUsedSystemVRAM.

For the Windows platform, the used system vram can be obtained with this PowerShell command:

(((Get-Counter "\GPU Process Memory(*)\Local Usage").CounterSamples | where CookedValue).CookedValue | measure -sum).sum

For the Linux platform, it can be obtained with this command:

sudo sed 's/^.*, \([0-9]\+\) bytes$/\1/' /sys/kernel/debug/dri/0/i915_gem_objects |\
  awk '{print $1, "Bytes"; exit}'

EDIT: try this release binary to enable ollama run with Intel GPUs.

UPDATE: update experimental-oneapi ollama server to v0.0.2


🔄 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/5593 **Author:** [@zhewang1-intc](https://github.com/zhewang1-intc) **Created:** 7/10/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `support_intel_igpus` --- ### 📝 Commits (10+) - [`bfc32f9`](https://github.com/ollama/ollama/commit/bfc32f94fc08018bf8f56a7eef229e62270ab580) support intel igpus - [`c484e28`](https://github.com/ollama/ollama/commit/c484e2820e8fd9c2bf08bc84e605b686efad6927) support windows - [`4a23ed2`](https://github.com/ollama/ollama/commit/4a23ed2d97b0b261431f177d1e976097a7118435) fix windows - [`467a555`](https://github.com/ollama/ollama/commit/467a5558fc6e3018b6a30aa07922c029449f07bc) fix typo - [`902e27f`](https://github.com/ollama/ollama/commit/902e27f1b99da43651aae1ace655218697ac6756) igpu discovery refactor on linux platform - [`2472e7e`](https://github.com/ollama/ollama/commit/2472e7e4ce0f8212b2710bc2dfeefca00a87fd0d) igpu discovery refactor on windows platform - [`a6cb159`](https://github.com/ollama/ollama/commit/a6cb1593d2912b8d2de792e2d94f517c065d7a4e) remove reg match - [`58e4bdf`](https://github.com/ollama/ollama/commit/58e4bdf8d276d22b31b2035b33c034e779e8fa42) Update gpu/gpu.go - [`62ab563`](https://github.com/ollama/ollama/commit/62ab5633a63412be58c0e85d2f6305a3a94c2650) new igpu used system-ram command - [`c9283ca`](https://github.com/ollama/ollama/commit/c9283ca9ae279bfd713410e761dc29e86b34da90) lint ### 📊 Changes **9 files changed** (+304 additions, -218 deletions) <details> <summary>View changed files</summary> 📝 `envconfig/config.go` (+3 -0) 📝 `gpu/cpu_common.go` (+5 -0) 📝 `gpu/gpu.go` (+40 -6) 📝 `gpu/gpu_info_oneapi.c` (+18 -0) 📝 `gpu/gpu_info_oneapi.h` (+1 -0) 📝 `gpu/types.go` (+3 -2) ➕ `llm/generate/gen_oneapi.ps1` (+55 -0) 📝 `llm/generate/gen_windows.ps1` (+6 -210) ➕ `llm/generate/gen_windows_utils.ps1` (+173 -0) </details> ### 📄 Description Hi, I’m submitted this PR to enable Intel iGPU through the `OLLAMA_INTEL_IGPU` environment variable. Due to the limitations of Intel’s foundation software (details can be seen in this [issue](https://github.com/intel/compute-runtime/issues/742)), it is currently impossible to directly obtain the total vram and available vram of the iGPU. For Intel iGPU, the maximum available iGPU vram is roughly half of the total ram. Therefore, as a workaround, this PR adds the `OLLAMA_INTEL_USED_SYSTEM_VRAM` environment variable to set the size of the used VRAM that is shared with the host. In this PR, the size of iGPU’s freeMemory is designed to be `totalram/2-IntelUsedSystemVRAM`. For the Windows platform, the used system vram can be obtained with this PowerShell command: ``` (((Get-Counter "\GPU Process Memory(*)\Local Usage").CounterSamples | where CookedValue).CookedValue | measure -sum).sum ``` For the Linux platform, it can be obtained with this command: ``` sudo sed 's/^.*, \([0-9]\+\) bytes$/\1/' /sys/kernel/debug/dri/0/i915_gem_objects |\ awk '{print $1, "Bytes"; exit}' ``` **EDIT:** try this [release binary](https://github.com/zhewang1-intc/ollama/releases/tag/experimental-oneapi-v0.0.1) to enable ollama run with Intel GPUs. **UPDATE**: update experimental-oneapi ollama server to [v0.0.2](https://github.com/zhewang1-intc/ollama/releases/tag/experimental-oneapi-v0.0.2) --- <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-29 13:25:40 -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#58538