[PR #3876] [Engine] Metal: wrap a Gyro file without its PLE table (37.6 instead of 92 GB in GPU buffers) #4813

Open
opened 2026-11-07 15:39:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3876
Author: @mnott
Created: 10/23/2026
Status: 🔄 Open

Base: main ← Head: metal-gyro-wrap-ple


📝 Commits (1)

  • 707ae68 fix(metal): wrap a Gyro file without its PLE table: the head and tail ranges only, no read-ahead of the table

📊 Changes

3 files changed (+74 additions, -26 deletions)

View changed files

📝 metal/src/engine/window.cpp (+39 -26)
📝 metal/src/mtl_rt.h (+5 -0)
📝 metal/src/mtl_rt.mm (+30 -0)

📄 Description

Rebased onto v0.2.6 (same change as before).

Problem and result

On macOS the engine wraps the whole Gyro GGUF, including its PLE table, into Metal buffers. With Gyro-M TQ2_0 (92 GB file, about 54 GB of it the PLE table) the log shows wrapped 91.97 GB as 2 overlapping buffers. With this change only the head and tail ranges around the PLE table are wrapped and the read-ahead skips the table: wrapped 37.57 GB as 2 separate ranges (of 91.97 GB).

Overview of our related macOS / Metal contributions: #4128. Split out of #3299, whose Gyro-on-Metal kernel commits are upstream since v0.2.3.

Approach

When the file has a PLE table, window.cpp wraps the ranges before and after it as two separate no-copy buffers instead of one buffer over the whole file. Without a PLE table the existing span logic is unchanged.

Validation

Branch head 707ae686aa671567a7172600969def327d004507, one commit on v0.2.6. Apple Silicon, 128 GB unified memory, Gyro-M TQ2_0, --ple-io direct --spec 2 with the MTP draft, same flags for both builds.

Passed:

  • Build of strata on macOS.
  • Startup log: v0.2.6 wrapped 91.97 GB as 2 overlapping buffers, this branch wrapped 37.57 GB as 2 separate ranges (of 91.97 GB).
  • Greedy, 80 tokens: output token ids identical to v0.2.6.

Failed:

  • none observed

Not run:

  • A decode speed comparison on v0.2.6 (the earlier one on v0.2.3.1 is in the previous description: 2k decode 70.9 -> 84.6 tok/s).

Limits

Applies when the file carries a PLE table and the PLE is read directly (--ple-io direct); other files keep the existing span logic.


🔄 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/Niko1221/Strata/pull/3876 **Author:** [@mnott](https://github.com/mnott) **Created:** 10/23/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `metal-gyro-wrap-ple` --- ### 📝 Commits (1) - [`707ae68`](https://github.com/Niko1221/Strata/commit/707ae686aa671567a7172600969def327d004507) fix(metal): wrap a Gyro file without its PLE table: the head and tail ranges only, no read-ahead of the table ### 📊 Changes **3 files changed** (+74 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `metal/src/engine/window.cpp` (+39 -26) 📝 `metal/src/mtl_rt.h` (+5 -0) 📝 `metal/src/mtl_rt.mm` (+30 -0) </details> ### 📄 Description Rebased onto v0.2.6 (same change as before). ## Problem and result On macOS the engine wraps the whole Gyro GGUF, including its PLE table, into Metal buffers. With Gyro-M TQ2_0 (92 GB file, about 54 GB of it the PLE table) the log shows `wrapped 91.97 GB as 2 overlapping buffers`. With this change only the head and tail ranges around the PLE table are wrapped and the read-ahead skips the table: `wrapped 37.57 GB as 2 separate ranges (of 91.97 GB)`. ## Related discussion Overview of our related macOS / Metal contributions: #4128. Split out of #3299, whose Gyro-on-Metal kernel commits are upstream since v0.2.3. ## Approach When the file has a PLE table, `window.cpp` wraps the ranges before and after it as two separate no-copy buffers instead of one buffer over the whole file. Without a PLE table the existing span logic is unchanged. ## Validation Branch head `707ae686aa671567a7172600969def327d004507`, one commit on `v0.2.6`. Apple Silicon, 128 GB unified memory, Gyro-M TQ2_0, `--ple-io direct --spec 2` with the MTP draft, same flags for both builds. **Passed:** - Build of `strata` on macOS. - Startup log: v0.2.6 `wrapped 91.97 GB as 2 overlapping buffers`, this branch `wrapped 37.57 GB as 2 separate ranges (of 91.97 GB)`. - Greedy, 80 tokens: output token ids identical to `v0.2.6`. **Failed:** - none observed **Not run:** - A decode speed comparison on v0.2.6 (the earlier one on v0.2.3.1 is in the previous description: 2k decode 70.9 -> 84.6 tok/s). ## Limits Applies when the file carries a PLE table and the PLE is read directly (--ple-io direct); other files keep the existing span logic. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4813
No description provided.