Commit Graph
42 Commits
Author SHA1 Message Date
Niko1221 f1fce32863 DeepSeek out (7/7): no DeepSeek engine is built, packaged, signed or put into a feed; the two DeepSeek docs pages say so
- Deleted: packaging/build_dsv41_cuda.sh, build_dsv41_hip_linux.sh, build_dsv41_windows.bat,
  packaging/mac/build_dsv41_engine.sh, tools/dsv41 (pack, smoke, tune, refs, its HIP build scripts) and
  third_party/project-maya (its notice covered only the DeepSeek port).
- package_engine.py: no strata-dsv41 beside the engine, no --require-dsv41; build_hip_linux.sh (rx9070),
  build_cuda_linux_aarch64.sh and spark/build_engine.sh build and package the Qwen engine only (the same tree,
  flags and architectures; the packages no longer carry strata-dsv41); package_terminal.py no longer bundles the
  dsv41 scripts; feed_tool.py / make_local_feed.py have no --dsv41; make_model_release.py no DeepSeek bucket;
  mac/sign-and-notarize.sh: --engine is the generic engine-package step (a model shape's engine uses it), its
  DeepSeek words go; docker/build.sh and entrypoint.sh comments; tools/check py-optional without tools/dsv41.
- docs/DEEPSEEK41.md and docs/DEEPSEEK_MAC.md: the owner's five-line page (approved 11-11), each page with the
  whole text, so an old link to either lands on the full answer ("on a Mac" in the Mac one).
- Tests: the DeepSeek build-script and --require-dsv41 checks go (test_engine_manifest, test_bundle_tools_paths,
  tools/test_quant_header_names, tools/test_no_llama_download's list, test_update_feed's --dsv41 build test).
The feed member for older Strata versions, frozen, is the next commit (the owner chose to keep it).
2026-11-11 11:47:48 +01:00
Niko1221 c6f84f2815 DeepSeek out (6b, Metal): the rest of the DeepSeek Mac code
Holdable on its own: with it held back the Mac still builds (commit 6 took the two pieces that had to go with
src/dsv41); this one removes what is dead since then.
- metal/src/engine: ds4_ctx.cpp, ds4_finish.cpp, ds4_host.cpp, ds4_vision_metal.cpp, stubs_ds4.cpp (unreferenced
  objects of the strata_metal_kernels glob) and msl/ds4_*.metal (6; the Qwen engine never loaded them, msl_libs.h;
  packaging/mac/build_engine.sh copied every msl/*.metal into the Qwen package, so they leave the package too).
- metal/include/metal_compat: ds4_metal_host.h, ds4_vision_metal.h and cublas_v2.h (the cuBLAS shim of the
  DeepSeek sources; no Qwen source on the Mac includes it); cuda_runtime.h loses the ds4_metal_flush / kick
  declarations; mtl_rt.h loses start_keepalive (defined only for the DeepSeek runtime).
- metal/src/mtl_rt.mm (26 blocks) and metal/src/gpu/runtime.cpp (35 blocks): the `#if defined(STRATA_DS4_RUNTIME)`
  blocks go. The macro was set only on strata_ds4's own copies of these two files, so every other target read them
  without the blocks already.
- metal/tests ds4_* / dsu_* / dsv41/, metal/probe/busy_flag_probe.mm, the dsu_ref_vs_ggml target,
  third_party/antirez-ds4 (it covered the Metal vision tower only); metal/CMakeLists.txt comments.
2026-11-11 11:46:24 +01:00
Niko1221 6f19a96629 third_party/stb: stb_image.h v2.30 from llama.cpp's vendor folder (own vision tower), check_vendored takes it 2026-11-09 16:57:19 +01:00
Niko1221 033cfdd8cd strata-llama: add ggml-blas (ggml turns it on by default on a Mac)
The macOS identity gate found that the picture reader did not configure from the vendored tree on a Mac: GGML_BLAS defaults to ON there (Accelerate) and
ggml/src/ggml-blas was not vendored. 918 files, 20.56 MB; still byte-identical to the pin.
2026-11-09 04:09:16 +01:00
Niko1221 463940282d strata-vision: llama, mtmd and ggml vendored at the pin (third_party/strata-llama); no llama.cpp download is left
third_party/strata-llama holds what tools/vision builds - llama (src, include), tools/mtmd, vendor/{hash,miniaudio,nlohmann,sheredom,stb} and the whole ggml
with its backend registry and the CPU (x86, Arm), CUDA, HIP, SYCL and Metal backends - as 916 files (20.5 MB) byte-identical to llama.cpp 3cf03257f, upstream
CMake unedited, MIT licences kept; UPSTREAM.md lists every file with its sha256 and says phase 3 deletes the tree with tools/vision. tools/check_vendored.py
covers it (also against a llama.cpp tree with --upstream). tools/vision/CMakeLists.txt takes it as the default LLAMA_DIR; setup.py (vision_llama,
VISION_SOURCES), the vision/HIP/CUDA/Spark/Mac/Windows scripts, sycl/setup_intel.py and the Dockerfile build from it (STRATA_GGML_DIR / LLAMA / --llama stay as
overrides). setup.py has no llama.cpp zip any more; tools/test_no_llama_download.py fails if a script, Docker file or workflow fetches or requires a tree.
2026-11-08 23:29:17 +01:00
Niko1221 745819efc6 quant header: the text moves to strata-quant-common.h, third_party/ggml/ggml-common.h forwards to it
third_party/strata-ggml/strata-quant-common.h holds the header text (llama.cpp's ggml/src/ggml-common.h at the pin plus the one Strata edit; manifest row
'edited'); third_party/ggml/ggml-common.h is a one-line forwarder kept for two releases, so every #include "ggml-common.h" is unchanged. The Metal
runtime reads the text under the new name (resource_path.h resource2: <exe>/metal/strata-quant-common.h, else the old name beside the executable, else
the compiled-in path); the Mac package script ships metal/strata-quant-common.h and, for two releases, the same text as metal/ggml-common.h. The
dpct-migrated SYCL-mode copy moved the same way (it is not part of the build). tools/test_quant_header_names.py.
2026-11-08 23:20:42 +01:00
Niko1221 525c0be13a gguf-py and llama.cpp's HF converter vendored at the pin (third_party/strata-gguf-py)
The pack tools, the NVFP4-local conversion and the fixture generator read GGUF files with gguf-py; until now setup downloaded the whole llama.cpp
zip for it. third_party/strata-gguf-py holds gguf/ (gguf-py), converter/ (convert_hf_to_gguf.py, conversion/) and the licences, byte-identical to
llama.cpp 3cf03257f (UPSTREAM.md lists every file with its sha256; tools/check_vendored.py verifies it, also against a llama.cpp tree with --upstream).
tools/_paths.py finds it first (STRATA_GGUF_PY stays as an override); nvfp4_convert/verify import the vendored converter.
2026-11-08 23:15:53 +01:00
Niko1221 19418261e9 Give the quant header Strata's name as a forwarder, nothing else moves
third_party/strata-ggml/strata-quant-common.h includes third_party/ggml/ggml-common.h,
with the provenance and MIT notice. The text stays at the old path: the Metal
runtime reads that file's text under that name and the Mac package ships it as
metal/ggml-common.h, so the runtime lookup, the compiled-in path and the
packaging scripts are untouched (the swap goes with the 1B packaging change).
2026-11-08 14:43:03 +01:00
Niko1221 bc83c088de Fold the trellis MMQ overlay into plain files of the vendored ggml-cuda
The configure-time overlay (cmake/strata_ggml_tq_overlay.cmake) wrote the Gyro
trellis types (TQ2_T, TQK6, TQK7, TQP5-7) into patched copies of ggml-cuda's
headers inside the build tree. They are plain files in
third_party/strata-ggml/ggml/src/ggml-cuda-tq now (patched ggml.h, mmq.cuh,
mmq-load-tiles.cuh, mmq-config-*.cuh; the copies quantize.cu, quantize.cuh,
mmq-vec-dot.cuh; tq.cuh, the tile loader and the six instances), byte for byte
the overlay's output and each listed in UPSTREAM.md; check_vendored.py checks
that the patched files only add lines. The pristine ggml-cuda files stay
untouched, so every regular instance compiles exactly as before. The default
build uses the folder like the overlay dir (first on strata_mmq's include path);
the SHA-256 guard of the MMQ_TAB scheduler is not needed for it. A
-DSTRATA_GGML_DIR build still gets the overlay, reading tq.cuh and the tile
loader from the vendored folder. third_party/ggml-tq is gone.
2026-11-08 14:43:03 +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 e483f7835c Mac DeepSeek vision tower: GEMM on the Metal 4 tensor ops (BF16 operands read in place, FP32 accumulation; 798x448 in 93 ms, 1344x1260 in 1.2 s, was 2.6 s and 29 s), DS4_VISION_NO_MPP=1 for the plain kernel, sequential-FMA test GEMM (DS4_VISION_REF_GEMM) 2026-11-02 19:42:56 +01:00
Niko1221 6ca50487ef Mac DeepSeek: the vision tower on Metal (kernels, BF16 GEMM, host side), capability marker STRATA_DS4_METAL_VISION_V1; credit to antirez/ds4 (MIT, 890898cf) 2026-11-02 19:16:42 +01:00
Niko1221 b8668d0385 split: sFNX (johnfink8/sfnx f9ba1e9, MIT) as published: engine, engine process, CPU tests, two data files, LICENSE and NOTICE 2026-11-01 20:42:54 +01:00
Niko1221 169d5d6a9e DeepSeek --parallel: the DSpark drafter in the steps of several requests (Project Maya #611, needmorevram; with mw00's 1434096, 4b2378b, 0d0f261) 2026-10-31 10:16:57 +01:00
Niko1221 69896982ae DeepSeek --parallel on an event scheduler: prompts read a piece at a time, a read alone yields to a request, opt-in STRATA_DS4_READ_PIECES (Project Maya #587, mrsirg97-rgb) 2026-10-31 09:55:53 +01:00
Niko1221 331ef6890d DeepSeek prompt ring sized by the GPU's measured host link, opt-in DS4_RING_MB=link (Project Maya #609, mw00) 2026-10-31 09:37:43 +01:00
Niko1221 29c2d574f8 DeepSeek --parallel from Project Maya (#332, mw00): per-conversation state, attention split out of layer(), step_multi / sample_multi 2026-10-31 09:35:38 +01:00
Niko1221 f080938676 Merge branch 'f-041-maya-a' into f-041-maya-b
# Conflicts:
#	src/dsv41/ds4_main.cpp
#	src/dsv41/ds4_model.cu
2026-10-31 09:08:07 +01:00
Niko1221 8ea5361bfc Merge tag 'v0.2.9' into f-041-maya-b
Strata 0.2.9 (engines and the SYCL package built from 99866a47a2b8a21b131aad162a584ee9da92f8f0; the Windows and Linux x86 app, Terminal, Control and installers from c62d5e3a15b40ea51c96aae9e8d36928965f53ab; the Mac set from 4cf0d8cd3 and the Spark Control from 38f56619c, which the later card fix does not touch; the later commits change the Python Control, server, setup, tests, tools, docs, the app host and the Mac Metal engine only)
2026-10-31 09:07:42 +01:00
Niko1221 908a4dee7b Merge tag 'v0.2.9' into f-041-maya-a
Strata 0.2.9 (engines and the SYCL package built from 99866a47a2b8a21b131aad162a584ee9da92f8f0; the Windows and Linux x86 app, Terminal, Control and installers from c62d5e3a15b40ea51c96aae9e8d36928965f53ab; the Mac set from 4cf0d8cd3 and the Spark Control from 38f56619c, which the later card fix does not touch; the later commits change the Python Control, server, setup, tests, tools, docs, the app host and the Mac Metal engine only)
2026-10-31 09:07:32 +01:00
Niko1221 54eff48756 DeepSeek engine: a short chunk streams only the experts it picks on the batches path, opt-in (A4b); DS4_UNPICKED_STAT
Project Maya #691 (needmorevram, c7d08c5), the "a chunk streams only the experts it picks" part, onto src/dsv41's batches
path (Streamer / copy_ahead; DS4_FLOW=0 or a pack the flow does not take): with DS4_SKIP_UNPICKED_ROWS=N (or
DS4_SKIP_UNPICKED=1 for every chunk) a chunk of at most N rows waits for its layer's routing and then reads and copies only
the experts some row of it picked, into the same slots and batches, so the summing order is the same.  Off by default.
Strata's flow path already streams only routed experts, so the default path gains nothing from it.
DS4_UNPICKED_STAT=1 prints, per chunk size, the share of a layer's experts no row of the chunk picked.

Credit: Project Maya #691 (needmorevram), MIT, third_party/project-maya/NOTICE.md.
2026-10-31 07:17:30 +01:00
Niko1221 490b4b0fad Merge f-041-maya-a2 (A2 tail cost, A5 path calibration, small items) into f-041-maya-a
Keeps A3's shared-start store and A4a's feed_marks together with Project Maya #668's tail-cost judgement (mw00).
2026-10-31 04:53:53 +01:00
Niko1221 0be5d73f00 DeepSeek engine: restore points near a prompt's end kept in one read, feed's after (A4a)
Project Maya #691 (needmorevram, c7d08c5), the restore-point part, onto src/dsv41: Model::feed_marks() keeps the restore
points inside a run of chunks from snapshot sets the layers fill on the way (kSnapN = 8 sets; feed_mark's one set became
an array), each the state a read up to that point leaves, instead of a run up to each point; Model::marks_inside() says
whether that is worth it (the long-prompt skip's extra rows at most a chunk, inner_cost); the serve loop reads the rest
of a prompt that way when the points left are inside it (not past a shared start a read from token 0 stops at, #607).
STRATA_DS4_MARKS_INSIDE=0 stops at each point as before.  feed()'s `after` (the rest of the prompt still to come) moves
the long-prompt skip's kept rows to the prompt's end.  Not ported from #691: the chunk streaming only the experts it
picks, the EXL3 lend, DMA read-back of host sums.

Credit: Project Maya #691 (needmorevram), MIT, third_party/project-maya/NOTICE.md.
2026-10-31 04:37:02 +01:00
Niko1221 c17b458c4f DeepSeek engine: a new conversation behind the same system prompt and tools reads only its own part (A3)
Project Maya #607 (mw00, b2d4c30) onto src/dsv41: when a prompt read from token 0 reaches its shared start (shared=,
pin=) the state the read keeps there is also copied apart from the conversation, in RAM (slot_save).  A prompt that does
not continue the conversation in the model takes back the longest kept start it begins with, when that covers more than
the model's own restore points (a kept conversation slot only when it covers more still), and reads only the rest.  With
or without STRATA_DS4_SLOT_KEEP.  STRATA_DS4_PREFIX_KEEP (2 starts, LRU), STRATA_DS4_PREFIX_GB (2), STRATA_DS4_PREFIX_MIN
(1024); 0 keeps none.  Starts with pictures are not kept.

Credit: Project Maya #607 (mw00), MIT, third_party/project-maya/NOTICE.md.
2026-10-31 03:09:06 +01:00
Niko1221 70f1f90d75 DeepSeek engine: DS4_ASYNC_T stays 8 by default (16 is opt-in; Project Maya #608, mw00): the window-size logits test did not show the claimed independence 2026-10-31 03:07:58 +01:00
Niko1221 9edd253c25 NOTICE: fix the B4 credit line 2026-10-31 02:13:51 +01:00
Niko1221 1daf05cb02 Merge branch 'f-041-maya-a' into f-041-maya-b
# Conflicts:
#	third_party/project-maya/NOTICE.md
2026-10-31 02:05:45 +01:00
Niko1221 a280f5bbd0 DeepSeek one-GPU decode from Project Maya: copies pulled in place, windows streamed, landings in recent slots (#476 RubenTorney)
With the lane on (DS4_STREAM=1) and one discrete NVIDIA GPU, the CPU lane's RAM copies are pinned and the fetch kernel pulls a streamed
expert where it lies; a verify window's experts stream too and land in a recent slot, so the link's bytes stay in VRAM.
Gating and follow-ups: one-GPU path only where experts stream (1b60249, 482e46c #496, 7c0ceb1 #551, mw00), no landing while the swap is pending
and a table-update wait (32f3c8c handmade0octopus), a failed fill is never published (#646 handmade0octopus), Windows with pin by need (#567 TheSmokeDev),
HIP pull clock on gfx11/gfx12 and DS4_IQ1S_ROWS (#563 Cass, mw00). Everything stays behind DS4_STREAM=1; DS4_RAM_SKIP_W (changes answers) is opt-in.
Not ported: the helper-GPU condition (#415). Built on CUDA sm_120; model identity/A-B not run yet.
2026-10-31 02:04:11 +01:00
Niko1221 ec723c27e8 DeepSeek expert cache: recent slots from Project Maya (#344, needmorevram), selective port
The layer keeps DS4_RECENT=<n> VRAM slots (taken from its coldest experts) for CPU-lane experts it used twice in its last 8 ticks.
A thread copies each fill on its own stream, the next tick maps it by one tab_set launch a device; a swap leaves recent slots and
experts being filled alone, and a run of chunks that lends the tail waits for the fills first. Opt-in (default 0), values unchanged.
Not taken from #344: all-reduce over DMA, segmented top-k, DS4_INDEX_TC, the cuBLAS workspace pin.
ds4_gguf_test: its Q8_K default now follows the engine (opt-in, DS4_IQ_Q8K=1).
2026-10-31 02:04:03 +01:00
Niko1221 5322f1c2bd NOTICE for libstrix (asf0, MIT): the gfx1151 fused-expert barrier follows its barrier() 2026-10-31 01:21:21 +01:00
Niko1221 216252f034 DeepSeek PCIe lane and whole-token judge from Project Maya (#312 Peasant Smith, #329 mw00), staged merge v1.1.17 to v1.1.19
Lane and Q8_K rounding opt-in (DS4_STREAM=1, DS4_IQ_Q8K=1) until their gates have run.
2026-10-31 01:10:17 +01:00
Niko1221 abe5e67923 ds4 thread pool: fence the generation store before reading the sleepers, and start workers from generation 0
A worker going to sleep at the moment a batch started could miss both the new generation and the wake-up (the caller then runs the batch alone, slower, not wrong). Taken from Project Maya v1.1.36 (#618, Cody Harrison), MIT, credited in third_party/project-maya/NOTICE.md.
2026-10-31 01:08:49 +01:00
Niko1221 3ec28f5cc0 DeepSeek engine: tail restore point judged by its cost (A2), per-class path calibration (A5), sampler/lane/bf16 fixes, DS4_ASYNC_T 16
Taken from Project Maya (MIT), staged against v1.1.42:
- A2: the tail restore point is left out where its read stop costs more than
  reading its tokens again (TailCost wired into the serve loop; one in 32 still
  kept to measure again; STRATA_DS4_RESTORE_TAIL_AUTO=0 keeps it always). Maya
  #668 (mw00, 8721412 and 66fb17b).
- A5: the flow timing correction of the opt-in timing pick stays in the prompt
  size class that measured it (ds4_path_policy.hpp + test). Maya #612 (Will
  Hampson, 6e0d27d). Our default pick is by length already.
- A sampler CUDA error ends the request instead of sending token -1; logits()
  copies on the head stream. Maya #619 (Cody Harrison, 2040174).
- A CPU-lane layer that cannot compute its experts stops the engine instead of
  answering zeros; a layer with no GPU kernel is refused at load, any other
  warns. Maya #620 (Cody Harrison, e598716).
- bf16_rn by arithmetic on CUDA too. Maya #676 (rilken, 79628d7).
- DS4_ASYNC_T default 8 -> 16: windows of 9-16 rows take the same device path
  as 1-8. Maya #608 (mw00, b9c07e7). DS4_ASYNC_T=8 gives the old path.
2026-10-31 01:08:29 +01:00
Niko1221 6e53c7f8d6 DeepSeek engine: restore points (marks) a request asks for, kept in the conversation and in the slots (A0)
Ports Project Maya's restore points (#639, needmorevram, 50a3313; ds4_marks.hpp v1.1.42 by mw00 and needmorevram) onto
src/dsv41 as a per-file merge, not a commit apply:

- ds4_marks.hpp as in Maya v1.1.42 (latest_point, mark_plan, mark_victim, TailCost; TailCost is not wired in yet, #668).
- Model::mark(shared) / marks_cap() / check_bytes(): up to STRATA_DS4_RESTORE_POINTS (4, 0 = none, at most 16) restore
  points besides checkpoints 0 and 1 and the anchor, the least recently used giving way, the shared start last.
  restore() and best_check() go back to a mark; a slot keeps the marks with their roles (3 mark, 4 shared start), slot
  identity strata-ds4-session-4; the .meta file takes up to 3 + 16 checkpoint positions.
- Replaces Strata's fourth checkpoint (ck[3], the pin=N shared start) by a shared mark: pin=N is now shared=N.
- GEN keys marks=<pos>,... tail=<pos> shared=<pos> (pin=N kept): the prompt read stops at each point mark_plan keeps and
  keeps the state there.
- Tests: tests/dsv41/marks_test.cpp (Maya's ds4_marks_test), slot_test for the longer checkpoint list.

Credit: Project Maya #639 (needmorevram), #668 / ds4_marks.hpp (mw00), MIT, third_party/project-maya/NOTICE.md.
2026-10-31 00:56:53 +01:00
Niko1221 8477811197 Merge f-dsv41-mac (DeepSeek on Metal) into v0.2.7
The 0.2.7 DeepSeek changes (persistent-grid IQ kernels, int8 rounding batches, hc_mix_split with a block counter, head columns,
chunk-path knobs) are kept; the Metal engine's hooks sit on top of them: every kernel launch is strata_ds4_launch(), the rounding
batch ends in the Metal multi-quantiser dispatch, the head stays at 4 columns a pass on Metal (8 moves the KL), and the macOS
parallel expert prefetch is macOS-only.
2026-10-27 16:44:27 +01:00
Kevin Read 38b06316ef Gyro-L: read the pair-trellis types TQP5/TQP6/TQP7 (ggml 147-149) on the CPU, CUDA and the MMQ prompt path (#3806)
Gyro-L (agentionai's 50 GiB file) stores its experts as a pair trellis: 128
values per block, a fp16 scale and 64 steps of K bits (K = 5, 6, 7), two
weights per step taken from the first pair of the TQ2_T codebook entry the
step's state selects. The engine refused the file because it did not know the
three type ids. This adds them next to the existing trellis types 144-146
without changing those.

What changed:
- gguf_reader.hpp / tools/gguf_reader.py: names and block sizes (42 / 50 / 58 bytes).
- tq_cpu.*, tq_states.hpp, tq_avx2.cpp: tq_supported / tq_kbits / tq_block_bytes
  for the new ids (the bytes per block are 2 + 8K for the pair layout, 2 + 4K
  for the others), a scalar pair kernel (the reference) and an AVX2 pair kernel
  that is bit for bit equal to it; AVX-512 uses the AVX2 pair kernel.
- iq_kernels.cu: TqInfo, the lane decode (tqp_states8, a byte window), the
  dot product, the decode-once Split, the fp16 dequantizer and the format lists
  for 147-149. They are reached only by a pack that holds these types.
- moe_mmq.cu, strata_ggml_tq_overlay.cmake, third_party/ggml-tq/tq.cuh,
  ggml-common-tq.h: the MMQ prompt path for the three types (overlay
  enumerators, traits, tile loader branch, instances).
- native_expert_parity: names tqp5-7 and skips its synthetic check, with a
  message, on a ggml that has no trellis traits.
- docs/GYRO.md: the "not supported" sentence now says how Gyro-L is read.

Changes to the contributor's patch:
- tq_cpu.cpp called the AVX2 pair kernel without the x86 guard the rest of the
  file has, which breaks the Metal build (it compiles tq_cpu.cpp without
  tq_avx2.cpp): the pair rows go through one helper that falls back to the scalar kernel.
- moe_mmq.cu named GGML_TYPE_TQP5-7 under STRATA_MMQ_TQ, but the public
  agentionai llama.cpp has the older trellis types and not these: a new
  STRATA_MMQ_TQP (set for the overlay and for a tree that has the tqp instances)
  guards them, so that tree still builds. The HIP overlay lists get the three
  instances too, and ggml_tq_overlay_test checks them (and sets the CMake
  policy its IN_LIST needs).
- native_expert_parity: the skip test compared a type-name pointer to null, but
  ggml_type_name of an id past the table reads past it (the test crashed on
  an upstream ggml); it compares against GGML_TYPE_COUNT.
- docs/GYRO.md keeps the plain description and leaves out the contributor's
  measured speeds (we have not repeated them).

Tests added: src/kernels/cpu/tqp_cpu_test.cpp (no ggml, no model: the scalar
kernel against a bit-by-bit reference from the format definition, every ISA
equal to scalar for 1-8 tokens and for gate/up rows, the type predicates for ids
0-299 against the old formulas), the pair types in tq_pascal_bench (fp16
dequantizer bit for bit against the definition, decode kernels within 3e-2,
decode-once == per-column), tools/test_gguf_tqp.py, and native_expert_parity
tqp5/6/7 registered when the ggml tree has the tqp instances.

Checked (no model): tqp_cpu_test passes on x86 (AVX2 on z440; AVX2 and
AVX-512 on the owner PC with MSVC); tq_pascal_bench on an RTX 5070 (sm_120,
MSVC build): 0 failures, the TQP dequantizer matches the definition in all
bits, and the checksum lines of TQ2_T/TQK6/TQK7 are byte-identical to the
build without this change. Builds: CUDA sm_86 (gcc), sm_60 (CUDA 12.9),
sm_120 (MSVC), SYCL, and the CPU files for aarch64.

Not covered: the contributor's own parity runs need a ggml tree that carries the
types (not public here), and the 50 GiB model run (load check, coherent
answer, 32K prompt, MTP, Gyro-S/M identity) is still to be done. Metal, SYCL and
HIP have no kernels for the types; HIP was read, not built.
2026-10-27 01:57:57 +01:00
Niko1221 8a7102ec4d dsv41: a long prompt skips layers 20-39 on all but its last 2,668 rows (STRATA_DS4_PROMPT_SKIP, on by default)
Layers 20-39 of DeepSeek-V4.1-Flash read a prompt's earlier tokens only through layer 20's compressed KV and index
keys, and each looks back one 128-token window more than the layer before. So for the answer and for the rings the
decode reads they need their own work only on the last (40 - 20) x 127 + 128 = 2,668 rows. A prompt of ~3,700 or more
new tokens on one GPU now runs its earlier chunks through layers 0-19 plus layer 20's kv_only part (the hyper-connection
pre-norm, the compressor latent, the index keys, the compressed KV) and nothing of the later layers' attention or
experts; the chunk the cut falls in runs layers 20-39 from the cut row on; later chunks run every layer. The expert flow
plans nothing for the skipped (chunk, layer)s. STRATA_DS4_PROMPT_SKIP: 1 (default) the skip, 2 only the last 128 rows
(DeepSeek's own serving; answers shift a little), 0 off. Same approach as Maya #318.

H100 emulation (64 GB cgroup, 12 GiB VRAM, store 41 GB, 3.6 GB/s SSD cap): 16K prompt 69.3 s -> 51.5 s (236 -> 318
tok/s, two alternating pairs), 4K 32.5 s -> 30.7 s; 800 teacher-forced positions after a 4,200-token skipped prompt: KL
0.00029 against the full work, top-1 against the text 88.11% against 87.98%, ppl 1.5110 against 1.5111.

--score gets DS4_SCORE_PREFIX=N (the segments joined, the first N tokens read as one prompt with the last row's logits,
the rest scored) so the skip can be scored; tools/dsv41/test_prompt_skip.py runs it against a pack when one is named.
The Maya notice file now says later Maya changes are covered by the same notice.
2026-10-24 01:11:34 +02:00
mw00andneedmorevram bbd0a2c673 dsv41: import Project Maya's DeepSeek-V4.1 engine unmodified (v1.1.17, 8d9a9b5d)
Verbatim copy of mw00/project-maya src/ds4, tests/ds4_*, tools/ds4 and the exl3 / sampler
kernel sources it needs, MIT, with their LICENSE and a NOTICE. Not built yet; the next
commits adapt it to Strata's tree.

Co-authored-by: needmorevram <needmorevram@users.noreply.github.com>
2026-10-20 16:19:45 +02:00
Niko1221 b15b209a03 Step B: Gyro's trellis MMQ prompt kernels on an upstream ggml, so the packaged engine reads Gyro prompts as fast as rc2
cmake/strata_ggml_tq_overlay.cmake writes, at configure time, a copy of the pinned ggml-cuda headers (and ggml.h, quantize.cu) into
the build folder with TQ2_T / TQK6 / TQK7 routed the way IQ2_XS is: same Q8_0_16 tile layout, dot kernels and tile configs (the
fork's own configs for them are copies of IQ2_XS's), three template instances, the tile loader and tq.cuh from third_party/ggml-tq.
Only the strata_mmq target sees the copy; every other type is compiled from the untouched files. Anchors are checked: another
llama.cpp turns the overlay off with a message (FP16 prompt path). moe_mmq.cu knows the trellis block geometry itself.

The tile loader and the trellis tables are agentionai/llama.cpp's (MIT, ggml authors; Laurent Zuijdwijk), ported from
agentionai/llama.cpp 93a24e5 ggml/src/ggml-cuda/{tq.cuh,mmq-load-tiles.cuh,tq-lut-i8.cuh}.

Checked: Gyro-S and Gyro-M exact_pp 4096/20000 residual dumps IDENTICAL to rc2 (R9700 gfx1201); Q2_0 and IQ3_XXS IDENTICAL to f-split
on gfx1201 and sm_86; ctest ggml_tq_overlay.
2026-10-16 03:51:27 +02:00
Laurent Zuijdwijk d0a02fe426 CPU trellis kernels: AVX2 / AVX-512 decode-and-dot for TQ2_T / TQK6 / TQK7
Expert-cache misses of the Gyro files run on the CPU workers. Until now those
rows went through ggml-cpu's vec_dot one token at a time. Strata now has its
own kernels for the three trellis types (tq_cpu.hpp), chosen at run time like
the i-quant ones:

- the 32768 x 4 int16 state table (one 8-byte lookup per four weights, built
  from the codebook in third_party/ggml/ggml-common-tq.h, now also visible to
  host code), scalar state extraction, four table rows per YMM by broadcast
  loads + VPBLENDD, VPMADDWD (AVX2) or VPDPWSSD (AVX-512 VNNI);
- the weights of a block are decoded once for all the tokens routed to the
  expert (a verify window), then each token is a few instructions;
- one fixed arithmetic for every ISA: exact int32 sums per Q8_0 sub-block,
  four float FMA chains, a fixed final sum. AVX2, AVX-512 and the scalar
  reference give the same bits, and a token gives the same bits alone or in a
  group of any size (no group-size rule needed, cf. #152).

native_gu_rows / native_down_rows take them for types 144-146 on AVX2 and
AVX-512 CPUs. STRATA_NO_TQ_KERNELS=1 restores ggml-cpu's vec_dot,
STRATA_TQ_ISA=scalar|avx2|avx512 caps the ISA. A CPU without AVX2 keeps
ggml-cpu.

tq_cpu_parity (CPU only, ctest tq_cpu_parity and tq_cpu_parity_avx2):
AVX2 / AVX-512 vs the scalar kernel bit for bit for groups of 1-8 tokens,
vs ggml-cpu's vec_dot (rel ~1e-7, float order) and vs to_float in double
(rel ~1e-5, the int16 table), plain and Hadamard-rotated, for Gyro-S
(tqk6/tqk7) and Gyro-M (tq2_t) experts through the engine entry points.
`tq_cpu_parity --bench` is the micro-benchmark (clock-calibrated cycles).

Zen 5, one thread, weights streamed from DRAM, core cycles per 128-weight
block (one token / per token in a group of three):
  ggml-cpu vec_dot, AVX2 build:     108-117 / 108-116
  ggml-cpu vec_dot, AVX-512 build:   64-66  /  61-62
  Strata AVX2:                       47-49  /  22-23
  Strata AVX-512:                    47-49  /  22
  (Q2_0's AVX2 kernel: ~20; the repacked AVX-512 Q2_0 kernel: ~7)

Ported from agentionai/Strata rc2 7c85f1d (rc2 = 9ff02c9), author Laurent Zuijdwijk.
2026-10-15 21:31:35 +02:00
Laurent Zuijdwijk fbf045eb6a APR port, stage 4: trellis decode and Hadamard rotation on the GPU paths
- third_party/ggml/ggml-common-tq.h: the fork's TQ2_T/TQK6/TQK7 block
  structs and 2048-point codebook (device table).
- iq_kernels.cu: Fmt<144..146> (the fork's tq.cuh lane decode against q8_1,
  4 q8_1 blocks per 128-block), dq_tq in dq_dispatch (prompt FP16 path,
  embedding), is_iq / row bytes; hadamard_rows / hadamard_rows_f16
  (shared-memory FWHT in the CPU's butterfly order) and
  hadamard_device_signs; native_expert_grouped rotates h when
  NativeExpertLayout::had_block is set.
- verify.cpp (local GPU), remote_experts.cpp (helper GPUs), prefill.cpp
  (FP16 fallback; folded layers never take MMQ) rotate x / h into their
  own buffers; the shared expert and the CPU doorbell copy keep x.
- native_expert_parity --synthetic-hadamard; ctests for tqk6/tqk7 and
  tq2_t when ggml is the agention fork.
- generate.cpp: APR packs run only with STRATA_APR=1 until validated end
  to end on a GPU.
- hip_backend.cmake: gfx1151 as an unvalidated architecture.

Rebased onto upstream 0.1.39: native_expert_grouped takes the separate
SwiGLU / rotate / q8_1 passes when the down weights are folded (the one-pass
swiglu_q8_1 kernel has no h to rotate); the new decode peer GPU
(peer_experts.cpp) rotates its private input copy and passes the down signs,
as remote_experts.cpp does.

Ported from agentionai/Strata rc2 6c7abde (rc2 = 9ff02c9), author Laurent Zuijdwijk.
2026-10-15 21:29:38 +02:00
Niko1221 01529aaa82 Strata: Qwen3.8-Flash-Next on a 12-24 GB NVIDIA GPU + 64 GB RAM, one-click install
Inference engine, OpenAI/Anthropic API on localhost, optional image input, one-file setup
(START-HERE.bat / setup.sh). Model files are downloaded from Hugging Face by the setup.
2026-09-24 18:42:20 +02:00