Commit Graph
240 Commits
Author SHA1 Message Date
Niko1221 d5026839ff #6770: the global K/V of one slot grows through CUDA virtual memory (no copy), the context is set to what the card holds once the drafter has loaded, opt-in --kv-prealloc
The elastic global K/V grew one visit at a time (new buffer, copy, free the old one), so the card needed one old visit buffer extra and a long request stopped 1.2 to 1.8 GB short of the
context that had been planned ("VRAM exhausted growing elastic global KV cache", 503), and the plan was set before the drafter (DSpark's fused weights, DFlash 2 codebooks and rings)
took its memory.

- ink_runner.cuh: with ONE slot on ONE card (no layer split, no elastic 1M mode, K/V not split to host at the start) every global visit's K, V and scale buffers are address ranges for the
  requested context (strata::core::VmmRange, src/core/vmm.cpp, now also linked into the CUDA backend) and physical memory is mapped behind them as the context grows; the pointers never
  move, so no peak of old + new. A failed mapping falls back to the host tail (kv_spill_tail, the earlier code, now a function) or to a refused request, as before.
  STRATA_INK_KV_VMM=0 takes the earlier growth back.
- ink_dspark.cuh: the classic drafter's global context grows the same way (ctx_vmm).
- ink_cuda_backend.cu: after the drafter has loaded (--kv-offload off), max_ctx is set to what the card holds (ink_kv_reach_ctx, 256 MiB kept free), up or down, never above
  --max-context ("max_ctx A -> B" line); --kv-prealloc / STRATA_INK_KV_PREALLOC=1 maps that whole context at start-up (and refuses to start, with a message, if the mapping fails); a request
  that fails to grow says how much video memory is free now and what to do.
- ink_serve.h + InkBackend::kv_reachable_tokens(): a prompt the card can no longer hold (another program took video memory after the plan, --kv-offload off) is refused at the start with
  a message instead of ending with 0 tokens; the engine stays up.
- strata/core/ink_kv_grow.hpp: ink_kv_reach_ctx() and its test (ink_kv_grow_test). Register: STRATA_INK_KV_PREALLOC (opt-in), STRATA_INK_KV_VMM (rollback); docs/INKLING_KV.md, SETTINGS.md.

Measured (RTX 4090, SQ-20 v2, --kv fp8 --kv-offload off, prompts of 90K / 100K / 110K / 128K tokens; VRAM ballast taken before the first allocation to get the Windows 4090's room;
phaseA-tests/rel0224/ink-kv/RESULTS.md, REPLY-6770.md): no ballast: tokens identical old / new / --kv-prealloc, decode equal; 700 MiB ballast, classic drafter: old ends the 110K request at
100,864 tokens with 0 tokens, new answers it; default drafter: old plans 104,192 and refuses 110K and 128K, new answers both; 1,300 MiB: old plans 74,240, new raises it to 109,568 and
answers a 100K prompt; every answer identical to the unballasted run; short prompts: same tokens, speed within 0.5%; ballast after the start: --kv-offload auto answers (host tail), off
refuses with a message. An RTX A6000 with a 128K prompt: identical tokens. Builds: CUDA sm_86 and sm_89 (Linux), sm_120 (MSVC), HIP gfx1151.
2026-12-01 21:46:58 +01:00
Niko1221 4ce01c3f08 --kv auto, final rule per backend (owner, 2026-12-01): NVIDIA FP8; AMD, Mac and Intel keep FP16; the one rule takes the backend's default and its reason
The measurements (phaseA-tests/rel0224/ink-kv/RESULTS.md) made FP8 a good default where the card likes it and a bad one where it does not:

- CUDA: FP8 on every card and slot count (KL 0.005, top-1 95-98%, FASTQ subset SQ-20 v2 201/213 FP16 against 202/213 FP8, 64 slots +24 to +27% and a 32K
  decode x2.5 on 12 and 16 GB cards because the cache is half the size and stays on the card; -1 to -3% on an RTX A6000 that has no native FP8).
- HIP (AMD): the 0.2.23 rule is back, unchanged: FP16, FP8 from 16 slots on a card of 36 GiB or less, STRATA_HIP_KV_FP8_SMALL and the Strix Halo FP8_KV_C64 set as before.
  On the Radeon AI PRO R9700 FP8 costs 7% decode at 4K and 17% at 32K (prefill -8% at 32K); the retirement of STRATA_HIP_KV_FP8_SMALL is undone.
- Metal (Mac): FP16 ("auto: Mac default"); --kv fp8 (#6983) and the opt-in M5 Max fast set are as they were.
- SYCL (Intel): FP16, FP8 from 16 slots and in the Intel Arc fast set, as before (Arc A750: FP8 decode -6%, KL 0.0044 at 4K and 0.0054 at 32K).

ink_kv_auto_rule() now takes the parallel slots, the card's memory and what the backend's default is (fp8_by_default / fp8_from_slots / card cap / its sentence), so
the rule and its reasons stay in one place; every backend prints "[kv] <backend>: K/V cache <type> (auto: <reason>)". ink_main no longer sets FP8 at 16 slots for every
backend (that made a Mac and an Intel card take FP8 by the back door); the CPU reference keeps its own FP8-from-16-slots rule in its backend. The plan
(inkling_fit.auto_fp8_kv) follows: FP8 for CUDA and an unnamed backend, the 0.2.23 rule for HIP, FP16 for Metal and SYCL. Tests: ink_kv_rule_test (host only),
test_inkling_kv_auto.py, and the planner tests that pinned FP16 numbers pin them with fp8_kv=False.
2026-12-01 20:52:09 +01:00
Niko1221 d1d0f59c7c Metal K/V start-up line follows #6983 (--kv fp8 on any Metal GPU); the doc and the rule header say so
After #6983 an explicit `--kv fp8` is honoured on every Metal GPU (the M5 Max fast set still picks FP8 by itself). `--kv auto` stays FP16 outside the M5 Max set: INK-PR measured
FP8 on an M5 Max at KL 0.0053 / top-1 96% against FP16 with the K/V halved, but decode -10 to -12% at 4K to 16K, so it is a choice there, not a default (the owner decides).
The [kv] line says which of the two happened, and says so when `--kv fp16` meets the M5 Max set's own FP8.
2026-12-01 20:13:00 +01:00
Niko1221 ff17a139fa Inkling 2 Mini: --kv auto is FP8 on every card and slot count; one rule for every backend, a start-up line, and a long-document KL mode
`--kv auto` (the default) now stores the K/V cache as FP8 wherever the backend can (CUDA, HIP; SYCL stays FP16 by default until its A750 / B70
numbers are in, Metal takes FP8 only in the M5 Max set) and FP16 where it cannot. K8V8 and K8V4 are only chosen when asked for (--kv k8v8, --kv k8v4).
An explicit --kv always wins. Before, every backend had its own rule (CUDA: FP16 unless 16+ slots, a card of 13 GB or less with the K/V offload off, sm_89+ with a
context over 16K, three RTX 50 rows; HIP: FP16 below 16 slots; SYCL: FP16).

- engine/include/strata/core/ink_kv_rule.hpp: the one rule (host only) and the one start-up line, "[kv] cuda: K/V cache fp8 (auto: default)"; the CUDA, HIP, SYCL
  and Metal backends call it. Test: engine/tests/core/ink_kv_rule_test.cpp.
- CUDA: plan_vram_reserve() takes the type from the rule; STRATA_INK_ELASTIC_1M + STRATA_INK_KV_K8V4 remains the tester's way to K8V4. HIP: the old small-card
  switch STRATA_HIP_KV_FP8_SMALL is retired (register entry marked retired in 0.2.24).
- ink_main --help: the --kv line says what auto is.
- --dump-ref / --kld-eval: a row-selected form for long documents (INK_KLD_TAIL=N INK_KLD_STRIDE=s keep the logits of every s-th of the last N positions; the file
  then starts with -n_tokens; INK_KLD_CHUNK / INK_KLD_CHUNK_TAIL set the prompt chunk of the head and of the scored part). The old file format and behaviour are unchanged;
  the --kld-eval line gains refPPL and dNLL at its end.
- terminal: the memory plan (inkling_fit.auto_fp8_kv) sizes FP8 for every backend except SYCL and Metal; compute_unified and recommend take fp8_kv like compute does.
  Tests that pinned the FP16 numbers now pin them with fp8_kv=False; test_inkling_kv_auto.py covers the new rule, the launcher's k8v8 / k8v4 clamp and that every backend
  calls the one rule. docs/INKLING_KV.md; docs/SETTINGS.md regenerated.

Measurements (phaseA-tests/rel0224/ink-kv/RESULTS.md): teacher-forced KL of FP8 against FP16 K/V 0.005-0.007 and top-1 95-98% on 4K / 32K / 128K documents
on RTX A6000 (SQ-20 v2), RTX A4000 (SQ-15), R9700 (SQ-15), Arc A750 (SQ-10, 4K), RTX 5070; the needle misses are the same with FP16.
2026-12-01 20:11:36 +01:00
Niko1221 8ece5d8a51 Merge PR #7499 (CUDA: keep K/V on the card with COMPACT_HYBRID all-resident, ShiQu1218) 2026-12-01 19:14:52 +01:00
Niko1221 a8db6d059b Merge PR #7367 (safetensors: widen BF16 trunk tensors to F32, devlier) 2026-12-01 19:14:52 +01:00
Niko1221 256aef16c1 Merge f-hy4-e2e (Hy4-Flash GGUF engine, clean-room) into nx-hy4-0224, on next-0224 addfdb161
The Hy4-Flash GGUF engine (f-hy4-clean + f-hy4-mla + the E2E fixes: CPU expert rows equal to the GPU rows bit for bit, the engine's
out-of-memory message, the plan reserve for A40 / RTX A6000), opt-in:
  - CUDA: STRATA_BUILD_HY4_FLASH, OFF by default (configured only with CUDA on and no HIP);
  - Metal: STRATA_BUILD_HY4_FLASH_METAL, OFF by default (the f-hy4-e2e side linked the Hy4 engine into the Metal strata
    unconditionally; here its targets, the strata link and STRATA_HAVE_HY4_FLASH are behind the option).
Conflicts: engine/CMakeLists.txt (f-hy4-e2e had the whole file in CRLF; next-0224's file kept, the Hy4 option and include re-applied by
hand) and engine/metal/CMakeLists.txt (next-0224's ggml handling kept; mtl_rt split into mtl_rt_core + mtl_rt as the merged
gguf_lite.cpp needs, Hy4 targets behind the option).
2026-12-01 15:33:23 +01:00
Niko1221 97509d1877 hy4-flash: a CPU expert row is the same float as the GPU row of the same expert, bit for bit
Which experts of a token run on the CPU and which on the GPU depends on timing (CPU split auto), and the two arithmetics
differed in the last bits (8 lane partials without fused multiply-add and libm's exp on the CPU; 32 lane partials with fused
multiply-adds, an xor butterfly and the CUDA exp on the GPU). The model is sensitive enough that this moved the logits from
run to run with CPU experts on (KL 1e-3 to 3e-2 between two identical runs), while CPU experts off was bit-identical.

The CPU row kernels (scalar, AVX2, VNNI tiers) now follow the GPU decode kernels' reduction contract (own_decode.hpp), and the
SwiGLU exponential is one shared function (own/swiglu_math.hpp, host and device give the same bits) used by the CPU expert
glue and by the GPU decode quantiser. New test hy4_flash_cpu_gpu_rows_parity: the CPU tiers against own::mmvq on the GPU for
Q4_K / Q6_K / Q8_0 (217k outputs), the rule-E quantiser, the exponential over a dense sweep and the clamped SwiGLU image.
cpu_experts_test compares tiers with the production silu.

Measured on an A40 (sm_86), chat-advice and json-raw, 64 rows each: before, two runs with CPU experts on differ (KL 0.00145 and
0.0221) and differ from CPU off; after, the dumps are byte-identical run to run and CPU on equals CPU off.
2026-12-01 09:57:25 +01:00
Niko1221 73c150784d Merge next-0224 (#7310 opt-in) into f-clean-p2i 2026-12-01 08:58:44 +01:00
Niko1221 0962a447f2 peer autonomous: refused with STRATA_ADAPT_OVERLAP=1 (FORCE does not override), the decision is a pure function with a test
The autonomous window has no host loop, so it would not wait for the adaptive tier's copies to land. peer_autonomous_policy.hpp holds the rules
(overlap, sm_120 with the FORCE override, every expert on a card with the LOSSY opt-in); peer_autonomous_policy_test covers them; the guard in
generate.cpp uses it. SECOND_GPU.md and the register say 'refused', not 'do not combine'.
2026-12-01 08:35:53 +01:00
Niko1221 35b6880d11 Merge next-0224 (R9700 and multi-GPU merges) into f-clean-p2i 2026-12-01 07:24:33 +01:00
Niko1221 de2bb9457a Merge f-7310-int into f-7310-int2: PR 7310 (peer direct signal, autonomous window; opt-in, exact guard) onto 47a993eaf; settings register regenerated 2026-12-01 07:20:05 +01:00
Niko1221 47a993eaff Merge f-mgpu-p0 into next-0224: strata_mgpu phase 0, the shared multi-GPU layer foundation (no engine behaviour change)
Topology probe, device set, planners, transports and the strata-topo program with their tests; the Terminal strata topo command. Nothing in the engine calls it yet.
2026-12-01 06:58:09 +01:00
Niko1221 453e3dd141 Merge f-7310-trial into f-7310-int: PR 7310 (peer_experts direct signal and autonomous window) with the review fix-ups 2026-12-01 06:52:25 +01:00
Niko1221 ce52657a48 integrate P-3: artifact/dequant.hpp from the clean-room header
The old header is replaced (guard renamed), the transition comparison test and the one-off build scripts that compared old and new are removed.
2026-12-01 02:19:19 +01:00
Niko1221 6466dbf2f8 integrate P-2: rope_scaling.hpp (and the SYCL copy) call rope_yarn_math.hpp
The enum and the host/device macro come from rope_scaling_type.hpp; freq_scale, mscale, corr_dims, rope_yarn_ramp and rope_scaled_angle are one-line calls into
strata::kernels::yarn. The comments that named ggml as the contract now name the YaRN paper.
2026-12-01 02:18:37 +01:00
Niko1221 27e86c2b63 integrate P-1: dp4a.hpp (CUDA, SYCL) and the RDNA1 dp4a branch from the clean-room files
dp4a.hpp and its SYCL copy are replaced by the clean-room headers; strata_spin_pause keeps the old behaviour on HIP (sleeps on every target but CUDA below 7.0).
hip_compat/intrinsics.hpp: the gfx1010 / gfx1012 branch calls dp4a_rdna1 (new header).
2026-12-01 02:17:47 +01:00
Niko1221 57274cc902 clean-p2: rope SYCL kernel uses sycl::cos/sin/log (identical to the old SYCL rope on 1M inputs), old/new device comparison tools 2026-12-01 02:15:50 +01:00
Niko1221 486f3204ca clean-p2: rewrite packets P-1 to P-4 from the specs (new files; old files untouched)
P-1  kernels/dp4a_clean.hpp (CUDA), sycl/.../dp4a_clean.hpp, hip_compat/dp4a_rdna1.hpp
P-2  kernels/rope_yarn_math.hpp (+ rope_scaling_type.hpp)
P-3  artifact/dequant_clean.hpp
P-4  vision/own/image_resize.cpp (smart_resize, Pillow-exact bicubic, resize_pad_ceil)

Tests: tests/clean_p2 (vectors, rope golden, dp4a checks, black-box comparisons with the
current dequant.hpp), tests/data/clean_p2 (spec vectors), image_resize_vectors_test and
image_resize_fuzz.py (Pillow). Written from phaseA-tests/clean/P2-INTERFACES.md,
FORMAT-SPEC.md and public documentation only.
2026-12-01 00:59:46 +01:00
Niko1221 6f4425a111 mgpu: strata-topo --force-p2p, a named peer-copy request runs when P2P is proven and exact, chooser reasons for both directions; strata topo child gets the quiet-crash environment and is listed as a spawn site 2026-12-01 00:49:16 +01:00
Niko1221 108cbd5fb8 peer autonomous: order the residency-table upload before the window, keep it in sync on flip_pending, size the plan for a whole window, release the doorbell word on a failed launch
The device residency table was copied from pageable memory on the refill stream with no event toward the window's stream,
flip_pending (STRATA_ADAPT_OVERLAP) never updated it, PeerPlanDevice held 64 entries while a window can route kWindowMaxT x 10,
peer_plan used one 128-thread block, and release_gpu_waits did not free the peer's wait on h_seq_.
2026-11-30 23:54:22 +01:00
Niko1221 06fd2f0700 mgpu: strata_mgpu phase 0, the shared multi-GPU layer's foundation (no engine behaviour change)
New library engine/include/strata/mgpu + engine/src/mgpu, wired in cmake/backends/mgpu.cmake:

- DeviceSet: the topology data model (devices, per-pair links, measured figures), the
  primary-card rule, JSON in and out (schema_version 1), synthetic builders for tests.
- DeviceGuard: RAII current-device switching.
- probe: PCIe link (sysfs / NVML), copy and memory bandwidth, mapped-host access, per pair
  the staged route, peer copy where proven (the #2666 host-bridge rule and an exact data test
  first), and the mapped-flag round trip. CUDA, and HIP through the hip_compat shim.
- strata-topo program and `strata topo [--json]` in the Terminal (new subcommand only).
- Transport interface: peer copy and host-staged implemented, doorbell a stub for P1;
  choose_mode is a pure function of the measured link.
- Placement planner: plan_experts (cost model of one decode window, f = argmin instead of
  STRATA_PEER_HOT; Rows / OrderedPartials / SumPartials; N cards) and plan_layers (the layer
  split's fitted model as a pure function). Unit tests on synthetic pairs and quads.
- terminal/tools/mgpu_identity.py: greedy token-hash identity of a family's goldens, one
  GPU against several.

Nothing in the engine calls any of it yet.
2026-11-30 23:49:37 +01:00
Niko1221 2930ce8df2 merge f-hy4-mla (tip b8cd23ffa): MLA kernel tile/unit skipping, fp16 plane for Q8_0, planner export 2026-11-30 23:36:28 +01:00
Niko1221 b2f43f0584 Provenance headers for nine files that hold ggml-derived code without one
The similarity scan found ggml / llama.cpp derived text in strata-quant-common.h (through its generator), dot_avx2.cpp, dot_neon.cpp,
arm_act.inc, act_avx512.cpp, kq_avx2.cpp, split/iqdot_hip.cuh, sycl/iq2xs_host_tables.inc and strata_gguf.py, with no provenance wording
(dot_avx2, dot_neon and arm_act carried only our own copyright line). Each now says which parts are derived (MIT, Copyright (c) 2023-2026
The ggml authors, pin 3cf03257f; gguf-py's own licence line for strata_gguf.py) and that the rest is ours. Comments only: no code changes,
the generated header is regenerated from the changed generator (check passes).

The nine are `derived:` entries of tools/no_ggml_allowlist.txt, which is also rewritten for the files that now carry the wording.
tools/ggml_similarity.py reports the derived line numbers per file, which is how the parts were found. The tenth file of the scan,
strata_reader_layout_golden.inc, is a false positive (rows of 0x00) and gets no notice.
2026-11-30 23:26:28 +01:00
Niko1221 842325a332 merge f-hy4-clean (PG) into f-hy4-clean-dec; one format-vectors directory 2026-11-30 22:45:03 +01:00
Niko1221 735e0ac081 hy4 decode: structure-of-arrays decode image, 16 columns, extended bench, ablation and prof harnesses (work in progress) 2026-11-30 22:44:35 +01:00
Niko1221 02f7854e68 merge f-hy4-clean into f-hy4-clean-pg (decode branch: own::dequant_f32 / own::mmvq used by the engine; DenseGemm and dense_fits kept) 2026-11-30 22:33:39 +01:00
Niko1221 6e100034fa hy4 decode: rows a warp picked from the launch size (R never changes a bit, tested), BF16 vector activation loads, flush-rule tests 2026-11-30 22:30:03 +01:00
Niko1221 5d151d3a26 kernels: mla_latent_attn: tile and unit skipping, fp16 plane for Q8_0, 32-head tile, split rules, planner export
Brought over from f-mla-kernel: key tiles / 64-slot units no row can see are skipped (sliding windows, masks, dead sparse entries); the single-plane
tensor-core mode dequantises a Q8_0 latent once into an fp16 key tile; a 32-head tile for 16+ tiles of 32 heads outside the per-query mode; the chunk count of the
single-plane kernel from floor / ceiling of 2 x SMs / tiles by waves per chunk (the other kernels keep the 2 x SMs rule); mla_latent_suggest_splits for callers
that size scratch; slot bitmask and the n_kv cap by q_pos; tests for each.
2026-11-30 22:14:54 +01:00
Niko1221 02516a4a64 merge f-hy4-clean into f-hy4-clean-pg; flush rule in the device quantiser; dense Q8_0 stays on cuBLAS (dense_fits) 2026-11-30 22:06:34 +01:00
Niko1221 76a9bb87ff merge f-hy4-clean into f-hy4-clean-dec; flush rule in the device quantiser; decode_bench moved to tools/hy4_flash 2026-11-30 22:05:36 +01:00
Niko1221 ed78b15b9e hy4 pgemm: own dequantisers (Q8_0/Q4_K/Q6_K/F16/BF16/F32) and DenseGemm (dequantise to fp16 + cuBLAS) replace main's prefill::Gemm and dequant_f32 on the Hy4 path; tests and a token-count sweep 2026-11-30 22:04:31 +01:00
Niko1221 d4d253650e merge f-hy4-clean-cpu: own CPU expert rows, no ggml in the Hy4 CPU path 2026-11-30 22:03:55 +01:00
Niko1221 cee34daaea hy4 decode: rule E quantiser, tests pass on sm_86 (decode_test 94832 checks, rms_norm_test), bench 2026-11-30 21:56:51 +01:00
Niko1221 30f5457cc7 hy4flash_gguf CPU experts: Strata's own row kernels replace ggml-cpu
Clean-room row kernels for the Hy4 CPU experts (Q4_K, Q6_K, Q8_0 weight rows times a rule-E activation row):
a portable scalar tier, an AVX2 tier and an AVX-512 VNNI tier (256-bit VNNI dot products), runtime cpuid
dispatch, integer sums exact and one fixed fp32 sequence (no fused multiply-add) in every tier, so a
token's row is the same alone and in any window, in any job order, on any worker and in any tier.
The activation quantiser is the rule of own/act_format.hpp; the vector one equals the scalar one bit for bit.

native_expert.cpp is now only the glue (geometry, SwiGLU with the clamp, calls into the rows). Removed:
every ggml / ggml-cpu use of the Hy4 CPU path, native_q81*.cpp, the aligned AVX-512 path with its 96 MiB
table and libmvec, the STRATA_HY4_FLASH_CPU_NATIVE_Q8K / CPU_Q81_ALIGNED switches, the ggml links of the
Hy4 targets, and the forced ggml configure for STRATA_BUILD_HY4_FLASH.

Tests rewritten against a float64 oracle written from FORMAT-SPEC.md (golden vectors bit-exact, synthetic
edge blocks, bound 1e-5 * (sum |w a| + min-term magnitude)).
2026-11-30 21:38:22 +01:00
Niko1221 2bf99cd027 artifact: strata::ggml_type_name is gguf_type_name (Strata's own name table; keeps 'ggml' out of the binary's symbols) 2026-11-30 21:24:57 +01:00
Niko1221 79f575cf00 hy4flash_gguf: portable acquire/release flag helpers (MSVC has no __atomic builtins) 2026-11-30 21:19:45 +01:00
Niko1221 0b8ef2536e hy4flash_gguf: portable acquire/release flag helpers (MSVC has no __atomic builtins) 2026-11-30 21:18:57 +01:00
Niko1221 2d8506118f hy4 decode: call sites switched to own_decode, shared kernel files restored to main, tests and bench (work in progress) 2026-11-30 21:18:57 +01:00
Niko1221 99d23e8a4d hy4flash_gguf: portable acquire/release flag helpers (MSVC has no __atomic builtins) 2026-11-30 21:18:48 +01:00
Niko1221 ed1517a273 hy4flash_gguf: portable acquire/release flag helpers (MSVC has no __atomic builtins) 2026-11-30 21:15:44 +01:00
Niko1221 975ff02085 hy4flash_gguf: __nanosleep only where the architecture has it (sm_6x spins) 2026-11-30 21:08:33 +01:00
Niko1221 5a4c2fbdb2 hy4 clean-room decode: own decode kernels, act quantisers (rule D), own_decode.hpp (work in progress) 2026-11-30 21:08:33 +01:00
Niko1221 d24e8868e5 hy4flash_gguf: __nanosleep only where the architecture has it (sm_6x spins) 2026-11-30 21:08:15 +01:00
Niko1221 b193056eb2 hy4flash_gguf: __nanosleep only where the architecture has it (sm_6x spins) 2026-11-30 21:07:56 +01:00
Niko1221 ad26cd5894 Four headers no longer claim "The ggml authors"
moe_wave_plan.hpp, router_lookahead_v2.hpp, ssd_stream_scheduler.hpp and ink_cold_store.hpp carried a copyright line of the ggml authors above
their contributor's own. The token-shingle scan against llama.cpp at the pin finds no run of 60 tokens in any of them (at most 5 derived lines,
all idiom noise), and grep finds no ggml or llama.cpp text in them besides that line. The line is removed; the SPDX MIT line and the
contributor's and Strata contributors' lines stay.
2026-11-30 21:05:04 +01:00
Niko1221 90fba27843 hy4flash_gguf: __nanosleep only where the architecture has it (sm_6x spins) 2026-11-30 21:00:41 +01:00
Niko1221 dad6ae9ae6 hy4 clean-room: drop the MMQ/ggml prompt build and the llama.cpp hooks; own router and norm
- remove engine/src/hy4flash_gguf/mmq/*, cmake/hy4_flash_mmq.cmake (libstrata_kq, the NVFP4 objects),
  and revert the edit of the vendored strata-llama quantize.cu (tools/check_vendored.py passes again)
- STRATA_BUILD_HY4_FLASH defaults to OFF
- strata::hy4_flash::pgemm: the prompt-GEMM interface the engine calls, with a "not built" stub for now
  (every query says no, so the engine keeps its matvec / dequantise + cuBLAS paths)
- remove the dlopen hooks: STRATA_HY4_FLASH_REFERENCE_OPS_LIBRARY, DIAG_FA / DIAG_ROUTER / DIAG_NORM
  (no dlfcn.h left in the engine, including shared elementwise.cu, which is main's again)
- own sigmoid router (own/router.cu) with a float64 reference test; the fused publish variant is gone
- own RMS norm (own/norm.cu) replaces the block-per-row kernels added to elementwise.cu
- remove the H20-only q4_pair_reuse path and its llama.cpp-derived oracle; the fused HC rms+quantise
- NVTX markers only where the header exists (CUDA 13 without the nvtx package)
- own activation block (own/act_format.hpp, rule D) shared by the coming kernels
- tools/hy4_flash/clean_gate.py: run the engine per case and compare logit dumps (top-1, KL, greedy-identical)
2026-11-30 20:57:10 +01:00
Niko1221 be5ca8cde9 kernels: mla_latent_attn: slot bitmask, n_kv cap by q_pos, explicit n_split honoured exactly; tests
sel_mask / mask_words (per-token bit per slot, combined with every other rule), n_kv_cap_by_qpos (n_kv(t) = min(n_kv(t), q_pos[t] + 1) for verify windows that must equal one-token calls), an explicit n_split is no longer clamped by the number of units (the caller's merge expects that many chunks). Tests for both; 16K prefill shape in the bench.
2026-11-30 20:10:32 +01:00
Niko1221 b9447e7cab kernels: Strata's own absorbed-MLA latent attention kernel (SIMT fp32 + sm_80 tensor-core hi/lo split), split-K, f32/f16/Q8_0 cache
strata/kernels/mla_latent_attn.hpp + src/kernels/cuda/mla_latent_attn.cu (+ mla_latent_attn_tc.inc): one kernel family for decode,
multi-token verify, chunked prefill and sparse selection over a latent KV cache [c_lat | k_pe] (interleaved or separate k_pe array,
flat or paged).  Query token x 16 heads per block share each latent tile in shared memory; online softmax; round-robin split-K chunks
with an exact (max, denominator) merge, optional per-head sinks; kv_pos / q_pos / window visibility; n_kv as scalar, device scalar or
per-query array; device-scalar causal base for graph replay; per-query rows bit-identical to one-token calls (bit_exact_per_query).
Paths: scalar fp32 FMA (any sm_61+), tensor cores mma.sync m16n8k16 on sm_80+ with each fp32 operand split into fp16 hi + lo (about
fp32 accuracy, 3 products) or plain fp16 (fast, lossy); a generic one-head-per-block kernel for any R <= 1024.
tests/kernels: float64 reference tests per mode (decode / verify / prefill, f32 / f16 / Q8_0, paged, sparse, windows, sinks, split
counts, softmax-weight probes, bit-exactness) and a bench against Ling's original mla_attn.
Clean-room: designed from the maths and public CUDA / PTX documentation only.
2026-11-30 20:06:31 +01:00