adm
87a66aee37
[RT][HIP] GPU executor core + first composed trunk forward verified on gfx1150
...
- rt::executor (feature `hip`): the bridge from the arena-validated plan to
GPU compute. ExecOp { op, reads, writes, params } + OpParams (concrete
shapes) + execute() dispatching the verified microkernels (embed, rms_norm,
gemm_bf16, flash_gqa, moe_router, vec_add, cast). Lowering CompiledPlans+IR
-> ExecOp lands with the packer; this core proves dispatch + composition.
- First COMPOSED GPU forward: embed gather -> rms_norm -> cast f32->bf16 ->
gemm(unembed), verified end-to-end vs a CPU oracle (<1e-4). The composition
test caught a real dtype-transition bug (f32 activation fed to a BF16 GEMM)
— fixed by adding the cast kernel the reference also inserts before matmul.
- kernels/hip: k_cast_f32_bf16 (f32 activation -> BF16 truncate) + C ABI +
wrapper. abi::vplan: CastF32Bf16 opcode (31 total).
- rt: optional hip dependency, feature-gated (default workspace stays
host-independent).
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; GPU parity 7/7 + composed trunk
forward 1/1 (--features hip). Principle recorded: parity-first baseline, then
our own measured improvements (Federico).
2026-12-01 13:57:07 +01:00
adm
b99d3a7a6a
[HIP] attention + MoE router + vec_add kernels (GPU-verified, parity vs reference semantics)
...
- k_flash_gqa_decode: single-token GQA attention over a f32 KV cache,
two-pass softmax, correctness-first base. Parity vs CPU oracle ~3e-6 on the
real Inkling shape (24 heads / 8 KV, hd 128). SWA window / relpos bias /
sinks / split-KV / WMMA are the later parity+performance refinements.
- k_moe_router_topk: Inkling EXACT sigmoid router, semantics verified against
strata k4_moe_router_topk — p=sigmoid(logit), score=p+bias, top-K by score
(smallest eid wins ties), weight=p[chosen], renormalized to route_scale.
Parity: top-k ids exact, weights ~1e-5 (128 experts, top-8, route_scale 8).
- k_vec_add: y=a+b elementwise (residual stream), exact.
- C ABI + safe Rust wrappers + DeviceBuf byte/i32 transfers + CPU-oracle tests.
Six compute kernels now verified on gfx1150 (embed, rms_norm, gemm_bf16,
flash_gqa, moe_router, vec_add); the base decode graph is covered except the
NVFP4 expert GEMMs (w13/w2) + reduce. Approach: standard correctness-first
math, Inkling-specific features ported from the measured reference (no
invented attention variants); performance pass (WMMA/split-KV) comes after.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; GPU parity 7/7 (--features hip).
2026-12-01 13:53:56 +01:00
adm
356f9c458e
[HIP][Docs] embed_bf16 + gemm_bf16 kernels (GPU-verified) + newcomer orientation guide
...
- kernels/hip: k_embed_bf16_gather (BF16 table -> f32 token rows, exact) and
k_gemm_bf16 (y[M,N] = x[M,K] @ w[N,K]^T, BF16 in / f32 accumulate,
correctness-first per-element; WMMA tiling is the later performance pass).
C ABI + safe Rust wrappers (embed_bf16_gather, gemm_bf16) + DeviceBuf
byte-level h2d/d2h.
- Verified LIVE on gfx1150: embed exact, gemm max_rel_err 0.0 across
(2,8,16)/(4,32,64)/(1,128,256), rms_norm ~1e-6. Three kernels now cover the
trunk + projection compute path (embed, norm, gemm).
- docs/ORIENTATION.md: a guide for newcomers arriving from vLLM/llama.cpp/
SGLang — what this engine is, the five ideas behind the mental-model shift
(microkernel+services, models compiled to .vbundle, forward pass as a
Lean-proven validated plan, proof-first, parity discipline), the crate map,
the honest current state (CPU pipeline done, GPU begun, no token yet), and
the ordered road to the first agent chat and beyond. Linked from README.
Verified: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
lean proofs (4 files, 42 theorems) green; GPU parity 4/4 (--features hip).
2026-12-01 04:54:05 +01:00
adm
bd0d4f2a63
[HIP] GPU backend bring-up: feature-gated hipcc build + first verified kernel on gfx1150
...
- New crate vetta-infer-hip: HIP FFI/DMA backend (unsafe isolated here per
AGENTS.md). Kernel build is feature-gated (`hip`, default OFF) so
`cargo test --workspace` stays host-independent (97/97, no toolchain).
build.rs invokes hipcc --offload-arch=gfx1150, archives libvetta_kernels.a,
links amdhip64 from ROCM_PATH/lib.
- kernels/hip/vetta_kernels.hip: device query, minimal device-buffer
lifecycle (alloc/free/h2d/d2h, RAII DeviceBuf), and the first microkernel
k_rms_norm_f32 (one block/row, shared-mem reduction). C ABI extended in
vetta_kernels.h.
- Safe wrappers: query_device, DeviceBuf, rms_norm_f32.
Verified LIVE on Sogliola (cargo test -p vetta-infer-hip --features hip
-- --ignored): device = AMD Radeon 890M Graphics gfx1150 CU=8 UMA=true;
rms_norm parity vs CPU oracle max_rel_err ~1.3e-6 across rows 1/4/3/2 and
d 2304/128/1024 (tolerance 1e-4). First GPU compute verified end-to-end:
hipcc -> static lib -> FFI -> launch -> parity. This opens the GPU execution
half (executor + remaining kernels toward the first served token).
2026-12-01 04:46:14 +01:00
adm
f57060caa7
[LD][ABI][Docs] Inkling base decode graph emitter (675 ops, arena-validated) + full forward blueprint
...
- ld::inkling_graph: emit_decode_base() generates the complete base decode
forward from the IR over the unrolled physical schedule: embed ->
[per-layer: norm -> QKV -> flash -> O-proj -> residual-add -> MLP norm ->
router -> experts w13/w2 -> reduce -> residual-add] -> final norm ->
unembed. Live-verified on Inkling: 675 ops, 236 arena decls, validated by
abi::arena (no overlap / checked bounds / no use-before-write). This is
the structurally-complete base; Inkling parity refinements (learned
AttnRes block-mix, loop controllers, ShortConv4, relpos, SWA window,
paged KV) layer on top next.
- abi::vplan: add the Inkling stage opcodes AttnResMix, ShortConv4, LoopCtrl,
L2Clip, KvStore, RelPosBias, MoeRouterTopk, VecAdd (30 total, roundtrip).
- ld::inkling_ir: LlmComp derives Copy (used by value in the emitter).
- docs/inkling-forward-design.md: full per-layer sequence extracted from
forward_batch_chunk (k1 AttnRes block-mix + controllers, k2 projections +
shortconv + relpos + KV store, k3 flash, O-proj block-boundary rule, k4
sigmoid router + SiTU experts), real scratch buffer set, deep-residual
block mechanism (block_size=6 snapshots + learned queries).
Verified live: RUSTFLAGS="-D warnings" cargo test --workspace = 97/97 PASS;
5 ignored live tests pass (base graph 675 ops); lean proofs (4 files, 42
theorems) green.
2026-12-01 04:39:08 +01:00
adm
d478787863
[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.
2026-12-01 04:35:46 +01:00
adm
465315ae94
[LD] Inkling ModelImporter foundation: typed config + total tensor classification + validated IR assembly
...
- ld::inkling: parse_config(config.json) -> InklingConfig (TextConfig,
LoopConfig, MtpConfig), checked extraction + consistency guards
(top_k <= n_experts, n_head % n_kv == 0, core_start < core_end).
full_attention_layers() = complement of local_layer_ids ({5,11,17,23}).
- ld::inkling_ir: classify(name) -> TensorRole, the total tensor-name ->
typed-role mapping (trunk, per-layer attn projections/sconv/controllers/
norms, NVFP4 router+experts, attention-residual/cross-pass queries, vision).
Unknown names -> None (explicit rejection). Verified TOTAL on the live
archive: 1244/1244 classified, 24 layers.
- ld::inkling_ir: assemble()/assemble_archive() -> InklingIr (trunk + 24
LayerIr + vision), structural validation vs config (layer count, embed
shape = vocab x hidden, required per-layer components, expert first dim =
n_experts). Attention-norm validation is type-aware: SWA layers use
attn_norm, full-attention layers use q/k/v_input_norm (discovered + fixed
via the live test, verified on the inventory).
- Opt-in #[ignore] live tests against /mnt/models/Inkling/safetensors
(config, classification completeness, IR assembly) — all pass; default
suite stays host-independent.
Verified live: RUSTFLAGS="-D warnings" cargo test --workspace = 87/87 PASS;
3 ignored live tests pass; lean proofs (4 files, 42 theorems) green.
2026-12-01 04:27:56 +01:00
adm
4de272beb1
[ABI][GW][Docs] encoder guard fields + sha256 provenance; Inkling tensor inventory; BGE-M3 recipe correction
...
- abi::bundle: manifest guard fields from the strata-ctl encoder incident
(review/2026-12-01-guardie-encoder.md): provenance {repo_id, revision,
shards sha256 = HF lfs.oid anchor, 64 lowercase hex validated},
model_kind decoder|encoder (encoder REQUIRES the full encoder_recipe:
pooling, end_text_token id, append_end_text, max_tokens, query/doc prefix,
native_dim — never derived from architecture), calibration {floor_hit,
peak_noise} finite in [-1,1]. Identity is provenance, not tensor shape.
- abi::sha256: pure FIPS 180-4, streaming update for GB shards, zero deps;
NIST vectors + million-a + streaming/chunk parity tests.
- abi::vplan: pool_l2norm generalized (mode mean|cls|last_token from the
manifest recipe), replacing mean_pool_l2norm.
- gw: `vetta-infer tensors <dir> [prefix]` subcommand; captured the live
Inkling inventory (docs/inkling-tensor-inventory.txt, 1244 tensors:
994 BF16 / 154 F32 / 48 F8_E4M3 / 48 U8) — ground truth for the importer.
- BGE-M3 recipe verified on the artifact: dense = CLS (1_Pooling/config.json
+ reference converter), 16 heads x 64, absolute position embeddings present;
spec/README corrected. Ordering: Inkling first, utility after (Federico).
- review/: tandem exchange (guardie + nostra risposta + osservazioni-recipe).
Verified live: RUSTFLAGS="-D warnings" cargo test --workspace = 75/75 PASS;
lean proofs/{slab_ring_dma,bus_lifecycle,serve_session,arena_plan}.lean green
(42 theorems, 0 sorryAx, standard axioms only).
2026-12-01 04:17:12 +01:00
adm
fb92662106
[ABI][LD][Proofs][Docs] M1 groundwork: arena-safety proof + .vbundle contract; embedder lane (M1.5) accepted
...
- proofs/arena_plan.lean: memory.vplan arena safety (8 theorems + 4
computational examples, 0 sorryAx): no overlap, checked index bounds,
no use-before-write, overlap-rejection completeness.
- abi::arena: validator mirroring the proof, checked offset arithmetic
(invariant #2 ), explicit error per violation class; 8 tests.
- abi::bundle: .vbundle manifest (ABI_VERSION=1, source+packer fingerprints,
backend target; incompatible ABI rejected explicitly), checked
memory.vplan/graph.vplan parsing, arena-validated compile(); 7 tests.
- ld::bundle: read-only load_bundle_plans(dir) over manifest + plan/*.vplan;
3 tests (good bundle, missing file, ABI mismatch).
- abi::vplan: encoder-lane opcodes (layer_norm, flash_full_attn, gelu_erf,
mean_pool_l2norm) + wire name mapping for all 22 opcodes, roundtrip test.
- Docs: utility-encoder scope carve-out (dense decoder LMs out, small
fully-resident encoders in), embedder-lane wire proposal + characteristic
parity vs vetta-semantics (cosine vs oracle, internal bit-exact goldens),
16-primitive kernel set, M1.5 milestone; README/AGENTS aligned
(65 tests, 42 theorems across 4 proof files).
- review/: tandem exchange with the strata-ctl coder (their request +
observations, our formal reply: embedder accepted, M0 dir cleanup done).
Verified live: RUSTFLAGS="-D warnings" cargo test --workspace = 65/65 PASS;
lean proofs/{slab_ring_dma,bus_lifecycle,serve_session,arena_plan}.lean green,
standard axioms only.
2026-11-30 15:22:00 +01:00
adm
7b50f1c07c
[ABI][KN][LD][CC][RT][LAB][SP][NT][TM][GW][Proofs][Docs] M0.5: realign workspace to vetta-infer-* microkernel architecture
...
Dissolve the M0 crates (core/io/proto/telemetry/hip/cli) into the approved
service layout abi/kn/ld/cc/rt/lab/sp/nt/tm/gw (docs/ARCHITECTURE.md).
- kn: Lean-verified control bus + service registry (bus_lifecycle.lean, 14 thms)
and SlabRing/UMA broker; rt: PrefixState + hybrid checkpoint pool.
- sp: faithful throughput-aware Adaptive-K port of clover_policy.h
(cooldowns, probes, throughput guards) with scenario parity tests.
- gw: strata-ctl-compatible wire emitters + serve session FSM
(serve_session.lean, 10 thms); abi::serve accepts image= (Vision delta closed).
- abi: pure contracts, checked JSON/VTC1/GEN parsers, zero-alloc sampler.
- ld/cc: checked safetensors reader + write-once VTC1 writer / O_RDONLY reader.
- tm: lock-free telemetry; nt: LyraRpc; lab shares the rt executor core.
- Docs: ARCHITECTURE.md decision-complete spec (MoE-only scope, .vbundle,
.vplan->CompiledPlan, wire contract, migration map); AGENTS.md Lean rule
+ tandem/review workflow.
Verified live: cargo test --workspace -D warnings = 46/46 PASS;
lean proofs = 34 theorems (slab_ring_dma 10, bus_lifecycle 14, serve_session 10),
0 sorryAx, standard axioms only; vetta-infer info on Inkling = 1244 tensors,
18.18 GiB, checked bounds.
2026-11-30 00:54:00 +01:00
adm
63b1668a92
[Core] M0 foundation: workspace, Lean 4 SlabRing/PrefixState contracts, checked safetensors/cache IO, serve proto, telemetry, and HIP ABI
2026-11-29 21:32:44 +01:00