Commit Graph
100 Commits
Author SHA1 Message Date
Niko1221 2ec7c34432 Merge f-own-4x 9e19948ff into f-own-int (round 16: Gyro trellis experts on the fused prompt path, opt-in STRATA_PF_FUSED_TQ=1; the golden dot test's fixed draw order) 2026-11-11 10:21:39 +01:00
Niko1221 9e19948ff9 split: the golden dot test draws its q8_1 scale and sum in a fixed order (same inputs under g++ and clang)
The split tools built each q8_1 block's ds with two random draws as the two arguments of one call:
    b.ds = make_half2(__float2half((float) (rng() % 1000) / 500.0f), __float2half((float) ((int) (rng() % 200) - 100)));
C++ leaves the order of those arguments unspecified: g++ (the host compiler under nvcc) drew s first, clang (HIP) d first, so a HIP
build of split_qdot_golden saw other inputs than the ones qdot_golden.txt was written from (all 176 groups "inputs differ"). Every other
input byte, the struct sizes and host __float2half (checked against a round-to-nearest-even reference over all 2^32 floats) were equal
in both builds. Now s is drawn first, then d, into named locals - g++'s order, so qdot_golden.txt and the CUDA inputs are unchanged:
- src/split/tools/qdot_golden.cuh:83 (make_inputs, the generator of the golden file and of the check)
- src/split/tools/qdot_test.cu:100 (the oracle test's own copy of the draws)
- src/split/tools/iqdot_test.cu:63 (the same draws)

Test code only; no engine source changes.

Checks:
- RTX PRO 5000 (sm_120): split_qdot_test --write-golden output byte-identical to the committed qdot_golden.txt; 0 of 704,512 dots
  differ from ggml; --regen-golden equal; split_qdot_golden 0 of 176 groups differ.
- RTX A4000 (sm_86): the same four results.
- AMD Radeon AI PRO R9700 (gfx1201, HIP build of split_qdot_golden): 0 of 176 groups differ from the unchanged file's cuda lines, so the
  HIP dots equal the CUDA dots bit for bit and the file needs no hip line; with one Q8_0 dot's arithmetic changed
  (d8_0*d8_1*sumi -> d8_0*(d8_1*sumi)) the check fails (rc 1, Q8_0 groups differ, Q4_0 / Q5_1 still equal).
- Not run: the Windows MSVC build of these files (owed).
2026-11-11 07:09:47 +01:00
Niko1221 41a63c5502 Merge f-own-4x c915680bd into f-own-int (round 15: opt-in Q8_0-down, Q8_0 gate/up and Q6_K fused prompt kernels, the leaner Q6_K loads, the split engine's golden dot test; not the trellis side branch) 2026-11-11 04:43:16 +01:00
Niko1221 878ddd8523 split: stored reference digests for the decode dots (qdot_golden.txt) and their check without ggml (split_qdot_golden)
Own-stack phase 4 (the split engine's own dot code). src/split/src/qdot.cuh is checked today only by split_qdot_test, which compares it with
ggml-cuda's vecdotq.cuh and so goes when the vendored ggml tree goes. This commit adds the check that stays: reference digests written once
by the oracle and a test that needs no ggml. Test code and a data file only: no file of a shipped split target changes.

- src/split/tools/qdot_golden.cuh (new, no ggml): the inputs of the 11 formats the split runs (Q4_0 Q5_1 Q8_0 Q4_K Q5_K Q6_K IQ4_NL IQ4_XS
  IQ3_S IQ3_XXS IQ2_S) drawn from fixed seeds (the same draws as split_qdot_test's), the dots run on the card in the decode kernels' call
  order (kbx, iqs = vdr x lane), groups of 4,096 dots, FNV-1a 64-bit digests of the inputs and of each group's float bits; the file format.
- src/split/tools/qdot_golden.txt (new, 10,098 bytes, 176 groups, 704,512 dots): one line a group, "<family> <format> <group> <dots>
  <input digest> <output digest> [% reason]". Family cuda holds every group; another toolchain family (hip) gets a line only where its bits
  differ, with the measured reason after '%' (none yet: HIP not checked). Written on an RTX PRO 5000 (sm_120, CUDA 13.2, the split's
  --use_fast_math flags).
- src/split/tools/qdot_test.cu: --write-golden <file> (writes only when every dot of qdot.cuh equals ggml's bit for bit on those inputs)
  and --regen-golden <file> (the cuda lines and the header must come out byte for byte as stored).
- src/split/tools/qdot_golden.cu (new) -> split_qdot_golden <file> [--family cuda|hip]: the check; names every differing group
  (format, group, its dots), exit 1 on a difference, 77 without a GPU.
- src/split/CMakeLists.txt: target split_qdot_golden and ctest split_qdot_golden (SKIP_RETURN_CODE 77), CUDA only for now (the HIP build
  gets it once its bits were compared on a card).

Checks (RTX PRO 5000): writer 704,512 dots against ggml, 0 differ; regeneration byte for byte equal; split_qdot_golden PASS 176 / 176
groups; negative check: a scratch build with one dot's arithmetic changed (qdot.cuh Q8_0 impl d8_0*d8_1*sumi -> d8_0*(d8_1*sumi)) FAILS
and names the 32 Q8_0 groups, every other format passes.
2026-11-11 01:31:07 +01:00
Niko1221 0678792490 Merge f-memlock-split 4aa298595 into f-own-int (round 14: the split engine locks its host-read tables as far as the machine allows, never a failed start) 2026-11-11 00:18:56 +01:00
Niko1221 4aa298595c split: the memory-lock log lines are final (owner's wording of 11-11), placeholder markers removed
The sentences of lock_line() and the "locked" / "read" in RAM lines stay byte for byte as they were; only the two
comments that called them placeholders change (memlock.hpp, memlock_test.cpp). No behaviour change.
2026-11-11 00:13:01 +01:00
Niko1221 dedb0b1be2 split: the host-read tables are locked as far as the machine allows (PLE table first), never a failed start
model.cpp: lock_in_ram (CUDA: threw when mlock failed, so a default Linux account with a small memory-lock limit could not start the split engine and fell back to the layer split; HIP: tolerated, but said 'locked' regardless) is replaced by lock_tables (memlock.hpp), the same rule for both builds: the soft limit raised as far as the hard limit allows, the free RAM respected, the PLE table locked first and the token embedding second (measured: with the unlocked pages dropped, the token embedding alone gives no gain), the rest read into memory, one log line when not everything is locked, and the 'locked in RAM' line says 'read' when it is not.
2026-11-10 19:16:41 +01:00
Niko1221 9257f5f034 split: memlock.hpp, locking the host-read tables as far as the machine allows, with its unit test
Header only (Linux, CUDA and HIP builds alike): raise the memory-lock soft limit as far as the hard limit allows, budget = min(limit left, MemAvailable - reserve), lock the parts in the order given, read the rest in with the same 16 threads, never throw, one log line when not everything is locked. The reserve (4 GiB or 5% of the RAM) is a named constant and a choice, not a measurement. The log sentences are placeholders for the owner's wording. Unit test split_memlock_test: plan, injected mlock (works / fails / runs out), the words, a real mlock under a lowered RLIMIT_MEMLOCK in a child process, the soft-limit raise. Not used by the engine yet.
2026-11-10 19:16:41 +01:00
Niko1221 58414f3ec8 split: own decode dots (src/qdot.cuh), no ggml-cuda header in the engine
The split engine (strata-split-N, split_fnx_run, the test tools) no longer includes ggml-cuda's common.cuh / vecdotq.cuh or ggml.h.
Its 11 quantized decode dots (Q4_0, Q5_1, Q8_0, Q4_K, Q5_K, Q6_K, IQ4_NL, IQ4_XS, IQ3_S, IQ3_XXS, IQ2_S), their helpers, the dp4a,
the HIP saturating byte subtract and the qk/qi traits now live in src/split/src/qdot.cuh: llama.cpp's vecdotq.cuh / common.cuh /
vendors/hip.h text at the vendored pin 3cf03257 (MIT, origin and licence in the file header), names only changed. Block layouts and
tables come from third_party/strata-ggml/strata-quant-common.h. The main engine's own copies (iq_kernels.cu) are not used: their
Q5_1 and Q4_0 dots compute differently on purpose and would change the split's tokens.

- ggml_type / GGML_TYPE_* / ggml_cuda_type_traits / ggml_cuda_dp4a -> GgmlType / T_* / qtraits / qd_dp4a in the split's sources
- kernels.cu, moe_mma.cu: the HIP #undef block for ggml's vendor header is gone (nothing of ggml's to make room for)
- iqdot_hip.cuh inside namespace fnx; iqdot_test compares against qdot.cuh's dots
- CMake: split targets see only third_party/strata-ggml (the quant header); the vecdotq.cuh check and GGML_USE_HIP are gone
- new split_qdot_test (CUDA, STRATA_BUILD_TESTS): every dot against vecdotq.cuh, bit for bit; the one split target that still
  includes ggml-cuda, as the oracle, and goes with the vendored tree

No behaviour change: SASS of strata-split-2 (3,095 kernels), split_fnx_run, split_moe_tile_test and split_gdn_tc_test identical
before/after on sm_86 with CUDA 13.1 (kernel names demangled, the format enum normalised); nothing outside src/split rebuilt;
split_qdot_test 0 of 46.1 M dots differ on an RTX A4000. HIP build not run yet.
2026-11-10 11:19:37 +01:00
Niko1221 067b4dda5f Vendor the ggml sources the engines build into third_party/strata-ggml
ggml-base, ggml-cpu (x86, Arm) and the ggml-cuda MMQ headers, quantizer and
instances the engines compile, frozen at llama.cpp 3cf03257 with the MIT
licence, UPSTREAM.md (file list with sha256) and tools/check_vendored.py.
The layout is llama.cpp's, so CMake takes ${root}/ggml from the vendored tree
by default (root, sycl, metal, split) and no longer fetches llama.cpp.
-DSTRATA_GGML_DIR=<checkout> stays as an override. Only ggml/CMakeLists.txt and
ggml/src/CMakeLists.txt differ from upstream (trimmed to ggml-base + CPU).
2026-11-08 14:43:03 +01:00
Niko1221 cf0161bfb3 Give the two standalone drivers optional build targets (cleanup 4.4)
src/dsv41/sampler_stat_main.cu -> target ds4_sampler_stat (CUDA, inside the
STRATA_BUILD_DSV41 block, EXCLUDE_FROM_ALL): the DeepSeek sampler statistics
harness that the Metal engine and `strata-dsv41 --sampler-test` compile from
the same sampler_stat.inc.
src/split/tools/selftest_main.cpp -> target strata-split-selftest (HIP,
inside the split engine's CMake, EXCLUDE_FROM_ALL): the split engine's kernel
self-test on one card, with no model. Its header cited a build script in a
private test folder; it now names the target.
Both are built by name only: nothing in the default build changes.
2026-11-07 16:28:46 +01:00
Niko1221 a7cc8faa5d split: one constant for the expert window floor, and the IQ3_S pool test
EXPERT_WINDOW_SLOTS (2 * MAXT * TOPK) is the slots a size pool must hold for one window's picks to have a place; ExpertCache's check, the residency
planner's floor and the arena's keep all read it. expert_residency_test now also covers the GSQ-RCO IQ3_S set's real pools (7, two of them a single
layer), a sweep of RAM targets against a copy of the old global ranking as the negative control, a refusal beyond what the floors allow, and that
the card's sliced 16-byte-padded strides partition the layers like the whole-expert bytes do. Class E (placement only).
2026-11-06 09:36:37 +01:00
MIDHAT NASHAR 20885f7af0 split: retain a window in every expert pool
Mixed-quant models can fail to load in the split engine after cold-expert offload: the global residency ranking can leave one size pool below the
2 * MAXT * TOPK slots Up::expert_cache() needs even while other pools can still give up experts. Group experts by both the gate/up and the
down byte strides, keep the cold-first ranking but skip eviction from a pool that has reached the window floor, count only the extra evictions
that really happen, and say so before the model is uploaded when the request cannot be placed.

Ported from #5158 (midhatn) unchanged; the tests and the engine check follow in the next commit.
2026-11-06 09:36:37 +01:00
Niko1221 c65b9f8be8 Merge branch 'f-0212-int' into f-0212-splitdf2 2026-11-03 13:57:10 +01:00
Niko1221 0748e92701 split: DFlash2 rounds follow the draft layer's length rule, lanes with no planned drafts bank their taps (FNX_DF2_DEFER, FNX_DF2_REFRESH), the batch planner prices a drafter round per lane that drafts (RowOffer::first_ms), FNX_DF2_TRACE, FNX_SPECULATE=0 reference 2026-11-03 13:57:09 +01:00
Niko1221 c850b979b5 split: DFlash2 as the draft source of the all-cards split engine (--draft dflash2 --draft-model PACK, FNX_DRAFT=dflash2). One drafter a lane on card 0 through df2_bridge (src/core/dflash2.cpp with bind() compiled out); the window graphs tap layers 5/15/25/35/45 on card 0 (df2_tap_gr), the prompt path taps each card's own rows into a host ring per lane; Session and BatchDecoder take the drafts after the commit. Greedy 6.4K and 27K answers identical to no drafter and to the draft layer (UD-Q4, 2 x A6000) 2026-11-03 12:16:09 +01:00
Niko1221 dfc675848f Merge f-0212-amdsplit (final 9149835c6) into f-0212-int 2026-11-03 11:55:52 +01:00
Niko1221 c2335eebba Merge f-0211-nvdual (final f95411b84) into f-0211-int 2026-11-03 11:41:43 +01:00
Niko1221 f95411b843 split: the int8 prompt attention is on for the IQ3_S-type files and off for the others (UD-Q4_K_XL: 57/61 with it off, 55/61 with it on, agent-A8 and A10), like GDN_TC; the variable overrides 2026-11-03 11:22:25 +01:00
Niko1221 3671e77acd split: the shared expert rides in the routed gate|up launch for every expert type, not only Q4_K (FNX_SH_FUSE=0 turns it off). The IQ and the other layers ran it as three launches on a second stream with an event fork and join, 48 layers a window; k_moe_gu_sd carries its swiglu and down as extra rows of blocks like k_moe_gu_q4k does, with the same lanes a row and summation order. Greedy answers (short, 6.5K, 26K) identical for IQ3_S and UD-Q4; IQ3_S 4 x R9700 1 user 115 -> 203 tok/s, 8 users 211 -> 351; UD-Q4 179 -> 186 and 367 -> 385 (n=1 pair) 2026-11-03 09:57:55 +01:00
Niko1221 22f4dbe0e1 split: the NVIDIA prompt path takes 8192 rows x 4 chunks only if the free VRAM after the weights holds it beside the K/V pool (UD-Q4_K_XL on 2 x 48 GB did not start); else 8192 x 2, 4096 x 4 or 4096 x 2 2026-11-03 09:46:00 +01:00
Niko1221 55a2bcd474 Merge f-0211-nvdual into f-0211-int
Conflict in src/split/src/prefill.cu (pf_ring and the ring wiring): kept both sides. The HIP all-to-all small-chunk path stays, guarded by !own_out (the own-rows output is the NVIDIA hyper-connection split's), and the ring runs with nvdual's own_out argument; in the next-card wiring the HIP a2a box/flag copies and the hyper-connection split's input pointers are both kept.
2026-11-03 08:46:45 +01:00
Niko1221 d2dc05557e split: gdn_tc_set_default and its flag live in namespace fnx (link) 2026-11-03 08:41:39 +01:00
Niko1221 0ffbf096f7 split: g_gdn_tc_default is defined where the scan reads it (kernels part 4), before its use 2026-11-03 08:37:41 +01:00
Niko1221 fcd1493c1a split: gdn_tc_set_default is called from the Engine constructor (engine.cu includes kernels.hpp), so the HIP build compiles; GDN_TC stays NVIDIA-only 2026-11-03 08:34:32 +01:00
Niko1221 d00d937b89 split: Pf::down_lt is declared outside the NVIDIA-only cublasLt block, so the hyper-connection checks in prefill.cu compile on HIP (HIP never sets it) 2026-11-03 08:30:58 +01:00
Niko1221 6983b09bba split (owner 11-03, do all 5): FNX_PF_ROWS 8192, FNX_PF_HCSPLIT mode 2 and FNX_PFX_ATTN_I8 on by default on NVIDIA; FNX_PFX_GDN_TC off for the IQ3_S-type files (decided in the engine from the file's routed-expert types), on for the others; passes limited to 8192 rows while other requests decode; tests 2026-11-03 08:26:30 +01:00
Niko1221 38c08443e0 split: a short last chunk is a pass of its own only after at least 3 whole chunks (with fewer the pass is unsplit anyway and the chunks hide each other's sums) 2026-11-03 06:33:56 +01:00
Niko1221 37e4fcf9ac split: the hyper-connection split needs at least 3 chunks in a pass (2 or 1 chunk: slower than the plain read) 2026-11-03 06:17:40 +01:00
Niko1221 cde3399b31 split: with the hyper-connection split a short last chunk is a pass of its own (prompts under 16K were not split at all: the tail kept the pass unsplit) 2026-11-03 05:37:45 +01:00
Niko1221 400e26e3a8 split: fix the two log lines of the hcsplit decision 2026-11-03 04:20:27 +01:00
Niko1221 9f891886d6 split: the hyper-connection split (exact mode) is the default on two NVIDIA cards when the calibration finds the algorithm; 4 chunks a pass unless other requests decode; tests 2026-11-03 04:09:53 +01:00
Niko1221 c984ab42a0 split: FNX_PF_HCSPLIT=1 splits only passes of whole 4096-row chunks and uses the calibrated algorithm only at 4096 and 2048 rows (exact mode); =2 any chunk of 512 rows or more 2026-11-03 03:52:10 +01:00
Niko1221 e8570ac616 split: FNX_PF_HCSPLIT runs the hc down GEMM through cublasLt with an algorithm calibrated at start to give the same rows at 2048 and 4096 rows (and cublasGemmEx's at 4096) 2026-11-03 03:42:59 +01:00
Niko1221 8088d056f0 split HIP: chunks of up to 256 rows are summed all-to-all instead of round the ring (FNX_PF_A2A_ROWS, with FNX_PF_PEER). Each card stores its f32 addends into the other cards' mailboxes, raises a flag per peer, and sums the chunk itself in the ring's own order and roundings: bit-identical to the ring, one cross-card latency instead of three hops and the gather. 29-row prompt pass 212 -> 139 ms, 6-row pass 206 -> 145 ms (RCCL: 156 / 149); greedy answers (short, 6.5K, 26K) identical to the ring and to RCCL 2026-11-03 03:21:46 +01:00
Niko1221 deebb73a65 split HIP: the prompt chunk sums through the peers' device memory (FNX_PF_PEER, default on when the peer push is on and RCCL is not in use). Receive slots, gather rows and flags live in fine-grained device memory of the receiving card; the sender's kernels store into it. Same sum kernels as the host exchange: greedy answers at 6.5K / 26K / 103K tokens identical to the host sums, 103K prompt 33.4 s -> 30.4 s 2026-11-03 02:52:12 +01:00
Niko1221 750cbf0dbd split HIP: i-quant decode dots (IQ3_S, IQ3_XXS, IQ2_S) with a cheaper sign expansion, the same integers as ggml's (0 of 25M random dots differ, tools/iqdot_test.cu; IQ3_S greedy 26K-token answer identical to the base build) 2026-11-03 02:52:12 +01:00
Niko1221 697fec9d06 split: FNX_PF_HCSPLIT_FULL=2 debug 2026-11-03 02:19:42 +01:00
Niko1221 8969119a42 split: FNX_ONEHOP=2 (screen): the one-hop window sum on two cards 2026-11-03 02:15:50 +01:00
Niko1221 a2aa1f3122 split: FNX_PF_HCSPLIT_FULL debug switch 2026-11-03 02:11:05 +01:00
Niko1221 d716ccfca6 split: FNX_PF_HCSPLIT swap on its own stream, FNX_PF_HCSPLIT_F16 (wip) 2026-11-03 02:05:20 +01:00
Niko1221 838b2e0de6 split: FNX_PFX_ATTN_I8 default back to off (agent-A10 failed 3 of 3 suite runs with it on); FNX_PFX_GDN_TC stays on; FNX_PF_HCSPLIT (screen, wip) 2026-11-03 02:00:38 +01:00
Niko1221 1bf5e13e7f split: the INT8 prompt attention (FNX_PFX_ATTN_I8) and the tensor-core GDN scan (FNX_PFX_GDN_TC) are on by default on NVIDIA sm_80+ (the owner's yes, 0.2.10.1); =0 turns each off; HIP keeps the old kernels 2026-11-03 01:16:47 +01:00
Niko1221 082af9c19a Split: tensor-core chunk scan for the prompt GDN behind FNX_PFX_GDN_TC (default off)
Strata's gdn_tc.cuh scan (mma.m16n8k16 f16 hi/lo split, state in registers, 2048-token super-blocks, prep kernel per value head) ported
into the split engine's prompt GDN (gdn_tc_prompt.cuh, part 4, CUDA sm_80+; HIP keeps the sub-chunk kernels). FNX_PFX_GDN_TC=1 runs it in
place of k_gdn_ch_prep / k_gdn_ch_rec when the card has the scratch for it. split_gdn_tc_test checks outputs and end state against the
sub-chunk kernels on random inputs (one card slice, C 33..32768) and times both. FNX_GDN_TIME=1 prints the prompt GDN's GPU time per card.
2026-11-03 01:16:47 +01:00
Niko1221 4a49d25975 split: FNX_PFX_ATTN_I8=1 (screen): the prompt attention on INT8 tensor cores, Strata's prompt_attn_i8v3 adapted to the split's K/V pages (scale per 32 values), card partials and cell lists (off by default) 2026-11-03 01:16:47 +01:00
Niko1221 95901fe8a4 Merge f-0291-split-hip e3563ff3d: AMD split final candidate (batched draft layer, RCCL sums, strata-split-2/3/4-amd) 2026-11-02 17:03:21 +01:00
Niko1221 e3563ff3dd split HIP: the RCCL default stays quiet when the peer push is off 2026-11-02 16:46:12 +01:00
Niko1221 d889208a0e split HIP: batched draft layer and RCCL prompt sums on by default (AMD); NVIDIA unchanged 2026-11-02 16:45:58 +01:00
Niko1221 8dd8f11a81 split: FNX_ADMIT_INTERLEAVE default off (no measured gain) 2026-11-02 16:24:46 +01:00
Niko1221 9ecdfa0df7 split: batched draft layer covers sampled lanes and draft penalties (per-lane penalize_row and candidates) 2026-11-02 16:23:05 +01:00