Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3543834
the shared expert's prefill rides the routed experts' device chain: a…
borisbat Sep 9, 2026
adec214
the whole-token decode span takes the shared expert: a qwen2moe-class…
borisbat Sep 9, 2026
80c5b81
the whole-model resident driver takes a MoE that fits the card: the p…
borisbat Sep 9, 2026
e36e04b
the MoE block's two routing dispatches retimed on the 30B window: the…
borisbat Sep 9, 2026
6f98709
the MoE plan doc: the 30B and twin per-role windows and tokens after …
borisbat Sep 9, 2026
75ecb96
the whole-model resident driver takes a hybrid MoE: a recurrent layer…
borisbat Sep 9, 2026
f717538
the grid formats' cm2 decodes take their bytes out of the 16-bit lane…
borisbat Sep 9, 2026
f8c4a0d
the resident MoE block's expert tiles take a tile ladder over the win…
borisbat Sep 9, 2026
5d12206
one more pass on the resident MoE chain's two parity misses, each rea…
borisbat Sep 9, 2026
99fc167
the MoE block's routed combine rides the residual step that follows i…
borisbat Sep 9, 2026
a029893
the MoE block's remainder, three levers: the router tile stages its r…
borisbat Sep 9, 2026
7232911
the decode GEMV family takes one, two or four output rows per subgrou…
borisbat Sep 9, 2026
ca1704a
the arc's comments harvested into the document system: of the 360 com…
borisbat Sep 9, 2026
17aa390
the Vulkan tier's MoE block gets its own architecture companion: `ARC…
borisbat Sep 9, 2026
0ab7958
the image layout stamp follows IMAGE_VERSION 36: the shared expert's …
borisbat Sep 9, 2026
138c9a3
the review round's batch: the decode GEMV family folds a row's lanes …
borisbat Sep 10, 2026
39e1a99
the image layout stamp in `REVIEW.das` follows the loader's shared-ex…
borisbat Sep 10, 2026
e2238c3
the depth-1 speculative step gains the reject arm's test seam: `set_m…
borisbat Sep 10, 2026
5e68b11
tests/test_parity.das declares the program root's stack budget (`opti…
borisbat Sep 10, 2026
9db51c5
the shared expert's K-quant planes are minted only on a load with a G…
borisbat Sep 10, 2026
a8e220c
the Vulkan companion's opening carries the charter line of each of th…
borisbat Sep 10, 2026
918b958
the review-md discovery test's dasllama fixture carries the surface t…
borisbat Sep 10, 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
15 changes: 9 additions & 6 deletions modules/dasLLAMA/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ re-transcoding `$LCPP/src/unicode-data.cpp`).

## 2. Mechanisms

- `ARCHITECTURE_IMAGE.md` - sec.2.1-2.1m: the prepared-image rail, the baked dev-W f16 plane,
- `ARCHITECTURE_IMAGE.md` - sec.2.1-2.1n: the prepared-image rail, the baked dev-W f16 plane,
the baked tower twin-W plane, the layout stamp `REVIEW.das` keeps over the byte-placing code,
and the meta-field tripwire every struct serializer opens with.
the meta-field tripwire every struct serializer opens with, and the planar-vs-blob flavor rebake.
- `ARCHITECTURE_GPU.md` - sec.2.2b, 2.2w-2.2x: the tensor-GEMM and fused-attention shapes that
measured out, the tower attention routes, and the tower driver's encode chains.
- `ARCHITECTURE_GPU_QUANT_PLANES.md` - sec.2.2y-2.2z: the Metal kq split scale plane, and the
Expand All @@ -53,10 +53,10 @@ re-transcoding `$LCPP/src/unicode-data.cpp`).
driver's prefill chain and byte stores - the prefill window chain, the Q8 requant byte store,
the decode GEMV family's grid codebook buffer, the tile probe's shared descriptor set layout,
and the recurrent block of the prefill window.
- `ARCHITECTURE_GPU_VULKAN_GEMM.md` - sec.2.2k-2.2m, 2.2q, 2.2ae: the cooperative-matrix tiles
the Vulkan tier's GEMMs run on - the cm2 decode lanes, the tile pick and the coopmat mode
ladder, the class-pipeline build seat, the MoE expert chain on those tiles, and the KHR arm's
hand-staged kq tile.
- `ARCHITECTURE_GPU_VULKAN_GEMM.md` - sec.2.2k-2.2m, 2.2q, 2.2ae, 2.2ah: the cooperative-matrix
tiles the Vulkan tier's GEMMs run on - the cm2 decode lanes, the tile pick and the coopmat mode
ladder, the class-pipeline build seat, the MoE expert chain on those tiles, the KHR arm's
hand-staged kq tile - and the decode GEMV family's lane split by row length.
- `ARCHITECTURE_GPU_VULKAN_RESIDENCY.md` - sec.2.2n-2.2o: what a model has to fit on the card
before the driver runs - the residency plan, and the GPU-slot marks swap that lets one slot
serve many models.
Expand All @@ -65,6 +65,9 @@ re-transcoding `$LCPP/src/unicode-data.cpp`).
whole-token decode span, the deltanet decode step's per-session resident state, and the
whole-model driver's hybrid token command and prefill (recurrent layers, gated attention,
partial rotary, the prefill-to-decode state handoff).
- `ARCHITECTURE_GPU_VULKAN_MOE.md` - sec.2.2af, 2.2ag: the resident driver's routed block in its
two eras - the MoE block of the prefill window, and the whole-model driver's MoE token
command.
- `ARCHITECTURE_GPU_MTP.md` - sec.2.28-2.39: the Metal speculative round over the batch driver's
same-slab verify, the box knob that sets the depth a round drafts, and the kernel
argument-alignment contract enforced at every dispatch.
Expand Down
32 changes: 16 additions & 16 deletions modules/dasLLAMA/ARCHITECTURE_GPU.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ that a question answered for one backend has an obvious address in the other. Th
family numbers, so no shared bind path may span the two layouts; and the in-engine moe mul_mm
A/B race harnesses (`dasllama_metal_prefill.das`) encode through `kn_moe_mm_family_tail`
rather than a per-class `enc_*` builder.
- **`dasllama_gpu_tier.das`** - the device-cooperation SPI: hook types, install/unset slots,
route/mark/want/status state, engine-facing forwarders. Vulkan implements it (per-op offload plus
resident plumbing, and the decode-era seats it alone fills: the cm2 expert chain
`set_moe_gpu_ffn_xf_hooks` / `_async_hooks`, the decode attention block
`set_moe_gpu_attn_dec_hooks`, the decode FFN tail `set_moe_gpu_ffn_tail_hooks`, the deltanet
decode step's state seams `set_moe_gpu_dn_state_hooks` (flush, invalidate, release), the
whole-token span `set_moe_gpu_span_dec_hook` - the span rides common's decode override
registry as `vulkan_moe_span`, selected by the MoE placement and declining per token - the
resident driver's q/k/v projection-bias seat `install_moe_gpu_resident_bias`, the OS
video-memory seat `install_moe_gpu_os_memory` the residency plan sizes against, and the
- **`dasllama_gpu_tier.das`** - the device-cooperation SPI: hook types, install/unset slots, route/mark/want/status
state, engine-facing forwarders. Vulkan implements it (per-op offload plus resident plumbing, and the decode-era
seats it alone fills: the cm2 expert chain `set_moe_gpu_ffn_xf_hooks` / `_async_hooks`, the decode attention block
`set_moe_gpu_attn_dec_hooks`, the decode FFN tail `set_moe_gpu_ffn_tail_hooks`, the deltanet decode step's state
seams `set_moe_gpu_dn_state_hooks` (flush, invalidate, release), the whole-token span `set_moe_gpu_span_dec_hook` -
the span rides common's decode override registry as `vulkan_moe_span`, selected by the MoE placement and declining
per token - the resident driver's q/k/v projection-bias seat `install_moe_gpu_resident_bias`, its MoE seats
`install_moe_gpu_resident_moe` (the tile admission per expert triple, the routing geometry with the router plane, an
MoE layer, and the routed block on a layer another seat built) behind the route lever `set_gpu_resident_route` /
`gpu_want_resident`, the OS video-memory seat `install_moe_gpu_os_memory` the residency plan sizes against, and the
weight-bytes seat `install_rdec_note_weight_bytes` the decode warm-up guard reads). The
installs are one-way: a test that arms the tier installs the seats and never restores them,
because no uninstall exists and none is needed - a seat serves whatever model loads next; Metal
Expand Down Expand Up @@ -134,8 +134,8 @@ in prefill) and the tuner calls those public entries.
`MetalPrefillDecline`); decline COUNTING lives in `<gpu>_common` beside `require_or_panic`, for
both paths.

Sections 2.28-2.30, the Metal speculative round and the dispatch alignment contract, are
`ARCHITECTURE_GPU_MTP.md`.
Sections 2.28-2.39 - the Metal speculative round, the depth a round drafts, the kernel argument-alignment
contract, and the verify, drafter and batch-driver mechanics after them - are `ARCHITECTURE_GPU_MTP.md`.

**The allowed asymmetries between the backends - this list is closed; a new one lands with its
entry here:**
Expand Down Expand Up @@ -260,10 +260,10 @@ consecutive staging runs, relaxed_precision always - are `REVIEW_GPU.md` rules a
`modules/dasMetal/REVIEW.das` descriptor gate; this section keeps only the refuted shapes
and why they lose.

Sections 2.2j, 2.2p, 2.2ab, 2.2ac and 2.2ad, the Vulkan resident driver's prefill chain and
byte stores, are `ARCHITECTURE_GPU_VULKAN.md`; its 2.2k-2.2m, 2.2q and 2.2ae - the cooperative-matrix
GEMM tiles - are `ARCHITECTURE_GPU_VULKAN_GEMM.md`; its 2.2n-2.2o - the residency plan and the
marks swap - are `ARCHITECTURE_GPU_VULKAN_RESIDENCY.md`.
The Vulkan resident driver's sections live in its companions, each head saying what it holds: 2.2j,
2.2p, 2.2ab, 2.2ac and 2.2ad in `ARCHITECTURE_GPU_VULKAN.md`; 2.2k-2.2m, 2.2q, 2.2ae and 2.2ah in
`ARCHITECTURE_GPU_VULKAN_GEMM.md`; 2.2n-2.2o in `ARCHITECTURE_GPU_VULKAN_RESIDENCY.md`; 2.2r-2.2v in
`ARCHITECTURE_GPU_VULKAN_DECODE.md`; 2.2af and 2.2ag in `ARCHITECTURE_GPU_VULKAN_MOE.md`.

### 2.2w The tower attention routes {#tower-attn-routes}

Expand Down
8 changes: 7 additions & 1 deletion modules/dasLLAMA/ARCHITECTURE_GPU_MTP.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ round commits rows 0..a: row a's logits become `s.logits` (the token sampled nex
post-final-norm hidden becomes `s.mtp_h` (the next round's carry, and the assistant drafter's h
input), `s.mtp_h_pos1` and the mirror watermark move to `pos + a + 1`, and `n_past` advances by
`a + 1`. The rows above the new watermark are the rejected drafts' - garbage the next round
rewrites - and only the watermark keeps them from being read.
rewrites - and only the watermark keeps them from being read. The CPU depth-1 step
(`mtp_spec_eval`) takes a rejected draft on a model with no recurrent layer without a re-forward:
the verify's row 0 already holds the committed token's logits and post-norm hidden, so they stand
and the draft head is re-seeded from them; a recurrent model restores the pre-verify state and
re-forwards the committed token. `set_mtp_force_reject_every(n)` rejects every n-th draft of that
step's greedy walk whatever the verify said - the seam a test reaches the reject arm through on a
fixture that accepts every draft.

**A sampled stream's walk draws instead of comparing argmaxes, and the same walk serves every
round - the two Metal rounds and the CPU depth-1 step.** The caller points `s.spec_params` at its
Expand Down
26 changes: 22 additions & 4 deletions modules/dasLLAMA/ARCHITECTURE_GPU_VULKAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,34 @@ Companion to `ARCHITECTURE_GPU.md`; section numbers are `ARCHITECTURE.md`'s. Thi
carries sections 2.2j, 2.2p, 2.2ab, 2.2ac and 2.2ad - the Vulkan resident driver's prefill
chain, its byte stores, and the tile probe's set layout: the prefill window chain, the Q8
requant byte store, the decode GEMV family's grid codebook buffer, the tile probe's shared
descriptor set layout, and the recurrent block of the prefill window. The cooperative-matrix
descriptor set layout, and the recurrent block of the prefill window. The MoE block of that
window and the token command's routed twin are `ARCHITECTURE_GPU_VULKAN_MOE.md`'s sections
2.2af and 2.2ag. The cooperative-matrix
tiles the chain's GEMMs run on - the cm2 decode spelling, the tile pick and the coopmat mode
ladder, the class-pipeline build seat, the MoE expert chain on those tiles, and the KHR arm's
hand-staged kq tile - are `ARCHITECTURE_GPU_VULKAN_GEMM.md`'s sections 2.2k-2.2m, 2.2q and
2.2ae. What a model has to fit on
2.2ae, and the decode GEMV family's lane split by row length its section 2.2ah. What a model has to fit on
the card before any of this runs - the residency plan, and the marks swap that lets one GPU
slot serve many models - is `ARCHITECTURE_GPU_VULKAN_RESIDENCY.md`'s sections 2.2n-2.2o. The
decode-era mechanisms of the per-op tier are `ARCHITECTURE_GPU_VULKAN_DECODE.md`'s sections
2.2r-2.2v. The GPU backend role table these sections build on stays in `ARCHITECTURE_GPU.md`
sec.1.5.

The module gate's four Vulkan checks (`REVIEW.das`) read these files. `check_khr_stage16_abstract`
reads `class template KqCm2BatchT` in `dasllama_vulkan_classes.das` and licenses no names: its
`khr_stage16` is declared abstract. `check_ar_max_dim_triple` reads `AR_MAX_DIM` in
`dasllama_vulkan_common.das`, the `row` slab of `ArBase` in `dasllama_vulkan_classes.das` and the
`c.dim` cap of `attn_dec_shape_ok` in `dasllama_blocks.das`, and licenses no names: the three
numbers agree. `check_cm2_khr_set` walks every `class template <Fmt>Cm2T : KqCm2BatchT` in
`dasllama_vulkan_classes.das` and requires `<Fmt>KhrBatch`, its `kq_batch_<fmt>_khr_cls` stamp and
an arm in each of `khr_cls_ensure`, `khr_cls_set` and `khr_cls_enc` in
`dasllama_vulkan_prefill.das`; its licensed set is `Q8Cm2T` alone - q8 is no `kq_sb` format, its
cm2 tiles carry no KHR arm, and the KHR mode serves q8 through its own tile.
`check_no_hand_pipelines` walks `dasllama/`, `harness/` and `tests/` for a
`vkCreateComputePipelines(` call and licenses no names inside them; the two llama.cpp shader ports
under `performance/` (`coopmat_mulmm_reference.das`, `coopmat_mulmm_port.das`) sit outside the
walk as reference measurements of another engine's kernels.

### 2.2j The Vulkan resident prefill window chain {#vk-prefill-window-chain}

**A prompt longer than `PF_WINDOW` rows runs as SEQUENTIAL windows over the same activation
Expand All @@ -30,8 +47,9 @@ starting 32 rows below the window's end (`fill_arena_batch_sched`'s `row0`, `Act
`ArArgs.row0`). Thirty-two, not one, because the s tile - the cm2 tile with 32-row columns
(`ARCHITECTURE_GPU_VULKAN_GEMM.md` sec.2.2l) - loads a whole 32-row column unclamped on its
fast path, and the resident prefill's activation planes (`pf_xf`, `pf_hf`) carry no read slack
past the window - unlike the MoE chain's gathered image and hidden plane, which sec.2.2l sizes
with 32 rows of slack past their last region. Rows below the slice keep stale gate, up,
past the window - unlike the MoE chain's gathered image and hidden plane, which
`ARCHITECTURE_GPU_VULKAN_GEMM.md` sec.2.2l sizes with 128 rows of slack past their last region
(`TILE_READ_SLACK`). Rows below the slice keep stale gate, up,
hidden and residual values that nothing reads. The sliced GEMMs do not split k: the split-k
reduce sums partial planes from row 0, so a region starting below the window's end would reduce
the wrong rows. The slice takes the f16-fed cm2 route only (`gu6 && dn6`); the other feeds run
Expand Down
Loading
Loading