Commit Graph
70 Commits
Author SHA1 Message Date
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 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 3d69a1d3b2 cuda: harden NVFP4 decode/prefill and accelerate all Unsloth quants 2026-11-22 19:19:31 +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 40fa01b31e hy4flash: enable multi-GPU across CUDA, AMD HIP, Intel SYCL, and DGX Spark (#6562, #6565, #6568) 2026-11-22 15:52:06 +01:00
Niko1221 307ccd1bab sm_86: reserve split lend regions before cold complement tail under RAM budget (#6583) 2026-11-22 15:41:53 +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 26123922c7 nvfp4: fix sm_120 prefill grid limit (#6576) and grouped down scale (#6577) 2026-11-22 15:05:07 +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 1a2b551ea4 Merge branch 'f-0220-ink-msycl-gguf' into f-0220-int 2026-11-22 14:26:52 +01:00
Niko1221 7031ccaf95 inkling2+hy4: auto-default L0-V1 for Arc B70 oneMKL & native GPU GGUF/safetensors loading on Metal/SYCL/HIP 2026-11-22 14:24:41 +01:00
Niko1221 44710df59b engine: fix #6489 sm_86/89 staged 128-row prefill tile, #6487 warmup error masking, and update settings register 2026-11-22 13:43:00 +01:00
Niko1221 7aaa789a94 feat(nextgen): apply NextGen integration across engine, qwen35, hy4flash, and inkling2 2026-11-22 13:12:57 +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 c0e6168506 Merge f-0219-rdna3 Wave-2: NVFP4 WMMA prefill, em0=8 LDS decode, and gfx1151 Windows defaults 2026-11-22 02:57:18 +01:00
Niko1221 ce2a51b2eb cuda/prefill: add MIT sm_120a/121a dense_fp4_tc and upgrade moe_fp4_tc v4 2026-11-22 02:27:43 +01:00
Niko1221 7c3f971e11 rdna3: Wave-2 NVFP4 WMMA prefill, IQ2_XS/NVFP4 LDS decode, staged h11p, and gfx1151 Win defaults 2026-11-22 02:23:22 +01:00
Niko1221 c0e8cfa042 Merge branch 'f-0219-ink-hip' into f-0219-int 2026-11-22 01:30:11 +01:00
Niko1221 431a26db11 cuda/cpu: sm_120 & sm_86 prefill, decode, DFlash2 TC, and default stack optimizations
Add clean-room MIT Blackwell (sm_120) and Ampere (sm_86) speedups for Qwen3.8-Flash-Next across IQ3_S, UD-Q4_K_XL, and NVFP4 with zero quality loss (STRATA_ROUTE_TAIL_SKIP=0; force_check.py PASS -0.042 pts, 0 events):

- Prefill pipeline & CPU pool:
  - Warm CUDA GEMM libraries at init to remove cold cuBLAS stall (2.4-3.8x faster TTFT).
  - Pre-pin cpu_x/cpu_rows/cpu_ones + dedicated async cpu_x_stream D2H and ExpertPool::run_range parallel native_quant_act (host grouping 81->7 ms on RTX 5090, 114->16 ms on RTX 3090).
  - Parallelize in-memory PleTable::gather_batch across up to 8 threads and skip per-row madvise syscalls when --ple-io ram already faulted pages (eliminates ~40 ms FP8 PLE stall on NVFP4).
  - Upgrade x86 AVX-512 VNNI dot_nvfp4_q8_0 to mul_sum_i8_pairs_float and register ENTRY(NVFP4, Q8_0, nvfp4_q8_0) (138-147 GB/s CPU pool BW; quant_selftest PASS).
  - Optimize sm_120a/sm_121a mxf4nvf4 MoE prefill v3 (NT=256, single-pass TR=64, coalesced loads, 0 spills, 1.37x at T=8192).
- Decode & DFlash2 verification:
  - Add clean-room sm_80+ BF16 Tensor Core DFlash2 attention (2.1x faster attention, -0.10 to -0.20 ms/round drafting).
  - Fix native_mmvq launch_multi chunking (>8 cols, 0 cuda_spill_guard spills) and keep interleaved native_mmvq_il for ncols 1..8 while routing ncols 9..16 to dense_i8_tc (with WARPS=1 small-N specialization).
  - Hoist Split<TG>::load outside NTC loop in native_gu_fused_kernel and extend to Q4_K, Q5_K, and NVFP4; add opt-in coalesced sm_120a nvfp4_decode_sm120 (STRATA_NVFP4_DEC_SM120=1) and opt-in vhead_bitplane (STRATA_VHEAD_BITPLANE=1) with out_nonfinite support.
  - Default sm_80+ Q8_0 HC to exact-FP32-activation gr_down_q8_fast + gr_up_q8_fast (0 KLD loss; opt-in INT8 TC via STRATA_HC_Q8_TC=1/2).
- Defaults & tests:
  - Enable verified sm_120 and sm_86 defaults in nv_defaults.cpp (with STRATA_VERIFY_DEVICE_HITS=1 + auto pcie_frac=0 on >16 GiB single-GPU cards, preserving ADAPT_FETCH=2 on <=16 GiB cards) and update nv_defaults_test.cpp.
2026-11-21 23:10:29 +01:00
Niko1221 199ecbd7ec inkling2: complete multi-gen AMD ROCm/HIP backend (RDNA4, RDNA3/3.5, 780M/890M/Strix Halo, RDNA2) 2026-11-21 21:20:54 +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 1f5f53e140 inkling2: add standalone strata-inkling v1.1 engine, 1..64 batching, vision, and serving
Add .strata v1.1 reader/codecs (SF4, MX8, paired 2-row S_K, vram_load_order), standalone strata-inkling shape-engine binary with 1..64 continuous slot batching (FP16/FP8 paged SWA-1024 + Global KV, compact ShortConv pool, DSpark speculative verify with exact per-step ShortConv rollback), 23-layer Vision ViT shard support, o200k tokenizer + ignore_merges, Jinja generation tag extension, InklingOutputParser, and StrataEngine parallel=64 integration.
2026-11-21 20:27:58 +01:00
Niko1221 b60658cae5 hip: first-class Radeon 780M (gfx1103) and Strix Point (gfx1150) iGPU support with UMA coherent GTT allocation and <=1s TDR/MES guards 2026-11-21 19:58:13 +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 8601e766b3 Merge f-hy4-int (Hy4-Flash Strata side and runner base) into the 0.2.18 branch 2026-11-20 00:15:23 +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 de17f306f7 Merge f-hy4-run (933b9bfd3: Hy4-Flash .strata reader, S_K codecs, Engram reader, gfx1151 runner) into the 0.2.17 release candidate
The merge is clean: every file of f-hy4-run is new on top of the candidate except
engine/include/strata/artifact/model_family.hpp (+6) and engine/cmake/backends/quant.cmake (+3).
2026-11-19 20:51:34 +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 f705bf0a81 Merge f-bw-h (link-aware CPU prompt share limit) into the 0.2.17 release candidate
f-bw-h (a620ffb61, 595d40922) and f-bw-f (38e6a0506) both arm the CPU prefill
share on a layer split. One conflict, engine/src/program/generate.cpp, the
share arming block of the serve start-up, resolved to one rule:

- BW-H first: on a layer split the stages' stream floors are summed; where the
  link rule raises the limit above 3,072 (Prefill::arm_cpu_share_split) it arms
  the share by itself and sets the limit and the expert width. This is what arms
  a split of three or more cards, and it gives a two-card split with a slow link
  its larger limit.
- BW-F second: arm_cpu_share(share_pool, share_pool && share_layout &&
  share_has_work): one card, or exactly two CUDA cards (STRATA_SPLIT_CPU_SHARE=0,
  kSplitShareDefault), armed by default with the default limit. A two-card split
  of fast links therefore keeps the share armed, as BW-F measured it.
- set_card_expert_share takes pool.workers() (BW-H) in the one-card condition.
- BW-F's start-up line is kept.

docs/SETTINGS.md is generated (conflict only in its table): regenerated from the
register.
2026-11-19 19:48:39 +01:00
Niko1221 ae4239aca6 Merge f-bw-f (two-card CPU prefill share by default) into the 0.2.17 release candidate 2026-11-19 18:55:56 +01:00
Niko1221 a620ffb619 CPU prompt share: the limit and the expert width follow the card's PCIe link (compute capability 12.0 default, STRATA_PREFILL_CPU_SHARE_AUTO=0 to get 3,072 / 8 back)
The default share took chunks up to 3,072 tokens and experts of at most 8 tokens, a setting measured on one 28 GB/s link.  A chunk from the limit up streams every expert the card does not hold in
one pass whose time F (bytes of the missing experts / the link) does not depend on the chunk length; the staged walk with the share grows with it, so the share pays up to a length T* that
grows with F.  RTX 5090 cards, UD-Q4_K_XL (8,056 of 24,576 experts on the card), 3 interleaved rounds, the share with 32-token experts against the default: T* 4.2K tokens at 53.6 GB/s (15 pool
workers), 8.8K at 28.3 GB/s (22), 14.0K at 14.1 GB/s (32), 19.7K (32-token experts) / 25K (64-token experts) at 3.6 GB/s; 8 pool workers 7.7K, 16 workers 8.5K (22: 8.8K).  At 53.6 GB/s the
default 3,072 beats streaming by 25-34% from 1,536 tokens and above ~4K staged equals streamed, so the rule never goes below 3,072.

share_rules.hpp link_rule(): limit = 3.4 x F (ms) tokens up to F = 3.67 s, +0.76 tokens per ms of F above it, between 3,072 and 20,480, scaled by (workers / 22)^0.15 for smaller pools; experts of
up to 32 tokens (64 from F = 3 s) where the limit is raised.  Prefill::set_card_expert_share takes the pool's workers; arm_cpu_share applies the rule to the default-armed share only (an explicit
STRATA_PREFILL_CPU_SHARE, STRATA_PREFILL_CPU_SHARE_MAX and STRATA_PREFILL_CPU_SHARE_NT keep their meaning) and prints one "CPU share rule:" line.  STRATA_PREFILL_CPU_SHARE_AUTO: unset = cc 12.0
discrete cards with the link probed, 1 = any CUDA card, any other value = off.  Settings register, docs, unit tests (share_rules_test) updated.
2026-11-19 17:28:01 +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 38e6a05061 Layer split of two CUDA cards: the CPU prefill share is armed by default, as on one card (STRATA_SPLIT_CPU_SHARE=0 turns it off)
Until now the default CPU prefill share (idle pool takes some of the experts a prompt chunk would stream over PCIe, chunks up to 3,072 tokens) was armed on one card only.
A layer split streamed every expert of every short prompt over PCIe, stage after stage, so a prompt of 32 to 566 tokens took 1.4 to 1.8 times as long on two
RTX 5060 Ti 16 GB as on one (UD-Q4_K_XL, DFlash2, PCIe 4.0 x8, 48 cores). The stages already take the pool one at a time (prefill.cpp), and
STRATA_PREFILL_CPU_SHARE=auto works on a split; only the default was missing.

share_rules.hpp: default_share_layout(later_stages, multi_gpu, env, cuda): one card as before; one later stage (two cards) on a CUDA build by default, the
switch both ways; three and four cards, the helper caches and HIP / SYCL builds stay off. generate.cpp (serve): the H11 memory check and arm_cpu_share use it,
one start-up line says so. share_rules_test: the layout table.

Prompt ms, two cards, default share off against on (3 rounds, tail skip off): 32 tokens 605 -> 268, 64: 825 -> 384, 84: 1,193 -> 489, 169: 1,680 -> 669,
566: 3,188 -> 1,574, 1,024: 2,869 -> 1,754, 2,048: 4,547 -> 2,512; 4,096 and longer are above the limit (+2%). Details and the KL gate: phaseA-tests/bw/RESULTS-BW-F.md.
2026-11-19 16:23:40 +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 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 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