[LD][ABI] Inkling plan foundations: physical schedule + scratch arenas + graph emitter (trunk)

- ld::inkling_plan: physical_schedule() unrolls the looped core (verified
  against the reference logical->physical mapping; Inkling = 6 + 3x12 + 6 =
  48 physical steps over 24 logical layers). scratch_layout()/scratch_plan()
  lay out the decode activation arenas (residual/q/k/v/attn_out/moe/logits),
  4 KiB-aligned with checked offsets, validated by abi::arena.
- ld::inkling_graph: GraphBuilder accumulates arena decls (scratch=0,
  weights=1, inputs=2) + a flat op sequence and validates the whole plan
  (no overlap, checked bounds, no use-before-write) via abi::arena.
  emit_trunk() emits the first complete sub-graph: embed(+embed_norm fused)
  -> final norm -> unembed, arena-validated. The per-layer k1->k4 body plugs
  into the same builder next.
- abi::vplan: add GemmBf16 opcode (BF16 trunk/unembed GEMM).
- docs/inkling-forward-design.md: forward blueprint grounded in the strata
  reference (k1->k4 stage order from kernel numbering, real scratch buffer
  set, loop structure, two forward paths main-LLM + MTP DSpark).

Verified live: RUSTFLAGS="-D warnings" cargo test --workspace = 96/96 PASS;
4 ignored live tests pass; lean proofs (4 files, 42 theorems) green.
This commit is contained in:
adm committed 2026-12-01 04:35:46 +01:00
1 parent 465315ae94
commit d478787863
5 files changed
+459 -1

No files matched your search

+4 -1
View File
@@ -15,6 +15,7 @@ pub enum VplanOp {
GemmQ8G64T16,
GemmQ4G64T16,
GemmNvfp4Mxfp8,
GemmBf16,
RopeKvWrite,
FlashGqaWmma,
GdnChunkwiseWy,
@@ -54,6 +55,7 @@ impl VplanOp {
Self::GemmQ8G64T16 => "gemm_q8_g64_t16",
Self::GemmQ4G64T16 => "gemm_q4_g64_t16",
Self::GemmNvfp4Mxfp8 => "gemm_nvfp4_mxfp8",
Self::GemmBf16 => "gemm_bf16",
Self::RopeKvWrite => "rope_kv_write",
Self::FlashGqaWmma => "flash_gqa_wmma",
Self::GdnChunkwiseWy => "gdn_chunkwise_wy",
@@ -82,6 +84,7 @@ impl VplanOp {
"gemm_q8_g64_t16" => Self::GemmQ8G64T16,
"gemm_q4_g64_t16" => Self::GemmQ4G64T16,
"gemm_nvfp4_mxfp8" => Self::GemmNvfp4Mxfp8,
"gemm_bf16" => Self::GemmBf16,
"rope_kv_write" => Self::RopeKvWrite,
"flash_gqa_wmma" => Self::FlashGqaWmma,
"gdn_chunkwise_wy" => Self::GdnChunkwiseWy,
@@ -119,7 +122,7 @@ mod tests {
fn name_roundtrip_all_opcodes() {
let all = [
VplanOp::EmbedBf16, VplanOp::RmsNorm, VplanOp::QuantizeXG64,
VplanOp::GemmQ8G64T16, VplanOp::GemmQ4G64T16, VplanOp::GemmNvfp4Mxfp8,
VplanOp::GemmQ8G64T16, VplanOp::GemmQ4G64T16, VplanOp::GemmNvfp4Mxfp8, VplanOp::GemmBf16,
VplanOp::RopeKvWrite, VplanOp::FlashGqaWmma, VplanOp::GdnChunkwiseWy,
VplanOp::GdnRecurrentStep, VplanOp::MoeRouteBucket, VplanOp::MoeW13Wmma,
VplanOp::MoeW2Wmma, VplanOp::MoeReduce, VplanOp::VitFlashAttnWmma,