mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 19:04:50 +07:00
[PR #12] [MERGED] GLM-5.3-Flash: GSQ-RCO 3.5-bit download, up to 16 GPUs, faster decode/prefill on one RTX 3090 #280
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#280
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/mw00/project-maya/pull/12
Author: @needmorevram
Created: 10/8/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @mw00
Base:
main← Head:glm-gsq-rco-3090-speed📝 Commits (1)
abe3b45GLM-5.3-Flash: GSQ-RCO 3.5-bit download, up to 16 GPUs, decode/prompt speed on one GPU📊 Changes
25 files changed (+3263 additions, -392 deletions)
View changed files
📝
CMakeLists.txt(+5 -1)📝
README.md(+73 -18)📝
include/strata/core/glm_model.hpp(+24 -6)📝
include/strata/hip_compat/cuda_runtime.h(+1 -0)➕
include/strata/kernels/cpu/kq_avx512.hpp(+32 -0)📝
include/strata/kernels/glm_batch.hpp(+18 -1)📝
include/strata/kernels/glm_fast.hpp(+2 -0)📝
include/strata/prefill/moe_mmq.hpp(+3 -0)📝
maya.py(+372 -62)📝
serve/server.py(+3 -0)📝
src/core/glm_cpu_bench.cpp(+1 -1)📝
src/core/glm_fast_path.cu(+467 -49)📝
src/core/glm_fast_state.hpp(+28 -8)📝
src/core/glm_model.cu(+150 -41)📝
src/core/glm_prefill.cu(+921 -160)➕
src/kernels/cpu/kq_avx512.cpp(+197 -0)📝
src/kernels/cuda/glm_batch.cu(+515 -28)📝
src/kernels/cuda/glm_fast.cu(+20 -7)📝
src/prefill/moe_mmq.cu(+2 -0)📝
src/program/generate.cpp(+14 -6)...and 5 more files
📄 Description
Summary
--model GSQ-RCO-3.5bit. GGUF files already on the PC still go through--gguf-dir, as on main.attn_kv_a_mqa, no MTP block. This PR adds the engine support it needs.--gpustakes a pair). This branch takes up to 16 (--gpus 0,1,...,kMaxParts = 16) and places the layer boundaries by each GPU's free VRAM../maya.sh --calibrate(tools/calibrate_glm.py) tunes the CPU lane for the PC: the PCIe share and the thread count. CUDA only.Rebased on
main5393fe7(v1.0.11). Main's FP16 latent cache, its attention kernels and the AMD/HIP port are kept; details below.Performance on one RTX 3090
GSQ-RCO 3.5-bit, max context 32,768 tokens. Each request is a fresh conversation: temperature 0, thinking off, 128-token answers.
Two earlier runs of this branch, before the last rebase, agree within 3% on prefill, with decode at 18.6–21.0 tok/s.
Prefill speeds up with length because a prompt streams every expert that isn't in VRAM over PCIe once per chunk. One chunk holds up to 31,040 tokens on a 24 GB card, so the 26.6K prompt takes one pass.
Memory (measured from
/procduring the run above; 1 GiB = 2^30 bytes):The RAM tier takes the free RAM less 6 GiB (
STRATA_GLM_RAM_HEADROOM_GB), up to what the experts need. Here every expert fits in VRAM + RAM (126.8 GiB), so decode doesn't touch the disk (disk 0.00 reads/tok). With less RAM the rest is read from disk and decode is slower.Before → after (same harness and requests). "Before" is this work's starting point: the GGUF support on main
142540b, before main's FP16 cache. Main itself can't run this GGUF, because it has no BF16attn_kv_a_mqapath.* Measured before the rebase. The expert warm-up, most of the start, still takes 238 s.
Test machine: RTX 3090 (sm_86) on PCIe 3.0 x8, 2× Xeon Gold 6152 (88 vCPUs, 2 NUMA nodes), 177 GiB RAM, CUDA 13.0, driver 615.71.
Calibration on the RTX 3090
./maya.sh --calibrateon the same PC (GSQ-RCO 3.5-bit, 32K context) measures decode speed with the RAM-tier experts split between the CPU and the PCIe link, and with fewer CPU threads:Nothing beat the engine's own choice by the 3% the tuning requires, so it kept it: 21.6 tok/s, the median of the interleaved confirmation runs. Saved to
calibration.jsonassettings: {}. On a PCIe 3.0 x8 link beside a many-core CPU, the engine's start-up guess is already right. The README's Tuning section shows the same table.Multi-GPU: up to 16 GPUs
--gpus/"gpu"take up to 16 GPUs (MAX_GPUS,kMaxParts); main takes two."layer_split": "auto").STRATA_GLM_SPLIT=a,b,...or the config's"layer_split"pin the boundaries;STRATA_GLM_DEVSpicks the devices.What changed
Decode (one GPU, experts mostly in RAM)
mbind(MPOL_INTERLEAVE)+cudaHostRegister(cudaHostAllocignores the mempolicy). The model's clean page cache is dropped first: a cached GGUF on one node had left the tier 78% on the other.STRATA_GLM_PROMOTE_FILL, up to 24 a token).Prompts
src/kernels/cpu/kq_avx512.cpp).mla_attn_mma_kernel:mma.syncm16n8k16, 32 heads a block, O in registers, reading main's FP16 latent cache.STRATA_GLM_PREFILL_ATTN_CHECK=1).STRATA_GLM_PREFILL_ATTN=wmma. Turing keeps the register kernel.Setup (
maya.py)--gguf-dir. A later--setupasks the question again instead of reusing the earlier--gguf-dirthe way main does; pass--gguf-diragain to keep those files.hf_url).--data-dirrenamed--models-dir. It is now the folder the downloads go in, each model in a folder named after it:--models-dir ~/modelsputs GSQ-RCO's file in~/models/GSQ-RCO-3.5bit/. The default isMaya-data/modelsnext to the repo, as on main. A model's files already in<DIR>/<quant>/, in<DIR>/glm-5.3-flash-<quant>/(where main downloads them) or directly in<DIR>are used where they are, and nothing is downloaded: the question shows them as "downloaded".--calibrate, and a tuning offer at the end of the setup. On AMD setups it is skipped and never queriesnvidia-smi.python3 maya.py(not on Windows), it re-runs itself throughmaya.shso it uses the private.venv.Every new path has an environment switch back to main's behaviour; they're listed in README → Tuning.
Merge notes
STRATA_GLM_PREFILL_SUBkeeps main's meaning: when set, it fixes every sub-batch, including the shared expert's. AMD setup writes1024and keeps 256 without it. NVIDIA without it sizes the sub-batches as above. Main's v1.0.11 changelog says "NVIDIA keeps 256"; that changes with this PR.mma.synckernel sits inside main's#if !defined(STRATA_USE_HIP)guard.cudaDevAttrCanUseHostPointerForRegisteredMem. It's now mapped tohipDeviceAttributeCanUseHostPointerForRegisteredMem.--setupafter--gguf-dir: main reuses the earlier GGUF folder without asking. This branch asks the model question again, and--gguf-dirkeeps the files.serve/server.pypassescpu_threadswith the otherstrata_tunekeys.Test plan
cteston the RTX 3090, excludingple_parityandglm_model_big: 32/32 pass.serve/,tools/, including main's newtest_maya_hip/test_hip_archs): 148 pass, 3 skipped../maya.sh --calibrateon the RTX 3090: it kept the engine's own settings (table above).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.