Files
leleka/docs/upstream.md
T
Pavlo Ratushnyi b6563e3937
KAR CUDA compile (GPU hidden) / kar-cuda-compile (pull_request) Failing after 52s
feat(kar): isolate target native routed storage in explicit mode
2026-10-07 19:06:39 +02:00

7.4 KiB

Strata upstream provenance

Status: source imported as a local Git subtree and preserved in a private hosted repository.

Field Value
Upstream repository URL https://github.com/Niko1221/Strata.git
Upstream commit SHA d9ab8435f654c368c586340d490915f6addf56a3
Local repository path engine/strata/
Primary hosted project repository URL https://git.vezha.io/para/leleka (private; push and CI)
Historical hosted project repository URL https://github.com/paveldhq/strata-next (private)
Import date 2026-10-02
Engine build instructions scripts/build-cpu.sh for source checks; CUDA build still to validate on Linux GPU
Local patch strategy Squashed Git subtree; preserve upstream commit IDs in subtree merge messages

The local Git remote strata-upstream points to the URL above. To review an update, run git fetch strata-upstream main, inspect the diff from the pinned SHA, choose a specific new commit, then run git subtree merge --prefix=engine/strata --squash <chosen-SHA> and the relevant checks. Do not silently advance to whatever happens to be latest.

The imported upstream tree includes its own small optional experimental control-vector GGUF and reference data. Production model weights, captures, and generated output remain outside this repository. The private project repository was created on 2026-10-04; its initial main is 858e7aa050f56b051dac5e3d7b765a05cb958aee. This preserves the existing subtree history and does not change the pinned upstream identity.

Project pushes and CI now use the private Gitea repository above. The historical hosting record and the pinned Strata upstream identity remain traceable; this hosting change does not advance or replace the imported upstream source.

Local CUDA validation, 2026-10-04

The upstream identity above is unchanged. The local Keyless opt-in fork compiled on Linux with CUDA 13.2.86 for RTX 5090 (SM 120). Query-routing numerical parity, V-only streaming and conversation snapshots passed. Pretrained-model quality failed; see the report. The ordinary K+V profile remains the production choice.

Local Linux packaging profile, 2026-10-04

STRA-23 adds the default-off STRATA_CUDA_STATIC CMake profile: static toolkit runtime/BLAS targets and GNU C++ runtime linkage for Linux. The imported source commit above remains unchanged; this is a local build-policy patch. A complete CUDA 13.2/SM 120 compilation and ELF audit passed without GPU inference. The candidate still needs host glibc 2.43 and an NVIDIA driver; model qualification is pending. See deploy/README.md and docs/build-validation.md for the exact scope, artifact identity and remaining packaging limits.

Experimental KAR expert integration, 2026-10-05

The pinned upstream commit remains unchanged. Local default-off STRATA_NEXT_EXPERIMENTAL_KAR_EXPERTS adds a native verifier cache-miss callback, linked to the separate gpu/kar component. Resident native hits and batched prefill retain their IQ weights; short prompt ingestion uses the verifier and therefore also exercises KAR misses. The runtime requires explicit archive and precision environment settings, validates the archive payload and expert geometry, and rejects unsupported pool/multi-device configurations. This is an experimental quality arm, not full compressed-model residency or a qualified speedup.

Experimental KAR batched prefill, 2026-10-07

The upstream SHA above is unchanged. A separate local STRATA_NEXT_KAR_PREFILL=1 opt-in connects batched prefill to the same KAR expert backend. It requires the experimental expert build and explicit archive/level; without the opt-in, prefill retains the upstream native IQ path. The callback uses bounded groups of at most eight activations, preserves grouped output and router weighting, and stops on backend or transfer failures. This arm bypasses native routed-expert staging/GEMM and its streaming producer, while keeping shared/dense projections and the native cache for verifier hits.

Host grouping contracts and GPU-hidden native-engine compilation are separate from real GPU validation. Tensor/logit parity, compressed residency, model quality and paired end-to-end measurements remain mandatory; this source change does not establish those results or enable the experimental profile by default.

Experimental KAR all-routed target isolation, 2026-10-07

The pinned upstream SHA remains unchanged. A separate local default-off STRATA_NEXT_KAR_ALL_ROUTED=1 arm requires STRATA_NEXT_KAR_PREFILL=1, the experimental KAR CUDA build, explicit expert archive and level, a native pack, fixed positive --prefill CHUNK, --spec 2..8, --expert-cache 0, --pcie-frac 0, and disabled adaptive native cache (--adapt-every 0 or --adapt-swaps 0). It rejects native expert profiles, mmap/resident/shared native banks, nonzero PCIe share, native cache policy/order switches, disabled callbacks, GPU-floor/no-capture modes, multi-device configurations, automatic chunks and a native device expert plan. Admission precedes opening the KAR backend or mutating its runtime options.

For the target layers, this arm omits opening ArenaExpertSource or FileExpertSource, native ExpertCache slots and native hit buffers. The early multi-token callback validates the whole window before any native lookahead, source begin/prefetch, quantization, plan or CPU expert job. Every routed row starts unowned and must return as a finite unweighted kind=3 row in routing order; malformed input, duplicate experts within a token, missing owners, unhandled rows or backend faults fail the layer. Completed KAR rows count as native cache refusals, never native hits; native CPU job/miss counts remain zero. The verifier accepts an absent native tier only in this explicit mode, requires the host callback, copies all completed host rows to its existing combine and omits native routed activation/hit/PCIe staging buffers and kernels. Its normal empty-plan completion publishes the A/B flags after the callback returns.

Prefill selects this allocation mode before initialization and keeps it across reset and relayout. Counting and carving use the same mode; routed GU, fallback activation/intermediate, MMQ, dequantized expert and staging rings, native stager workers and ring events are omitted. Router/grouping, routed output rows, shared experts, dense/embedding/head/PLE, attention, KV/indexer and session state remain. Attention and MoE scratch share a region sized by their maximum, so omitted MoE buffers cannot be added together as a claimed VRAM saving. The CPU expert-pool object remains for existing callback plumbing but runs no native routed jobs. The MTP drafter still uploads its separate native draft experts when configured: this is not a zero-copy full compressed-model claim.

scripts/test-kar-all-routed-contract.sh uses synthetic expert matrices and non-unit router weights to check 128 rows against an independent CPU combine oracle (absolute tolerance 1e-5), strict admission, successful counters/usage, null native handles, bounds, ownership, nonfinite/duplicate input and injected backend faults under address/undefined-behavior sanitizers. The existing prefill contract test also passes. These CPU results establish host contracts; CUDA compilation, real tensor/logit parity, model quality, allocation telemetry and paired end-to-end performance measurements are separate gates. No quality, measured memory saving or performance qualification is established by this patch.