Skip to content

Commit b6eaf06

Browse files
marcinbrzezanskirkinas
authored andcommitted
perf(gdn): fast mode by default for Qwen3.5 on SM120 GPUs
A Qwen3.5 model without --mode ran fast only on sm90 (Hopper) with fla; on sm120 (RTX 50 series, RTX PRO 6000 Blackwell) it ran eager. sm120 with importable fla now gets fast too; it was checked on an RTX 5060 Ti under native Windows (420 readouts against eager in fp32: 99.52% top-1 agreement, both disagreements near ties; 2.46x-8.64x the throughput of eager). Other capabilities, sm121 (GB10) among them, stay eager. INSTALL.md gives the Windows kernel packages it was checked with.
1 parent 793f9b4 commit b6eaf06

6 files changed

Lines changed: 51 additions & 10 deletions

File tree

‎basal/gdn_graph.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# the decoders this forward implements: Qwen3.5 text models (dense MLP) of these layer kinds
5252
GDN_MODEL_TYPES = ("qwen3_5_text", "qwen3_5")
5353
GDN_LAYERS = {"linear_attention", "full_attention"}
54-
54+
ACCELERATED_ARCHITECTURES = {(9, 0), (12, 0)}
5555

5656
def _decoder_config(model_dir, strict=False):
5757
"""config.json of a model directory, the decoder part (text_config of a multimodal wrapper); None if unreadable
@@ -105,9 +105,9 @@ def refused(quant=None, state_cache_gb=0, prefix=False, batches="default", lean=
105105

106106

107107
def default_fast():
108-
"""Whether a Qwen3.5 model gets --mode fast without --mode: on the GPU class its gate passed (Hopper, H100, 23 Oct)
109-
with fla installed; eager elsewhere until another GPU class passes it."""
110-
return (torch.cuda.is_available() and torch.cuda.get_device_capability()[0] == 9 and fla_rule() is not None)
108+
"""Whether Qwen3.5 defaults to fast on an allowlisted CUDA capability with importable fla.
109+
Checked on H100 (sm90) and RTX 5060 Ti (sm120); other capabilities default to eager."""
110+
return (torch.cuda.is_available() and torch.cuda.get_device_capability() in ACCELERATED_ARCHITECTURES and fla_rule() is not None)
111111

112112

113113
def _rms(x, w, eps):

‎basal/server.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def default_mode(model=None, revision=None):
134134
workstation GPUs), eager on other GPUs until they pass theirs (2.2.0 had no working default for it there: fast
135135
stopped at "'Gemma4Model' object has no attribute 'layers'"). A model with recurrent-state layers gets eager on CUDA
136136
and Apple Silicon (mps refuses it; mlx serves Qwen3.5 only when asked, --mode mlx), except a Qwen3.5 model (Gated
137-
DeltaNet), which gets fast on the GPU class where the graph engine's port passed its gate (gdn_graph.default_fast:
138-
Hopper with fla)."""
137+
DeltaNet), which gets fast on the capabilities allowed by gdn_graph.default_fast with importable fla:
138+
sm90 (checked on H100) and sm120 (checked on RTX 5060 Ti)."""
139139
if torch.cuda.is_available():
140140
if model is not None and _recurrent(model, revision):
141141
return "fast" if _gdn(model, revision) and gdn_default_fast() else "eager"

‎docs/HARDWARE.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,37 @@ clients (decisions/s; questions/s with five per request). fla 0.5.2 for the Gate
206206
(GEMMs ~3 ms, fla's Gated DeltaNet and convolution kernels ~2.3 ms); a five-question request about 27 ms, of which
207207
8.5 ms is the tokenizer (with `TOKENIZERS_PARALLELISM=false`, as in these runs).
208208

209+
## basal-omni-pico on RTX 5060 Ti (SM120, native Windows)
210+
211+
Measured 2026-11-05 on one RTX 5060 Ti 16 GB, driver 621.01, Windows, Python 3.12.11,
212+
PyTorch 2.11.0+cu128, Transformers 5.17.0, triton-windows 3.6.0.post26 and FLA 0.5.2; no causal-conv1d.
213+
Model `Remek/basal-omni-pico`; engine 2.5.3.
214+
215+
Local HTTP, concurrency 4, seed 0, three runs per mode/workload: 10 warm-up, 20 sequential and 80 concurrent
216+
requests each. Short/multi use about 512 synthetic tokens; long uses 1,500 (different from the H100 table).
217+
Fast used FA2 and `--batches default`. Each mode received a control request first; each run waited for
218+
GPU temperature <=45 C and utilization <=5% for three samples five seconds apart. Windows desktop apps remained.
219+
Throughput is median [min, max]; p50/p95 are medians of per-run sequential percentiles. All runs had zero errors.
220+
221+
| Mode | Workload | Throughput median [min, max] | p50 / p95 (ms) | Throughput / Eager |
222+
|---|---|---|---|---|
223+
| `eager` | short, 1 q | 17.77 [17.52, 18.70] req/s | 70.57 / 119.77 | 1.00x |
224+
| `fast-nocompile` | short, 1 q | 37.11 [37.09, 37.93] req/s | 29.79 / 33.36 | 2.09x |
225+
| `fast` | short, 1 q | 43.77 [43.76, 43.78] req/s | 25.44 / 28.93 | 2.46x |
226+
| `eager` | short, 5 q | 22.17 [22.06, 22.19] q/s | 187.04 / 233.23 | 1.00x |
227+
| `fast-nocompile` | short, 5 q | 120.55 [118.72, 120.62] q/s | 49.35 / 53.46 | 5.44x |
228+
| `fast` | short, 5 q | 140.12 [140.07, 140.21] q/s | 43.26 / 46.77 | 6.32x |
229+
| `eager` | long, 5 q | 8.01 [7.97, 8.11] q/s | 607.19 / 976.15 | 1.00x |
230+
| `fast-nocompile` | long, 5 q | 57.34 [57.06, 57.57] q/s | 87.22 / 124.06 | 7.16x |
231+
| `fast` | long, 5 q | 69.15 [69.12, 69.18] q/s | 76.28 / 105.81 | 8.64x |
232+
233+
Startup to healthy HTTP (one start per mode): Eager 15.56 s, Fast without compile 122.59 s, Fast 95.46 s.
234+
Model/Triton/Inductor caches were retained; startup is separate from request latency, not a cold-cache measurement.
235+
236+
The synthetic agreement check against `eager-fp32` passed: 420 readouts, 99.52% top-1 agreement (both disagreements
237+
were near ties), 98% decision agreement, 99.5% independence. The gate allows near ties; this is not held-out accuracy.
238+
The saved report omits seed, per-call and engine commit. Only this RTX 5060 Ti was measured, not other SM120 cards.
239+
209240
## Concurrent clients over 3k-token states (basal-omni)
210241

211242
How far one server scales with concurrent clients when every request has the same shape: one choice question over a

‎docs/INSTALL.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ basal-serve --model Remek/basal-2.0-4.5B --mode fast --template-prefix off --por
9494
- From a clone instead: `git clone https://github.com/rkinas/basal && cd basal && uv pip install -e ".[fp8]"`
9595
(after the torch line above).
9696

97+
On native Windows, Qwen3.5 on SM120 was checked with PyTorch 2.11.0+cu128 and these kernel packages
98+
(install after PyTorch and basal above):
99+
100+
```powershell
101+
python -m pip install triton-windows==3.6.0.post26 flash-linear-attention==0.5.2
102+
```
103+
104+
See the [RTX 5060 Ti environment and measurements](HARDWARE.md#basal-omni-pico-on-rtx-5060-ti-sm120-native-windows).
105+
97106
Ask questions with curl. Several questions about one state go into one request and share the state:
98107

99108
```bash

‎docs/SERVING.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ benchmarking a GPU.
3232
- **Qwen3.5 models (Gated DeltaNet layers)**, such as basal-omni-pico: `fast` and `fast-nocompile` serve them since 2.4
3333
(2.3.2 refused them): the graph engine keeps each request state's recurrent state beside its keys and values and
3434
continues every question from it (one row per question and option order in the branch pass), with fla
35-
(flash-linear-attention) for the Gated DeltaNet layers. Without `--mode` they run `fast` on Hopper (H100, the GPU
36-
class the port was gated on) when fla is installed, `eager` elsewhere. fla picks each kernel's launch config by
35+
(flash-linear-attention) for the Gated DeltaNet layers. Without `--mode` they run `fast` on sm90 and sm120 when
36+
fla is importable, `eager` elsewhere (checked on H100 and
37+
[RTX 5060 Ti](HARDWARE.md#basal-omni-pico-on-rtx-5060-ti-sm120-native-windows)). fla picks each kernel's launch config by
3738
timing, and a different pick rounds differently: on the H100 80 GB and the RTX PRO 6000 Blackwell `fast` and
3839
`eager` take configs recorded on that GPU instead (the ready line says `fla configs pinned`), so every start gives
3940
the same answers. On another GPU the first start times them (`fla configs timed`) and keeps its picks in

‎tests/test_recurrent.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ def resolve(name, revision=None, metadata_only=False):
188188

189189

190190
@pytest.mark.parametrize("cc, fla, mode", [((9, 0), True, "fast"), ((9, 0), False, "eager"), ((8, 0), True, "eager"),
191-
((12, 0), True, "eager")])
191+
((12, 0), True, "fast"), ((12, 0), False, "eager")])
192192
def test_default_mode_of_qwen35_on_cuda(monkeypatch, qwen35, cc, fla, mode):
193-
"""Without --mode: fast where the port passed its gate (Hopper, with fla), eager on other GPU classes."""
193+
"""Without --mode: choose fast only for an allowed CUDA capability with importable fla."""
194194
monkeypatch.setattr(server_module, "resolve", lambda name, revision=None, metadata_only=False: name)
195195
monkeypatch.setattr(gdn_module.torch.cuda, "is_available", lambda: True)
196196
monkeypatch.setattr(gdn_module.torch.cuda, "get_device_capability", lambda *a: cc)

0 commit comments

Comments
 (0)