Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c972a9b
Recover archived EXL3 first-slice source candidate
BlivionIaG Nov 10, 2026
053b0a5
Keep the final complete cache-grid boundary in the regression
BlivionIaG Nov 10, 2026
ff44d92
Read the EXL3 chain's settings through the platform environment table
BlivionIaG Nov 10, 2026
fdc67f4
cuda: keep qualification dispatch lean and preserve test environment
BlivionIaG Nov 10, 2026
04dd909
test: preserve EXL3 profile environment with current allocator API
BlivionIaG Nov 10, 2026
3cddc10
docs: trim EXL3 recipe history and wrap loader comments
BlivionIaG Nov 10, 2026
6a81d08
test: cover every registered environment setting
BlivionIaG Nov 10, 2026
d132b2b
cuda: add EXL3 expert-parallel TP and MTP drafts
BlivionIaG Nov 4, 2026
8ae9b05
cuda: migrate EXL3 TP diagnostics to explicit head geometry
BlivionIaG Nov 5, 2026
50844d2
cuda: retain prepared prompt snapshots in TP lane state
BlivionIaG Nov 10, 2026
97de683
Drop the obsolete pre-MTP scratch omission test and document head cap…
BlivionIaG Nov 10, 2026
d09f7cc
cuda: register EXL3 head and MTP residency settings
BlivionIaG Nov 10, 2026
2dda698
test(exl3): propagate TP memory configuration refusals
BlivionIaG Nov 10, 2026
0b95fb5
test: cover tensor-parallel environment acceptance
BlivionIaG Nov 10, 2026
9f8ad41
cuda: add decode-exact EXL3 deep prefill
BlivionIaG Nov 4, 2026
a86b201
cuda: dispatch TP prefill directly to its leaf runner
BlivionIaG Nov 5, 2026
e1d826c
exl3 prefill: read deep-prefill settings through platform/environment
BlivionIaG Nov 10, 2026
91b3a28
cuda: register prefill controls and refuse malformed profiling
BlivionIaG Nov 10, 2026
910a32f
test(exl3): restore scratch omissions and make prefill controls expli…
BlivionIaG Nov 10, 2026
3f86ded
test: cover EXL3 prefill environment acceptance
BlivionIaG Nov 10, 2026
9b3be4d
tests: attach expert pools in EXL3 real-weight layer checks
BlivionIaG Nov 11, 2026
38bb604
tests: pass no draft layer to the TP pool attachment hook
BlivionIaG Nov 11, 2026
af87bd3
Remove EXL3 snapshot grid after 45-state off-grid restore proof
BlivionIaG Nov 11, 2026
cd40f3b
EXL3 prefill: TP partials in f64, typed f64 all-gather, one rounding …
BlivionIaG Nov 12, 2026
0d85188
Run the FP64 canonical root directly at TP1 without an extra partial …
BlivionIaG Nov 12, 2026
625187d
Gather EXL3 canonical tensor-parallel partials as FP64
BlivionIaG Nov 12, 2026
a945795
Keep FP64 collective qualification on real rank execution, not a mock…
BlivionIaG Nov 12, 2026
f0c4889
EXL3: canonical expert reduction in f64, one rounding to f32 at the root
BlivionIaG Nov 12, 2026
f280dab
Require strict canonical error checks and record measured FP64 launch…
BlivionIaG Nov 12, 2026
389681b
Document the canonical FP64 reduction in the EXL3 recipe
BlivionIaG Nov 12, 2026
6ed4a56
Complete F64 contract accumulators across backends and satisfy lean c…
BlivionIaG Nov 12, 2026
ac86ce1
Keep canonical exchange invariants concise and contribution-compliant
BlivionIaG Nov 12, 2026
542a57c
Complete narrowed-partial fault handling in rotate contract descriptors
BlivionIaG Nov 12, 2026
811691c
fix(flashnext): reject host-planned whole-pass captures
BlivionIaG Nov 12, 2026
409b471
tests: re-pin gradient serving identities for #1441
BlivionIaG Nov 12, 2026
d2c8459
fix(exl3): inspect the canonical branch in layer diagnostics
BlivionIaG Nov 12, 2026
ea623d6
docs(exl3): describe the canonical layer diagnostic branch
BlivionIaG Nov 12, 2026
a98938f
Restore Main video-budget diagnostic coverage
BlivionIaG Nov 12, 2026
6e589b0
Keep main's head_local rows for the classic Flash Next scratch
BlivionIaG Nov 13, 2026
8aa1ae2
Pin the serving identity of cuda_prompt.zig at this head
BlivionIaG Nov 13, 2026
1cac5ca
flashnext batch moe: shorten one comment to the lean rule's width
BlivionIaG Nov 13, 2026
2c5e5d4
native cuda snaps: the ladder test calls passRules with this branch's…
BlivionIaG Nov 13, 2026
bc57ccf
native cuda snaps: the ladder test calls passRules without a loaded g…
BlivionIaG Nov 13, 2026
fdd1277
Keep EXL3 merge resolutions and current main integration
ashhart Nov 19, 2026
c428f4c
Adapt Flash Next EXL3 to main's CUDA paths and checks
ashhart Nov 22, 2026
591f202
flashnext exl3: the pool's round stamp and number wrap instead of tra…
BlivionIaG Dec 5, 2026
88fffba
flashnext: a state resumed from disk is placed where TF_FLASHNEXT_SNA…
BlivionIaG Dec 5, 2026
a80c6b1
flashnext exl3: admission counts the MTP head's resident trellis the …
BlivionIaG Dec 5, 2026
aac93d3
flashnext exl3: an MTP residency change keeps the decoder's placement…
BlivionIaG Dec 5, 2026
d0d0c6f
tools: EXL3 gates exit nonzero when a required check fails
BlivionIaG Dec 5, 2026
a82efee
flashnext: host tests follow main's environment table and the moved g…
BlivionIaG Dec 5, 2026
e03138c
flashnext exl3: the TP2-vs-TP1 deep prefill gate compares bytes, not …
BlivionIaG Dec 5, 2026
7233cd5
cuda contract: release the Flash Next EXL3 set when a later set fails…
BlivionIaG Dec 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion docs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ Diagnostics quote and escape the supplied text so it cannot create another termi
| `TENSORFOLD_HIP_MEMORY_LIMIT_GB` | A positive finite GiB amount whose byte count fits a 64-bit size |
| `TF_DSPINE_WINDOW` | Qwen3.8-27B on CUDA with a DSpine `--drafter`: whole row count 16 through 8192 that narrows the drafter's sliding window; it must be at least the block (16) and at most the checkpoint's own `sliding_window`, else the drafter is refused when it opens; unset or blank keeps the checkpoint's (8192 for tencent/Qwen3.8-27B-DSpine-b16) |
| `TF_DRAFT_NODES` | Whole native-size nonnegative count, capped by the drafter's window; zero disables trees |
| `TF_FLASHNEXT_EXL3_PREFILL`, `TF_FLASHNEXT_EXL3_PREFILL_RING`, `TF_FLASHNEXT_EXL3_PREFILL_OVERLAP` | Exactly `0` or `1`; default on |
| `TF_FLASHNEXT_EXL3_PREFILL_REDUCED_BRANCH`, `TF_FLASHNEXT_EXL3_PREFILL_TWO_CHUNK` | Exactly `0` or `1`; default off |
| `TF_FLASHNEXT_EXL3_PREFILL_ROWS` | Whole nonnegative rows; unset uses 8192 general / 4096 server; an explicit count sets both |
| `TF_FLASHNEXT_EXL3_PREFILL_RING_AHEAD` | Whole nonnegative lookahead count; default 1 |
| `TF_FLASHNEXT_PROFILE` | Exactly `0` or `1`; default off |
| `TF_QMMF_HALF_BELOW` | Whole native-size nonnegative block count; zero disables half tiles; default 96 |
| `TF_HY4_MEM_FLOOR_GIB` | Whole GiB of MemAvailable below which `tf-hy4-cuda-generate`'s loader stops; default 10 |
| `TENSORFOLD_PROMPT_CACHE_KEEP_OTHERS` | Exactly `0` or `1`, checked when the CUDA backend starts; default off ([profiles](profiles.md)) |
Expand All @@ -52,6 +57,19 @@ Diagnostics quote and escape the supplied text so it cannot create another termi
| `TF_HEAD_GEOMETRY` | Whole native-size nonnegative geometry count in the head benchmark |
| `TF_ROCE_GID_INDEX` | Whole index 0 through 2147483647; unset searches for a RoCE v2 IPv4 GID |
| `TF_QWEN35_CHUNK_SOLO` | Qwen 3.5/3.6/3.8 on CUDA: 4096 or 8192 rows a foreground prompt pass while no other stream decodes (a background warm pass keeps 4096); unset, empty or 4096 is off, with main's scratch. Checked when the model loads, with the family's own message |
| `TF_FLASHNEXT_CHUNK` | Whole prompt rows from 1 through 16384 per pass; default 1536 |
| `TF_FLASHNEXT_CHUNK_SOLO` | Whole rows from the busy chunk through 16384; unset keeps the family's default; EXL3 packs refuse an override |
| `TF_FLASHNEXT_CACHE_TELEMETRY`, `TF_FLASHNEXT_EXL3_LAYER_TELEMETRY`, `TF_FLASHNEXT_EXL3_PROFILE_SIZING` | Exactly `0` or `1`; default off |
| `TF_FLASHNEXT_SNAP_HOST` | Exactly `0` or `1`; default on for EXL3 above 32768 context tokens, otherwise off |
| `TF_FLASHNEXT_EXL3_ARCH` | Exactly `unqualified`; unset requires the qualified architecture |
| `TENSORFOLD_MEMORY_RESERVE_GIB` | Finite nonnegative GiB; memory admission separately enforces its 0.5 GiB floor (2 on unified memory) and total memory size |
| `TF_FLASHNEXT_EXL3_LINE_DELTAS` | `POOL:+N,POOL:-N` without control characters; pool validation requires balanced line transfers |
| `TF_FLASHNEXT_EXL3_STREAMS` | Positive whole stream count; default 1; `--parallel` wins |
| `TF_FLASHNEXT_EXPERT_LINES` | Whole expert-line count per layer; pool construction requires at least 10; unset derives the count from memory |
| `TF_FLASHNEXT_EXPERT_RESERVE_MB` | Whole MiB from 0 through 17592186044415; unset uses the server reserve |
| `TF_FLASHNEXT_PLE_READ` | Exactly `map` or `pread`; default `map` |
| `TF_FLASHNEXT_EXL3_PROFILE_DIR` | Directory path without control characters; unset disables persisted expert-use profiles |
| `TF_FLASHNEXT_EXL3_ROUTED` | Exactly `host` or `device`; default `host` |
| `TF_GEMMA4_CHUNK_SOLO` | Gemma 4 on CUDA: a multiple of 512 from 512 through 4096; unset, empty or 512 is off. Checked when the model loads, with the family's own message |
| `TF_DRAMA_PREFILL_ROWS` | Drama 3 on CUDA: whole prompt rows a chunk, 1 through 1024; default 1. Checked when the checkpoint opens, with its own message |
| `TF_DRAMA_REFERENCE_CACHE` | Drama 3 on CUDA: kept reference states, 0 (off) through 16; default 0. Checked when the checkpoint opens, with its own message |
Expand Down Expand Up @@ -165,7 +183,8 @@ stops the start with the variable, the supplied text and the accepted forms.
| `TF_FLASHNEXT_KEEP_LATE` | Exactly `0` or `1`; unset or blank leaves the choice to the loader |
| `TF_FLASHNEXT_DECODE_GRAPH` | Exactly `0` or `1`; default off |
| `TF_FLASHNEXT_SPLIT_DENSE` | Exactly `0` or `1`; default on: two ranks split the BF16 dense projections |
| `TF_FLASHNEXT_SHARD_HEAD` | Exactly `0` or `1`; default off: each rank keeps its half of the output head |
| `TF_FLASHNEXT_SHARD_HEAD` | Exactly `0` or `1`; default off: each rank keeps its half of the output head. EXL3 defaults on at TP=2 and stays whole at TP=1 |
| `TF_FLASHNEXT_EXL3_MTP_RESIDENT` | Exactly `0` or `1`; default off; on keeps the EXL3 MTP experts on the device |
| `TF_FLASHNEXT_FUSED_SPLIT` | Exactly `0` or `1`; default off. `1` runs CUDA split-K lane calls of 2,048 columns or more on the fused form, with the same bits; Metal and HIP refuse `1` |
| `TF_FLASHNEXT_ATTN_LANES` | Exactly `0` or `1`; default off |
| `TF_FLASHNEXT_WARM_AHEAD` | Exactly `0` or `1`; default off |
Expand Down
59 changes: 59 additions & 0 deletions docs/flashnext-exl3-kernel-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Flash Next EXL3 kernel contract

Flash Next EXL3's canonical expert reduction starts in the one-rank slice: `fn_exl3_leaf_tree`,
`fn_exl3_leaf_partial` and `fn_exl3_leaf_finish` register in `contract_flashnext_exl3_canon.zig`. Leaves,
tree additions and transported partials are float64; only the root converts once to float32, round-to-nearest-even.
Outputs match the host tree bit for bit (NaN payloads aside), including float64's exceptional classes.
Controls flatten the tree, drop NaNs, write an input, use bf16 adds or narrow partials to float32; each must fail
its intended gate. Independent integer-product references check error and TP independence without a sampled-error
tolerance. Checkpoint BF16 state boundaries are unchanged.

The three Liquid-family planted faults live in `contract_liquid_controls.cuh`, included by `contract_controls.cu`;
the NVCC depfile tracks that header. Their entry points, launches and fault arithmetic are unchanged.
The row-major prompt control supplies the production caller's `P256=false`, `IDS=false`, `PN=0` policy to the shared
row body; its neighbouring-dimension fault is unchanged.

CUDA also checks Flash Next EXL3's canonical expert reduction (`flashnext_batch.cu`): the float32 root,
float64 `fn_exl3_leaf_partial` over leaves 0-31, 32-63, all 64 and an interior subtree, and
`fn_exl3_leaf_finish` over the pieces of 2, 3, 5 and 8 ranks (rows 1, 2, 5 and 16 at width 2560).
Each output is byte-equal to `exl3_canon.zig` (NaN payloads aside), has float64's exceptional class and
satisfies its numerical bound. Eight controls flatten a tree, drop NaNs, write an input, use bf16 adds,
or round a partial through float32.
Leaves and fixed-tree merges stay float64, including across the typed NCCL all-gather; the root alone
rounds to float32. Every TP degree 1 to 8 gives the same bits. Exact integer-product host references
bound root error by `2^-24 |sum| + 18 * 2^-53 sum(|y w|) + 2^-150` and require every sampled row to lose
no accuracy to the slot chain or rank-split sums, without an error-comparison tolerance.

CUDA also checks Flash Next's EXL3 deep prefill: its rotate and gate-up pass (`tf_exl3pf_rotate`, `tf_exl3pf_gu`) and
its down pass (`tf_exl3pf_down`), on rows of ten routed picks and the shared expert at 1 to 1,408 rows, each bit-equal
to the grouped decode form of `exl3_experts` it replaces (the planted control runs the gate-up pass against a decode
form with the other SwiGLU roundings); gate 4 runs zero trellis words, whose one dyadic weight makes every dot an exact
FP32 integer. Its dense prompt tile (`exl3_candidate.cu`'s `tf_exl3_promptd_0`, `_1` and `_2`, one a codebook) is
bit-equal to `linear_body` at 1 to 2,048 rows (the 64-row block's and the 256-row chunk's edges included) at every
width of 1 to 8 bits, on each form `plan()` gives (a K split or none, 4 or 8 warps) and on a family's fixed plans (one
split of 4 warps, two of 8); gate 4 runs all-ones states, one weight at every width, where an fp16 sum overflows. Four
controls: the tile at another K split, one a codebook, and one that zeroes x's NaN and infinities (red at gate 1).

CUDA also checks the deep prefill's rotate and expert-parallel reduction (`flashnext_exl3_prefill.cu`,
`tf-cuda-test exl3-tppf-contract`): `tf_exl3pf_rotate` against a host fp32 Hadamard, bit for bit;
`tf_exl3pf_tp_combine` over degrees 1 to 8 into eight-byte float64 partials; `tf_exl3pf_tp_finish`
over degrees 2, 3, 5 and 8 with float64 merges and one float32 rounding; and `tf_exl3pf_tp_place`
writing only slot zero and its unit weight. Probes retain sub-blocks, table boundaries, masked and
foreign picks, exceptional classes and the canonical numerical bound, through 4,096 rows.
Gate 4 stresses rotate's cancelling transform and finish's shuffled integer pairs; combine's explicit
float64 check makes gate 4 inapplicable, and place has no sums. Sixteen controls plant rotate's NaN,
input, table-sign and bf16 faults; combine's flat order, dropped NaN, input write, bf16 adds and
float32 partials; finish's flat order, bf16 merges, input write and float32 partials; and place's
NaN, input and weight faults. `test-flashnext-tppf-contract-host` uses the same oracles and checks
cross-degree equality, including cancellation whose exact sum is 2.

Flash Next's 13 EXL3 launches (`flashnext_exl3_pending.zig`) carry only an nvcc 13.4 receipt: they stay pending under
13.0 to 13.3 and take their 13.4 usage from `cuda_134`, which `pending_132.lookup` serves for that release.
The first, `fn_exl3_split_f16`, also runs gates 1 to 4 on the CUDA runner (`contract_flashnext_exl3.zig`): an fp16
row splits into bf16 hi = bf16(x) and lo = bf16(x - hi), every output's bits must equal float64's (NaN stays NaN; an
infinity gives hi = Inf and lo = NaN), and the device's hi + lo must equal x for every finite pattern. Its shapes
hold all 65,536 fp16 patterns and partial last blocks (n = 1,000 and 65,537). Three controls go red: one flushing NaN
and Inf to zero (gate 1), one launching whole blocks only (gate 3, at every tail) and one writing hi over its input
(gate 2). Gate 4 is N/A: it has no sums.
The other 12 launches of the set also run gates 1 to 4 on the CUDA runner (see the coverage above): the canonical tree
and finish, the pick mask, the prefill's rotate, gate-up, down, combine, finish and place, and the prompt tiles.
3 changes: 3 additions & 0 deletions docs/multi-rank-receipts.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Each path places its ranks its own way:
| Path | Places ranks by | Documented by |
| --- | --- | --- |
| Flash Next on two Macs | `--speed-up FILE`, one file per rank | [Speed-up mode](speed-up-mode.md) |
| Flash Next EXL3 on CUDA | `--tp 2 --rank N --master HOST` | [Its CUDA recipe](recipes/flash-next-cuda.md) places the pack across two GPUs |
| Native GLM-5.3-Flash on CUDA | `TF_GLM_RANK` of `TF_GLM_WORLD`, with `NCCL_COMM_ID` on rank 0's address | [Its recipe](recipes/glm-5.3-flash-cuda.md) starts two; [native placement and limits](../zig/src/families/glm/cuda_native.zig): the engine refuses a world past 16 |
| Nemotron 3.5 Super on CUDA | `TF_NEMOTRON_RANK` of `TF_NEMOTRON_WORLD`, with `NCCL_COMM_ID` | [Its recipe](recipes/nemotron-3.5-super-vl.md) starts two; a world must divide the expert shares |
| Legacy Python 0.6.6 engine | `--tp`, `--rank`, `--master` | [The Python GLM recipe](recipes/glm-5.3-flash.md) |
Expand All @@ -19,6 +20,8 @@ Placement is family-specific; use the selected family's current native recipe. `

New community-v2 receipts carry an optional `group` object with 1-8 loaded ranks, per-node hardware and a `single-node` or `multi-node` category. The server gathers it at startup and HTTP reads its frozen snapshot. `settings.rank_count` must agree. [Loaded group receipts](loaded-group-receipts.md) defines the fields, validation and receiver partitions. Ranks sharing a node are not multiple nodes; identical hardware names on two nodes do not merge them.

Flash Next registers engine cleanup before constructing its loaded-rank inventory, so a failed startup inventory releases the loaded engine.

V1 remains byte-for-byte unchanged, accepting 1, 2 or null as before. Legacy v2 receipts without `group` keep that bound. Missing, unsupported or inconsistent inventories remain unranked. No client or environment rank hint can fill them. ROCm distributed inventory remains unavailable. Community-v2 publication stays disabled until the receiver accepts and separates its new fields.

## The settings the ranks agreed on
Expand Down
15 changes: 12 additions & 3 deletions docs/recipes/exl3.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,25 @@ GLM-5.3-Flash.

- The native engine has the format and a reference decoder in core (`zig/src/core/exl3_format.zig`, @akol1, #496),
and Metal has a standalone EXL3 projection (`zig/src/core/exl3_projection.zig`, @akol1, #681). On CUDA, `qwen3_5`
serves EXL3 packs of the Qwen3.5 models and of the dense Qwen3.8-27B ([using it](#using-it)).
serves EXL3 packs of the Qwen3.5 models and of the dense Qwen3.8-27B ([using it](#using-it)). Flash Next serves EXL3 checkpoints on one and two CUDA
ranks; see [its recipe](flash-next-cuda.md#exl3-checkpoints) for qualification scope.
- CUDA's EXL3 operators, projections and grouped routed experts landed in 1.1.0 (#740, #741, #806, #837). On CUDA,
GLM-5.3-Flash runs its routed experts through them and `qwen3_5` serves dense EXL3 packs. Another family needs a
loader for its EXL3 tensors before it can serve a checkpoint.
- The Python engine served EXL3 on CUDA from 0.3.6 to 0.6.6 through the module @vcruz305 wrote (#42): every codebook,
widths 1 to 8 mixed per tensor, a row-invariant linear for 1 to 128 rows, and grouped routed experts, for the 27B,
Flash Next and mixed-width packs. It is at the
[`v0.6.6` tag](https://github.com/ashhart/TensorFold/tree/v0.6.6/src/tensorfold/cuda/exl3).
- This page's format description and arithmetic came with that module. The native decoder and the CUDA operators in
review follow them.
- This page's format description and arithmetic came with that module. The native decoder and the CUDA operators
follow them.

The first native CUDA Flash Next slice uses 64 leaves of 8 expert IDs, the shared expert in leaf 63,
an FMA chain in pick order inside each leaf, and a fixed balanced tree above them. Leaf sums and tree
additions stay in float64; only the root rounds once to float32, round-to-nearest-even.
This differs from the unreleased 11-slot-chain prototype. The later TP slice partitions the same tree and
transports float64 partials without narrowing. Other Flash Next formats retain their existing reduction.
Empty siblings contribute their actual `+0` additions before the root's conversion, preserving the same
zero sign at every partition.

## Engine versions

Expand Down
Loading