Skip to content

train 1119192157: #2044 #2340 (CI only) - #4049

Closed
ashhart wants to merge 25 commits into
mainfrom
lead/train-1119192157
Closed

ashhart wants to merge 25 commits into
mainfrom
lead/train-1119192157

Conversation

@ashhart

@ashhart ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #2044 #2340 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.

BadAd84 and others added 25 commits November 19, 2026 19:22
A decode window's routed experts run on the same item plan the prompt path and
the NVFP4/FP8 MoE path already use, instead of tf_exl3_group plus the maxu x
member-tile grid: the 9-slot picks are grouped by the Router into items of at
most 16 pairs and the grouped GEMVs launch in standard mode on grids
maxItems x (n/128) x (mats*sk), so at 64 rows ~325 blocks do work instead of
~55k and the one-block O(experts x pairs) group scan becomes the ranked plan.
No 9->8 compaction and no copy back: the down epilogue writes ey's routed slot
rows in place through tf_exl3_down_combine.

The grouped kernel and tf_exl3_down_combine already take item triples in
standard mode and a caller-chosen slot-row base, so no kernel change is needed:
the plan reaches the decode as the same Items the prompt path takes, with the
family's Router and the plan buffer the block already holds.

Bit-exact: the glm-exl3-items GPU check compares the item plan's ey against the
plain grouped decode byte for byte over distinct and lockstep (16/32/48/64-row)
windows, and calls the plain launch shape directly so both paths stay covered.
A wrong plan (a members offset off by one, a bad item first/count, the shared
item not skipped) routes a slot to the wrong expert, so ey's bytes differ.

A plan is refused (error.TileNotBuilt) for a non-mcg codebook, a non-zero wts
or out, a zero ey, or a null plan array: the item kernels read one codebook a
launch and write the caller's slot rows.

Files:
- zig/src/cuda/exl3_experts.zig: Items, runWith on the plan (standard mode), and
  fusedBytes/fusedScratch for the 9-slot layout without y.
- zig/src/families/glm/cuda_exl3.zig: the decode branch on decodeItems, and
  scratchBytes sizing a decode arena with decodeBytes, the larger of the plain
  8-slot layout and the 9-slot one, so no pool changes at GLM's shapes.
- zig/tests/cuda/glm_exl3_items_tests.zig: the items decode against the plain
  launch, case by case.
Dims 512 alone only asked the item plan about small matrices. The check now also runs
dims 4096 at the two widths a rank meets, 768 and 1024, one distinct window and one
lockstep window each, with dims threaded through the weights, layer and pack helpers.

Each shape carries an explicit case list, so 17 rows stays distinct: it is the only
distinct window that spans two 16-pair items. The RESULT line counts the NaN tallies
beside the byte comparisons, so this set prints 66 checks: 18 base cases and 4 served
cases at three checks each.
# Conflicts:
#	CHANGELOG.md
main.zig is at its 600-line limit, so a second command can only ride on the
lines glm-exl3 already has. Its dispatch now names both commands once and
calls glm_exl3_tests.runCmd, which picks the expert check or the item-plan
check by name, and the usage block names both commands on one line. The file
contributes no new lines to a merge, and each command runs the check it did.
…kes; CHANGELOG credit (#2044)

main's glm.experts.Kernels.load now takes ?cuda.experts32.Values as its last argument; null is the
no-block-32 choice the old false made, as glm_exl3_tests.zig passes. The CHANGELOG bullet credits
@BadAd84 and says the TP=3 decode numbers are the author's own run against main 673a34b.
…nks, the native 262,144 window)

inclusionAI's Ling-3.1-flash (bailing_moe_v3: 63 KDA and 9 MLA layers, 512 routed experts with
group-limited sigmoid routing) on the native CUDA server, built on #874's TP=1 port and #1541's host
package (config, names, route, oracle, synth, fixtures). #850 step 5, on the shared pieces:

- KDA layers on the shared CUDA KDA (#2142's cuda.kda: chain, saved-row replay through replayLayers);
  config.fixed is held to kda.geometry in a test.
- Routing on moe_glue's group-limited score form (tf_moe_topk_sigmoid_score_groups).
- MLA on the shared mla image (cuda.mla: 576-wide chunk tiles, 128-wide absorb and expand, the plain
  rope, the head-wise output gate), merged by GLM's latent merge; prompt rows in the expanded form on
  the family's tf_ling_pattn.
- EXL3 packs through main's shared EXL3 operators (cuda.exl3 Dense and tiles, exl3_experts with
  tf_exl3_plan_finish_after for Ling's clamp order, exl3_grouped). bf16 checkpoints load for the
  synthetic checks; FP8 and NVFP4 checkpoints are refused by name (LingFormat).
- The dense shared expert's SwiGLU in Ling's clamp order: ling_act.cu instantiates glm_swiglu.cuh's
  rows with the clamp on silu's output.
- TP=2 over hosts (TF_LING_RANK, TF_LING_WORLD): heads, expert widths and the head's vocabulary cut on
  EXL3's 128-wide blocks; rank 1 follows rank 0's steps; RoCE gathers up to GLM's cap.
- Lanes: shared windows across streams, copy drafts, CUDA graphs for one sequence's verify windows,
  prompt states kept in memory for the prompt cache.
- Admission: --context up to the native 262,144 positions (LingContext past it); config rope_scaling is
  refused as main's config does; the MTP layer is not loaded (drafts come from the prompt's text).
- Checks in tf-cuda-test (ling-route, ling-mla, ling-clamp, ling-synth, ling-weights,
  ling-forward-synth, ling-lanes, ling-init-faults, ling-exl3-layers, ling-exl3-clamp, ling-tp,
  ling-ckpt-check, ling-slots), test-ling on the host, docs/recipes/ling-3.1-flash-cuda.md.

Wiring: the ling_glue and ling_act images, the engine in cuda_engines.zig, the native registry entry,
test-ling and the runner's ling_cuda import. GLM: glm/cuda_latent.merge is public (Ling's chunks merge
through tf_glm_merge). The family's fake driver reports a discrete device, so downloads in its host
tests copy directly instead of through main's per-thread pinned bounce.

Co-authored-by: Jürgen Schmied <600316+jschmied@users.noreply.github.com>
tf-cuda-test ling-contract runs the family's own launches through gates 1-4: ling_glue's add, combine
(by slot and by expert), copy_rows and pattn; ling_act's SwiGLU in Ling's order at both blocks with
its 64-sums. The shared kernels the family calls (the mla image, the EXL3 finish-after, the
group-limited top-k) are registered with their own images. The set is in the full runner's family sets.
Gate-5 records for every launch (ling_cuda_records.zig: nvcc 13.0; 13.3 in pending_133; 13.2
pending), and the contract's image map names ling_glue and ling_act.
…s; ling-init-faults: the fake driver's sweep forgets leaked handles, a probe that reads a failure as no (exl3 dependentLaunches) is reported, not counted
… (download_stage), so every open in ling-init-faults makes the clean open's calls
…F_LING_RANK and TF_LING_WORLD registered, NCCL names literal, RoCE at GLM's default cap
…s main's registry test asks of every family with a host prompt cache
…kBias before it uploads it (a group holding +inf and -inf scores NaN, which the kernel always keeps), refused by name
… the checkpoint opens; config.parse keeps the head counts
…ows has no libc setenv, so test-cuda-host failed to link there)
…ers_ref.py, ling_ref_stream.py, ling_check.py --misses, ling_texts.json) and ling-tp --ids; the orphan ling_weights.py removed
…rary checkpoint, so dropping the call fails it
…rates) and carries the closeness and GSM8K numbers
Main's #2843 (3768bc0) gave Grouped.decode, Grouped.prompt and
exl3_grouped.Grouped.run the real pair count and the caller's tile, and sizes
the EXL3 storage by pairs. Ling's block_ffn passes rows * slots and its own
tile (16 for decode, promptTile for a prompt pass), as every other family
does. The device checks pass the tile their plans were routed at (16, or
ling_clamp's prompt tile); ling_exl3_clamp drops the old ignored bool.
#2340 registers the ling_glue and ling_act images in kernels.zig; no existing
kernel source changed. The serving pins run on every PR since #3011.
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

CI red on this tip (zig-b); the PRs go on as two smaller trains.

@ashhart ashhart closed this Nov 19, 2026
@ashhart
ashhart deleted the lead/train-1119192157 branch November 19, 2026 21:00
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.

3 participants