[PR #305] GLM: allow CPU lane retiming to select an all-PCIe plan #459

Open
opened 2026-10-29 21:25:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/305
Author: @JumpEggKiller
Created: 10/20/2026
Status: 🔄 Open

Base: main ← Head: fix/glm-retime-pcie-only


📝 Commits (1)

  • 611c113 Allow CPU lane retiming to select an all-PCIe plan

📊 Changes

2 files changed (+121 additions, -1 deletions)

View changed files

📝 src/core/glm_fast_path.cu (+2 -1)
➕ tools/test_glm_lane_retime.py (+119 -0)

📄 Description

When GLM decode repeatedly measures the CPU lane slower than PCIe, lane_retime() can compute an all-PCIe plan but explicitly discards it. The initial CPU allocation then survives even when the existing retimer has enough evidence to stop using it.

Allow that zero plan through the existing update. The warmup window, two consecutive measurements, sample/change limits, explicit-plan protection and CPU pool lifetime stay as before. Both the active plan and the default restored after request overrides become zero. Routing work between CPU and GPU can change output rounding and generated tokens.

Evidence and scope

On a local Windows machine with an EPYC 7R13 (48 cores / 96 logical processors), 256 GB RAM and four RTX 3090s, v1.1.16 abc09c7, Maya-M IQ2_S, MTP, 32K context and RAM budget 120 GB, archived Phase D CSVs show long-English decode 8.3 tok/s with automatic CPU lane versus 37.4 with MAYA_GLM_CPU_LANE=0. These are one run per configuration, sampled generation with different output lengths (512/510), not a patched-build A/B or a repeatability claim. Raw engine logs show a shared 45-thread pool, startup CPU estimates 0.222–0.352 ms/expert and much slower CPU execution during decode.

Thread contention, synchronization starvation and NUMA effects have not been established as the cause. The report incorrectly calls the host a 48-hardware-thread machine. The independent defect addressed here is the retimer rejecting its own zero plan.

Related: #268 (shared-pool tuning), #56 (Windows placement sensitivity), #235 (multi-GPU scaling), #302 (four 3090s benefiting from CPU execution), and #146 (retiming). These do not justify disabling CPU lanes for all 3+ GPU machines.

Validation

  • New CPU-only regression compiles the actual production planner and retimer with a minimal model/state fixture. Before the fix, sustained slow samples fail f.cpu_plan == 0; after, it passes, including transient slow samples, explicit plans, faster CPU samples and pool preservation.
  • MSVC C++17 regression passes; HIP compatibility check and git diff --check pass.
  • Windows tools suite: 332 tests, 3 failures / 11 errors / 27 skips; untouched main reproduces the same 14 failing cases (331 tests). These are HIP setup/report tests on Windows.
  • Server suite: 215 tests, 4 errors / 5 skips on Windows; errors are subprocess executable-format failures. Untouched main reproduces the same four errors (215 tests).
  • No patched CUDA build or GPU performance/quality A/B yet. This draft changes eventual retiming after sufficient samples, not first-request latency. Once zero is selected there are no automatic CPU samples to detect recovery; explicit tuning or restart can re-enable it.

Base: current main 8d9a9b5.


🔄 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/mw00/project-maya/pull/305 **Author:** [@JumpEggKiller](https://github.com/JumpEggKiller) **Created:** 10/20/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/glm-retime-pcie-only` --- ### 📝 Commits (1) - [`611c113`](https://github.com/mw00/project-maya/commit/611c113b79d0f3ef39ae2d16333dadc23eee1185) Allow CPU lane retiming to select an all-PCIe plan ### 📊 Changes **2 files changed** (+121 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/core/glm_fast_path.cu` (+2 -1) ➕ `tools/test_glm_lane_retime.py` (+119 -0) </details> ### 📄 Description When GLM decode repeatedly measures the CPU lane slower than PCIe, `lane_retime()` can compute an all-PCIe plan but explicitly discards it. The initial CPU allocation then survives even when the existing retimer has enough evidence to stop using it. Allow that zero plan through the existing update. The warmup window, two consecutive measurements, sample/change limits, explicit-plan protection and CPU pool lifetime stay as before. Both the active plan and the default restored after request overrides become zero. Routing work between CPU and GPU can change output rounding and generated tokens. ### Evidence and scope On a local Windows machine with an EPYC 7R13 (48 cores / 96 logical processors), 256 GB RAM and four RTX 3090s, v1.1.16 `abc09c7`, Maya-M IQ2_S, MTP, 32K context and RAM budget 120 GB, archived Phase D CSVs show long-English decode 8.3 tok/s with automatic CPU lane versus 37.4 with `MAYA_GLM_CPU_LANE=0`. These are one run per configuration, sampled generation with different output lengths (512/510), not a patched-build A/B or a repeatability claim. Raw engine logs show a shared 45-thread pool, startup CPU estimates 0.222–0.352 ms/expert and much slower CPU execution during decode. Thread contention, synchronization starvation and NUMA effects have not been established as the cause. The report incorrectly calls the host a 48-hardware-thread machine. The independent defect addressed here is the retimer rejecting its own zero plan. Related: #268 (shared-pool tuning), #56 (Windows placement sensitivity), #235 (multi-GPU scaling), #302 (four 3090s benefiting from CPU execution), and #146 (retiming). These do not justify disabling CPU lanes for all 3+ GPU machines. ### Validation - New CPU-only regression compiles the actual production planner and retimer with a minimal model/state fixture. Before the fix, sustained slow samples fail `f.cpu_plan == 0`; after, it passes, including transient slow samples, explicit plans, faster CPU samples and pool preservation. - MSVC C++17 regression passes; HIP compatibility check and `git diff --check` pass. - Windows tools suite: 332 tests, 3 failures / 11 errors / 27 skips; untouched main reproduces the same 14 failing cases (331 tests). These are HIP setup/report tests on Windows. - Server suite: 215 tests, 4 errors / 5 skips on Windows; errors are subprocess executable-format failures. Untouched main reproduces the same four errors (215 tests). - No patched CUDA build or GPU performance/quality A/B yet. This draft changes eventual retiming after sufficient samples, not first-request latency. Once zero is selected there are no automatic CPU samples to detect recovery; explicit tuning or restart can re-enable it. Base: current main `8d9a9b5`. --- <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 labels
pull-request
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
mw00/project-maya#459
No description provided.