[PR #10700] [MERGED] Estimate projector memory correctly for Ollama engine #23872

Closed
opened 2026-04-19 17:15:58 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10700
Author: @jessegross
Created: 5/13/2025
Status: Merged
Merged: 5/19/2025
Merged by: @jessegross

Base: mainHead: jessegross/vision_graph


📝 Commits (2)

  • bd4887c llm: Consistently track unassigned model data
  • d3a7ce2 llm: Estimate projector memory correctly for Ollama engine

📊 Changes

1 file changed (+28 additions, -20 deletions)

View changed files

📝 llm/memory.go (+28 -20)

📄 Description

The Llama engine always places vision projectors on the first GPU if one exists. However, the Ollama engine groups it with the output layer, which means the projector is only offloaded if all other layers are offloaded. The memory estimation code always assumes the former layout - this changes it to use the correct layout based on the engine.

This addresses two impacts of the current behavior:

  • In multi-GPU setups, we can crash with OOM errors when we try to allocate memory on a full GPU while another still has space.
  • If the vision projector is large, it may prevent us from offloading anything when we could have fit some of the text layers.

🔄 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/10700 **Author:** [@jessegross](https://github.com/jessegross) **Created:** 5/13/2025 **Status:** ✅ Merged **Merged:** 5/19/2025 **Merged by:** [@jessegross](https://github.com/jessegross) **Base:** `main` ← **Head:** `jessegross/vision_graph` --- ### 📝 Commits (2) - [`bd4887c`](https://github.com/ollama/ollama/commit/bd4887c4ff1a24a46bb5364dc877f0efb9915946) llm: Consistently track unassigned model data - [`d3a7ce2`](https://github.com/ollama/ollama/commit/d3a7ce2e741ffd2f3d7ed394c2348ea8c1222133) llm: Estimate projector memory correctly for Ollama engine ### 📊 Changes **1 file changed** (+28 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `llm/memory.go` (+28 -20) </details> ### 📄 Description The Llama engine always places vision projectors on the first GPU if one exists. However, the Ollama engine groups it with the output layer, which means the projector is only offloaded if all other layers are offloaded. The memory estimation code always assumes the former layout - this changes it to use the correct layout based on the engine. This addresses two impacts of the current behavior: - In multi-GPU setups, we can crash with OOM errors when we try to allocate memory on a full GPU while another still has space. - If the vision projector is large, it may prevent us from offloading anything when we could have fit some of the text layers. --- <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-19 17:15:58 -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#23872