Skip to content

perf(gdn): use fast mode by default for Qwen3.5 on SM120 GPUs - #114

Closed
marcinbrzezanski wants to merge 2 commits into
rkinas:mainfrom
marcinbrzezanski:exp/gdn-sm120
Closed

marcinbrzezanski wants to merge 2 commits into
rkinas:mainfrom
marcinbrzezanski:exp/gdn-sm120

Conversation

@marcinbrzezanski

@marcinbrzezanski marcinbrzezanski commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Qwen3.5 models currently default to eager on SM120, despite the working Fast backend. This change enables automatic fast selection when FLA is importable, alongside the existing SM90 support.

Validation on an RTX 5060 Ti 16 GB under native Windows confirmed that Fast starts with compilation enabled, serves requests successfully, passes the synthetic agreement gate, and delivers substantial throughput improvements over Eager.

Performance:

  • Three repetitions of three workloads in each of eager, fast-nocompile, and fast: 27 runs, all with zero request errors.
  • Median Fast throughput was 2.46x Eager for short single-question requests, 6.32x for short five-question requests, and 8.64x for long five-question requests.
  • Fast also outperformed fast-nocompile across all three workloads.
  • Startup was measured separately from request latency. Existing compilation caches were retained; these were not cold-cache startup measurements.

Correctness and integration:

  • Synthetic agreement against eager-fp32: gate passed over 420 readouts, with 99.52% top-1 agreement. Both disagreements were near ties.
  • Full tests/test_recurrent.py: 67 passed, 3 skipped.
  • Pre-commit checks passed.
  • Starting without --mode selected fast; /v1/models confirmed the mode and a control request succeeded.

The change adds SM120 to the CUDA capability allowlist, tests selection with and without FLA, and documents the Windows environment and benchmark results.

Benchmark provenance:

  • Engine: 8e80d3eba0fd0bff8195e39c928ceac9194c8b82 (2.5.3).
  • Model: Remek/basal-omni-pico, revision 923233bee50579e8d1a22419f14b5cacceb6e38e.
  • Server modes: eager, fast-nocompile, fast, with --batches default.
  • Load test: --n-seq 20 --n-conc 80 --concurrency 4 --seed 0.
  • Workloads (--synthetic, --questions-per-request): (512, 1), (512, 5), (1500, 5).
  • A control request preceded each mode's measurements; each run waited for comparable GPU temperature and utilization.

Summary by Sourcery

Enable automatic Fast mode for Qwen3.5 on validated SM90 and SM120 GPUs when FLA is importable.

New Features:

  • Default Qwen3.5 serving to fast on SM120 GPUs when FLA is available, alongside SM90 support.

Enhancements:

  • Allowlist supported CUDA architectures for accelerated Qwen3.5 mode selection and cover the behavior with tests.

Documentation:

  • Document native Windows SM120 installation, serving behavior, benchmark results, and validation outcomes.

Tests:

  • Add coverage for Qwen3.5 mode selection with and without FLA across supported and unsupported CUDA capabilities.

@sourcery-ai

sourcery-ai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR changes Qwen3.5’s implicit mode selection to use the Fast backend on allowlisted SM90 and SM120 GPUs when FLA is importable, adds regression tests for the selection matrix, and documents the native Windows SM120 setup, validation, and performance results.

Sequence diagram for default Qwen3.5 serving mode

sequenceDiagram
    participant User
    participant Server
    participant GDN as gdn_graph
    participant GPU
    participant FLA

    User->>Server: start without --mode
    Server->>GDN: default_fast()
    GDN->>GPU: is_available()
    GPU-->>GDN: SM90 or SM120
    GDN->>FLA: fla_rule()
    FLA-->>GDN: importable
    GDN-->>Server: true
    Server-->>User: select fast
    User->>Server: send Qwen3.5 request
    Server-->>User: successful response
Loading

Flow diagram for automatic Qwen3.5 backend selection

flowchart TD
    A[Qwen3.5 recurrent model] --> B{CUDA available}
    B -->|No| E[eager]
    B -->|Yes| C{SM90 or SM120}
    C -->|No| E
    C -->|Yes| D{FLA importable}
    D -->|No| E
    D -->|Yes| F[fast]
Loading

File-Level Changes

Change Details Files
Expand automatic Qwen3.5 Fast-mode selection to SM120 while retaining the FLA availability gate.
  • Add SM90 and SM120 to the accelerated architecture allowlist.
  • Require CUDA availability, an allowlisted capability, and importable FLA before selecting fast.
  • Update default-mode documentation to describe the supported GPU capabilities.
basal/gdn_graph.py
basal/server.py
Add regression coverage for capability- and FLA-dependent default mode selection.
  • Verify SM120 selects fast when FLA is available.
  • Verify SM120 falls back to eager when FLA is unavailable.
  • Retain coverage for SM90 and unsupported capabilities.
tests/test_recurrent.py
Document native Windows SM120 installation guidance and benchmark evidence for the Fast backend.
  • Add tested PyTorch, Triton-Windows, and FLA package versions.
  • Publish throughput, latency, startup, correctness-gate, and benchmark methodology results.
  • Clarify cache and hardware limitations of the measurements.
docs/INSTALL.md
docs/HARDWARE.md
Update serving documentation to reflect automatic Fast selection on SM90 and SM120.
  • Explain that Qwen3.5 defaults to fast on supported capabilities when FLA is importable.
  • Link the SM120 hardware measurements while preserving eager fallback behavior elsewhere.
docs/SERVING.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="basal/gdn_graph.py" line_range="105" />
<code_context>
-    return (torch.cuda.is_available() and torch.cuda.get_device_capability()[0] == 9 and fla_rule() is not None)
+    """Whether Qwen3.5 defaults to fast on an allowlisted CUDA capability with importable fla.
+    Checked on H100 (sm90) and RTX 5060 Ti (sm120); other capabilities default to eager."""
+    return (torch.cuda.is_available() and torch.cuda.get_device_capability() in ACCELERATED_ARCHITECTURES and fla_rule() is not None)


</code_context>
<issue_to_address>
**Explicit CPU selection is ignored**

When the caller omits `--mode`, selects `--device cpu`, and runs on SM90 or SM120 with FLA importable, `main()` does not pass `a.device` to `default_mode()`, so this returns `fast` on an allowlisted GPU even when the caller selected `--device cpu`. `Server` then constructs the graph backend without that device override, and the model uses CUDA instead of CPU; startup can fail or use a GPU the caller intended to avoid.

Account for an explicit device override when choosing the default mode, or preserve the requested device when selecting the fast backend.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread basal/gdn_graph.py Resolved
@rkinas rkinas mentioned this pull request Nov 7, 2026
@rkinas

rkinas commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Thank you, Marcin! This PR shipped in basal 2.8.0 with your authorship: basal-omni-pico started without --mode on an RTX PRO 6000 Blackwell (SM120) now runs --mode fast. We checked it on an RTX PRO 6000 Blackwell: pico without --mode gives the --mode fast answers byte for byte. Capabilities not validated yet (SM121, SM100) stay in eager.

Your commits, with ours on top (style, GB10 and B200 in the default-mode tests, and a release note that names the answers that move):

Closing as merged into 2.8.0.

@rkinas rkinas closed this Nov 7, 2026
dkoryto pushed a commit to dkoryto/basal that referenced this pull request Nov 8, 2026
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.

2 participants