[PR #642] GLM paged attention and multi-sequence serving with prefix-aware scheduling #645

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

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/642
Author: @ClintMoody
Created: 10/28/2026
Status: 🔄 Open

Base: main ← Head: paged-attn-main


📝 Commits (5)

  • 1672a2a Apply GLM paged-attention contribution onto upstream v1.1.33, rebased onto v1.1.36
  • 7aefb7d Fix two em-dash comment lines in glm_multi.cu
  • df8e5d6 Neutralize an internal decision comment in generate.cpp
  • 9f7e1ea Neutralize internal history and gate references in port comments
  • 6806e0f docs(readme): note the paged-attention fork provenance at the top

📊 Changes

26 files changed (+4298 additions, -109 deletions)

View changed files

📝 CMakeLists.txt (+34 -1)
📝 README.md (+11 -0)
➕ bench/README.md (+47 -0)
📝 include/strata/core/glm_model.hpp (+114 -0)
➕ include/strata/core/glm_pages.hpp (+94 -0)
➕ include/strata/core/glm_prefix.hpp (+82 -0)
📝 include/strata/kernels/glm_batch.hpp (+10 -2)
📝 include/strata/kernels/glm_fast.hpp (+10 -1)
➕ src/core/glm_ablate.cuh (+145 -0)
📝 src/core/glm_fast_path.cu (+22 -1)
📝 src/core/glm_model.cu (+58 -7)
📝 src/core/glm_multi.cu (+2103 -67)
➕ src/core/glm_pages.cu (+323 -0)
📝 src/core/glm_prefill.cu (+43 -1)
➕ src/core/glm_prefix.cu (+206 -0)
📝 src/core/glm_rows.cu (+7 -1)
📝 src/core/glm_rows_state.hpp (+1 -0)
➕ src/core/glm_seq_dynamic_test.cpp (+198 -0)
📝 src/core/glm_window.cu (+5 -1)
📝 src/kernels/cuda/glm_batch.cu (+26 -2)

...and 6 more files

📄 Description

Summary

This contribution adapts GLM-5.3-Flash's latent cache to a page-pool and page-table layout, adds per-sequence state and prefix sharing, and schedules multiple requests with admission and pressure management. It includes CUDA gather routing, tests for page/prefix/latent parity, and a synthetic dynamic-sequence test. The work is based on upstream Project Maya v1.1.33 (88a746c9f94d3c34a9ed31711ecfc64a2f03aa39). It does not port GLM paged attention into DeepSeek's distinct src/ds4/ engine; the feasibility assessment in the private outer project's DS4-PAGED-ATTENTION-NOTE.md says a direct port is inappropriate.

Author credit: Clint Moody contributed the paged-attention, multi-sequence serving, scheduler, and related integration work. Project Maya and Strata retain their existing author credits and copyright notices. The repository's MIT license and all upstream/vendor notices are unchanged. DeepSeek model weights and optional differently licensed drafter weights do not belong in the code PR.

What the branch contains

  • Paged page-pool KV management with admission, pressure and eviction checks (selftests for fill, force-evict, in-use gather bit-exactness and full-pool pressure sweeps).
  • Multi-sequence serving: parked sequence slots allocate their speculative KDA backup alongside the acquired sequence and count it in admission, floor and cap accounting.
  • Prefix-aware scheduling: repeated-prefix requests reuse cached tokens (1,536 of 1,775 prompt tokens reused on the repeated-prefix probe window).
  • Speculative-drafter concurrency path byte-identical to the serial MTP path, +12.5% aggregate throughput vs the incumbent pipelined reference in the same probe window.
  • A fork README note at the top of README.md explaining the provenance; everything upstream below it is untouched.

Test plan (performed evidence)

  • Build gate from clean upstream sources: cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_TESTS=ON -DCMAKE_CUDA_ARCHITECTURES=86 then ninja -j 8 maya strata_core strata_kernels strata_engine strata_prefill strata_spec: EXIT 0, 154 targets, only the pre-existing unused-argmax warning.
  • Parity selftests beside a free-GPU window: glm_prefix_parity and glm_lat_paged_parity PASSED; glm_pages_parity passes beside a free GPU (its beside-production run fails only with the documented init-shrink OOM beside a full GPU, by design).
  • Dynamic-sequence fixture and test pass through the validated pack.
  • Isolated probe windows on the port build: all concurrent probe requests (4- and 8-wide) completed with finish_reason=stop; the repeated-prefix probe reused 1,536 of 1,775 prompt tokens; the speculative path under concurrency stayed byte-identical to the serial MTP path (+12.5% aggregate vs the incumbent pipelined reference in the same window).
  • Disclosed limitation: with paging enabled, one of three temperature-zero canaries diverged in wording from the stock answer; sustained-load, long-context and error-path gates remain open. Do not label the paged path production-ready until those gates run.

Notes for maintainers

  • No tracked binary fixtures were added; the port reuses upstream's existing test fixtures.
  • The PR contains no local absolute paths, hostnames, IPs or private history; the branch starts at upstream v1.1.33 and carries one squashed contribution commit plus comment-scrub commits.
  • DeepSeek's src/ds4/ engine is deliberately untouched; DeepSeek loaded and passed bounded probes on the same PC separately, but its sustained speed, long-context behavior and quality remain unmeasured. No DeepSeek performance claim is made from the GLM port tests.

🔄 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/642 **Author:** [@ClintMoody](https://github.com/ClintMoody) **Created:** 10/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `paged-attn-main` --- ### 📝 Commits (5) - [`1672a2a`](https://github.com/mw00/project-maya/commit/1672a2a467b104c04c8d31533b3577778f20c918) Apply GLM paged-attention contribution onto upstream v1.1.33, rebased onto v1.1.36 - [`7aefb7d`](https://github.com/mw00/project-maya/commit/7aefb7d48bc0012f183f225dac0ed4ea972cf97e) Fix two em-dash comment lines in glm_multi.cu - [`df8e5d6`](https://github.com/mw00/project-maya/commit/df8e5d6b5f78efc539bf45ca2db22051a648c448) Neutralize an internal decision comment in generate.cpp - [`9f7e1ea`](https://github.com/mw00/project-maya/commit/9f7e1ea87dd57ec0129a0800328f6ff48062656b) Neutralize internal history and gate references in port comments - [`6806e0f`](https://github.com/mw00/project-maya/commit/6806e0f0b498e02eefa89948f309eddb55f9ae7a) docs(readme): note the paged-attention fork provenance at the top ### 📊 Changes **26 files changed** (+4298 additions, -109 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+34 -1) 📝 `README.md` (+11 -0) ➕ `bench/README.md` (+47 -0) 📝 `include/strata/core/glm_model.hpp` (+114 -0) ➕ `include/strata/core/glm_pages.hpp` (+94 -0) ➕ `include/strata/core/glm_prefix.hpp` (+82 -0) 📝 `include/strata/kernels/glm_batch.hpp` (+10 -2) 📝 `include/strata/kernels/glm_fast.hpp` (+10 -1) ➕ `src/core/glm_ablate.cuh` (+145 -0) 📝 `src/core/glm_fast_path.cu` (+22 -1) 📝 `src/core/glm_model.cu` (+58 -7) 📝 `src/core/glm_multi.cu` (+2103 -67) ➕ `src/core/glm_pages.cu` (+323 -0) 📝 `src/core/glm_prefill.cu` (+43 -1) ➕ `src/core/glm_prefix.cu` (+206 -0) 📝 `src/core/glm_rows.cu` (+7 -1) 📝 `src/core/glm_rows_state.hpp` (+1 -0) ➕ `src/core/glm_seq_dynamic_test.cpp` (+198 -0) 📝 `src/core/glm_window.cu` (+5 -1) 📝 `src/kernels/cuda/glm_batch.cu` (+26 -2) _...and 6 more files_ </details> ### 📄 Description ## Summary This contribution adapts GLM-5.3-Flash's latent cache to a page-pool and page-table layout, adds per-sequence state and prefix sharing, and schedules multiple requests with admission and pressure management. It includes CUDA gather routing, tests for page/prefix/latent parity, and a synthetic dynamic-sequence test. The work is based on upstream Project Maya v1.1.33 (`88a746c9f94d3c34a9ed31711ecfc64a2f03aa39`). It does not port GLM paged attention into DeepSeek's distinct `src/ds4/` engine; the feasibility assessment in the private outer project's `DS4-PAGED-ATTENTION-NOTE.md` says a direct port is inappropriate. Author credit: Clint Moody contributed the paged-attention, multi-sequence serving, scheduler, and related integration work. Project Maya and Strata retain their existing author credits and copyright notices. The repository's MIT license and all upstream/vendor notices are unchanged. DeepSeek model weights and optional differently licensed drafter weights do not belong in the code PR. ## What the branch contains - Paged page-pool KV management with admission, pressure and eviction checks (selftests for fill, force-evict, in-use gather bit-exactness and full-pool pressure sweeps). - Multi-sequence serving: parked sequence slots allocate their speculative KDA backup alongside the acquired sequence and count it in admission, floor and cap accounting. - Prefix-aware scheduling: repeated-prefix requests reuse cached tokens (1,536 of 1,775 prompt tokens reused on the repeated-prefix probe window). - Speculative-drafter concurrency path byte-identical to the serial MTP path, +12.5% aggregate throughput vs the incumbent pipelined reference in the same probe window. - A fork README note at the top of `README.md` explaining the provenance; everything upstream below it is untouched. ## Test plan (performed evidence) - Build gate from clean upstream sources: `cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_TESTS=ON -DCMAKE_CUDA_ARCHITECTURES=86` then `ninja -j 8 maya strata_core strata_kernels strata_engine strata_prefill strata_spec`: EXIT 0, 154 targets, only the pre-existing unused-argmax warning. - Parity selftests beside a free-GPU window: `glm_prefix_parity` and `glm_lat_paged_parity` PASSED; `glm_pages_parity` passes beside a free GPU (its beside-production run fails only with the documented init-shrink OOM beside a full GPU, by design). - Dynamic-sequence fixture and test pass through the validated pack. - Isolated probe windows on the port build: all concurrent probe requests (4- and 8-wide) completed with `finish_reason=stop`; the repeated-prefix probe reused 1,536 of 1,775 prompt tokens; the speculative path under concurrency stayed byte-identical to the serial MTP path (+12.5% aggregate vs the incumbent pipelined reference in the same window). - **Disclosed limitation:** with paging enabled, one of three temperature-zero canaries diverged in wording from the stock answer; sustained-load, long-context and error-path gates remain open. Do not label the paged path production-ready until those gates run. ## Notes for maintainers - No tracked binary fixtures were added; the port reuses upstream's existing test fixtures. - The PR contains no local absolute paths, hostnames, IPs or private history; the branch starts at upstream `v1.1.33` and carries one squashed contribution commit plus comment-scrub commits. - DeepSeek's `src/ds4/` engine is deliberately untouched; DeepSeek loaded and passed bounded probes on the same PC separately, but its sustained speed, long-context behavior and quality remain unmeasured. No DeepSeek performance claim is made from the GLM port tests. --- <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#645
No description provided.