Commit Graph
8504 Commits
Author SHA1 Message Date
Niko1221 6bdebbedf5 fix(setup): the Inkling expert caps are rounded up, so a plan that holds every expert in the card never leaves the last ones on the host
setup wrote --vram-experts-gb / --ram-experts-gb with "%.2f" of the plan's GiB, rounded to nearest. A plan that fills the card with every expert
sits exactly on the experts' bytes, so any rounding down (or a table that is a little low) cuts the last expert off: rc0 on an RTX 5090, UD-Q4_K_XL,
wrote --vram-experts-gb 14.42 (the table's 15.48 GB; the file's experts are 15.80 GB) and the engine loaded 3034 experts on the card and 38 on the
host, the hybrid path (hyb=1).

Measured on the 5090 (strata-inkling, same binary, drafter off, one request): with the 0.2.20 flags (--vram-experts-gb 15.48) all 3072 experts
resident, prefill 4264 tok/s on a 4096-token prompt, decode 136; with rc0's flags 38 on the host, prefill 3968 (-6.9%), decode 131.6-132.0 (-3.3%);
with the cap written by this commit (14.76 GiB) all 3072 resident again, prefill 4257, decode 131.7-132.0. Greedy tokens are identical in the three
(the host experts are not what changed the fingerprint GRID saw).

- setup.inkling_expert_flags: both caps are rounded UP to the 0.01 GiB the flag carries; a plan with every expert in the card (full_vram) gets 0.05
  GiB of slack (about 11 experts).
- test_inkling_fit_free: no figure is rounded below itself; UD-Q4_K_XL on a 32 GB card gets a cap of at least its real 15.80 GB + 0.05 and less than
  5% more.
2026-11-23 18:25:48 +01:00
Niko1221 617aa3f607 fix(setup): the Inkling planner no longer charges the GGUF drafter file on top of the drafter's scratch on a discrete card
The planner budgeted the DSpark drafter at 0.25 GB of scratch plus, for a GGUF build, 0.40 GB for dspark-*.gguf: 0.65 GB. Measured on an RTX 3060 Ti
8 GB (7.66 GiB free, ctx 32768, screen reserve, the same plan with the drafter off and on, strata-inkling 'dev11'): the engine places 81 fewer
experts for SQ-10 (968 -> 887, 0.23 GB) and 41 fewer for UD-Q4_K_XL (489 -> 448, 0.19 GB) with the drafter on, its ledger says `DSpark took 78-80
MiB`, and it answered a 8000-token prompt with 455 MiB free. The GGUF drafter's weights are part of the trunk the loader already reads (and the
calibrated dense share), so on a discrete card only the scratch is a further cost: a GGUF plan with the drafter on was 0.45 GB too small for the card.
Unified memory still counts the file (it holds everything), the download size still counts it.

- inkling_fit.compute(): dense_total no longer adds DSPARK_GGUF_GB.
- tests/terminal/test_inkling_fit_dspark.py: the planner's off -> on difference equals what the engine gave up (SQ-10 0.23 GB, UD-Q4_K_XL 0.19 GB,
  within 0.12 GB), the GGUF and SQ charges are equal, unified memory and the download size still count the file.

Not taken: DSPARK's figures of +0.86 GiB (GGUF) to +1.0 GiB (SQ) loaded, 1.0-1.2 GiB at peak: on a card with room the runner sizes its workspaces to
the free memory (max_batch tiers at 1200 / 2200 MiB free), so a delta of used memory measures what the engine chose to take, not what it needs;
on the tight card, where the planner has to be right, the engine's own placement is the measure.
2026-11-23 15:53:57 +01:00
Niko1221 c43678bf23 fix(inkling2/cuda): the FP4 sm_120 file gets sm_120a also when the architectures come from CMAKE_CUDA_ARCHITECTURES ("120-real")
ink_moe_fp4_sm120.cu uses the block-scaled FP4 MMA, which only exists for the arch-specific targets sm_120a / sm_121a. cuda/CMakeLists.txt mapped
120 -> 120a (121 -> 121a) only when STRATA_INK_CUDA_ARCHS held the bare number. A build that inherits CMAKE_CUDA_ARCHITECTURES such as
"61-real;120-real;89-real" (build_cuda_linux.sh does not pass STRATA_INK_CUDA_ARCHS; the INTEG and GRID builds hit it) matched nothing, built the
file for plain compute_120 and ptxas failed ("mma with block scale not supported on sm_120").

- ink_sm120a.cmake: ink_sm120a_archs() maps every entry of the form 12[01]a?(-real|-virtual)? to 12[01]a with the suffix kept
  (120 -> 120a, 120-real -> 120a-real, 120-virtual -> 120a-virtual, 121-real -> 121a-real); other entries drop out; a list without a Blackwell
  entry is returned as it is. cuda/CMakeLists.txt calls it instead of the inline loop. The other CUDA files keep the list as it was given.
- tests/cmake/ink_sm120a_test.cmake (ctest ink_sm120a_cmake, cmake -P, no compiler): 13 cases, among them "61-real;120-real;89-real" ->
  "120a-real" and "75-real;86-real;89-real;120-real;120-virtual" -> "120a-real;120a-virtual".
- Configure check on a CUDA 12.8 box, CMAKE_CUDA_ARCHITECTURES="61-real;120-real;89-real", no STRATA_INK_CUDA_ARCHS: the FP4 file's gencode was
  compute_120 before and is compute_120a after; ink_cuda_backend.cu keeps compute_61 / 89 / 120.
2026-11-23 15:50:49 +01:00
Niko1221 d528772fc3 fix(inkling2): a BF16 / F16 mtp.safetensors drafter had its norm weights, biases and fuse_weight read as F32 garbage (0 percent of the drafted tokens accepted)
The CUDA drafter reads dspark.*norm*.weight, the biases and dspark.fuse_weight as F32 (the Q8_0 GGUF path widens them while loading).
The safetensors paths (an external mtp.safetensors beside a GGUF, and the official Inkling-2-Mini folder) copied them as the file stores
them, BF16, so the drafter read the BF16 bytes as floats. Measured on an RTX 3090, UD-Q4_K_XL with the BF16 mtp.safetensors:
0 of 1592 drafted tokens accepted on code, 45 tok/s against 85 with the drafter off; with the Unsloth Q8_0 drafter 44 percent accepted.

Both loaders now widen BF16 / F16 vectors (rank 1, "norm", "bias", "fuse_weight") to F32 as they are placed in the trunk section;
2-D weights stay BF16. Header strata/core/ink_widen.hpp, test ink_widen_test (no GPU).
2026-11-23 15:40:24 +01:00
Niko1221 5b23b78b4f fix(setup): the Inkling planner counts what N request slots cost on each backend, names the largest N that fits, and takes the GGUF sizes from the files
Three corrections to inkling_fit.py, each against measurements:

1. --parallel N. An Arc A750 8 GB crashed at --parallel 32 (dalloc 256 MiB, 0 of 3072 experts in VRAM) because the plan treated every backend like
   CUDA. Read from the engines' allocation code: SYCL gives every slot its K/V at the full context in FP16 up front (slots x ctx x 32 KiB, no FP8,
   no paging, no host K/V; 34 GB at 32 slots x 32K) plus drafter K/V per slot; CUDA and HIP keep a 4096-token window on the device; the workspaces
   grow from 8 slots. non_expert_gb / global_kv_gb / kv_cache_gb / dspark_gb / swa_sconv_gb / auto_fp8_kv take the backend. New
   max_parallel(...) returns the largest N that fits at the context (and the largest context at which the requested N fits) with a plain sentence:
   "--parallel 32 does not fit at a context of 32768 tokens on this sycl setup: the largest count that fits is 1". parallel_fits(...) is the check;
   the plan's kv_fits now counts the per-slot growth over one slot (the measured one-slot start-up on a 4 GiB card is unchanged).
2. The host K/V of N slots. Measured on the real CUDA engine (RTX 3060, SQ-10, ctx 32768, N = 4, 8, 16, 32, 64: all start and answer): the mapped host
   K/V is every slot's whole context (3.4 GiB at 4 slots, 31.7 GiB at 64 slots FP8); the plan counted a 4096-token window per slot from 16 slots
   (8x too small). global_kv_total_gb() is used for the host share and the RAM check; the planner's per-slot VRAM cost now follows the engine's memory
   ledger within 0.5 GiB (test AgainstTheEngine holds the measured numbers).
3. GGUF sizes. bodies_gb was approximated (UD-IQ4_XS 13.68, UD-Q4_K_XL 15.48 GB) and cut the experts the plan could place short by 1-3%: the real
   routed-expert bytes come from the GGUF headers (14.04 / 15.80 GB); on the RTX 4090 the plan's cap left 83 and 38 experts on the host. dense_gb
   for GGUF builds is the card share of the BF16-expanded 3.93 GB trunk, calibrated on what the engine placed with the planner's flags (RTX 3060 Ti
   7.66 GiB free: 2.24 GB placed, plan 2.35; RTX 3060 11.63 GiB free: 6.62 GB, plan 6.62; UD-IQ4_XS and UD-Q4_K_XL alike): 2.45 GB. It has to be
   re-calibrated when the loader keeps Q8_0 tensors as they are in the file.

Tests: test_inkling_fit_slots.py (per-backend slot cost, the A750 case, largest N, monotonic in card and context, the engine's measured ledger and host
K/V), updated expectations in test_inkling_fit.py (UD-Q2_K_XL needs 0.05 GB more than a 16 GiB unified pool, from its real expert bytes).
2026-11-23 15:13:57 +01:00
Niko1221 8c2afbc2bf fix(inkling): the GGUF loader gives the mapped pages of a tensor back once it is copied, halving peak RSS (UD-IQ4_XS 28 -> 14 GiB, UD-Q4_K_XL 32 -> 15 GiB)
The GGUF is mmapped read-only (strata::GgufFile) and every tensor is copied out of the mapping: the trunk into the arena, each expert into a
VRAM upload buffer or the host expert arena. The mapped pages stayed in the resident set after the copy, so the file (15.7 GB UD-IQ4_XS,
17.6 GB UD-Q4_K_XL) sat next to the copies. Peak RSS was 28-36 GiB with 7-13 GiB of experts in RAM, which does not fit a 32 GB machine.

- strata/core/mapped_pages.hpp: release_mapped_pages(p, n) drops the whole pages inside [p, p + n) from the process (madvise MADV_DONTNEED on
  Linux, VirtualUnlock to trim the working set on Windows; rounded inward so a neighbour's page is never dropped). The pages stay in the OS
  page cache, reclaimable, and fault back in on a later read, so only the double count goes. STRATA_INK_KEEP_MAPPED_PAGES=1 turns it off.
- ink_gguf_loader.h: read_expert_body releases the gate/up/down source ranges after copying them (both the NVFP4 -> SF4 repack and the GGUF_RAW
  copy); the trunk, drafter and vision tensors (every tensor without _exps) are released once sec1_arena holds them.
- tests/core/mapped_pages_test.cpp: a 64 MB mapping touched in full drops from 67 MB to 3.5 MB resident, unaligned ends round inward, and the
  data reads back unchanged (Linux, -O0 and -O2).
- The .strata and safetensors loaders read with fread / ifstream and never map the file: SQ-10 / SQ-20 peaked at 3.3 / 13.5 GiB on the 12 GB
  card, which is the plan's RAM share plus the trunk and the CUDA runtime.

Measured on an RTX 3060 12 GB (planner-sized plans, ctx 32768, drafter off, same plan before and after): UD-IQ4_XS peak RSS 28.4 -> 13.8 GiB,
UD-Q4_K_XL 31.8 -> 15.5 GiB; first-prompt, 128-token, 8000-token tokens identical on every step; decode 11.5 / 7.7 -> 11.4 / 7.9 tok/s and
8.2 / 6.2 -> 8.3 / 6.2 tok/s (unchanged), prefill 217 -> 216 and 195 -> 195 tok/s.
2026-11-23 14:38:15 +01:00
Niko1221 4a612c8bd8 fix(setup): the Inkling planner sizes GGUF experts by their converted size on backends that convert them at load (#6729)
HIP, SYCL and Metal run no native kernel for most GGUF expert types: ink_gguf_transcode.h turns them into S4_K (types of 4 bits per weight or
less), S6_K (Q5_*, Q6_K) or S8_K (Q8_*, F16, BF16) while loading; NVFP4 stays a bit-exact SF4 copy. An IQ1_S expert grows from 1.56 to 4.19
bits per weight (2.7x). The planner counted the file size, so on those backends part of the experts had no place in the plan.

- inkling_fit.py: every GGUF build carries its routed-expert element count per ggml type (read from the GGUF headers of the ten Unsloth
  builds); bodies_gb_for(build, backend) returns the file size for CUDA / CPU / no backend and the converted size for hip, sycl and metal.
  compute() and compute_unified() use it (the unified path gets the backend from place()).
- Converted expert bodies of the builds on HIP: UD-IQ1_S 5.96 -> 11.7 GB (x1.96), UD-IQ1_M x1.89, UD-IQ2_XXS x1.78, UD-Q2_K_XL x1.64,
  UD-IQ3_XXS x1.27, UD-Q3_K_XL x1.10, the NVFP4 builds (UD-IQ4_XS, UD-Q4_K_M, UD-Q4_K_XL) about 1.0, UD-Q8_K_XL x0.80 (BF16 -> S8_K).
- test_inkling_fit_converted.py: the rule per backend, the plan on HIP puts the converted size (CUDA the file size), a build that fits a 12 GiB
  card whole on CUDA goes hybrid on HIP, the unified path counts it; two tests read ink_gguf_transcode.h and sk_codecs.hpp and fail when the
  planner's copy of the type -> code rule or the superblock sizes drifts from the engine's.
2026-11-23 14:29:44 +01:00
Niko1221 ec46ef3b13 fix(inkling): capability checks are per device, so a mixed-architecture split runs each card's own kernels (#6808 #6796)
On a layer or expert split ink_has_int8_tc(), ink_has_wmma_f16() and sm120::available() cached their answer in one process-wide static, filled
on the first call, which happens on stage 0. A later stage on a different architecture then ran stage 0's kernel path: an sm_86 stage ran the
sm_120 FP4 MoE kernels (corrupted prompt states, malformed tool calls, #6808), an sm_60 stage the INT8 tensor-core kernels (wrong logits, #6796).
Decode (M < 24) uses other kernels, which is why short answers still looked right.

- strata/core/ink_caps.hpp: PerDeviceFlag (one cached answer per device index) and the pure capability rules, so a test can feed two capability sets.
- ink_moe_cuda.cuh / ink_moe_fp4_sm120.cu: the three checks index their cache by cudaGetDevice(); the WMMA shared-memory carveout is set per device.
- ink_runner.cuh: the loop-controller GEMM took TF32 / the FP16 tensor-core path from the FIRST card's compute capability (m.sm_cc); it now uses the
  capability of the stage that runs it (the static analysis in #6796 pointed at exactly this).
- tests/core/ink_caps_test.cpp: sm_120 then sm_86, sm_86 then sm_60 and the reverse, Volta/Turing/Ampere; each device is asked once.

The cache-per-device approach and the three call sites come from the report and tested patch in #6808 by markie1006; #6796 by Darkstarrd-dev
found the loop-controller use of m.sm_cc. Single-card behaviour is unchanged: same greedy tokens as before on an RTX 3060 Ti (sm_86) and on an
RTX PRO 5000 (sm_120, sm120_tc=1 in the load line).
2026-11-23 14:10:21 +01:00
Niko1221 58076a5239 fix(setup): the Inkling recommendation stays "quality"; "balanced" (everything in the card) is opt-in
The previous planner commit made the default choice the best build whose experts all sit in the card, which falls back to SQ-10 on 8 and 12 GB
cards. The owner prefers the bigger builds (UD-Q4_K_XL, IQ, SQ-20) and wants the speed of experts held in RAM fixed in the engine, not traded
away by the recommendation. recommend() keeps preference="quality" as its default (the thresholds it had: SQ-20 from 22 GiB free, SQ-15 from
11 GiB free with enough RAM, else SQ-10); preference="balanced" (alias "speed") is the opt-in. The free-memory, margin, screen reserve and GiB
changes stay. The tests that named the default now name the preference.
2026-11-23 13:31:22 +01:00
Niko1221 26476337d7 feat(inkling2/cuda): STATS reports the expert-cache hit rate of decode
The hybrid path (experts partly in RAM) already looks at every routed expert on the batched path (M <= 16, decode and short prefill chunks).
It now counts them: expert_selections (every routed expert) and expert_misses (the ones not in the card, served from RAM or SSD); STATS prints
both, so a run can state the hit rate = 1 - misses / selections between two STATS lines (the share of routed experts served from the card).
BackendStats gets the two fields (0 where a backend does not count). The count is a host-side integer increment per routed expert in a loop
that already runs, no extra copy or sync.
2026-11-23 13:14:59 +01:00
Niko1221 8f7a4c81fb feat(setup): inkling_fit.max_context() and a K/V-fits check; a bigger build on a smaller card is planned, not refused
Inkling-2-Mini is a MoE (about 3.4B active of 26.4B): with the experts that do not fit the card held in RAM, every build starts on an
8 / 12 / 16 GB card; the question is speed and context, not "does the file fit". The planner already moved experts to RAM; two things were missing:

- inkling_fit.max_context(build, free VRAM, RAM, ...): the largest context at which the build starts with no expert on SSD, from the free
  memory with the margin and the screen reserve (the K/V goes to RAM first, as the engine does by itself).
- compute() reports "kv_fits": a context whose K/V stays in the card (no RAM for it) must fit the card beside the dense weights even with every
  expert in RAM. Before, a 1M-token context on a 4 GiB card was reported as fitting while its K/V alone is 33 GB.

Tests in test_inkling_fit_free.py: every build gets at least 32K on 4 / 8 / 12 / 16 GiB, the context follows the free RAM, a K/V that fits
neither the card nor RAM is flagged, a screen reserve never raises the context.
2026-11-23 13:14:59 +01:00
Niko1221 7a1467e217 fix(setup): the Inkling planner works from the memory that is free, keeps a margin and a screen reserve, and writes GiB (#6662 #6644 #6792 #6739)
- The card: setup already hands the planner min(total, free) of nvidia-smi (effective_vram_gb); a layer split over several cards now sums
  the FREE memory too, not the sizes.
- RAM: new setup.ram_free_gb() (Windows available physical memory; Linux MemAvailable, in a container the cgroup limit minus its use; macOS
  free + inactive pages). The planner (strata_control/inkling_fit.py: ram_free_gib) keeps the experts held in RAM inside the free RAM minus
  1.5 GB; what does not fit streams from disk and is said so, instead of overcommitting.
- A card that drives a display keeps a larger reserve (desktop=True, 0.8 GB, from gpu_drives_display), so the 8 GiB card of #6739 no longer
  ends with 159 MiB free; the margin VRAM_SAFETY_GB (0.3 GB) is explicit and VRAM_DRIVER_GB is recalibrated to what the engine's memory ledger
  measures (1.30 instead of 1.60 with the margin inside), so a headless card gets the plans that were measured to start (0.4-0.5 GiB left).
- The flags: the planner counts GB, strata-inkling reads --vram-experts-gb / --ram-experts-gb as GiB; setup wrote the GB number, so the
  engine's cap sat 7.4% above the plan. inkling_expert_flags() converts.
- Default choice (preference "balanced"): the best build whose experts all sit in the card (the K/V may be in RAM), else SQ-10; the older
  "quality" choice (a bigger build with part of its experts in RAM) stays available. Measured on an RTX 3060 12 GB, drafter off: SQ-10 all in
  the card 34-38 tok/s; SQ-10 with 2.6 GB in RAM 10 tok/s; SQ-15 with 4.7 GB in RAM 4-8 tok/s. With the backend named "cuda" the planner puts
  SQ-15 fully in a 16 GiB card with the K/V in RAM (the engine does it itself there; A4000 16 GB started with 0.4 GiB left); an unnamed
  backend or HIP keeps the older, more cautious rule (#6613).

Tests: test_inkling_fit_free.py (margin, screen reserve, free-RAM cap, unknown free RAM, GiB flags, ram_free_gb on Linux and in a container,
the plan inputs); test_inkling_fit.py follows the new default.
2026-11-23 13:05:15 +01:00
Niko1221 a8371d27fa fix(inkling2, hy4): say plainly when the binary has no GPU code for the card, before anything loads (#6759)
A CUDA engine binary is built for a list of architectures (the CUDA 13 packages: sm_75 and newer; the CUDA 12 ones also
sm_60/61/70). On a card it holds no code for, the weights load and the first kernel fails; strata-inkling then ended with a
misleading "CUDA error 2 (out of memory)" in the loader, and a binary that gets past that (lazy module loading, as under
volta-forever) leaves the logits at 0 and answers token id 0 forever, with no error.

strata/core/arch_probe.hpp builds the message; strata-inkling (ink_cuda_backend.cu) and strata-hy4 (hy4_main.hip.cpp, CUDA
builds, serve and CLI, every GPU named) ask CUDA for the attributes of a probe kernel (cudaFuncGetAttributes), which answers
for the whole binary, and end with: "this strata-inkling has no GPU code for <card> (compute capability X.Y): <cuda error>.
<way out>" (a Pascal / Volta card: the CUDA 12 engine package or a CUDA 12.x build with -DSTRATA_EXPERIMENTAL_SM60=ON; else
the package made for the card or a rebuild for that architecture). strata (generate.cpp, the Qwen engine) already did this
(device_code_error()).

Test arch_probe_test (no GPU): the message names engine, card, compute capability, CUDA error and the way out; the Volta
text appears only below 7.5.

Measured on an RTX 4090 (sm_89) with binaries built for sm_120 only (no SASS for the card, PTX compute_120 cannot run on it):
- strata-inkling, origin/main: "strata-inkling CUDA error 2 at ink_runner.cuh:322: out of memory", exit 1.
- strata-inkling, this change: "init: this strata-inkling has no GPU code for NVIDIA GeForce RTX 4090 (compute capability 8.9):
  invalid resource handle. Use the engine package made for this card ... -DCMAKE_CUDA_ARCHITECTURES=89", exit 1, nothing loaded.
- strata-hy4, origin/main: no mention of the card (it goes on to read the model); this change: the same message, as an
  "ERR ..." line in --serve and on stderr in the CLI, exit 1.
2026-11-23 12:20:56 +01:00
Niko1221 859276060a fix(inkling2/cuda): a start-up allocation that does not fit gets a smaller workspace and a clear message, not "CUDA error 2 at ink_cuda.cuh:54" (#6644 #6792)
After the experts are placed, the runner, the K/V and the DSpark drafter allocate their buffers. When one of them did not fit
the engine ended with "strata-inkling CUDA error 2 (out of memory) at ink_cuda.cuh:54", which says neither how much was asked
for nor how much the card had.

- the message now reads "... (allocating 39 MiB; 22 of 11910 MiB free)" (ink_alloc_failed);
- while the backend initialises, a failed allocation throws InkAllocFailure instead of ending the process; the backend then
  retries the runner with the prefill chunk halved (512 > 256 > 128 > 64) and, if the drafter does not fit, runs without it
  ("DSpark drafter turned off ..."); only when even chunk 64 does not fit does start-up end, with a message that names the
  smaller context / --vram-experts-gb / other programs as the way out;
- a memory ledger line is logged: "[InkCUDA] memory: N MiB free after load, runner+KV took N MiB (max_batch=..), DSpark took N MiB, N MiB free now";
- test hook STRATA_INK_TEST_STEAL_MIB=N (holds N MiB after the experts are placed), switch STRATA_INK_OOM_RETRY=0 (old behaviour).

Measured on an RTX 3060 12 GB, SQ-10, 16K context, DSpark on, with N MiB held after the experts were placed (902 MiB free):
- STRATA_INK_OOM_RETRY=0: "CUDA error 2 ... ink_moe_cuda.cuh:131 (allocating 39 MiB; 22 of 11910 MiB free)", the engine ends.
- default: chunk 512 and 256 fail, chunk 128 starts (max_batch=128, 110 MiB left), the answers are the same tokens as an unconstrained run.
With 1102 MiB free the existing rule that lowers max_batch below 1200 MiB already copes (both settings start).
On an unconstrained 3060 / A4000 / 4090 the ledger shows 400-500 MiB free after start-up on a planned 12 GB card, and nothing changes.
2026-11-23 12:20:55 +01:00
Niko1221 1178074aa0 hardening(inkling2/cuda): choose the .strata fast loader by the file's real kind, not by the manifest's format string (#6643 #6597)
"init: Invalid .strata magic (expected STRATA\x00\x01)" came from handing a GGUF to the .strata reader. Since 0.2.20
(b02efbd48) the loader no longer does that, and origin/main loads GGUF files on CUDA (RTX 3060 12 GB:
`strata-inkling --serve --native Inkling-2-Mini-UD-Q2_K_XL.gguf --max-context 16384 --draft off` loads and answers),
so #6643 does not reproduce on main.

InkCudaModel::load_from_model_file() still decided by `mf.m.format.rfind("strata", 0) == 0`, a string from the file's
own manifest. InkModelFile::is_native_strata() now says it from how the file was opened (kind == Strata), so a GGUF or
safetensors file can never reach StrataFileReader whatever its metadata says.
2026-11-23 12:20:55 +01:00
Niko1221 1e800fd204 fix(inkling2/cuda): grow the global K/V when the net growth fits, not only when the whole new K/V fits (#6770 #6755)
ensure_global_kv_cap() compared the free memory with the WHOLE new K/V (global visits x slots x new capacity), as if
the old K/V were not already in the card. When the plan leaves room for the full context, that check refuses at about
half of it; the request then fails (and on a fatal path the engine ends) with gigabytes still free.

The 8 global visits grow one at a time (allocate the new buffer, copy, free the old one), so the card needs the net
growth of every visit plus the one old visit that is still held: strata/core/ink_kv_grow.hpp
(ink_kv_next_cap / ink_kv_grow_peak_bytes / ink_kv_grow_fits / ink_kv_grow_target), used by the runner.

Test ink_kv_grow_test (no GPU) models the growth loop with room planned for 131072 tokens: the old rule stops at
73728, the new one reaches 131072; also a card with room for 3/4 of the context, and the full / tight / none targets.

Checked on an RTX 4090 with 9.8 GB held back (SQ-10, --kv fp16 --kv-offload off --max-context 131072, planned context
51584, prompts of 20000, 30000, 45000 tokens):
- origin/main: the K/V stops growing at 32768 tokens (63% of the plan): "VRAM exhausted growing elastic global KV cache
  to 33071 tokens", the engine ends, the 45000-token request is lost.
- this change: the K/V grows 8192 > 16384 > ... > 49152, the 45000-token request is answered; prompts above the planned
  51584 get "prompt length out of range" and the engine stays up.
2026-11-23 12:20:55 +01:00
Niko1221 fd203ddf6a fix(inkling2/cuda): do not reuse a stale converted X buffer between mixed-format attention projections (#6788)
From PR #6788 by @paperniuk.

On Inkling-2-Mini-SQ-15 the attention weights of one layer are in two formats (wq_du and gate_attn
Q8_ROW; wr_du, wk_dv and wv_dv BF16). linear_multi() ran them one by one with reuse_x_bf16 = (i > 0),
which assumes the first projection already converted X into d_x_bf16; the Q8_ROW GEMV never does, so the
BF16 GEMMs read whatever an earlier GEMM had left there. The same prompt then answered differently
depending on what ran before it (prefill M = 4..16).

linear_x_cache_fmt() says which format linear() converts X into for a weight, linear_cached() reuses the
buffer only when it already holds that format; used in the linear_multi() fallback and in the M > 16 QKV
block. The pre-quantized Q8_ROW path checks cur_moe_ws and the xq_sk capacity like linear() does.

Checked here on three cards: SQ-15, prompts of 15, 19, 15 (and more) tokens, greedy, --draft off. On
origin/main the 15-token prompt answers with one token repeated (6648, 24757, 68911 ... depending on the card)
or a different text on every repeat; with this change every run gives the same right answer
(140215, 68014, 68025, 220, 16, 13 ...), 4 and 2 repeats identical.
- Tesla V100 16 GB (sm_70, the FP16 attention path), so the PR fixes Volta too, not only sm_120.
- RTX 3060 12 GB (sm_86), 9 prompts of 8..19 tokens, 4 repeats of the 15-token one.
- RTX 4090 24 GB (sm_89), 25000 and 40000 token prompts give the same tokens as origin/main.
2026-11-23 11:19:41 +01:00
Niko1221 de3cb634a0 fix(inkling2): put the "dspark." prefix on drafter tensors from a GGUF or mtp.safetensors (#6762 #6784 #6717)
A drafter that comes from Unsloth's dspark-Inkling-2-Mini-*.gguf or from mtp.safetensors
carried plain tensor names ("layers.0.self_attn.o_proj.weight", "fuse_weight", ...), while the
CUDA, SYCL and Metal runners ask for "dspark.<name>" (the .strata spelling). The engine
stopped at load with: missing tensor 'dspark.layers.0.self_attn.o_proj.weight'.

The two loaders now name every drafter tensor "dspark.<name>"; the GGUF name map moved to
strata/core/ink_names.hpp (ink_dspark_name / ink_dspark_plain_from_gguf), so a test can
check all 54 tensors of the real dspark GGUF against what the runners look up
(ink_names_test, no GPU). CPU, HIP and the dual-GPU backend already strip the prefix.

Checked on an RTX 3060 12 GB (sm_86), Unsloth UD-Q2_K_XL + dspark Q8_0: origin/main stops with the
error above, this build loads, answers, and gives the same tokens as with --draft off.
2026-11-23 10:56:59 +01:00
Niko1221 f65f2d614b README: line the Linger sponsor logo up with Olares
Both sponsor logos are centred on the line (align="middle"), and the Linger wordmark files get 88 units of empty space above the artwork, so the tops and the bottom lines of the two wordmarks match in light and dark mode (checked in a headless render).
2026-11-23 09:58:56 +01:00
Niko1221 e8bab87288 README: add the Linger (heylinger.com) sponsor logo next to Olares, in all languages
Both wordmarks are in docs/media/sponsors: the site's own file for light backgrounds and a white-ink copy for dark mode (the site has no light version); the provenance is in docs/media/sponsors/README.md.
2026-11-23 09:42:13 +01:00
Niko1221 73d4f4196c fix(tools,tests): sequence-order MCP install cancel on Windows and align POSIX/Docker CI checks 2026-11-23 03:12:29 +01:00
Niko1221 94e1fc4fbf fix(tests,docs): register STRATA_PREFILL_RAM_RESERVE_MIB and prefer Git usr/bin in test_docker_files 2026-11-23 02:12:25 +01:00
Niko1221 ff7a77bfbe Merge branch 'f-p2-serve': Pass 2 serve verification and fixes 2026-11-23 01:45:38 +01:00
Niko1221 6bd3485dac fix(serve): fix check_model & /v1/models schema, Hy4/Inkling UI effort, Inkling quoted tags (#6675/#6680/#6682/#6686), and SYCL sampling_keys test (#6610) 2026-11-23 01:44:10 +01:00
Niko1221 575f42d316 Merge branch 'f-p2-tui-cli': Pass 2 verification and fixes 2026-11-23 01:35:21 +01:00
Niko1221 c7f69def84 Merge branch 'f-p2-gui': Pass 2 verification and fixes 2026-11-23 01:35:20 +01:00
Niko1221 26ec63b1d1 Merge branch 'f-p2-engine': Pass 2 verification and fixes 2026-11-23 01:35:20 +01:00
Niko1221 ef0eb8a4f9 Merge branch 'f-p2-docker': Pass 2 verification and fixes 2026-11-23 01:35:19 +01:00
Niko1221 00810bdd98 fix(tui,cli,setup): align prompt-cache-spread snapshots, Intel Arc SYCL Inkling/Hy4, GGUF import, drafting/KV guards, multi-GPU & free VRAM, and CI test suite 2026-11-23 01:33:57 +01:00
Niko1221 ae8ea9d420 fix(gui): clamp Hy4-Flash reasoning effort, overhaul QuestionCard UX, drain chat saves on shutdown, and fix SECURITY.md links 2026-11-23 01:12:02 +01:00
Niko1221 759ccf6c68 fix(engine): harden hy4 vcache headroom, inkling2 Metal/HIP/SYCL/CUDA guards, GGUF layout, and CMake checks 2026-11-23 01:10:33 +01:00
Niko1221 db4b257754 fix(docker): fix MODEL_PATH validation, package shape engines in Dockerfile.src, update docs to 0.2.20 2026-11-23 01:04:51 +01:00
Niko1221 923e2df4d0 docs: add Hy4-Flash, Inkling 2 Mini, and Olares sponsor across README and all translations 2026-11-23 00:18:31 +01:00
Niko1221 a34979fc94 fix(hip): use hipblaslt_ext::getKernelNameFromAlgo in gemm.cu on ROCm 10.2+ v0.2.20 2026-11-22 22:07:41 +01:00
Niko1221 0435d69504 fix(hip): fix rdna_mmvq.cu header order and link strata_kernels_cpu in strata_split_df2 2026-11-22 21:58:33 +01:00
Niko1221 2e87c08db1 Release Strata 0.2.20 (Control and engines 0.1.66) 2026-11-22 20:46:53 +01:00
Niko1221 5ea521afe4 Wire RDNA2-4 HIP Unsloth WMMA/DP4A dispatch, v_perm LUT16, and settings register 2026-11-22 20:02:36 +01:00
Niko1221 f962c5b075 Merge branch 'f-0220-unsloth-xplat': Unsloth and NVFP4 acceleration across Metal, SYCL, and HIP RDNA2-4 2026-11-22 19:54:23 +01:00
Niko1221 9e3ad2778f Accelerate Unsloth quants and NVFP4 across Metal, SYCL, and HIP RDNA2-4
Add first-class Unsloth quant (Q2_K, Q3_K, Q4_K, Q5_K, Q6_K, Q8_0, IQ4_XS, IQ3_XXS) and NVFP4 (type 40) support and optimizations across Apple Silicon Metal, Intel Arc SYCL, and AMD RDNA2/3/3.5/4 HIP backends:

- Metal (engine/metal/): Add T_IQ3_XXS, T_Q2_K, T_Q3_K, T_Q8_0, and T_NVFP4 across quant, units (incl. STRATA_METAL_F16), mma, dense_mm, gemv, gemvu, gr (BF16+F32 inject), moe, moeu, and moe_mm (v1/v2/v3/v4/v6 ragged tiles + halved-load W8 for IQ4_XS/IQ4_NL), plus host dispatch (window.cpp, prompt_chain.inc, moe_tiles.h, ref_quant) and parity suites.
- SYCL (engine/sycl/): Add full NVFP4 (40) decode/dequant/combine with exact s_gate/s_up/s_down tail scales in all branches, hoisted Split<TY>/KqSplit<TY> across all Unsloth/NVFP4 types, opt-in SYCL EXP_MODE=8 with had_block==0 guard, SG16 XMX SLM decoders for Q4_K/Q5_K/Q6_K/IQ4_XS/NVFP4, and expanded parity suites.
- HIP (engine/include/strata/kernels/hip_unsloth_*.hpp, engine/src/kernels/hip/): Add clean-room RDNA2/3/3.5/4 Wave32 DP4A + hoisted HipSplit<TY> + fused EXP_MODE=8 (had_block==0 guard, 65535-safe grid striding, exact NVFP4 tail scales) and unified gfx11/gfx12 Wave32 WMMA FP16/BF16/INT8 + fused dequant-to-LDS prefill kernels with standalone 5-arch verification harness.
2026-11-22 19:51:03 +01:00
Niko1221 5d9539b054 native_expert_parity: compare raw block dequantizers before NVFP4 tail scale 2026-11-22 19:45:35 +01:00
Niko1221 5cf4cd3343 Align Q36 expert type mirror, offline split-engine probe, quiet_crash_env, and app snapshot goldens 2026-11-22 19:43:49 +01:00
Niko1221 e3fe30f755 Merge branch 'f-0220-nvfp4-cuda': NVFP4 decode/prefill fixes and CUDA Unsloth quant acceleration 2026-11-22 19:22:05 +01:00
Niko1221 3d69a1d3b2 cuda: harden NVFP4 decode/prefill and accelerate all Unsloth quants 2026-11-22 19:19:31 +01:00
Niko1221 a1d08e033f Merge branch 'f-0220-unsloth-ink': lossless Unsloth GGUF acceleration and fixes for #6580, #6612..#6633 2026-11-22 19:14:08 +01:00
Niko1221 4aaa1cbdcd inkling2: accelerate Unsloth GGUF quants and fix issues #6580/#6612-#6633
- Native lossless FMT_GGUF_RAW execution across CUDA (vectorized DP4A Q8_1
  multi-token M=1..16 kernels), HIP (FP16/WMMA grouped kernels), Metal
  (simdgroup_matrix + multi-token reuse), SYCL (SG16 + XMX DPAS), and CPU
  (strata::quant runtime-CPUID SIMD Q8_K/Q8_0 dots); removes lossy SF4
  repacking for host-spilled GGUF experts.
- Fix #6633: engage DSpark speculative decoding for greedy and sampled
  requests in --serve, report drafting=dspark in INFO and 9-field DONE
  counters, shrink initial DSpark global KV on tight VRAM, and detect
  --draft dspark in inkling_kind/drafting/server.
- Fix #6631: translate GUI/TUI multi-GPU main/helper roles into --gpus and
  --layer-split auto for Inkling-2-Mini.
- Fix #6630: split Metal Section 4 into <=maxBufferLength multi-buffer chunks
  (sec4_bufs[4] + chunk_idx) so SQ-15/SQ-20 experts past 1 buffer never
  fault to token 0.
- Fix #6627/#6620/#6612: align Inkling chat prompt suffix with closed empty
  thought span, guard loop detector against structured YAML/JSON, and add
  slot prompt-end checkpointing (ShortConv + SWA KV + DSpark) for multi-turn
  prefix reuse.
- Fix #6618: isolate AVX2/FMA host kernels into ink_host_avx2.cpp behind
  runtime CPUID dispatch and honor STRATA_ISA_FLOOR across Inkling CMake.
- Fix #6617: reserve and allocate 2x ping-pong prefill staging buffers before
  d_sec4 and pinned host arena and clear ws.y_pair on M>=2 hybrid MoE.
- Fix #6613/#6621: clamp HIP KV grow_pool with host-mapped fallback, add
  WDDM FP8 auto-KV + chunk capping, tighten Radeon 16 GB fit headroom across
  all 13 builds x 4-128 GB tiers, and reject mismatched Strata catalog model
  IDs (+ opt-in --strict-model).
- Fix #6580: size HIP per-expert MoE scratch to B*top_k with chunking and
  bounds checks, fix SYCL CpuGroup pair overflow, and NaN-harden top-k8
  routers across HIP, Metal, and SYCL.
2026-11-22 19:13:12 +01:00
Niko1221 c53f8e54cd Merge branch 'f-0220-unsloth-tiers': 5.6x-6.0x SIMD quantize_q8_K, Unsloth CPU dot speedups, and 4GB-32GB/UMA tier fit 2026-11-22 19:12:14 +01:00
Niko1221 4414c29887 Optimize Unsloth CPU SIMD quant kernels and all-tier VRAM/RAM planning
Vectorize quantize_q8_K across AVX2, isolated AVX-512, and ARM64 NEON; optimize cold-expert dot and dot_x4 kernels (Q4_K, Q5_K, Q6_K, Q8_0, IQ4_XS, IQ3_XXS, IQ3_S) with 0 EVEX zmm leakage in AVX2 TUs; add #4870 coverage-based adaptive cache defaults (2/192/0.92 for 15%-65% coverage) and heterogeneous Unsloth slot sizing in generate.cpp; add #6354 auto int8 KV + elastic --kv-resident, 4/6 GB discrete unlock, and full discrete/UMA tier planner + test suite.
2026-11-22 19:10:57 +01:00
Niko1221 bbced6d490 Merge branch 'f-0220-sweep-6629': fix #6614, #6619, #6623, #6626, #6628, #6629, and #4891 2026-11-22 18:54:58 +01:00
Niko1221 41aa4c850c Fix #6623, #6614, #6619, #4891, #6629, #6628, and #6626 sweep 2026-11-22 18:53:59 +01:00
Niko1221 b02efbd48e inkling2: match strata-v1.1 format in fast loader/SSD cap and align HELLO/GEN max_ctx 2026-11-22 18:30:38 +01:00