[PR #13531] [MERGED] llm: Avoid integer underflow on llama engine memory layout #45507

Closed
opened 2026-04-25 01:12:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13531
Author: @jessegross
Created: 12/19/2025
Status: Merged
Merged: 12/19/2025
Merged by: @jessegross

Base: mainHead: jessegross/free_mem


📝 Commits (1)

  • 1c3f698 llm: Avoid integer underflow on llama engine memory layout

📊 Changes

1 file changed (+11 additions, -2 deletions)

View changed files

📝 llm/server.go (+11 -2)

📄 Description

On the llama engine, when we compute the memory layout, we reserve a buffer to allow for some flexibility for incorrect estimates. This is subtracted from GPU free memory and on GPUs with limited memory, it may underflow.

Fixes #13494


🔄 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/13531 **Author:** [@jessegross](https://github.com/jessegross) **Created:** 12/19/2025 **Status:** ✅ Merged **Merged:** 12/19/2025 **Merged by:** [@jessegross](https://github.com/jessegross) **Base:** `main` ← **Head:** `jessegross/free_mem` --- ### 📝 Commits (1) - [`1c3f698`](https://github.com/ollama/ollama/commit/1c3f698f96fb6b61491c8d8c904256e4c5f8c076) llm: Avoid integer underflow on llama engine memory layout ### 📊 Changes **1 file changed** (+11 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `llm/server.go` (+11 -2) </details> ### 📄 Description On the llama engine, when we compute the memory layout, we reserve a buffer to allow for some flexibility for incorrect estimates. This is subtracted from GPU free memory and on GPUs with limited memory, it may underflow. Fixes #13494 --- <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-25 01:12:21 -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#45507