Repository navigation
qwen3_5 cuda: a rank's EXL3 cut launches the whole weight's plan, shown against one GPU's bytes (first part of step 2 of #3325) - #3602
Conversation
|
Thanks @Nipale-ai, this is a clean first step for TP=2 on dense Qwen3.5. Each weight is cut only along its outputs (n), so a rank never adds another rank's partial sums. Every cut keeps the whole weight's What we checked:
Optional points for the next step:
Device check, done on our side:
|
b42acce to
35c545d
Compare
|
Thank you @Nipale-ai. The pinned-column plan is unchanged from our review, the GB10 cut test passed on both sides, and the head merges cleanly with current main with green CI. Nothing else is needed from you; it goes into the landing queue.
|
35c545d to
37f6df3
Compare
Place qwen35-tp-cut's existing command description in main_usage.zig, where main moved the CUDA runner's help. Preserve every main entry and the incoming command description unchanged.
Weight.pinnedColumns is columns with the parent's (sk, wk) fixed, so each column keeps the bits the whole matrix gives it. columns is unchanged.
Share.hidden is hidden over the world in 128-tiles, refused as NotOnTiles where it would leave them. o, out and the k part of mlp now say they are where a rank's part sits in the gathered input, not cuts of those weights.
…n, host only cuda_shard_plan.zig names, for the 27B's eleven EXL3 weights, which Share span cuts the output axis and the (sk, wk) every launch of the cut keeps: the whole weight's. Host tests pin both at worlds 1, 2 and 4 from exl3.planOf, and show which halves would plan their own.
…s bytes Every EXL3 weight of a pack, both ranks of a world of two, 1 to 1,536 rows, bf16 and fp32 outputs, finite and non-finite rows, and projection groups. The same columns planned on their own are run beside them.
Place qwen35-tp-cut's existing command description in main_usage.zig, where main moved the CUDA runner's help. Preserve every main entry and the incoming command description unchanged.
37f6df3 to
fb390e5
Compare
Place qwen35-tp-cut's existing command description in main_usage.zig, where main moved the CUDA runner's help. Preserve every main entry and the incoming command description unchanged.
|
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. |
What this changes
First part of step 2 of #3325 (TP=2 serving): the host-sized part of the dense Qwen3.5 TP=2 weights. A rank's cut of an EXL3 weight now starts with the plan of the whole weight, and the plan says which weight is cut how. This moves no token:
--tp 1is unchanged,--tp 2stays refused bynative/cuda_refusal.zig(not touched), and nothing outside tests reads the new code yet. There is no exchange between ranks, no session and no NCCL in this pull request.The route is the one Flash Next's
--tp 2took in #1784: each rank computes its own output columns over the full K, and the disjoint outputs are copied, not summed. Here every weight is cut only along its output axis n, in 128-tiles, so a rank adds no partial sum of another. The EXL3 kernel's sum order depends on(sk, wk), the K splits and warps, andplan()takes them from the weight's own (k, n); a half planned alone can launch other splits than the whole weight, so the cut has to carry the whole weight's plan.cuda/exl3.zig:Weight.pinnedColumns(from, n)iscolumnswith the parent's(sk, wk)fixed.columnsis unchanged, socuda_draft_frame.zig:171, its one caller before this pull request outside tests, gets the same bits.qwen3_5/cuda_shard.zig:Share.hidden, the rows ofo_proj,out_projanddown_proj(hidden over the world, in 128-tiles; a split that leaves the tiles isNotOnTiles, never rounded).o,outand the k part ofmlpnow say what they are, where a rank's part sits in the gathered input, not cuts of those weights:o_proj,out_projanddown_projare cut along n here, not along k as those three doc lines described. The declaration test incuda_shard_decl_test.zigfollows.qwen3_5/cuda_shard_plan.zig(new, host only): for the eleven EXL3 weights, whichSharespan cuts n and which(sk, wk)every launch of the cut keeps, taken fromexl3.planOfof the whole weight. Host tests pin both at TP=2 on the 27B's widths, check at TP=1, 2 and 4 that the spans tile each axis in 128s, and show which halves would plan their own (below). In Native CUDA TP=2 support for Qwen3.8-27B EXL3 on heterogeneous consumer GPUs #3325 I asked whether the(sk, wk)each half launches with should be pinned in step 1's host tests or in step 2. These tests pin them here, and the cut keeps the whole weight's plan, as Flash Next TP=2: exact output-column splits, 21% faster plain decode #1784 keeps the whole weight's K slices for Flash Next.tf-cuda-test qwen35-tp-cut PACK [STEP]: on one card, for every EXL3 weight of the 27B's 64 layers and its head (401 weights of a real 27B pack) and both ranks of a world of two, the output of the pinned view equals the same columns of the whole run, byte for byte.qwen3_5/cuda.zigexportsshard,shard_planandexl3_admitfor the runner;zig/tests/cuda/main.ziggets the subcommand's two lines and, to stay at 600 lines, importsexl3_tp2_testsandexl3_candidate_testsat their dispatch lines.What the plan shows on the 27B (whole weight, then the half or quarter planned alone), as
exl3.plangives it. The TP=2 column is also what the device run below reports (for in_proj_qkv the device run prints one span's plan, the other two are the formula's); the host tests pin which weights differ at TP=4, and the TP=4 values are the formula's:atc overlap --base origin/main --json(atc 0.9.6, withATC_READ_ONLY=1), run in this tree on 2026-11-16 at 20:25 CET, base main 077998f, this head d27a711, result as printed:"complete": false, limitationsotherPullRequestsLimit,pullFilesUnavailable,pullRequestsLimit,timeLimit; 8 changed files;myPullRequestsempty; 17 other pull requests share one file each (areas 2 and 7), 10 of them"conflict": "clean"(glm cuda: decode windows' EXL3 experts run on the 16-pair item plan #2044, qwen3_5 cuda: warm turns prefill the next turn's prompt and keep only a 4096-row-multiple end #2824, Qwen 3.5 CUDA: kept prompt states reuse a freed pinned buffer of their size #2841, Ling-3.1-flash on CUDA, on one or two GB10s #2340, dots: the image tower on CUDA, with its GB10 runner checks #2770, dots: serve dots.mocr's images on CUDA with --vision #2771, dots: oracle image references and FP64 projection checks #2772, docs: dots.mocr's images on native CUDA #2773, qwen35 cuda: fuse the dense MLP's NVFP4 prompt gate and up projections into one launch #2410, idol: Idol's denoiser on CUDA (stacked on #1766) #1767) and 7"conflict": "unknown"(glm cuda: TF_GLM_GRAPHS=1 replays verify windows as CUDA graphs (#1490) #2279, CUDA: #1764's BF16 prompt tile for Qwen ModelOpt, Nemotron and Dory, plus two exact Qwen prompt kernels (#1762) #2008, moss image: serve pictures on CUDA (encoder, decoder and host for #1573) #2281, GLM-5.3-Flash CUDA: shared rounds draft MTP for every stream at once #2856, ricursive: speed up Ripple-65B on two GB10s #2523, ricursive: serve Ripple-65B on two GB10s with up to 1M tokens of context #2522, qwen3-asr: host slice, the shared tower and Qwen3 schedules over a backend binding (#2105) #2239); none reports a conflict; no worktree overlap. The scan is incomplete, so it does not show that nothing else touches these files.Checks on this head
python3 tools/zig/lean_check.py, base and head: 221 on the base, 221 on this head, 0 new (6,575 and 6,577 files; all 221 inherited).python3 tools/pr_check.py --base origin/main --pr 3602: 0 errors, 1 warning ("Zig changed: no Unreleased bullet naming this PR"; this change carries no CHANGELOG line, as qwen3_5 cuda: the dense family has a rank plan, host only; it moves no tokens #3383's did not).zig build test-cuda-host --summary all: base 410/410 steps, 6,917 of 6,950 tests passed, 33 skipped; head 410/410 steps, 6,922 of 6,956 passed, 34 skipped. That is six more tests (this pull request adds five test blocks; the per-step totals grow by 4, 1 and 1, so one shard test runs in two steps) and one more skip: it is not one of the new tests but isnemotron ring batchinnemotron/cuda_source_ring_test.zig, which skips itself when its first read finishes before the second is asked (it did so in the head run only, which shared the machine with the host run below; no file of this pull request touches it).zig build -Dfixed-cpu test-host --test-timeout 20m --summary allfrom an empty cache, on this head: 2,108/2,108 steps, 19,968 of 20,099 tests passed, 131 skipped, 0 failed, exit 0.zig fmt --check build.zig zigandgit diff --check origin/main: clean.git range-diffshows all four as=, and their patch ids match). With the new tests copied onto main and no source change,test-cuda-hostended 403/410 steps with 3 failed; the compile errors wereno field or member function named 'pinnedColumns' in 'exl3.Weight'andno field named 'hidden' in struct 'cuda_shard.Share'(inexl3_dense_test.zig,cuda_shard.zig,cuda_shard_plan.zigandcuda_shard_decl_test.zig). Each of the four test files was also shown red with a planted wrong value (a 2 for q_proj's split count, 2561 for a hidden span end, a 3 for a pinned plan, a hidden span 128 too wide in the declaration). The planted values ran together in two runs on the first head (the first run held three of them; the declaration's compile error was fixed and its value planted in the second), and each failed the tests that pin it: one test each inexl3_dense_test.zig,cuda_shard.zigandcuda_shard_plan.zig, and both tests ofcuda_shard_decl_test.zigthat compare the declaration withShare.of.zig build -Dnvcc=<cuda 13.3> -Dsm=120 install, thentf-cuda-test qwen35-tp-cut PACKon one RTX 5090 (sm_120): see Receipt.fmt,zig,zig-b,zig-windows,zig-macos-dev-tools,pytest,release-pathsand bothbenchmark-clientsjobs passed;host-nightly-linuxandhost-nightly-macoswere skipped.zig build test test-goldenanddev-toolson macOS (no Metal file is touched); the kernel contract (no kernel is new or changed); other SMs than 12.0 and other packs than the 4.00 bpw one below; the pack's eight EXL3 weights of the MTP head (mtp.*), which the runner does not read; HIP and Metal; the red-before runs on this exact head (see above); a separate repeat of thenemotron ring batchskip on this head; the TP=4 plan values on a card (formula only).Receipt
n/a for inference: nothing outside tests reads
cuda_shard_plan.zigorpinnedColumns,Share.ofhas no caller outside tests,--tp 1launches what main launches and--tp 2is refused before any device work as in #3383. The device check below is the evidence this step carries.quantization_config.json: exl3 1.4.2, 4-bit tensors, 6-bit head), Hugging Faceturboderp/Qwen3.8-27B-exl3, branch4.00bpw, revision 113cf7ab958054860e43fb7f3063b1af19171095 (from the download metadata, checked against the repository's branch list).tf-cuda-test qwen35-tp-cut PACKover all 64 layers (401 weights): PASS, 63,856 byte comparisons of a rank's pinned columns against the whole run's, exit 0. Both ranks of a world of two, 1, 2, 16, 17, 36, 48, 49, 128, 129 and 1,536 rows (the head to 129 rows), bf16 and fp32 outputs, finite rows and rows with NaN, +inf and -inf in the first row, and 1,536 gate+up projection groups. Every comparison was equal; none differed.Densemakes them): 1, 2 and 16 rows the linear (401 of 401); 17, 48, 49 and 128 rows linear_wc (401 of 401); 36 rows linear_wc 177 and the mid-M kernels 224; 129 rows a linear_wc block of 128 and a linear block of one row (401 of each); 1,536 rows twelve linear_wc blocks (4,800 launches: the 400 layer weights, the head is not run that far). A second sweep with linear_wc off ran the mid-M kernels at 17, 36, 48, 49 and 128 rows (401 of 401 each). The pinned views always take the linear (pickdoes that for a fixed plan). Each was equal to the whole run's bytes.columnsgives them): equal for k_proj, v_proj, o_proj, out_proj, gate_proj, up_proj and lm_head, whose plans agree; different for q_proj, in_proj_qkv, in_proj_z and down_proj, whose plans differ (4,4 / 8,4 / 8,4 / 16,4 against 1,8 / 1,8 / 4,4 / 8,4). In those four the unpinned bytes differed in most runs (q_proj 1,853 of 1,920, in_proj_qkv 16,352 of 17,280, in_proj_z 5,478 of 5,760, down_proj 7,327 of 7,680 comparisons). The runner fails if a weight whose plan differs never shows other bytes, so the pin is shown to matter.Checklist
tf-cuda-testsubcommand, not a test step: without PACK it prints the usage and fails withMissingArgument, and it needs a card.Inference block: n/a, this reaches no inference.