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).
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.
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.
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.
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.
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.
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).
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.
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).
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.
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.
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.