[PR #5167] [Engine] metal: TYPE_SIZE knows the agentionai trellis types 143-146, so a Gyro GGUF can be planned for streaming #5331

Open
opened 2026-11-07 16:34:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5167
Author: @Flo5k5
Created: 11/4/2026
Status: 🔄 Open

Base: main ← Head: metal-repack-trellis-types


📝 Commits (1)

  • 2e5d9ef fix(metal): TYPE_SIZE knows the agentionai trellis types 143-146 so the streaming experts file can plan a Gyro GGUF (sizes from tools/gguf_reader.py)

📊 Changes

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

View changed files

📝 metal/tools/metal_repack.py (+2 -1)

📄 Description

Problem and result

metal/tools/metal_repack.py fails with KeyError: 144 when the Mac source setup prepares the streaming experts copy for a Gyro model: its TYPE_SIZE table stops at type 42 and knows nothing of the agentionai trellis blocks (143 PTQ1_0, 144 TQ2_T, 145 TQK6, 146 TQK7).

After the patch, ./setup.sh --family gyro --model Gyro-M completes end to end on an Apple Silicon Mac, and the engine serves the model.

Trace (setup by sources, ./setup.sh --family gyro --model Gyro-M on an Apple Silicon Mac):

File "metal/setup_mac.py", line 517, in main    experts_file(shards[0])
File "metal/setup_mac.py", line 222, in experts_file    need = X.size_bytes(native) / 1e9
File "metal/tools/stream_experts.py", line 33, in plan    rd = R.Reader(gguf)
File "metal/tools/metal_repack.py", line 99, in __init__    b, q = TYPE_SIZE[t["type"]]
KeyError: 144

The sizes already exist in the tree (tools/gguf_reader.py: "TQ2_T": (128, 34), "TQK6": (128, 26), "TQK7": (128, 30), "PTQ1_0": (128, 28)); this PR adds types 143-146 to TYPE_SIZE with those sizes. One line of table, no behaviour change for existing types. The pair trellis types 147-149 (TQP5-7, Gyro-L) are not included: no sizes for them in the tree, and #4127 adds the Metal kernels separately. None needed from the maintainer beyond the review.

Approach

A pure table extension: no kernel, no behaviour, no default changes. Compatibility: setups that never see a trellis-typed GGUF are untouched.

Validation

Passed:

  • ./setup.sh --family gyro --model Gyro-M --yes --no-start on a MacBook Pro M5 Pro (20-core GPU, 64 GB), v0.2.6 source checkout + this patch: completes end to end - pack prepared (460 tensors), streaming experts copy written, start script generated.
  • The engine then serves the model and a full tools/strata_bench.py run passes (chat 25.7 tok/s median on streaming, 0 failed request): first Mac measurement of Gyro-M, community report to follow separately.

Failed:

  • Without the patch the setup dies in step 6 on a stock v0.2.6 checkout (reproduced; the same table is unchanged on main today).

Not run:

  • CUDA/HIP/SYCL builds: the touched file is the Mac repack tool only.

Limits

Types 147-149 (Gyro-L pair trellis) stay out until their sizes exist in the tree (#4127 territory).


🔄 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/5167 **Author:** [@Flo5k5](https://github.com/Flo5k5) **Created:** 11/4/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `metal-repack-trellis-types` --- ### 📝 Commits (1) - [`2e5d9ef`](https://github.com/Niko1221/Strata/commit/2e5d9ef2c74f8e99118d0c0d1ec08ee46b27511c) fix(metal): TYPE_SIZE knows the agentionai trellis types 143-146 so the streaming experts file can plan a Gyro GGUF (sizes from tools/gguf_reader.py) ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `metal/tools/metal_repack.py` (+2 -1) </details> ### 📄 Description ## Problem and result `metal/tools/metal_repack.py` fails with `KeyError: 144` when the Mac source setup prepares the streaming experts copy for a Gyro model: its `TYPE_SIZE` table stops at type 42 and knows nothing of the agentionai trellis blocks (143 PTQ1_0, 144 TQ2_T, 145 TQK6, 146 TQK7). After the patch, `./setup.sh --family gyro --model Gyro-M` completes end to end on an Apple Silicon Mac, and the engine serves the model. Trace (setup by sources, `./setup.sh --family gyro --model Gyro-M` on an Apple Silicon Mac): ``` File "metal/setup_mac.py", line 517, in main experts_file(shards[0]) File "metal/setup_mac.py", line 222, in experts_file need = X.size_bytes(native) / 1e9 File "metal/tools/stream_experts.py", line 33, in plan rd = R.Reader(gguf) File "metal/tools/metal_repack.py", line 99, in __init__ b, q = TYPE_SIZE[t["type"]] KeyError: 144 ``` ## Related discussion The sizes already exist in the tree (`tools/gguf_reader.py`: `"TQ2_T": (128, 34), "TQK6": (128, 26), "TQK7": (128, 30), "PTQ1_0": (128, 28)`); this PR adds types 143-146 to `TYPE_SIZE` with those sizes. One line of table, no behaviour change for existing types. The pair trellis types 147-149 (TQP5-7, Gyro-L) are not included: no sizes for them in the tree, and #4127 adds the Metal kernels separately. None needed from the maintainer beyond the review. ## Approach A pure table extension: no kernel, no behaviour, no default changes. Compatibility: setups that never see a trellis-typed GGUF are untouched. ## Validation **Passed:** - `./setup.sh --family gyro --model Gyro-M --yes --no-start` on a MacBook Pro M5 Pro (20-core GPU, 64 GB), v0.2.6 source checkout + this patch: completes end to end - pack prepared (460 tensors), streaming experts copy written, start script generated. - The engine then serves the model and a full `tools/strata_bench.py` run passes (chat 25.7 tok/s median on streaming, 0 failed request): first Mac measurement of Gyro-M, community report to follow separately. **Failed:** - Without the patch the setup dies in step 6 on a stock v0.2.6 checkout (reproduced; the same table is unchanged on main today). **Not run:** - CUDA/HIP/SYCL builds: the touched file is the Mac repack tool only. ## Limits Types 147-149 (Gyro-L pair trellis) stay out until their sizes exist in the tree (#4127 territory). --- <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#5331
No description provided.