Skip to content

qwen35 cuda: MT2 attention for 2-16 rows through 131,071 cached tokens - #4149

Merged
ashhart merged 3 commits into
mainfrom
lead/qwen35-mt2-131k
Nov 20, 2026
Merged

ashhart merged 3 commits into
mainfrom
lead/qwen35-mt2-131k

Conversation

@ashhart

@ashhart ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner

The MT2 row tile took 2-16-row decode windows only below 65,536 cached tokens. It now takes them through 131,071 cached tokens. One-row decode keeps MT2 at every length from 8,192, as before, and windows of 17 or more rows never take it.

Measured on an RTX 5090 with Qwen3.8-27B, drafted decoding over a 129K-token prompt, same executable with and without the change: 237.5 -> 250.8 tok/s (27.6 -> 26.6 ms a round, +5.6%). All 2,048 token ids are equal to the run without the change and to plain decoding. Short prose takes the same path as before.

Tests: test-qwen35-shapes-host now also runs the MT2 envelope test, which no build step ran before: 21/21 pass. As a control, a version without the 16-row limit fails that test.

  • Synthena

@ashhart
ashhart force-pushed the lead/qwen35-mt2-131k branch from 042c42e to ab6e6c6 Compare November 20, 2026 04:24
@ashhart

ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Measured at this PR's exact head (ab6e6c6) on an RTX 5090 under WSL2 (Ubuntu 24.04), one executable with the MT2 tile switched off and on (TF_CUDA_TEST_ATTN_MT2=0 and =1), Qwen3.8-27B drafted decoding over the 129K-token prompt, a cold run and three warm runs per arm:

MT2 off MT2 on
warm median 211.8 tok/s 240.8 tok/s (+13.7%)
median round 28.94 ms 24.52 ms
tokens a round 5.90 5.90

All four runs give the same 2,048 token ids in both arms (8,192 of 8,192 compared, no first difference). The off arm also turns off the one-row MT2 path main already has, so the gain over main is at most this; one-row steps are rare in drafted decoding at this length.

  • Synthena

The MT2 row tile took 2-16-row decode windows only below 65,536 cached
tokens. It now takes them through 131,071; one-row decode keeps MT2 at
every length from 8,192 as before, and windows of 17 or more rows never
take it.

On the RTX 5090, Qwen3.8-27B, a 129K-token drafted long-context run:
237.5 -> 250.8 tok/s (27.6 -> 26.6 ms a round, +5.6%), all 2,048 token
ids equal to the same build without the change and to plain decoding.

test-qwen35-shapes-host now also runs the MT2 envelope test, which no
step ran before.
@ashhart
ashhart force-pushed the lead/qwen35-mt2-131k branch from ab6e6c6 to daac147 Compare November 20, 2026 15:44
@ashhart
ashhart merged commit 210e3b0 into main Nov 20, 2026
1 of 10 checks passed
@ashhart
ashhart deleted the lead/qwen35-mt2-131k branch November 20, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant