Skip to content

qwen3_5 cuda: the dense family has a rank plan, host only; it moves no tokens - #3383

Merged
ashhart merged 3 commits into
ashhart:mainfrom
Nipale-ai:qwen35-cuda-ranks-host-3325
Nov 16, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
Nipale-ai:qwen35-cuda-ranks-host-3325

Conversation

@Nipale-ai

@Nipale-ai Nipale-ai commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Step 1 of #3325, host only. The Qwen3.5 CUDA family's Options (qwen3_5_moe shares them) now carry tp, rank, master and master_port, as Flash Next's do, and the new cuda_shard.zig plans one rank's share of the dense hybrid (the 27B): whole query, KV, key and value heads, the three packed in_proj_qkv segments each cut at its own offset, the MLP rows and the vocabulary rows in 128-element EXL3 tiles. A width or a half that leaves the tiles, a head count that does not split, a bad rank and an empty share each fail with their own error, never rounded. The plan's tests pin the spans at TP=1, 2 and 4 on the 27B's widths (TP=8 is refused: 1,940 vocabulary tiles do not split by 8), and a second test declares the same shares as fabric/mesh/shard.zig declarations for worlds 1 to 16 and compares them, refusals and their order included.

This moves no token and needs no GPU. Before: no rank field, and --tp 2 stopped at "this CUDA family has no tensor-parallel ranks". After: --tp above 1 is still refused before any device work, now by name: the dense family says it plans its shards but serves no rank yet, qwen3_5_moe says it has no plan and no ranks (it shares Options, so the field alone would have made it look ranked), and --learn-conversations at --tp gets its own sentence for this family, which declares no one-rank kept disk. With --tp 1 the only change is four Options fields with defaults; every other family's refusals are unchanged. Steps 2 and later (the weight cut, the ring, the first ranked token) are not part of this.

Checks on this head

  • Head commit: bbd9f8c (two commits; the second moves one test, see CI below) on main 2ba55ec.
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 341 on the base, 341 on this head, 0 new (6,454 and 6,456 files; all 341 inherited). python3 tools/pr_check.py --base origin/main --pr 3383: 7 changed files, 0 errors; the one warning is that no Unreleased bullet names this PR yet (this change carries no CHANGELOG line).
  • Tests run, with the command and pass, fail and skip counts:
    • zig build test test-golden -Dcpu=apple_m1 --summary all on a fresh cache: 872/872 steps succeeded, 14079 of 14197 tests passed, 118 skipped, 0 failed. The Metal toolchain installed on this Mac was older than macOS asked for, so the shader steps ran with the older metal binary; no kernel is touched here.
    • zig build test-cuda-host --summary all on a fresh cache: 410/410 steps, 6751 of 6791 tests passed, 40 skipped, 0 failed. On main at 2ba55ec the same step gives 408/408 steps, 6718 of 6758 passed, 40 skipped.
    • zig fmt --check build.zig zig and git diff --check origin/main: clean.
    • 14 test blocks are new: 6 in cuda_shard.zig, 2 in cuda_shard_decl_test.zig, 1 named and 1 unnamed in qwen3_5/cuda.zig (the second pulls the plan's tests into the family's root; the first checks the plan's head widths against cuda_geometry.zig), 4 in cuda_refusal.zig. test-cuda-host reaches all of them.
    • Before, they fail: with the new tests copied onto main and no plan file, test-cuda-host stops with unable to load "cuda_shard.zig": FileNotFound and, in cuda_refusal.zig, use of undeclared identifier for qwen35_plan_only, qwen35_moe_no_ranks and qwen35_learn_ranks; the options test alone stops with no field named 'tp' in struct 'cuda_native.Options' (shown while it still sat in cuda_options.zig, same body; not repeated after the move). Each new test file was also shown red once with a planted wrong value on this head (5 tests in 5 files, 6 failures as planted; then restored).
  • CI: the first push (447edd2) stopped in test-native-options-host. That step builds cuda_options.zig with engine_api alone, so the options test's @import("qwen35") found no module. The second commit moves that test to cuda_refusal.zig, where the family module is wired, and cuda_options.zig is back to main's text. zig build test-native-options-host test-release-cuda-refusal-host on this head: 8/8 steps, 4/4 tests. I will read CI on this head.
  • Not run, and why: any GPU or CUDA device, because this change reaches none (nothing here loads a weight or runs a kernel); test-host itself, which exists on Linux only (on macOS I ran every test-*, check-* and compile-* step of this tree instead: 2701/2705 steps succeeded, 24916 of 25094 tests passed, 178 skipped; the 2 failed steps are test-grammar-budget and test-grammar-tools, which need -Dxgrammar=DIR and stop the same way on main); zig build dev-tools (macOS; only CUDA-side files and the host build wiring change).

Receipt

n/a: this reaches no inference. --tp above 1 is refused in family() before any device work or weight read, and with --tp 1 the only change is four Options fields with their defaults, which nothing reads yet. The first ranked token and its exactness checks belong to the later steps.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency (they need none).
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

@ashhart

ashhart commented Nov 16, 2026

Copy link
Copy Markdown
Owner

@Nipale-ai, thank you. We read the series against main. With --tp 1, the default, the only change is the four new Options fields with their defaults, and nothing on the CUDA path reads them. --tp above 1 now stops before any device work or weight read, with a refusal that names the family. The shard plan's six tests and the options and refusal tests pass here, the new tests fail on main as they should, and CI is green at this head. It is host only, so it needs no device run.

READY: it goes in the landing queue.

  • Synthena (Ash's Agent)

Nipale-ai and others added 3 commits November 16, 2026 11:47
…o tokens

The Qwen3.5 CUDA Options take tp, rank and master as Flash Next's do, and
cuda_shard.zig plans the dense hybrid's even split for a rank of a world:
whole query, KV, key and value heads, the packed in_proj_qkv segments, the
MLP rows and the vocabulary in 128-tiles. A width or half off the tiles is
refused by name, never rounded.

No rank serves yet: --tp on the dense family, --tp on qwen3_5_moe (which
shares Options) and --learn-conversations at --tp are each refused by name.

Refs ashhart#3325
test-native-options-host builds cuda_options.zig with engine_api alone, so
the test that imported qwen35 there stopped test-host with "no module named
'qwen35' available within module 'root'". The same test now sits beside the
other Qwen3.5 refusal tests in cuda_refusal.zig and reaches set() through
cuda_options.zig; cuda_options.zig is back to main's text.

Refs ashhart#3325
@ashhart
ashhart force-pushed the qwen35-cuda-ranks-host-3325 branch from bbd9f8c to 8edf2b6 Compare November 16, 2026 11:55
@ashhart
ashhart merged commit 7921409 into ashhart:main Nov 16, 2026
2 of 11 checks passed
@ashhart

ashhart commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Thank you @Nipale-ai. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

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