mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4127] [Engine] Metal: decode and prompt kernels for the pair-trellis expert types TQP5/TQP6/TQP7 #4913
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4913
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4127
Author: @mnott
Created: 10/25/2026
Status: 🔄 Open
Base:
main← Head:pr/metal-tqp-pair-trellis📝 Commits (7)
f4822a1feat(metal): decode kernels for the pair-trellis expert types TQP5/6/7 (147-149), CPU reference and expert_parity types05f2fcc[Engine] TQP5/TQP6/TQP7 (ggml 147-149): the pair trellis in the readers, the packer and the CPU reference25d0febTQP5/6/7: numpy reference decoder, fork C harness, parity fixtures from the real modelc64c509feat(metal): prompt kernels for the pair-trellis expert types TQP5/TQP6/TQP7e61ca65feat(metal): the decode window and prompt chain take a router of 256 expertsbe25b2dfix(metal): deq_tqp reads the pair-trellis stream as 16-bit words (one 64-bit window a lane) instead of 24 byte loads: Coder-L decode 72 -> 85 tok/s886bc6ebuild(metal): tqp_parity links the in-repo TQP reference when no fork checkout is given📊 Changes
42 files changed (+5856 additions, -65 deletions)
View changed files
📝
include/strata/artifact/gguf_reader.hpp(+19 -0)📝
include/strata/kernels/cpu/tq_cpu.hpp(+9 -4)📝
metal/CMakeLists.txt(+16 -0)📝
metal/kernels/moe.metal(+10 -7)📝
metal/kernels/moe_mm.metal(+34 -0)📝
metal/kernels/prompt.metal(+7 -7)📝
metal/kernels/quant.metal(+49 -0)📝
metal/kernels/router.metal(+7 -7)📝
metal/src/engine/iq_host.cpp(+6 -3)📝
metal/src/engine/prompt_chain.inc(+13 -10)📝
metal/src/engine/window.cpp(+27 -20)📝
metal/src/ref_quant.cpp(+24 -2)📝
metal/src/ref_quant.h(+1 -1)📝
metal/tests/expert_parity.cpp(+2 -2)➕
metal/tests/tqp_parity.cpp(+112 -0)➕
metal/tools/gen_tqp_ref.py(+84 -0)➕
ref/tqp/gen_table.py(+33 -0)➕
ref/tqp/tq2t_lut_table.h(+516 -0)➕
ref/tqp/tqp_ref_c.c(+131 -0)📝
src/kernels/cpu/tq_cpu.cpp(+52 -2)...and 22 more files
📄 Description
Problem and result
Gyro Coder files (for example Gyro Coder-L TQ3_0) store their experts in the pair-trellis types TQP5/TQP6/TQP7 (GGML types 147-149). v0.2.6 on macOS cannot load such a file: it stops in
kernels::cpu::native_fmt/expert_layout_load. With this change the Metal engine loads and runs them.Related discussion
Overview of our related macOS / Metal contributions: #4128. docs/GYRO.md lists these types (147-149) as the reason Gyro-L is not supported; Gyro-L also runs with this branch (comment below).
Approach
expert_parity.deq_tqpreads the pair-trellis stream as 16-bit words (one 64-bit window per lane) instead of 24 byte loads (Gyro Coder-L decode 72 -> 85 tok/s in our earlier measurement on the same machine).tqp_paritylinks the in-repo TQP reference when no fork checkout is given, so a plain build of all targets succeeds.Validation
Branch head
886bc6e7d7aa438081c1f42dc42df28e311e3ff0, 7 commits onv0.2.6. Apple Silicon, 128 GB unified memory, Gyro Coder-L TQ3_0,--ple-io direct --spec 2with the MTP draft.Passed:
strataand all test targets) on macOS.tqp_parity,route_parity 256,route_parity 512,expert_parity --had-test: pass.Failed:
Not run:
Limits
The packer and setup scripts are not wired into setup.sh's model list yet, so Gyro Coder and Gyro-L are packed by hand (tools/iq_pack.py).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.