mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #75] [MERGED] EXL3 quants (exllamav3) for GLM-5.3-Flash: packer, device and CPU kernels, prompts, MTP #320
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#320
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/75
Author: @needmorevram
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @mw00
Base:
main← Head:exl3📝 Commits (2)
25cbbf3EXL3 quants (exllamav3) for GLM-5.3-Flash: packer, device and CPU kernels, prompts, MTP182c49fSetup: turboderp's EXL3 3.05bpw quant as a download (experimental, NVIDIA only)📊 Changes
21 files changed (+4251 additions, -51 deletions)
View changed files
📝
CMakeLists.txt(+8 -1)📝
README.md(+5 -0)📝
docs/SETTINGS.md(+1 -0)📝
include/strata/core/glm_model.hpp(+18 -0)➕
include/strata/kernels/cpu/exl3_cpu.hpp(+35 -0)➕
include/strata/kernels/cpu/exl3_ref.hpp(+20 -0)➕
include/strata/kernels/exl3.hpp(+120 -0)📝
maya.py(+164 -17)📝
src/core/glm_fast_path.cu(+291 -12)📝
src/core/glm_fast_state.hpp(+17 -3)📝
src/core/glm_model.cu(+359 -4)📝
src/core/glm_prefill.cu(+128 -9)➕
src/kernels/cpu/exl3_cpu.cpp(+270 -0)➕
src/kernels/cpu/exl3_ref.cpp(+79 -0)📝
src/kernels/cpu/native_expert.cpp(+4 -0)➕
src/kernels/cuda/exl3.cu(+1053 -0)📝
src/kernels/cuda/glm_fast.cu(+21 -1)➕
tests/exl3_test.cu(+550 -0)➕
tools/exl3_pack.py(+743 -0)➕
tools/glm_chat_template.jinja(+257 -0)...and 1 more files
📄 Description
Runs EXL3 (exllamav3) quants of GLM-5.3-Flash on Maya's engine. The engine reads the trellis-coded weights in place from the model's safetensors, so nothing is converted or copied. It was tested with turboderp/GLM-5.3-Flash-exl3 at 3.05 bpw (125 GB). The open items are at the end.
or by hand:
Summary
tools/exl3_pack.pybuilds a pack beside the model and copies no weights. It writes four things:maya-exl3.gguf, holding llama.cpp's glm5-next metadata, the tokenizer, and every unquantized tensor under llama.cpp's name and layout (kv_bsplit intoattn_k_b/attn_v_b,A_log->ssm_a, the fused q|k|v conv split in three);index.txt/dense.bin, where EXL3 matrices are rows of a new kindx;exl3.txt, with each EXL3 matrix's trellis / suh / svh offsets and each routed expert's nine pieces (one model groups its tensors by type, so an expert's parts are not contiguous);tools/glm_chat_template.jinja, the same template Maya's GGUFs carry), or the model's own with--model-template.The NextN (MTP) block is packed too.
--check <gguf>compares the result with a GGUF of the same model: against Maya-L, cosine is 0.999 at 5-6 bits and 0.98-0.99 at 3 bits.Device kernels (
src/kernels/cuda/exl3.cu).CPU lane (
src/kernels/cpu/exl3_cpu.cpp). RAM-tier EXL3 experts are computed on the CPU, with AVX-512F/BW and a scalar fallback. The mul1 codebook is affine in a byte sum, so the kernel adds the bytes withvpmaddubsw/vpmaddwdand keeps F32 activations. It uses the device's exact affine constants.Engine.
mv(), the MoE step, the CPU lane, the prompt path,load_mtp, and the 2-4 GPU split search's costs.Prompts take each EXL3 expert by its row count. An expert routed to at most 64 of a chunk's tokens goes through the tensor-core kernels; a busier one is reconstructed to FP16 once and multiplied by cuBLAS. Dense weights always use reconstruct + cuBLAS. New setting
STRATA_GLM_EXL3_MMA_ROWS(default 64,0= cuBLAS for every expert), with a row indocs/SETTINGS.md.Fix for main: a race in
glmfast::Workers::run(the shared CPU pool). A straggler from the previous batch could claim an index under the next batch's larger job count. It then ran the new job, andrun()could return while that job was still running. This shows when consecutive batches differ in size; here it was an intermittent segfault at start (kernel logsegfault at 0x2000000010in afast_cpu_expertslambda).run()now closes the ticket before it publishes the new job. A standalone stress test hits the race on the old pool and is clean on the new one.native_fmtrefuses types outside ggml's table. EXL3's type id is 200, which indexed past the table.The setup offers the EXL3 model as a download (
EXL3-3.05bpw). It is marked experimental, is never the default, and is not offered with--backend hip.332ab45, each with its size and sha256 (125.3 GB,mtp.safetensorsincluded).config.json(glm5_next, exl3) instead of a GGUF header.tools/exl3_pack.py.Tests
Rebased on v1.0.34 (
bdd4167). The rebase resolved conflicts inglm_fast.cu(the EXL3 jobs are taken before the HIPmv_rdnabatch, which takes only BF16 and Q6_K jobs), the README (the setting row moved todocs/SETTINGS.md),maya.pyand its tests (Maya-M-Derisked and the ZFS tests kept). On the rebased branch:strataandexl3_testbuild for sm_86 and sm_120;tools/check_hip_compat.pypasses;exl3_testpasses on all nine GPUs, the RTX 3090 and the eight RTX 5060 Ti (0 failures, 0 launch errors);Read for main's parallel split load (#80): each part loads its own EXL3 tables and shards in
load_pack, the kernels' shared GPU scratch is created under a mutex, and the EXL3 CPU lane is set up in the deferredfast_setup_finish.On the v1.0.30 build:
exl3_test(new ctest). The device kernels against the scalar reference (src/kernels/cpu/exl3_ref.cpp):gemm_rows;It passes on an RTX 3090 (
exl3_test: ok (0 failures, 0 launch errors)), built for sm_86 and sm_120.The model.
--check, cosines above).tools/check_hip_compat.pypasses. The tensor-core kernels are CUDA-only (mma_supported()is false on HIP), but the HIP build was not compiled here.Unit tests: 7 new tests for the EXL3 download in
tools/test_maya_models.py.The setup with
--model EXL3-3.05bpwwas tested by hand on this machine and works: it writes the config (maya-exl3-3.05bpw.json, the model in<models-dir>/EXL3-3.05bpw), and Maya starts with the EXL3 model on all nine GPUs.Benchmarks
Setup.
tools/exl3_pack.py.--max-context 16384 --greedy,STRATA_GLM_TIMING=1.Each setup is one engine start that answers three requests in order:
One RTX 3090 (24 GB)
1,848 of the 12,096 experts are in VRAM; the rest are in a 99 GB pinned RAM tier. The CPU lane has 40 threads.
9 GPUs (8 × RTX 5060 Ti 16 GB + the RTX 3090)
The split is the engine's own: layers [0,7) [7,12) [12,16) [16,23) on the 3090, then [23,27) [27,32) [32,36) [36,41) [41,45). Its 12,384 VRAM slots hold every expert at start, and one 40-thread CPU pool is shared by all nine GPUs.
With MTP (the default with two GPUs or more):
Without speculation (
STRATA_GLM_NO_SPEC=1):Rebased on v1.0.34, MTP on, the same three prompts (token for token):
Decode and prompt speeds are within about 2% of the v1.0.30 build. The decode after the 12K prompt is lower because fewer of its drafts were accepted (82% against 94%): speculation is not exact (see Output), so the answer, and with it the acceptance, varies between runs. The first request's prompt took 7.8 s, against 2.4 s on v1.0.30. That is a one-time cost before decoding starts; its cause was not looked into.
The first long prompt after start seems to carry a one-time cost on 9 GPUs. In every run the 12,140-token prompt took less time than the 6,389-token one, and its second 6K-token chunk finished 2.2-2.3 s after the first. During that first long prompt, each card lends about 2 GB of its expert pool to the prompt's buffers, and 1,443 experts move to the RAM tier. Whether that movement is what costs the time has not been checked yet.
Output
GGUF packs take the same code paths as before. The only shared changes are the
Workers::runfix and thenative_fmtrange check. Maya-L ran on this branch before the rebase onto v1.0.30 (for the speculation check below), but not on the rebased build.Speculation is not exact, on main as well. With speculation off, two EXL3 runs give the same 80 greedy tokens. With it on, the EXL3 output diverges from speculation-off at token 36, and Maya-L's GGUF diverges at token 8. The pipelined speculative decode is therefore not bit-exact for either format. This is not specific to EXL3.
Open items
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.