[PR #461] [CLOSED] EXL3 decode on V100 / T4 / RTX 20: the trellis windows cut eight at a time - bit-exact, decode +11-17% on a V100 #538

Closed
opened 2026-10-29 21:26:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/461
Author: @merbanan
Created: 10/24/2026
Status: ❌ Closed

Base: main ← Head: pr/exl3-legacy-windows


📝 Commits (1)

  • 7ebcf80 EXL3 decode on Volta / Turing (exl3_legacy.cu): a lane's 8 trellis windows cut together with funnel shifts, as exl3.cu's frag8 - the same values, the expert kernels ~25 % faster on a V100

📊 Changes

1 file changed (+79 additions, -17 deletions)

View changed files

📝 src/kernels/cuda/exl3_legacy.cu (+79 -17)

📄 Description

What

NVIDIA GPUs before sm_80 decode EXL3 with v1.1.8's kernels (exl3_legacy.cu). Its decode8 cut every trellis step's 16-bit window on its own: two shared-memory words, a modulo index and a 64-bit shift per step. That was most of the ~10 instructions per weight; only one of them is the multiply-add.

A lane's 8 consecutive steps lie within one or two words. This PR cuts them together with funnel shifts, exactly as exl3.cu's frag8 already does on the newer kernels (exllamav3's grouping per K, exl3_dq.cuh), and covers both integer and half-integer K.

  • The states are the same, so the decoded values, the sums and the output are the same bit for bit.
  • Only decode8 changes. The kernels around it, the reduction order and every other path are untouched.
  • One file: src/kernels/cuda/exl3_legacy.cu. HIP doesn't build that file (tools/check_hip_compat.py passes).

Exactness

Deterministic runs (CPU lane off, MAYA_GLM_RAM_GB=50) with turboderp's EXL3 2.05bpw quant: 2K and 8K fresh prompts, 256 greedy tokens. The tokens were identical to v1.1.26's at both lengths. The as-served runs with the CPU lane on also produced the same text at 8K and 27K.

Speed

Measured on a Tesla V100-PCIE-32GB at 250 W with a Ryzen 9 7950X, EXL3 2.05bpw, against v1.1.26.

Expert and dense kernels during decode (nvprof, 2K prompt + 256 tokens):

kernel v1.1.26 this PR
moe_gate_up_kernel<4, 2> 238 µs 179 µs
moe_down_kernel<4, 2> 85 µs 68 µs
mv_kernel<8, 2> (the dense matrices) 54 µs 41 µs

Decode as served (the default CPU lane, 3 alternating rounds, fresh prompts + 256 greedy tokens, tok/s):

prompt v1.1.26 this PR
2K 22.4 (22.3–22.6) 25.0 (23.8–25.9) +11 %
8K 23.6 (23.2–23.8) 27.6 (27.6–27.6) +17 %
27K 23.6 (23.5–23.7) 27.3 (26.7–27.6) +16 %

Every round with the change was faster than every round without it. Prompt speed is unchanged, since the prompt path uses exl3.cu's kernels.

Only the 2-bit quant (K2 = 4, codebook mul1) was run here. The other K take frag8's existing code for their K, unchanged. Not run on a T4 or an RTX 20 card, which take the same path.


🔄 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/461 **Author:** [@merbanan](https://github.com/merbanan) **Created:** 10/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/exl3-legacy-windows` --- ### 📝 Commits (1) - [`7ebcf80`](https://github.com/mw00/project-maya/commit/7ebcf80e4e08c50eaab1c65b022539f9755fb51d) EXL3 decode on Volta / Turing (exl3_legacy.cu): a lane's 8 trellis windows cut together with funnel shifts, as exl3.cu's frag8 - the same values, the expert kernels ~25 % faster on a V100 ### 📊 Changes **1 file changed** (+79 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cuda/exl3_legacy.cu` (+79 -17) </details> ### 📄 Description ## What NVIDIA GPUs before sm_80 decode EXL3 with v1.1.8's kernels (`exl3_legacy.cu`). Its `decode8` cut every trellis step's 16-bit window on its own: two shared-memory words, a modulo index and a 64-bit shift per step. That was most of the ~10 instructions per weight; only one of them is the multiply-add. A lane's 8 consecutive steps lie within one or two words. This PR cuts them together with funnel shifts, exactly as `exl3.cu`'s `frag8` already does on the newer kernels (exllamav3's grouping per K, `exl3_dq.cuh`), and covers both integer and half-integer K. - The states are the same, so the decoded values, the sums and the output are **the same bit for bit**. - Only `decode8` changes. The kernels around it, the reduction order and every other path are untouched. - One file: `src/kernels/cuda/exl3_legacy.cu`. HIP doesn't build that file (`tools/check_hip_compat.py` passes). ## Exactness Deterministic runs (CPU lane off, `MAYA_GLM_RAM_GB=50`) with turboderp's EXL3 2.05bpw quant: 2K and 8K fresh prompts, 256 greedy tokens. The tokens were identical to v1.1.26's at both lengths. The as-served runs with the CPU lane on also produced the same text at 8K and 27K. ## Speed Measured on a Tesla V100-PCIE-32GB at 250 W with a Ryzen 9 7950X, EXL3 2.05bpw, against v1.1.26. **Expert and dense kernels during decode** (nvprof, 2K prompt + 256 tokens): | kernel | v1.1.26 | this PR | |---|---:|---:| | `moe_gate_up_kernel<4, 2>` | 238 µs | 179 µs | | `moe_down_kernel<4, 2>` | 85 µs | 68 µs | | `mv_kernel<8, 2>` (the dense matrices) | 54 µs | 41 µs | **Decode as served** (the default CPU lane, 3 alternating rounds, fresh prompts + 256 greedy tokens, tok/s): | prompt | v1.1.26 | this PR | | |---|---:|---:|---:| | 2K | 22.4 (22.3–22.6) | 25.0 (23.8–25.9) | +11 % | | 8K | 23.6 (23.2–23.8) | 27.6 (27.6–27.6) | +17 % | | 27K | 23.6 (23.5–23.7) | 27.3 (26.7–27.6) | +16 % | Every round with the change was faster than every round without it. Prompt speed is unchanged, since the prompt path uses `exl3.cu`'s kernels. Only the 2-bit quant (K2 = 4, codebook mul1) was run here. The other K take `frag8`'s existing code for their K, unchanged. Not run on a T4 or an RTX 20 card, which take the same path. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:26:35 +07:00
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#538
No description provided.