Commit Graph
9 Commits
Author SHA1 Message Date
Pavlo RatushnyiandClaude Opus 5.5 3ebcb3ffd6 experiment: one prompt prefilled by the iGPU and the NPU together; measured, no gain (STRA-220)
leleka-gpu-npu-worker (crates/gpu-npu-worker) splits a long prompt: the NPU path takes the
first share of the tokens and the GPU path the rest, on two threads. They meet only in the
KV cache, through the new leleka_gptoss::LayerCache, which both prefill paths now use instead
of &mut State (same behaviour). The GPU part's cache waits for each layer the NPU part
stores, so the GPU runs layer l while the NPU runs l+1. The last-token distribution matches
the GPU alone (KL <= 1e-4).

Measured: 2048 tokens 0.89-1.13x against the GPU alone, depending on share; agent episode
(4 turns of ~2,060 new tokens, 6 alternating pairs) 0.81-1.16x per pair, a net loss. Both
paths stream all weights whatever their token share and share the 15 W budget, and the NPU
part's CPU attention over the growing context is the slow side. Not adopted; stays
experimental. Also: NpuPrefill::with_cpu_threads, and -ArmA/-ArmB/-LogDir in
Compare-PrefillWorkers.ps1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:42:12 +02:00
Pavlo RatushnyiandClaude Opus 5.5 c58173097d test: paired speculation A/B, CPU batch-cost curve and accelerator verify cost; docs (STRA-220)
ab_speculation: four agent-style prompts, 3 alternating pairs, greedy, identical
outputs in all 96 runs; copy-heavy output 1.10-1.36x decode, new text within noise
of 1.0. batch_cost: a CPU pass over n >= 4 tokens costs about 0.65 n single steps, so
CPU speculation is capped near 1.5x. One 9-token pass takes 7.3 s on the iGPU and
6.3 s through the NPU service against 0.75-0.93 s on the CPU, so neither is used for
verification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:11:02 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 60199600c1 test: paired agent-shaped episode through the control plane, CPU worker vs GPU-prefill worker (STRA-219)
Four turns of ~1380 new tool-output tokens each on a growing cached prefix, three alternating pairs:
episode wall time 333.0 s (CPU worker) vs 125.0 s (GPU worker), paired 2.60x / 2.70x / 2.70x. Scripted
episode, not real agent traffic; the answers were not compared.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 02:00:56 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 a08d6fbf55 perf: separate tile configuration for the grouped expert products; record the tile sweep (STRA-219)
No tile beat 4x4 for the experts; the hook (LELEKA_IGPU_MOE_TILE) stays for later experiments.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 01:32:19 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 c44d1f553d test: record the paired CPU-vs-GPU prefill A/B and add the ab_prefill harness (STRA-219)
Warm, alternating order, same prompts, same process: paired speed-up 2.87x (512 tokens), 3.40x (1024),
3.97x (2048), 3.57x (4096) with 95% CIs in docs/igpu-prefill.md; GPU 50-64 tok/s against 15-17 tok/s on the
CPU. Synthetic prompts, 3-5 pairs, clocks/power not controlled.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 01:26:53 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 f07302b944 feat: admit GPU prefills by free memory; the worker falls back to the CPU for that prompt (STRA-219)
PrefillAccelerator::admit lets an accelerator refuse a prompt without being disabled. The GPU prefill
estimates its footprint (two layers of weights, scratch, hidden states, caches, 1 GiB headroom; 1.6 GiB
estimated vs 2.0 GiB peak private bytes measured for 1024 tokens before the headroom was raised) and
compares it with a probe; the worker's probe is the OS's available memory (sysinfo). admission_check
exercises both outcomes on the real model. 1024-token prefill with the vec4 attention: 15.9 s (64.5 tok/s),
single unpaired run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 00:48:48 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 bf4f01b3ac perf: vec4 shared-memory attention kernel for the GPU prefill (STRA-219)
One full layer over a 512-token batch ending at position 4096: 0.52 s -> 0.22 s (8192: 1.07 s -> 0.44 s).
4096-token synthetic prompt, single unpaired run: 91.9 s -> 67.5 s (60.7 tok/s; CPU 247 s earlier). Same
tests against the CPU attention. Teacher-forced vs llama.cpp on the gate text: 95.3% / KL 0.0121 (the
earlier kernel gave 97.1% / 0.0100): the two GPU runs differ from each other by KL 0.0058, as much as GPU vs
CPU (0.0067-0.0080) and the CPU's own scalar vs SIMD (0.0048); a second text shows GPU-vs-CPU noise equal
to CPU-scalar-vs-SIMD noise (docs/igpu-prefill.md). Reported as borderline against the strict KL limit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 00:38:20 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 7a78e87ea8 feat: add leleka-igpu-worker, the CPU worker with GPU prefill for long prompts (STRA-219, phase D)
- cpu-worker: GptOssEngine can take a PrefillAccelerator (falls back to the CPU and drops it on failure)
- igpu-worker: separate executable, same protocol, --gpu-min-tokens/--gpu-batch; CPU-only with a message when
  no GPU is usable
- real-model worker tests no longer assert llama.cpp's later greedy tokens (near-ties that moved with the
  attention/KV/router changes of STRA-214; the first token and the reuse/determinism checks stay); the
  teacher-forced gate is the comparison with llama.cpp

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 00:21:20 +02:00
Pavlo RatushnyiandClaude Sonnet 5.5 d8460a0e8d feat: add the leleka-gptoss-igpu crate: GPU prefill of gpt-oss that fills the CPU decoder's KV cache (STRA-219, phase C)
- gptoss: PrefillAccelerator hook, Model::prefill_reuse_accelerated, layer/weight views, embed,
  next_from_hidden (shared with the CPU forward pass), State KV export/import
- igpu: threaded weight repacking (131 s -> 6 s of upload for 24 layers), explicit half rounding of block
  scales (the compiler folds the pack/unpack round trip away), matmul_rows, buffer reads/writes at offsets
- teacher-forced gate with GPU prefill: best token 97.1% vs llama.cpp, mean KL 0.0100, NLL +0.0148;
  vs the CPU decoder KL 0.0067 (see docs/igpu-prefill.md). Experimental, not wired into the worker.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-15 00:10:43 +02:00