Commit Graph
59 Commits
Author SHA1 Message Date
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 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 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 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 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 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 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 53f59c0640 engine: fix Windows WDDM VRAM paging, sm_89 defaults, gfx1200/RDNA4 crashes & NaNs, sm_70 V100 kernels, and MSVC CUDA LNK2005
- Windows WDDM VRAM safety floor & post-cache shrink (#6128, #5915): join warm_gemm_libraries before sizing, enforce per-tier WDDM discrete free-VRAM floors (>=1280 MiB >=16 GB, >=960 MiB 10-12 GB, >=640 MiB 6-8 GB, >=448 MiB 4 GB; opt-out STRATA_WDDM_VRAM_FLOOR=0), raise legacy --vision --vram-reserve-mib 700, reserve 384 MiB late-alloc headroom on WDDM, and include mtp_bind + prefill_mib + late_alloc in both sized_slots and post-memset shrink with 0 slack so Driver 595+/621.01 never pages VRAM to host RAM.
- Prefill chunk cap & sm_89 / multi-GPU tiny-cache fixes (#5199, #6509, #6208, #6431, #6583): keep bare --prefill auto at 8192 on <=16.5 GiB NVIDIA GPUs so prompt loans do not cannibalize hot expert slots; remove regressive STRATA_L2_PF=1 and conflicting STRATA_QFUSE=1 from sm_89 Ada defaults; extend tiny-cache (<25% resident) swap dampening and 25% Zipf-head pinning to multi-GPU layer splits.
- RX 9060 XT / gfx1200 RDNA4 fixes (#6254, #6526, #5162, #6127, #5649, #5718): serialize warm_gemm_libraries on Windows HIP to avoid amdhip64_7.dll/rocblas.dll cold-boot 0xC0000005; default DEBUG_HIP_DYNAMIC_QUEUES=0 before first HIP call (opt-out STRATA_HIP_DYNAMIC_QUEUES=1); use __builtin_memcpy in RDNA4 load_int_b2 and hoist Q6KTraits scales into registers to avoid gfx1200 NaNs; add STRATA_VERIFY_TIMEOUT_S (30s HIP default) with one-shot flag re-publish grace.
- Volta sm_70 opt-in bitwise kernels (PR#6603 STRATA_GR_V70, PR#6604 STRATA_Q8_V70) + PR#6505 cudaGetDevice error checks.
- Windows MSVC CUDA LNK2005 fix: default CMAKE_CUDA_RUNTIME_LIBRARY=Shared on MSVC across engine/cmake/backends/cuda.cmake and engine/src/inkling2/CMakeLists.txt so strata.exe and strata-inkling.exe link cleanly without cudart_static.lib/cudart.lib collisions.
2026-11-22 17:22:37 +01:00
Niko1221 adab4d45e0 Merge branch 'f-0220-new-issues' into f-0220-int 2026-11-22 16:24:45 +01:00
Niko1221 e3ef567e35 Merge branch 'f-0220-8g12g-qwen' into f-0220-int 2026-11-22 16:00:41 +01:00
Niko1221 63b73ba73f Merge branch 'f-0220-multigpu' into f-0220-int 2026-11-22 15:59:06 +01:00
Niko1221 d28c053e67 perf(low-vram): optimize 8 GB & 12 GB consumer GPUs and unlock 4 GB 0-slot mode 2026-11-22 15:57:43 +01:00
Niko1221 cc62949293 engine: fix multi-GPU usage race (#6560), PHB peer fault, SYCL stage_dev, #6427/#6501/#6504, and Win HIP split-2 2026-11-22 15:52:07 +01:00
Niko1221 dceb034d57 mtp: support native GGUF experts (Q4_0, IQ4_NL) in drafter (#6582) 2026-11-22 15:11:30 +01:00
Niko1221 ddca992850 Merge branch 'f-0220-nextgen' into f-0220-int
# Conflicts:
#	engine/src/hy4flash/run/hy4_gpu_model.hip.h
#	engine/src/hy4flash/run/hy4_main.hip.cpp
#	engine/src/inkling2/cuda/ink_hybrid.cuh
#	engine/src/inkling2/cuda/ink_runner.cuh
#	engine/src/inkling2/hip/ink_hip_backend.hip.cpp
#	engine/src/program/generate.cpp
2026-11-22 15:05:59 +01:00
Niko1221 1f6bd2d34b feat(ssd-stream): add 3-tier NVMe streaming and first-class GPU+SSD & CPU+SSD modes 2026-11-22 14:51:40 +01:00
Niko1221 14618d7d2f Merge branch 'f-0220-eng-q36' into f-0220-eng-fixes 2026-11-22 13:39:01 +01:00
Niko1221 3319f9e272 q36: support per-layer head_count_kv arrays (#6522) and staging headroom
Accept qwen35moe.attention.head_count_kv (and head_count) as either a scalar or a per-layer integer array of length block_count in both check_architecture_qwen35moe and geometry_from_gguf, resolving the non-zero full-attention head count (never blindly reading entry 0), tolerating feed_forward_length == 0 and optional nextn_predict_layers. Add optional headroom to OneSessionInput and HybridIn for card-0 driver/pinned-mapping overhead, plus CPU unit test q36_metadata_test wired into cpu-check.
2026-11-22 13:37:40 +01:00
Niko1221 64363f6809 Merge branch 'f-0220-eng-sycl' into f-0220-eng-fixes 2026-11-22 13:23:14 +01:00
Niko1221 534802c8dc engine: integrate #6406, #6529, #6550, #6523 and fix #6515, #6431, #6462, #6423, #6417, #6493, #6533, #6470 2026-11-22 13:23:13 +01:00
Niko1221 7aaa789a94 feat(nextgen): apply NextGen integration across engine, qwen35, hy4flash, and inkling2 2026-11-22 13:12:57 +01:00
Niko1221 1f1057b3f3 sycl: preserve message-boundary checkpoints for branching follow-ups (PR #6534, #6533) 2026-11-22 13:05:20 +01:00
Niko1221 0f1738e611 engine: integrate #6547, #6548, #6538, #6465 (batched MTP, QSA stream batch, persistent spill, bounded swap) 2026-11-22 13:02:10 +01:00
Niko1221 d1f409140c Merge f-0219-sm120: Blackwell sm_120, Ada sm_89, and Ampere sm_86 Flash-Next optimizations 2026-11-22 04:19:02 +01:00
Niko1221 a2ca43e53b cuda: sm_120/121/89/86 Wave-2+3 decode/prefill multipliers, partial-cache fix, and defaults 2026-11-22 02:27:43 +01:00
Niko1221 f8ebab6179 rdna3: keep STRATA_GDN_CHUNKED opt-in on discrete gfx11 (32.6x lower 4K KL) 2026-11-22 01:35:02 +01:00
Niko1221 c8c82e300a rdna3: fix STRATA_VERIFY_DEVICE_HITS alias in expert_source and keep opt-in on discrete gfx11 2026-11-22 01:05:25 +01:00
Niko1221 d31256b79d rdna3: Phase 3 CU-safe/WDDM-safe WMMA DFlash2, rdna_gr, rdna_mmvq, and GDN megakernel 2026-11-21 21:31:25 +01:00
Niko1221 34b82b5409 rdna3: Phase 1 WDDM coherent alloc, gfx1100-1151 defaults, and AVX512BW+VNNI ZMM dots 2026-11-21 21:31:24 +01:00
Niko1221 e78cd033ca cuda: add clean-room bit-plane LM head, INT8 TC dense GEMM, and mxf4nvf4 v2 2026-11-21 20:39:07 +01:00
Niko1221 a14c910fe6 Engine: rebase MIT sm_120a/sm_121a mxf4nvf4 prefill and partial-VRAM device hit planning onto 0.2.18 2026-11-21 19:48:39 +01:00
Niko1221 7c90399f4e Merge f-cg1-ram: a cgroup v1 limit credits the group's clean page cache in the RAM probe 2026-11-19 21:05:19 +01:00
Niko1221 c9f031dcd8 RAM probe: a cgroup v1 limit credits the group's clean page cache (a Docker container on a v1 host read "only 0.1 GiB of RAM is free")
detail::host_available_memory read a cgroup v1 limit as memory.limit_in_bytes - memory.usage_in_bytes. v1's usage_in_bytes charges the whole page cache, and the kernel
evicts that cache before it fails an allocation at the limit, so a container that had read its model through the file cache sat at its limit with its RAM to spare.
The v2 branch credits the group's clean file pages (and the conversation memory guard and the setup's Python probe credit them on v1 too); this branch did not.
Every figure built on it was short: the default CPU prompt share was "not armed by default: only 0.1 GiB of RAM is free" (the share needs 3.3 GiB), and the arena
verdicts, the resident-budget clamp and the file tier's room read the same number.

Measured on the rented RTX 5090 box (Vast 61335444: Docker, cgroup v1 hybrid, 171 GiB limit, 104 GB model, EPYC 9B14): limit - usage = 2.57 GiB with 99.9 GB of clean file
pages (total_inactive_file + total_active_file) in the group.

arena_cgroup_room_v1 (conversation_memory.cpp): room = limit - (usage - credit), credit = total_inactive_file + total_active_file - total_dirty - total_writeback, never more
than the usage, less min(credit / 2, limit / 64): the rule of the v2 container branch (arena_cgroup_room). shmem (in total_cache, on the anon lists) and mlocked pages are
not on the file lists, so they stay charged. A memory.stat without total_inactive_file or no memory.stat: no credit (limit - usage, as before). STRATA_MEM_CREDIT_INACTIVE=1
credits total_inactive_file alone. The v2 branches are unchanged.

Test: file_expert_source_test (test_host_memory) has the box's memory.stat / usage / limit (2026-11-19 19:01:37 UTC) in the hybrid fixture: the room was 2.57 GiB before and is
92.9 GiB now; memory_guard_test has the pure arena_cgroup_room_v1 cases (shmem, dirty, writeback, bound by the usage, no stat, inactive only).
2026-11-19 20:09:20 +01:00
Niko1221 ca99e886f7 STRATA_ADAPT_FETCH=2 is the default on compute capability 12.x CUDA cards with 16 GiB of memory or less
RTX 5050 / 5060 / 5060 Ti / 5070 / 5070 Ti / 5080 and the laptop parts. A card with more memory,
and every other vendor and architecture, keeps it off. A value the user sets (0 included) always wins;
STRATA_ADAPT_FETCH=0 is the way back, STRATA_SM120_PERF=0 and STRATA_DEFAULTS=026 leave it out with the
rest of the sm_120 table.

The switch is read once per process and only a one-card run uses it (a layer split, helper cards, a peer
tier and --batch turn it off), so the engine's main card (STRATA_PRIMARY_DEVICE) decides; its memory is
cudaDeviceProp::totalGlobalMem, read without making a context.

BW-9, 2x RTX 5060 Ti 16 GB, UD-Q4_K_XL, tail skip off, product flags, 3 paired rounds: decode +4 to +43%
by kind (medians 1.087 to 1.325), expert cache hit rate 54.4 -> 62.0%, forced-token KL against the FP16
prompt path 0.948 [0.830, 1.063] of the default's, prompts level except json 169 at +3 to +5%.

The start-up line of the sm_120 defaults names it and says it is not bit-exact; the lines that say the
switch cannot run in a given start (a layer split, --batch, ...) say the default is not used there.
Unit test adapt_fetch_default_test (the card rule, the table, apply_nv_defaults with the user's value,
the off switches); settings register: status default.
2026-11-19 19:22:00 +01:00
Niko1221 4a409b919b Serve: the first request's free-VRAM note is said only when the free memory fell since the start-up line or is under 512 MiB (item 17)
0.1.62 and before warned "only N MiB of VRAM free at the start of this request" at the first request of every start below 1 GiB (512 MiB off
Windows), also on a card the expert cache fills on purpose. The rule is now strata/core/vram_request_notice.hpp: say it below the safe figure
when the free memory is at least 64 MiB lower than the start-up line reported (generate.cpp keeps that figure in g_startup_vram_free_mib; the
request compares the same figure the start-up line prints) or is under 512 MiB; with no start-up figure the old rule stays. The text is the
owner-approved wording of TEXT-BATCH-0217 item 4 (Windows says "Windows", other systems "the driver"). Once per 128 MiB lower, as before.
Test: vram_request_notice_test (header-only, CPU). docs/DETAILS.md describes the new rule.
2026-11-19 16:24:56 +01:00
Niko1221 240aeb9858 [Engine] prefill tier sort, Volta WMMA, NVLink P2P peer prefill and stage hand-offs, P2P decode scatter (#6023)
From PR #6023 (midhatn; its engine commit 3440d4609), author kept. The engine, the unit test and the register entry are taken;
the PR's docs (docs/NVIDIA_V100.md rows, the bench report under docs/bench-results/) are not (they describe the mechanisms as
measured on 2x V100-SXM2 NVLink only). What the commit does:
- STRATA_MMQ_TIER_SORT=1 (opt-in): the experts of a prompt chunk go in readiness-tier order (VRAM, pinned RAM, file stager) and
  row-count order within a tier (mmq_resident_sort.hpp, mmq_resident_sort_test), in the staged walk, the layer-major walk and the
  peer's walk; under it an async P2P copy (cudaMemcpyPeerAsync + an event) hands a chunk's hidden state from one layer-split stage to
  the next;
- pf_wmma() (STRATA_PF_WMMA=1, opt-in) is no longer compiled out of an MMQ-free build;
- Prefill::set_peer() works on an MMQ-free build: int8 (q8_1 over P2P) or WMMA expert kernels on the peer card, the peer's gathers
  grouped (gather_native_group), the 35 % peer stream over every layer the peer can take;
- the decode peer's output goes straight into the primary's hit_out buffer over P2P (hit_out_dev), and the layer split's hand-off
  buffers sit in VRAM when two cards can reach each other;
- the staged walk's stream-ahead window counts pending copies (max_pending), the layer-major walk groups its gathers
  (STRATA_PREFILL_GROUP_GATHER, on unless 0).

This commit is the PR as it came; the next commit of this series turns the pieces that change a default (VRAM hand-off buffers,
decode scatter, tail-skip rules, layer-major group gather) into opt-in switches and says why.
2026-11-19 16:21:18 +01:00
Niko1221 d59c367522 verify window: one routing launch pair per layer for a non-native router, opt-in STRATA_ROUTE_WIN=1; a profile stamp for the routing (#3476)
From PR #3476 (pugolini; its commits 51d8370a8 and 70813d5b8), author kept; hand port, and the default is changed. The native router is
512 x 10 only, so a 256-expert model (Qwen3.8-Flash-Next Coder) took the per-token moe_route loop in the verify window,
a projection and top-k launch pair per token and layer. moe_route_window (one multi-column BF16 projection and one top-k per
layer, bitwise the per-token calls by route_window_parity) was reachable on gfx906 builds only; the PR made it the default on
every HIP card. Here the branch is compiled on every backend and route_window_on() keeps gfx906's default (on) and makes
every other backend opt-in (STRATA_ROUTE_WIN=1), because we have not repeated the PR's measurement (R9700, Coder IQ1_M,
--spec 4: routing 3.34 to 1.39 ms a window, decode +9%, same output hashes). Also taken from the PR: profile stamp slot 33
("router (proj+topk)", under STRATA_VERIFY_PROFILE=1) splits the routing from the plan / doorbell time, and
route_window_parity now covers T = 1..6. Unset, the launches on CUDA, HIP and Metal are the ones before. The name is in the
settings register (status research); the parity program on the R9700 is in the gate table.
2026-11-19 16:19:26 +01:00
Niko1221 6175deb948 MTP: --mtp-q4 head/all says so when no draft-head subset is installed (#4333)
From PR #4333 (xyzzing; its commit 9da37ce3e), author kept, changed from a refusal to a warning.
--mtp-q4 head (and all) requantizes the draft head's token subset, but make_q4_head() is only reached inside the
draft_vocab.bin branch of MtpDrafter::bind(). With no rt/draft_vocab.bin (and no --mtp-draft-vocab) the flag did
nothing and drafting ran over the full head, with no hint (the reporter lost a measurement window to it). bind() now
prints a line that names the missing subset and the fix (tools/draft_vocab.py, or --mtp-q4 proj). The PR made bind()
fail; here it only warns, because the setup config of some machines passes --mtp-q4 all and a pack without a subset
used to start (warnings over refusals). It stays silent for the shared-drafter path and for rebinds, as in the PR.
The usage line, the option comment and the set_q4 header comment state the requirement. Nothing else changes.
2026-11-19 16:19:23 +01:00
Niko1221 4ced1736e9 STRATA_TAP_FILE works on a layer split (#5748)
From PR #5748 (botBehavior; its commit 5d3f3cda6), author kept. STRATA_TAP_FILE (the residual-stream research dump)
was dropped without a message when the model ran on a layer split: Verifier::init cleared the path unless one verifier
held every layer. On a split each stage now parses STRATA_TAP_LAYERS (same rules as one card: sorted, unique, the last
layer excluded), keeps the layers inside its own range as the drafter's taps do, and the first stage opens the file,
writes the header with the whole layer list and, after the chain has run, gathers every stage's rows to the host
(gather_taps_host) and writes the window, on both the overlapped and the sequential return path. The file has the same
"STAP" v1 layout as one card. Two messages say so when the dump cannot be done (no layer in range; the drafter owns the
split's taps). With STRATA_TAP_FILE unset nothing new runs (tap_split_ stays false) and the one-card path is unchanged.
Author's check (2x RTX 5070 Ti, 2 stages): replies byte-identical with the dump on and off, rows against one card
at cosine 0.998 or more per layer in the median, no empty slots. Not run by us (it needs two cards and a model); the
CUDA build is checked on l620.
2026-11-19 16:19:20 +01:00
Niko1221 43e44ac3b7 Windows file tier: opt-in STRATA_BLOB_VERIFY re-reads each direct-read expert blob through a buffered handle and compares (#6166)
From PR #6166 (IvanAndreychikov; its commits 417611ae0 and 955198e42), author kept. A diagnostic for the non-finite
logits reports (#879, #6145): after the direct reader (read_direct) delivers an expert blob, the same byte ranges
are read twice through an independent buffered handle (one synchronous handle per thread and shard) and compared. A
mismatch is reported only when both buffered reads agree with each other and differ from the direct bytes, with the
shard, offsets, a hexdump and a third view from a read-only file mapping that says which side is wrong. A summary
line is printed at exit. STRATA_BLOB_VERIFY=1 arms it; STRATA_BLOB_VERIFY_DELAY_SEC holds it off during the start-up
fill. It is Windows-only code (the other systems compile to nothing), and unset it costs one atomic load per
blob. Both names are in the settings register (status research). Not run by us on a pack (no machine that shows the
fault); the Windows compile is checked on the owner PC build (see the gate table).
2026-11-19 16:19:19 +01:00
Niko1221 7e89e22cf7 Merge f-fix-win-eng (FIX-WIN engine, #3725) into f-eng-0163 2026-11-19 16:19:04 +01:00
Niko1221 0476b64aae Merge f-fix-gpu (FIX-GPU) into f-eng-0163 2026-11-19 16:19:01 +01:00
Niko1221 88b8578c3b Merge f-fix-eng (FIX-ENG) into f-eng-0163 2026-11-19 16:18:56 +01:00
Niko1221 87d20b7cc8 Merge f-tailskip-engine (engine: STRATA_ROUTE_TAIL_SKIP off when unset) into f-eng-0163 2026-11-19 16:18:53 +01:00
Niko1221 48a40d32f8 Merge f-bw-b (BW-B: GB10 sm_121 defaults) into f-eng-0163 2026-11-19 16:18:41 +01:00
Niko1221 15b55d5581 Windows HIP: --adapt-async 1 and STRATA_ADAPT_OVERLAP=1 are refused unless STRATA_WIN_HIP_RISKY=1 (#5672, #5738)
On an RX 7900 XTX (Windows, HIP) --adapt-async 1 ended long generations with a verify timeout and a display-driver reset every 1 to 3 long answers;
without it the same engine and config ran clean at the same speed (#5672). STRATA_ADAPT_OVERLAP=1 on a gfx1030 card (Windows, HIP) ended the first
request with a GPU fault and a display-driver timeout; it was confirmed on CUDA only (#5738). Both are opt-in. On a Windows HIP engine the engine now
starts with each of them off and prints one line saying why. STRATA_WIN_HIP_RISKY=1 takes both as asked and prints one warning line. Linux HIP, CUDA,
SYCL and Metal are unchanged.

Decision and the lines: include/strata/core/win_hip_risky.hpp; test win_hip_risky_test (both platforms, with and without the override, the lines).
The setting is registered with status research. STRATA_NUMA_BALANCING (the earlier HIP NUMA commit) was missing from the register and is added with
status default: tools/test_settings_register.py failed on it. Windows cannot be run here: the Windows branch is two constants and was compiled on
the HIP build only as the Linux side.
2026-11-19 13:59:21 +01:00
Niko1221 de7ba14078 Verify window capture: an error an earlier call left pending is said and cleared, not blamed on the capture's first launch (#5636)
On sm_70 / sm_75 the first verify-window capture ended the engine with "copy_i32_from_mapped launch: invalid argument" on a plain grid-stride copy,
deterministically on a 2080 Ti, and on a V100 only until STRATA_VERIFY_DEBUG=1 changed the calls in between. The launch wrappers read
cudaGetLastError(), which returns the first error since the last read from ANY call of the thread, so an earlier call that failed unchecked is
blamed on the next launch that is checked, and that check exits.

Verifier::capture (CUDA builds) now reads the slot before cudaStreamBeginCapture: a pending error is said once with its text and number ("a CUDA
error was already pending before the verify window's capture") and cleared when it is not sticky. A sticky error (illegal address, lost device)
stays and fails the calls after it as before. Nothing a launch inside the capture produces is cleared. HIP and Metal builds are untouched.

Test: pending_cuda_error_test (a failing cudaMemcpy leaves its error in the slot; take_pending_cuda_error returns it and the slot is empty after;
nothing pending changes nothing; needs a device, exit 77 without).
2026-11-19 11:36:29 +01:00
Niko1221 0e091d4f9f MTP: the draft head subset buffer holds the wider of the head's row and the Q4_0 row (#5841)
--mtp-q4 head|all rewrites the gathered draft-head subset in place as Q4_0 rows (n_embd / 32 * 18 bytes). bind() sized the buffer for the
head's own row, and an IQ4_XS head has the narrower row (1,360 bytes against 1,440 at n_embd 2560), so the host-to-device write went 8.1 MiB
past the buffer on a 106,299-token subset: "mtp: writing the draft head", engine exit 1 at load (GB10 defaults select --mtp-q4 all).

The buffer and the vram_ account now use mtp_draft_head_row_cap (strata/core/mtp_head_rule.hpp): the wider of the two rows. Formats at least
as wide as Q4_0 (Q6_K, Q8_0) and --mtp-q4 off are unchanged.

Test: mtp_head_rule_test (IQ4_XS 1,360 -> 1,440, wider formats and q4 off unchanged, n_embd not a multiple of 32).
2026-11-19 11:36:29 +01:00
Niko1221 ad9aa75973 RAM probe: a cgroup without a memory.max, or a path outside the mount, no longer ends with "cannot determine available memory" (#5196)
host_available_memory (the probe behind --resident-experts, --resident-budget-gib and the arena's RAM check) returned false on two cgroup v2 shapes
that carry no problem for the memory itself, and the engine then read every expert from the files (--mmap-experts) with RAM free:
- a group in the process's chain that has no memory.max (the memory controller is not switched on for it, as for many desktop session scopes): it
  counts as no limit of its own now, and the groups above it are still read;
- a container whose /proc/self/cgroup names the host's path while /sys/fs/cgroup is its own group (no cgroup namespace): the path is not in the
  mount, so the mount's root is read as the process's own group (on a real v2 host the root has no limit, MemAvailable alone).
An unreadable or malformed limit still fails, and the failure now names what could not be read (HostMemory::why), appended in brackets to the three
"cannot determine available memory for ..." messages (the texts keep their start).

Test: file_expert_source_test (test_host_memory): a controllerless child, the parent's limit above it, a path outside the mount with and without a
limit on the mount's root, an unreadable memory.max. The cases that expected a failure for the first two shapes are replaced.
2026-11-19 11:24:56 +01:00
Niko1221 8d92f0a388 HIP: the arch choices of the prompt path and the drafters are made per card, not by the first card that asks (#4431)
gr_upmix (prefill/kernels.cu) cached "this card has gfx11 matrix cores" in a function-level static, so on a layer split over an RX 7900 XTX (gfx1100)
and an RX 9070 XT (gfx1201) the card that reached it first decided for both: with the gfx1100 stage first, the gfx1201 stage launched the gfx11 kernel
and the first prompt died with "prefill gr_mix_r: no kernel image is available for execution on the device" (the error check after it names the next
kernel, not the bad launch). The same one-answer-for-all-cards form decided the fused hyper-connection read (STRATA_QFUSE_HC default, verify.cpp), the
DFlash2 Q4 kernel pick (dflash2.cu) and the MTP drafter's stream priority (mtp.cpp), all on "is this a gfx12 card". Each now asks once per device
ordinal through strata::core::PerDeviceFlag; the environment overrides still win for every card.

Test per_device_flag_test (host only, fake arch table: a gfx1100 first then a gfx1201, and the reverse); --legacy is the process-wide form, registered
WILL_FAIL. On a single card nothing changes: identity gate on the R9700 (gfx1201) in RESULTS-0217-FIXGPU.md. Not run on a mixed gfx11 + gfx12 pair: none here.
2026-11-19 11:10:57 +01:00