| | |
| | ====================================================================== |
| | === Niko1221/Strata @ 8db8753d55850a1e36cf61db19faf8f08fa90f30 |
| | ====================================================================== |
| | |
| | --- [STRATA_ROUTE_TAIL_SKIP (expert skip)] 712 lines --- |
| | /tmp/src_audit/Strata/terminal/setup.py-299-# (575.51 / 576.02), which strata update enforces. cuda12_min_driver() reads that from the package or the feed (#4247 #4188). |
| | /tmp/src_audit/Strata/terminal/setup.py-300-CUDA12_COMPAT_DRIVER = 528 if WIN else 525 |
| | /tmp/src_audit/Strata/terminal/setup.py-301-ENGINE12_DIR = "engine-cuda12" |
| | /tmp/src_audit/Strata/terminal/setup.py:302:MIN_ENGINE = (0, 1, 46) # versions compare all numbers; v0.1.60: engine changes since v0.2.13.1 (git log 628f74955..HEAD); v0.1.59: engine changes since v0.2.12 (git log 146df3c46..HEAD); v0.1.58: engine rounds 0215-0217 (tuned drafters, the file-tier re-check, prefill and Q5_0 fixes; git log c3b3f5035..HEAD); v0.1.46: the 0.2 release engine (UPDATE.bat and setup fetch it from the signed feed, #3469 #3437); v0.1.45: Qwen3.6 parallel requests and pictures, fixes #2346 #2372 #2396; v0.1.44.1: CPUs without AVX2 start again (#2324: an illegal instruction before main in the NVFP4 CPU rows), the CUDA 12.0/12.1 toolkits build (#2322), a crashed engine start is named instead of retried as a GPU runtime start, Mac M2 (#2323); v0.1.44: UD-Q4/Q5/Q6_K_XL and Q8_0 Unsloth files in setup (K-quant experts, MMQ prompt library strata_kq), NVFP4 packs, Qwen3.6-35B-A3B, Intel Arc A-series kernels, the pipelined-decode and latency work; v0.1.43.1: the adaptive overlap no longer collapses decode on pinned-host desktops (#1964 #1975), Windows PLE mmap stall (#1984), pinned prompt uploads (#1996), the I/O watchdog allowance; v0.1.43: adaptive-tier copies overlap on CUDA, P100 (sm_60) kernel tables, RDNA4 (gfx1200/gfx1201) defaults (route tail skip, measured PCIe share, 16K prompt chunks, fused IQ3 prompt experts); v0.1.42.1: the GGUF-in-place file tier on Windows unmaps every shard, dual-socket starts judge each NUMA node and STRATA_DROP_CACHE_ON_EXIT, tools/strata_bench.py; v0.1.42: STRATA_ROUTE_TAIL_SKIP=7 default on CUDA (+13-16% decode), the AMD 2-GPU checkpoint fix (H13), Phase 2 fixes and opt-ins; v0.1.41.1 (folded into 0.1.42): the #1576 card order, #1616 stage size, #1595 CPU share, #1630/#1607 Windows HIP chunk cap and commit-limit warning, #1603 parallel-request bookkeeping; v0.1.41: CPU prefill share on by default (NVIDIA, chunks < 1024), --batch-groups auto, the file tier read in batches on Windows, Pascal decode fix, per-arch tables; v0.1.40.3: the #1357 MTP router guard, the #1376 Windows HIP cache floor, #461 runtime DLLs, Intel A750 first-request fix; v0.1.40.2: F4 verify windows, the Linux file tier (#1194), the stager wait (#1057), #1264/#1201/#1139 fixes, opt-in CPU share (#1282), Intel Arc; v0.1.40: --resident-experts on a layer split with the split+resident variant (#848), --kv k8v4 with KV streaming (#711); v0.1.39: the #577 file-tier regression fixed, the OpenAI Responses API (#451, Codex), a reply stuck on one token ended (#606), the head before the arena (#620), effort_position (#458), --vram-reserve hot resize opt-in (#533), PR batch; v0.1.38: prompts faster (one gather per expert group #372, the first chunk's PLE rows beside layer 0 #374, DeltaNet three heads per thread #413), --kv q4_0 prompts on tensor cores (#452), Q5_0 experts on the GPU (#473), IQ4_XS on AVX-2 (#415), unbuffered expert on Windows (#357 #362), --peer-device (#531), a 6 GB card starts (#496), PR batch; v0.1.37: a silent engine is restarted (#481), Windows AMD counts the desktop's VRAM (#380 #377 #497), a steadier PCIe probe (#485), fixes #496 #495 #498 #505 #493; v0.1.36: a cancelled prompt logged as read so far (#471), the draft-head hint (#474), UPDATE.bat (#475), --expert-profile-save (#477); v0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB (#467), fixes #460 #459 #446 #447 #457 #448 #444; v0.1.34: AMD on Windows (a ready-made HIP engine), an MCP server for AI assistants (tools/strata_mcp.py), a shorter README; v0.1.33: a portable image encoder again (#411 #412), setup recommends instead of forcing (#406 #403 #364 #384), fixes #352 #365 #369 #371 #375 #393 #408 #414; v0.1.32: split prompts faster (#340), AMD router +12%, Unsloth Q4 in setup, faster Q4 prompts, #326/#327/#342/#344 fixes, PR batch; v0.1.31: Unsloth UD-Q4_K_XL (experimental), GGUF-in-place low-RAM mode, Windows GGUF load 2x, server race + tokenizer fixes, AMD intrinsics; v0.1.30: short prompts faster (streaming from 1024 tokens), resident low-RAM variant, multi-GPU session carve, RDNA4; v0.1.29: sampled answers faster (split top-k), #154 correctness fixes; v0.1.28: the expert cache reserves the draft head, a cancelled request no longer fails the next; v0.1.27: RTX 20 (sm_75) in the ready-made engine, the HIP build without CUDA headers; v0.1.26: the draft layer's prompt pass in batches; v0.1.25: faster prompts (grouping off the copy engine, fused hyper-connection kernels), AMD HIP backend, --kv k8v4; v0.1.24: long prompts faster (QSA select on tensor cores); v0.1.23: image requests honor sampling, 8 GB cards start, batched verify window; v0.1.22: faster prompts (tensor-core attention), multi-GPU across images/steering/KV streaming; v0.1.21: multi-GPU layer split (--gpus); v0.1.20: system-prompt checkpoint, PCIe probe, hit rate; v0.1.19: penalties |
| | /tmp/src_audit/Strata/terminal/setup.py-303-# KV bytes per context token and attention layer: 8-bit 1056, rotated 4-bit 576, hybrid K8V4 (8-bit K, 4-bit V) 816 |
| | /tmp/src_audit/Strata/terminal/setup.py-304-KV_CELL_BYTES = {"q4_0": 576, "k8v4": 816} |
| | /tmp/src_audit/Strata/terminal/setup.py-305-PY_PACKAGES = ["numpy", "jinja2", "regex", "pyyaml", "tqdm", "requests", "pillow", "psutil"] |
| | -- |
| | /tmp/src_audit/Strata/terminal/setup.py-4808- or better than the FP16 path's; UD-Q4_K_XL keeps it opt-in here (the Linux gfx12 engine takes it by itself since 0.2.10.1). |
| | /tmp/src_audit/Strata/terminal/setup.py-4809- STRATA_HC_Q8 on CUDA for the UD-* files is the ENGINE's default now (it sees the Q8_0 hyper-connection projections in the GGUF); setup |
| | /tmp/src_audit/Strata/terminal/setup.py-4810- writes nothing for it. |
| | /tmp/src_audit/Strata/terminal/setup.py:4811: STRATA_ROUTE_TAIL_SKIP=0 in every Unsloth config (0.2.17, owner 11-19: the tail skip is Off by default; users saw lower quality). Before 0.2.17 setup |
| | /tmp/src_audit/Strata/terminal/setup.py-4812- wrote it only where every expert is in RAM and not on Linux gfx12; the RAM-budget mode and Linux gfx12 ran the engine's own default (rank 7). |
| | /tmp/src_audit/Strata/terminal/setup.py-4813- The in_budget and arch arguments are kept for the callers and no longer change anything. Every engine start also sets an unset |
| | /tmp/src_audit/Strata/terminal/setup.py:4814: STRATA_ROUTE_TAIL_SKIP to 0 (serve/server.py child_env), so the other families and the configs made before 0.2.17 start Off too. The way to |
| | /tmp/src_audit/Strata/terminal/setup.py:4815: turn it on is STRATA_ROUTE_TAIL_SKIP=7 (the app's Expert settings, strata launch --set STRATA_ROUTE_TAIL_SKIP=7); a setup run again keeps |
| | /tmp/src_audit/Strata/terminal/setup.py-4816- a value the person put there (carry_over).""" |
| | /tmp/src_audit/Strata/terminal/setup.py-4817- env = {} |
| | /tmp/src_audit/Strata/terminal/setup.py-4818- if family != "unsloth": |
| | /tmp/src_audit/Strata/terminal/setup.py-4819- return env |
| | /tmp/src_audit/Strata/terminal/setup.py-4820- if model in ("UD-Q5_K_XL", "UD-Q6_K_XL"): |
| | /tmp/src_audit/Strata/terminal/setup.py-4821- env["STRATA_MMQ_KQ"] = "1" |
| | /tmp/src_audit/Strata/terminal/setup.py:4822: env["STRATA_ROUTE_TAIL_SKIP"] = "0" |
| | /tmp/src_audit/Strata/terminal/setup.py-4823- return env | | | /tmp/src_audit/Strata/terminal/setup.py-4824- | | | /tmp/src_audit/Strata/terminal/setup.py-4825- | | | -- | | | /tmp/src_audit/Strata/terminal/setup.py-7643-SETUP_KEYS = frozenset({"exe", "args", "cwd", "tokenizer", "model_name", "log", "lib_dirs", "port", "backend", "env", | | | /tmp/src_audit/Strata/terminal/setup.py-7644- "gpu", "gpus_asked", "gpus_by", "layer_split", "host", "api_key", "draft_vocab", "vision", "args_written", "ui_budget_work_gib", "shape_title"}) | | | /tmp/src_audit/Strata/terminal/setup.py-7645-SETUP_ENV = frozenset({"STRATA_HIPBLASLT_TUNING", "STRATA_ROCBLAS_TUNING", "STRATA_RESIDENT_PIN", "STRATA_NO_ARENA_THP", "STRATA_MMQ_KQ", "STRATA_HC_Q8", | | | /tmp/src_audit/Strata/terminal/setup.py:7646: "STRATA_ROUTE_TAIL_SKIP"}) | frozenset(GFX1103_SWITCHES) | frozenset(GFX1150_SWITCHES) # the "env" entries setup writes (the gfx1103 switches are setup's too: a re-run refreshes them, they do not linger) | | | /tmp/src_audit/Strata/terminal/setup.py-7647-# 0.1.44 added these three, written for Unsloth's files only (unsloth_default_env). In any other model's config they are the | | | /tmp/src_audit/Strata/terminal/setup.py:7648:# user's own (STRATA_ROUTE_TAIL_SKIP=0 to turn the tail skip off, STRATA_MMQ_KQ=1 ...): a setup run again keeps them there | | | /tmp/src_audit/Strata/terminal/setup.py-7649-# (0.1.44 dropped them with the rest of SETUP_ENV). | | | /tmp/src_audit/Strata/terminal/setup.py:7650:SETUP_ENV_UNSLOTH = frozenset({"STRATA_MMQ_KQ", "STRATA_HC_Q8", "STRATA_ROUTE_TAIL_SKIP"}) | | | /tmp/src_audit/Strata/terminal/setup.py-7651-# The only values setup writes for an entry that people also set by hand. STRATA_RESIDENT_PIN: setup writes "0" (ROCm, resident experts); a "1" is the person's (#6244). | | | /tmp/src_audit/Strata/terminal/setup.py-7652-SETUP_ENV_VALUES = {"STRATA_RESIDENT_PIN": frozenset({"0"})} | | | /tmp/src_audit/Strata/terminal/setup.py-7653-SETUP_VISION = frozenset({"exe", "cpu_exe", "mmproj", "model", "gpu", "max_tokens", "threads"}) | | | -- | | | /tmp/src_audit/Strata/terminal/setup.py-7677- if env: |
| | /tmp/src_audit/Strata/terminal/setup.py-7678- cfg["env"] = {**(cfg.get("env") or {}), **env} |
| | /tmp/src_audit/Strata/terminal/setup.py-7679- kept += [f"env {k}" for k in env] |
| | /tmp/src_audit/Strata/terminal/setup.py:7680: # 0.2.17: the tail skip is Off by default (setup writes STRATA_ROUTE_TAIL_SKIP=0 for Unsloth's files), and On is a value the person chose (7, or a | | | /tmp/src_audit/Strata/terminal/setup.py-7681- # rank 1-9): a setup run again must not turn it back to the 0. Only a value other than 0 is kept; an old 0 is Off, the same as the new one. |
| | /tmp/src_audit/Strata/terminal/setup.py:7682: old_skip = str((old.get("env") or {}).get("STRATA_ROUTE_TAIL_SKIP", "")).strip() if isinstance(old.get("env"), dict) else "" |
| | /tmp/src_audit/Strata/terminal/setup.py:7683: if old_skip not in ("", "0") and (cfg.get("env") or {}).get("STRATA_ROUTE_TAIL_SKIP") != old_skip: |
| | /tmp/src_audit/Strata/terminal/setup.py:7684: cfg["env"] = {**(cfg.get("env") or {}), "STRATA_ROUTE_TAIL_SKIP": old_skip} |
| | /tmp/src_audit/Strata/terminal/setup.py:7685: kept.append("env STRATA_ROUTE_TAIL_SKIP") |
| | /tmp/src_audit/Strata/terminal/setup.py-7686- ov, nv = old.get("vision"), cfg.get("vision") |
| | /tmp/src_audit/Strata/terminal/setup.py-7687- if isinstance(ov, dict) and isinstance(nv, dict): |
| | /tmp/src_audit/Strata/terminal/setup.py-7688- for k, v in ov.items(): |
| | -- |
| | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-35- group: str = "Speed" # the app's group of Expert settings the row is shown in | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-36- words: tuple[tuple[str, str], ...] = () # ("on", ...), ("off", ...): the app's two option names instead of On / Off (the default one says "(recommended)") | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-37- terminal_default: str = "" # the Terminal's Default cell for the row, when "on" / "off" would not say it | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py:38: # A switch with a value to choose instead of on / off (STRATA_ROUTE_TAIL_SKIP): (value, the app's word) for each choice besides the default, which is | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-39- # no entry at all (words' "on" word names it). The app shows them as one dropdown, the Terminal's sentence lists them (env_words). | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-40- choices: tuple[tuple[str, str], ...] = () | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-41- choice_note: str = "" # shown under the dropdown while a choice whose word is its own value (a number) is picked | | | -- | | | |
| | --- [moe-cache (llama.cpp PR #30966)] 23 lines --- |
| | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-284-// njobs[0] of them (njobs[1] is the block counter, left at zero). Output rows: pair t*TOPK+k (the shared expert's go to |
| | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-285-// TTOPK+t). With an ExpertCache (model.hpp) the same last block also plans the layer's slots (the jobs' experts not | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-286-// in a slot take one, CLOCK, the layer's tables updated) and writes list (1 + MAXT * TOPK ints: how many took a slot, | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp:287:// then their ids) for moe_cache's copy. | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-288-// sh_gu (rows sh_rows < 4096): the shared expert's gate|up over the q8_1 rows sh_y into sh_out, in the same launch | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-289-void router_route(const float W, const float* x, float* logits, int T, int* topi, float* topw, Job* jobs_gu, Job* jobs_dn, | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-290- int* njobs, void* st, const ExpertCache* ec = nullptr, int layer = -1, int* list = nullptr, const Q8S* sh_gu = nullptr, | | | -- | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-306-// a decode window's layer with an ExpertCache (model.hpp): the experts router_route's plan listed copied in from RAM to | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-307-// their new slots by a grid of the SMs (wide 16-byte reads; the MoE kernels' own reads over the link are latency-bound). | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-308-// With jobs, the plan runs here first, a launch of its own (when router_route did not plan) | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp:309:void moe_cache(int layer, size_t gu_stride, size_t dn_stride, const ExpertCache& ec, int* list, void* st, const Job* jobs = nullptr, | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-310- const int* njobs = nullptr); | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-311-// pool p's listed experts (list: device, its count then the experts' ids, each with its slot in ec.slot_of already) from | | | /tmp/src_audit/Strata/engine/src/split/src/kernels.hpp-312-// their host copies into their slots, one kernel: the arena's fill | | | -- | | | /tmp/src_audit/Strata/engine/src/split/src/engine_impl.hpp-145- unsigned* route_trace = nullptr; // FNX_ROUTE_TRACE=M, card 0, mapped host memory: decode's picks in order (M million) | | | /tmp/src_audit/Strata/engine/src/split/src/engine_impl.hpp-146- unsigned long long* route_trace_len = nullptr; | | | /tmp/src_audit/Strata/engine/src/split/src/engine_impl.hpp-147- unsigned long long route_trace_cap = 0; | | | /tmp/src_audit/Strata/engine/src/split/src/engine_impl.hpp:148: int* cache_list = nullptr; // moe_cache's scratch (with an ExpertCache) | | | /tmp/src_audit/Strata/engine/src/split/src/engine_impl.hpp-149- // FNX_PREFETCH_PROBE=1, card 0: layer l + 1's router on layer l's FFN input, its top 10 per row (guess [NL][MAXT * | | | /tmp/src_audit/Strata/engine/src/split/src/engine_impl.hpp-150- // TOPK]) scored against layer l + 1's picks (cnt [7]: probe_counts) | | | /tmp/src_audit/Strata/engine/src/split/src/engine_impl.hpp-151- float* probe_logits = nullptr; | | | | | | --- [KV quant (lossy cache)] 2945 lines --- | | | /tmp/src_audit/Strata/engine/bench/test_gfx906_qsa_query_swizzle_guard.py-117-} | | | /tmp/src_audit/Strata/engine/bench/test_gfx906_qsa_query_swizzle_guard.py-118-''' | | | /tmp/src_audit/Strata/engine/bench/test_gfx906_qsa_query_swizzle_guard.py-119- | | | /tmp/src_audit/Strata/engine/bench/test_gfx906_qsa_query_swizzle_guard.py:120:program = prefix + guard + "\nbool active(bool query_swizzle, bool lane_cell, int kv_mode) {\n" | | | /tmp/src_audit/Strata/engine/bench/test_gfx906_qsa_query_swizzle_guard.py-121-program += " const int kernel = -1; // the environment's choice (launch_chunks_batch)\n" + dispatch.group(0) + "\n return use_query_swizzle;\n}\n" + tests | | | /tmp/src_audit/Strata/engine/bench/test_gfx906_qsa_query_swizzle_guard.py-122-with tempfile.TemporaryDirectory(prefix="qsa-swizzle-guard-") as directory: | | | /tmp/src_audit/Strata/engine/bench/test_gfx906_qsa_query_swizzle_guard.py-123- cpp = Path(directory) / "guard_test.cpp" | | | -- | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-4310- return 1; | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-4311- } |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-4312- strata::prefill::configure_bmg_window(ss, *strata::q_of(main_cs), !multi_gpu && stages.empty() && o.batch <= 0); |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp:4313: if (g.n_qsa_layers() > 0 && ss.qsa_states[ss.qsa_primary()].kv_mode == 1) |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-4314- std::fprintf(stderr, "strata generate: KV streaming: %lld of %lld cells per QSA layer in VRAM, the K/V in " | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-4315- "%.2f GiB of pinned RAM\n", |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-4316- (long long) (ss.qsa_states[ss.qsa_primary()].n_slots * 4), |
| | -- |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-8632- } |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-8633- if (use_mtp && std::getenv("STRATA_SNAPSHOT_VERIFY") != nullptr) |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-8634- std::fprintf(stderr, "strata serve: DRAFT_PREFILL path=%s mode=%d cells=%lld\n", |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp:8635: batched ? "batched" : "token", mtp.kv_state().kv_mode, (long long) T); |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-8636- // progress for the server window: PP <position reached> <prompt tokens> <ms> <fresh tokens/s> | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-8637- const int64_t done = p0 + T; | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-8638- pp_reached = done; | | | -- | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-9526- "spec_min_p=%.2f conversation_cache_mib=%lld conversation_cache_slots=%d " | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-9527- "conversation_cache_min_free_mib=%lld tail_role_token=%lld vram_elastic=%d%s engine=" STRATA_VERSION "\n", | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-9528- (long long) o.max_context, o.kv.c_str(), | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp:9529: (long long) (g.n_qsa_layers() > 0 && ss.qsa_states[ss.qsa_primary()].kv_mode == 1 | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-9530- ? ss.qsa_states[ss.qsa_primary()].n_slots * 4 : 0), | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-9531- (long long) slots_all, (long long) g.n_layers * (long long) g.n_expert, (long long) mib_all, | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-9532- (long long) slots_primary, (long long) mib_primary, | | | -- | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-11003- } | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-11004- std::fprintf(stderr, "strata serve: SNAPSHOT_VERIFY draft=%016llx cells=%lld mode=%d source=%s resident=%lld\n", | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-11005- (unsigned long long) draft_hash, (long long) draft_kv.cells, | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp:11006: mtp.kv_state().kv_mode, "ram", | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-11007- (long long) (mtp.kv_state().n_slots * strata::kernels::qsa_real_shapes().page_size)); | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-11008- } |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-11009- live = std::move(incoming->live.ids); |
| | -- |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13053- const int64_t kvb = qs.head_dim, scb = (qs.head_dim / 64) * 2; | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13054- // a state's K/V arrays and their bytes per (cell, head) row: the host copy when it has one | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13055- auto kv_arrays = [&](const strata::core::QsaState& st) { | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp:13056: const bool h = st.kv_mode != 0; | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13057- std::vector<std::pair<const void*, int64_t>> a; | | | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13058- if (st.kv_q4) { |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13059- const int64_t q4b = (int64_t) strata::kernels::kv_q4_bytes_per_head((int) qs.head_dim); |
| | -- |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13243- "pool + plan %.3f ms, host staging %.3f ms, commit %.3f ms\n", st, |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13244- (long long) v.windows, v.ms_wait / w, v.ms_pool / w, v.ms_host / w, v.ms_commit / w); |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13245- } |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp:13246: if (g.n_qsa_layers() > 0 && ss.qsa_states[ss.qsa_primary()].kv_mode == 1) { |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13247- // KV streaming, cumulative over the process: blocks the selections named vs blocks read from RAM |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13248- // (this device's owned ordinals; a split's other stages hold theirs) |
| | /tmp/src_audit/Strata/engine/sycl/src/program/generate.cpp-13249- uint64_t miss = 0, look = 0; |
| | -- |
| | /tmp/src_audit/Strata/engine/sycl/include/strata/kernels/qsa_decode_attn.hpp-10-// acc = p . V -> partials |
| | /tmp/src_audit/Strata/engine/sycl/include/strata/kernels/qsa_decode_attn.hpp-11-// grid (n_head): merge the chunks with the usual log-sum-exp rescale |
| | /tmp/src_audit/Strata/engine/sycl/include/strata/kernels/qsa_decode_attn.hpp-12-// |
| | /tmp/src_audit/Strata/engine/sycl/include/strata/kernels/qsa_decode_attn.hpp:13:// FP16 pools or INT8 pools (codes + fp16 scale per 64 values, kv_q8.hpp). The grid is sized by the capacity; |
| | |
| | --- [expert placement / VRAM cap] 7 lines --- |
| | /tmp/src_audit/Strata/engine/include/strata/prefill/prefill.hpp-366- void lm_release(); |
| | /tmp/src_audit/Strata/engine/include/strata/prefill/prefill.hpp-367- bool lm_mid_ = false; |
| | /tmp/src_audit/Strata/engine/include/strata/prefill/prefill.hpp-368- bool lm_force_ = false; ///< run_multi: the walk even for a short total |
| | /tmp/src_audit/Strata/engine/include/strata/prefill/prefill.hpp:369: bool lm_by_default_ = false; ///< the walk is on because nothing was set (a wider VRAM margin, the measured super-chunk size) |
| | /tmp/src_audit/Strata/engine/include/strata/prefill/prefill.hpp-370- int ring_room_ = 0; ///< set_ring_room (this instance's, and it survives reset) |
| | /tmp/src_audit/Strata/engine/include/strata/prefill/prefill.hpp-371- void* ring_room_base_ = nullptr; ///< set_ring_room_base: the bytes the room's slots are |
| | /tmp/src_audit/Strata/engine/include/strata/prefill/prefill.hpp-372- uint64_t ring_room_bytes_ = 0; |
| | |
| | --- [router top-k / bias / tail] 930 lines --- |
| | /tmp/src_audit/Strata/terminal/setup.py-299-# (575.51 / 576.02), which strata update enforces. cuda12_min_driver() reads that from the package or the feed (#4247 #4188). |
| | /tmp/src_audit/Strata/terminal/setup.py-300-CUDA12_COMPAT_DRIVER = 528 if WIN else 525 |
| | /tmp/src_audit/Strata/terminal/setup.py-301-ENGINE12_DIR = "engine-cuda12" |
| | /tmp/src_audit/Strata/terminal/setup.py:302:MIN_ENGINE = (0, 1, 46) # versions compare all numbers; v0.1.60: engine changes since v0.2.13.1 (git log 628f74955..HEAD); v0.1.59: engine changes since v0.2.12 (git log 146df3c46..HEAD); v0.1.58: engine rounds 0215-0217 (tuned drafters, the file-tier re-check, prefill and Q5_0 fixes; git log c3b3f5035..HEAD); v0.1.46: the 0.2 release engine (UPDATE.bat and setup fetch it from the signed feed, #3469 #3437); v0.1.45: Qwen3.6 parallel requests and pictures, fixes #2346 #2372 #2396; v0.1.44.1: CPUs without AVX2 start again (#2324: an illegal instruction before main in the NVFP4 CPU rows), the CUDA 12.0/12.1 toolkits build (#2322), a crashed engine start is named instead of retried as a GPU runtime start, Mac M2 (#2323); v0.1.44: UD-Q4/Q5/Q6_K_XL and Q8_0 Unsloth files in setup (K-quant experts, MMQ prompt library strata_kq), NVFP4 packs, Qwen3.6-35B-A3B, Intel Arc A-series kernels, the pipelined-decode and latency work; v0.1.43.1: the adaptive overlap no longer collapses decode on pinned-host desktops (#1964 #1975), Windows PLE mmap stall (#1984), pinned prompt uploads (#1996), the I/O watchdog allowance; v0.1.43: adaptive-tier copies overlap on CUDA, P100 (sm_60) kernel tables, RDNA4 (gfx1200/gfx1201) defaults (route tail skip, measured PCIe share, 16K prompt chunks, fused IQ3 prompt experts); v0.1.42.1: the GGUF-in-place file tier on Windows unmaps every shard, dual-socket starts judge each NUMA node and STRATA_DROP_CACHE_ON_EXIT, tools/strata_bench.py; v0.1.42: STRATA_ROUTE_TAIL_SKIP=7 default on CUDA (+13-16% decode), the AMD 2-GPU checkpoint fix (H13), Phase 2 fixes and opt-ins; v0.1.41.1 (folded into 0.1.42): the #1576 card order, #1616 stage size, #1595 CPU share, #1630/#1607 Windows HIP chunk cap and commit-limit warning, #1603 parallel-request bookkeeping; v0.1.41: CPU prefill share on by default (NVIDIA, chunks < 1024), --batch-groups auto, the file tier read in batches on Windows, Pascal decode fix, per-arch tables; v0.1.40.3: the #1357 MTP router guard, the #1376 Windows HIP cache floor, #461 runtime DLLs, Intel A750 first-request fix; v0.1.40.2: F4 verify windows, the Linux file tier (#1194), the stager wait (#1057), #1264/#1201/#1139 fixes, opt-in CPU share (#1282), Intel Arc; v0.1.40: --resident-experts on a layer split with the split+resident variant (#848), --kv k8v4 with KV streaming (#711); v0.1.39: the #577 file-tier regression fixed, the OpenAI Responses API (#451, Codex), a reply stuck on one token ended (#606), the head before the arena (#620), effort_position (#458), --vram-reserve hot resize opt-in (#533), PR batch; v0.1.38: prompts faster (one gather per expert group #372, the first chunk's PLE rows beside layer 0 #374, DeltaNet three heads per thread #413), --kv q4_0 prompts on tensor cores (#452), Q5_0 experts on the GPU (#473), IQ4_XS on AVX-2 (#415), unbuffered expert on Windows (#357 #362), --peer-device (#531), a 6 GB card starts (#496), PR batch; v0.1.37: a silent engine is restarted (#481), Windows AMD counts the desktop's VRAM (#380 #377 #497), a steadier PCIe probe (#485), fixes #496 #495 #498 #505 #493; v0.1.36: a cancelled prompt logged as read so far (#471), the draft-head hint (#474), UPDATE.bat (#475), --expert-profile-save (#477); v0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB (#467), fixes #460 #459 #446 #447 #457 #448 #444; v0.1.34: AMD on Windows (a ready-made HIP engine), an MCP server for AI assistants (tools/strata_mcp.py), a shorter README; v0.1.33: a portable image encoder again (#411 #412), setup recommends instead of forcing (#406 #403 #364 #384), fixes #352 #365 #369 #371 #375 #393 #408 #414; v0.1.32: split prompts faster (#340), AMD router +12%, Unsloth Q4 in setup, faster Q4 prompts, #326/#327/#342/#344 fixes, PR batch; v0.1.31: Unsloth UD-Q4_K_XL (experimental), GGUF-in-place low-RAM mode, Windows GGUF load 2x, server race + tokenizer fixes, AMD intrinsics; v0.1.30: short prompts faster (streaming from 1024 tokens), resident low-RAM variant, multi-GPU session carve, RDNA4; v0.1.29: sampled answers faster (split top-k), #154 correctness fixes; v0.1.28: the expert cache reserves the draft head, a cancelled request no longer fails the next; v0.1.27: RTX 20 (sm_75) in the ready-made engine, the HIP build without CUDA headers; v0.1.26: the draft layer's prompt pass in batches; v0.1.25: faster prompts (grouping off the copy engine, fused hyper-connection kernels), AMD HIP backend, --kv k8v4; v0.1.24: long prompts faster (QSA select on tensor cores); v0.1.23: image requests honor sampling, 8 GB cards start, batched verify window; v0.1.22: faster prompts (tensor-core attention), multi-GPU across images/steering/KV streaming; v0.1.21: multi-GPU layer split (--gpus); v0.1.20: system-prompt checkpoint, PCIe probe, hit rate; v0.1.19: penalties |
| | /tmp/src_audit/Strata/terminal/setup.py-303-# KV bytes per context token and attention layer: 8-bit 1056, rotated 4-bit 576, hybrid K8V4 (8-bit K, 4-bit V) 816 |
| | /tmp/src_audit/Strata/terminal/setup.py-304-KV_CELL_BYTES = {"q4_0": 576, "k8v4": 816} |
| | /tmp/src_audit/Strata/terminal/setup.py-305-PY_PACKAGES = ["numpy", "jinja2", "regex", "pyyaml", "tqdm", "requests", "pillow", "psutil"] |
| | -- |
| | /tmp/src_audit/Strata/terminal/setup.py-4808- or better than the FP16 path's; UD-Q4_K_XL keeps it opt-in here (the Linux gfx12 engine takes it by itself since 0.2.10.1). |
| | /tmp/src_audit/Strata/terminal/setup.py-4809- STRATA_HC_Q8 on CUDA for the UD-* files is the ENGINE's default now (it sees the Q8_0 hyper-connection projections in the GGUF); setup |
| | /tmp/src_audit/Strata/terminal/setup.py-4810- writes nothing for it. |
| | /tmp/src_audit/Strata/terminal/setup.py:4811: STRATA_ROUTE_TAIL_SKIP=0 in every Unsloth config (0.2.17, owner 11-19: the tail skip is Off by default; users saw lower quality). Before 0.2.17 setup |
| | /tmp/src_audit/Strata/terminal/setup.py-4812- wrote it only where every expert is in RAM and not on Linux gfx12; the RAM-budget mode and Linux gfx12 ran the engine's own default (rank 7). |
| | /tmp/src_audit/Strata/terminal/setup.py-4813- The in_budget and arch arguments are kept for the callers and no longer change anything. Every engine start also sets an unset |
| | /tmp/src_audit/Strata/terminal/setup.py:4814: STRATA_ROUTE_TAIL_SKIP to 0 (serve/server.py child_env), so the other families and the configs made before 0.2.17 start Off too. The way to |
| | /tmp/src_audit/Strata/terminal/setup.py:4815: turn it on is STRATA_ROUTE_TAIL_SKIP=7 (the app's Expert settings, strata launch --set STRATA_ROUTE_TAIL_SKIP=7); a setup run again keeps |
| | /tmp/src_audit/Strata/terminal/setup.py-4816- a value the person put there (carry_over).""" |
| | /tmp/src_audit/Strata/terminal/setup.py-4817- env = {} |
| | /tmp/src_audit/Strata/terminal/setup.py-4818- if family != "unsloth": |
| | /tmp/src_audit/Strata/terminal/setup.py-4819- return env |
| | /tmp/src_audit/Strata/terminal/setup.py-4820- if model in ("UD-Q5_K_XL", "UD-Q6_K_XL"): |
| | /tmp/src_audit/Strata/terminal/setup.py-4821- env["STRATA_MMQ_KQ"] = "1" |
| | /tmp/src_audit/Strata/terminal/setup.py:4822: env["STRATA_ROUTE_TAIL_SKIP"] = "0" |
| | /tmp/src_audit/Strata/terminal/setup.py-4823- return env | | | /tmp/src_audit/Strata/terminal/setup.py-4824- | | | /tmp/src_audit/Strata/terminal/setup.py-4825- | | | -- | | | /tmp/src_audit/Strata/terminal/setup.py-7643-SETUP_KEYS = frozenset({"exe", "args", "cwd", "tokenizer", "model_name", "log", "lib_dirs", "port", "backend", "env", | | | /tmp/src_audit/Strata/terminal/setup.py-7644- "gpu", "gpus_asked", "gpus_by", "layer_split", "host", "api_key", "draft_vocab", "vision", "args_written", "ui_budget_work_gib", "shape_title"}) | | | /tmp/src_audit/Strata/terminal/setup.py-7645-SETUP_ENV = frozenset({"STRATA_HIPBLASLT_TUNING", "STRATA_ROCBLAS_TUNING", "STRATA_RESIDENT_PIN", "STRATA_NO_ARENA_THP", "STRATA_MMQ_KQ", "STRATA_HC_Q8", | | | /tmp/src_audit/Strata/terminal/setup.py:7646: "STRATA_ROUTE_TAIL_SKIP"}) | frozenset(GFX1103_SWITCHES) | frozenset(GFX1150_SWITCHES) # the "env" entries setup writes (the gfx1103 switches are setup's too: a re-run refreshes them, they do not linger) | | | /tmp/src_audit/Strata/terminal/setup.py-7647-# 0.1.44 added these three, written for Unsloth's files only (unsloth_default_env). In any other model's config they are the | | | /tmp/src_audit/Strata/terminal/setup.py:7648:# user's own (STRATA_ROUTE_TAIL_SKIP=0 to turn the tail skip off, STRATA_MMQ_KQ=1 ...): a setup run again keeps them there | | | /tmp/src_audit/Strata/terminal/setup.py-7649-# (0.1.44 dropped them with the rest of SETUP_ENV). | | | /tmp/src_audit/Strata/terminal/setup.py:7650:SETUP_ENV_UNSLOTH = frozenset({"STRATA_MMQ_KQ", "STRATA_HC_Q8", "STRATA_ROUTE_TAIL_SKIP"}) | | | /tmp/src_audit/Strata/terminal/setup.py-7651-# The only values setup writes for an entry that people also set by hand. STRATA_RESIDENT_PIN: setup writes "0" (ROCm, resident experts); a "1" is the person's (#6244). | | | /tmp/src_audit/Strata/terminal/setup.py-7652-SETUP_ENV_VALUES = {"STRATA_RESIDENT_PIN": frozenset({"0"})} | | | /tmp/src_audit/Strata/terminal/setup.py-7653-SETUP_VISION = frozenset({"exe", "cpu_exe", "mmproj", "model", "gpu", "max_tokens", "threads"}) | | | -- | | | /tmp/src_audit/Strata/terminal/setup.py-7677- if env: |
| | /tmp/src_audit/Strata/terminal/setup.py-7678- cfg["env"] = {**(cfg.get("env") or {}), **env} |
| | /tmp/src_audit/Strata/terminal/setup.py-7679- kept += [f"env {k}" for k in env] |
| | /tmp/src_audit/Strata/terminal/setup.py:7680: # 0.2.17: the tail skip is Off by default (setup writes STRATA_ROUTE_TAIL_SKIP=0 for Unsloth's files), and On is a value the person chose (7, or a | | | /tmp/src_audit/Strata/terminal/setup.py-7681- # rank 1-9): a setup run again must not turn it back to the 0. Only a value other than 0 is kept; an old 0 is Off, the same as the new one. |
| | /tmp/src_audit/Strata/terminal/setup.py:7682: old_skip = str((old.get("env") or {}).get("STRATA_ROUTE_TAIL_SKIP", "")).strip() if isinstance(old.get("env"), dict) else "" |
| | /tmp/src_audit/Strata/terminal/setup.py:7683: if old_skip not in ("", "0") and (cfg.get("env") or {}).get("STRATA_ROUTE_TAIL_SKIP") != old_skip: |
| | /tmp/src_audit/Strata/terminal/setup.py:7684: cfg["env"] = {**(cfg.get("env") or {}), "STRATA_ROUTE_TAIL_SKIP": old_skip} |
| | /tmp/src_audit/Strata/terminal/setup.py:7685: kept.append("env STRATA_ROUTE_TAIL_SKIP") |
| | /tmp/src_audit/Strata/terminal/setup.py-7686- ov, nv = old.get("vision"), cfg.get("vision") |
| | /tmp/src_audit/Strata/terminal/setup.py-7687- if isinstance(ov, dict) and isinstance(nv, dict): |
| | /tmp/src_audit/Strata/terminal/setup.py-7688- for k, v in ov.items(): |
| | -- |
| | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-35- group: str = "Speed" # the app's group of Expert settings the row is shown in | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-36- words: tuple[tuple[str, str], ...] = () # ("on", ...), ("off", ...): the app's two option names instead of On / Off (the default one says "(recommended)") | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-37- terminal_default: str = "" # the Terminal's Default cell for the row, when "on" / "off" would not say it | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py:38: # A switch with a value to choose instead of on / off (STRATA_ROUTE_TAIL_SKIP): (value, the app's word) for each choice besides the default, which is | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-39- # no entry at all (words' "on" word names it). The app shows them as one dropdown, the Terminal's sentence lists them (env_words). | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-40- choices: tuple[tuple[str, str], ...] = () | | | /tmp/src_audit/Strata/terminal/strata_control/speed_switches.py-41- choice_note: str = "" # shown under the dropdown while a choice whose word is its own value (a number) is picked | | | -- | | | |
| | --- [prune / approx / lossy] 2957 lines --- |
| | /tmp/src_audit/Strata/terminal/setup.py-116-HF_REVISIONS = { |
| | /tmp/src_audit/Strata/terminal/setup.py-117- "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF": "ed59f92082b1e93c0e96d60a8b11aab089b52f09", # 2026-09-29 |
| | /tmp/src_audit/Strata/terminal/setup.py-118- "ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF": "99bb8f7f95c7aa7b24a36a7786a4f657b30f5d3d", # 2026-10-07 (adds IQ3_S) |
| | /tmp/src_audit/Strata/terminal/setup.py:119: "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-Coder-GGUF": "bba88856f8c3c0c9e40e45f82d05e228b814ac43", # 2026-10-19 (the new expert-pruned shard 1) |
| | /tmp/src_audit/Strata/terminal/setup.py-120- "unsloth/Qwen3.8-Flash-Next-GGUF": "38bb39ee97821de2c9009abb7e93950eec396e66", # 2026-09-30 |
| | /tmp/src_audit/Strata/terminal/setup.py-121- "unsloth/Qwen3.6-35B-A3B-MTP-GGUF": "5bc3e238d916f48a861bac2f8a1990a0e9b7e98d", # 2026-10-12 |
| | /tmp/src_audit/Strata/terminal/setup.py-122- "agentionai/Qwen3.8-Flash-Next-Gyro-GGUF": "1ada08422e404aca51ab9df665f089f34c419c6b", # 2026-10-13 |
| | -- |
| | /tmp/src_audit/Strata/terminal/setup.py-735- "mmproj_hf": hf("ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF"), |
| | /tmp/src_audit/Strata/terminal/setup.py-736- "mmproj": "mmproj-Swift-Qwen3.8-Flash-Next-BF16.gguf", "name": "swift-1.5", |
| | /tmp/src_audit/Strata/terminal/setup.py-737- "license": "Swift Open License 1.0: https://huggingface.co/ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF"}, |
| | /tmp/src_audit/Strata/terminal/setup.py:738: # ISTA-DASLab's expert-pruned release: half of each layer's experts removed, chosen for code, agentic tool use and | | | /tmp/src_audit/Strata/terminal/setup.py-739- # vision; its shard 2 (the n-gram table) and vision encoder are the original's files, shared with it | | | /tmp/src_audit/Strata/terminal/setup.py-740- "coder": {"title": "Qwen3.8-Flash-Next Coder", "by": "ISTA-DASLab's coding version", | | | /tmp/src_audit/Strata/terminal/setup.py-741- "about": "half the experts (code, tools, images kept): needs ~32 GB of RAM, faster; weaker outside coding", |
| | -- |
| | /tmp/src_audit/Strata/terminal/setup.py-2840- z.with_name(z.name + ".done").unlink(missing_ok=True) |
| | /tmp/src_audit/Strata/terminal/setup.py-2841- | | | /tmp/src_audit/Strata/terminal/setup.py-2842- | | | /tmp/src_audit/Strata/terminal/setup.py:2843:# Parallel ranged downloads (0.2.0). One TCP stream often cannot fill a fast line (a long or lossy route, a CDN that limits | | | /tmp/src_audit/Strata/terminal/setup.py-2844-# each connection): download() takes the file in DL_CHUNK pieces over several connections, writes each piece at its own offset, | | | /tmp/src_audit/Strata/terminal/setup.py-2845-# and keeps the finished pieces in <name>.part.chunks so a stopped download continues where it was. Anything that is not a | | | /tmp/src_audit/Strata/terminal/setup.py-2846-# ranged file of known length (no Range support, no length, a small file) is one stream, as before. | | | -- | | | /tmp/src_audit/Strata/terminal/setup.py-4503- "gfx1151": "https://rocm.nightlies.amd.com/v2/gfx1151/", # Strix Halo (docs/STRIX_HALO.md) | | | /tmp/src_audit/Strata/terminal/setup.py-4504- "gfx1150": "https://rocm.nightlies.amd.com/v2/gfx1150/", # Strix Point: only with STRATA_EXPERIMENTAL_GFX1150=1 | | | /tmp/src_audit/Strata/terminal/setup.py-4505- "gfx1103": "https://rocm.nightlies.amd.com/v2/gfx110X-all/"} # Radeon 780M: only with STRATA_EXPERIMENTAL_GFX1103=1 | | | /tmp/src_audit/Strata/terminal/setup.py:4506:# The TheRock nightly indexes are pruned and move on, and each GPU family's index holds its own range (#1103: gfx103X-all | | | /tmp/src_audit/Strata/terminal/setup.py-4507-# starts at 7.13.0a20260422 and has no 7.10; #1267: the 7.10 wheel segfaults on a Strix Halo with kernel 7.2.8), so one | | | /tmp/src_audit/Strata/terminal/setup.py-4508-# version for every card cannot work. The wheel is chosen per index (the family): a preferred version, tried first; when | | | /tmp/src_audit/Strata/terminal/setup.py-4509-# the index no longer offers it, the newest one of the same 7.x line, else of the same major, with a warning (rocm_pick). | | | -- | | | /tmp/src_audit/Strata/engine/third_party/strata-ggml/ggml/include/ggml.h-1187- struct ggml_tensor * a); | | | /tmp/src_audit/Strata/engine/third_party/strata-ggml/ggml/include/ggml.h-1188- | | | /tmp/src_audit/Strata/engine/third_party/strata-ggml/ggml/include/ggml.h-1189- // GELU using erf (error function) when possible | | | /tmp/src_audit/Strata/engine/third_party/strata-ggml/ggml/include/ggml.h:1190: // some backends may fallback to approximation based on Abramowitz and Stegun formula | | | /tmp/src_audit/Strata/engine/third_party/strata-ggml/ggml/include/ggml.h-1191- GGML_API struct ggml_tensor * ggml_gelu_erf( | | | /tmp/src_audit/Strata/engine/third_party/strata-ggml/ggml/include/ggml.h-1192- struct ggml_context * ctx, | | | /tmp/src_audit/Strata/engine/third_party/strata-ggml/ggml/include/ggml.h-1193- struct ggml_tensor * a); | | | -- | | | /tmp/src_audit/Strata/terminal/serve/images.py-424- except (OSError, ValueError): | | | /tmp/src_audit/Strata/terminal/serve/images.py-425- pass | | | /tmp/src_audit/Strata/terminal/serve/images.py-426- | | | /tmp/src_audit/Strata/terminal/serve/images.py:427: def _prune(self) -> None: | | | /tmp/src_audit/Strata/terminal/serve/images.py-428- """Keep the newest keep_files PNGs of response_format url (the oldest go).""" |
| | /tmp/src_audit/Strata/terminal/serve/images.py-429- files = sorted((p for p in self.dir.glob("*.png") if FILE_NAME.match(p.name)), key=lambda p: p.stat().st_mtime) |
| | /tmp/src_audit/Strata/terminal/serve/images.py-430- for p in files[:max(0, len(files) - self.keep_files)]: |
| | -- |
| | /tmp/src_audit/Strata/terminal/serve/images.py-540- """Keep one PNG for response_format url -> its file name (32 random hex digits: the name is the access).""" | | | /tmp/src_audit/Strata/terminal/serve/images.py-541- name = secrets.token_hex(16) + ".png" | | | /tmp/src_audit/Strata/terminal/serve/images.py-542- (self.dir / name).write_bytes(data) | | | /tmp/src_audit/Strata/terminal/serve/images.py:543: self._prune() | | | /tmp/src_audit/Strata/terminal/serve/images.py-544- return name | | | /tmp/src_audit/Strata/terminal/serve/images.py-545- |
| | /tmp/src_audit/Strata/terminal/serve/images.py-546- def response(self, images: list[bytes], job: dict, figures: dict, base_url: str) -> dict: |
| | -- |
| | /tmp/src_audit/Strata/terminal/strata_cli/cli.py-1686- "will checkpoint and report inconclusive rather than claim an improvement", |
| | /tmp/src_audit/Strata/terminal/strata_cli/cli.py-1687- file=sys.stderr) |
| | /tmp/src_audit/Strata/terminal/strata_cli/cli.py-1688- |
| | /tmp/src_audit/Strata/terminal/strata_cli/cli.py:1689: run = time_skip.TimeSkipRun(state_root(), workspace, a.prompt, checks, max_attempts=a.attempts) |
| | |
| | ====================================================================== |
| | === RustingStudio/RustingStrata @ e2d6e673b0d1fb6919c26655151620fa9813747f |
| | ====================================================================== |
| | |
| | --- [KV quant (lossy cache)] 342 lines --- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-4-# docs/V100-results.md, with every divergent position attributed to a named, legitimate |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-5-# architectural/arithmetic difference (the registry below) or listed as an open follow-up. |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-6-# Optionally aggregates the --nocapture logs of tests/kernels.rs, tests/llama_numerics.rs |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:7:# and tests/kv_q8.rs into the per-op table, and compares two perplexity --kld-base files. |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-8-# |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-9-# Usage (CPU, phase A — reproduces the documented 9/640): |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-10-# python3 -I tools/consistency.py \ |
| | -- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-301- (m[1], m[3], "cuda_vs_vulkan", "differing_bits", int(m[5]), REGISTRY_HINT.get(m[1]))]), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-302- (re.compile(r"^op (\w+) (cuda\|vulkan) $$ (.*) $$ : (\d+) of (\d+) differ from the first backend"), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-303- lambda m, bk: [(m[1], m[3], "cuda_vs_vulkan", "differing_bits", int(m[4]), REGISTRY_HINT.get(m[1]))]), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:304: # tests/kv_q8.rs:79 — q8 KV vs f16 KV | | | /tmp/src_audit/RustingStrata/tools/consistency.py-305- (re.compile(r"^nh (\d+) nkv (\d+) hd (\d+) kernel (\d+): q8 vs f16 decode " + NUM | | | /tmp/src_audit/RustingStrata/tools/consistency.py-306- + r", q8 prefill vs decode " + NUM), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:307: lambda m, bk: [("kv_q8", f"nh {m[1]} nkv {m[2]} hd {m[3]} kernel {m[4]}", "q8_vs_f16", "rel_l2", float(m[5]), "q8-kv"), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:308: ("kv_q8", f"nh {m[1]} nkv {m[2]} hd {m[3]} kernel {m[4]}", "q8_prefill_vs_decode", "rel_l2", float(m[6]), "q8-kv")]), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-309-] |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-310- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-311- |
| | -- |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-1-//! Workgroup shared-memory accounting of a committed SPIR-V kernel, without a GPU. |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-2-//! |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-3-//! shared_bytes walks the module, keeps the Workgroup-storage-class OpVariable s and sizes them with the |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs:4://! specialization map a pipeline would use: constants 0 .. n-1 from the spec vector and constant 15 = kv_q8 (see |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-5-//! Vk::pipeline). Array lengths are specialization-constant expressions, so the same committed SPIR-V can need |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-6-//! different amounts of shared memory depending on the model's weight type. An unsupported opcode is an error with |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-7-//! its number, never a silent 0. |
| | -- |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-255- fn shared_bytes_modes(&self, kernel: &str, spec: &[u32], kv_k: u32, kv_v: u32) -> Result<u32> { |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-256- let mut map = HashMap::with_capacity(spec.len() + 2); |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-257- for (i, &v) in spec.iter().enumerate() { map.insert(i as u32, v); } |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs:258: map.insert(15, kv_k); // as Vk::pipeline: KV_MODE and VKV_MODE, common.glsl |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-259- map.insert(16, kv_v); |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-260- let mut total = 0u64; |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-261- for &ty in &self.workgroup { |
| | -- |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-272- |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-273-/// Bytes of Workgroup shared memory kernel kernel needs with specialization constants spec (ids 0 .. n-1, and |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-274-/// constant 15 = K mode and 16 = V mode), computed from the committed SPIR-V in src/vulkan/spv/. No GPU and no pipeline. |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs:275:pub fn shared_bytes(kernel: &str, spec: &[u32], kv_mode: u32) -> Result<u32> { |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs:276: shared_bytes_split(kernel, spec, kv_mode, kv_mode) |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-277-} |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-278- |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-279-/// shared_bytes with independent K and V cache modes (specialization constants 15 and 16). |
| | -- |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-377- for kernel in ["attn_prefill_64", "attn_prefill_128", "attn_prefill_256"] { |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-378- for mode in 0..=3u32 { |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-379- let bytes = shared_bytes_split(kernel, &[], mode, mode).unwrap(); |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs:380: assert!(bytes <= 49152, "{kernel} with kv_mode={mode} needs {bytes} bytes (> 49152)"); |
| | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-381- } | | | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-382- } | | | /tmp/src_audit/RustingStrata/src/vulkan/spv_smem.rs-383- } |
| | -- |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward/device.rs-534- fn to_device(&mut self, m: &Inkling2Model, be: &dyn Backend, pos: usize) -> Result<()> { |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward/device.rs-535- let (c, hd) = (&m.cfg, m.cfg.head_dim); |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward/device.rs-536- let (kw, (at, len)) = (c.n_head_kv * hd, hists(c)); |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward/device.rs:537: ensure!(self.synced == pos \|\| crate::cuda::kv_mode() == 0, |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward/device.rs-538- "quantized KV cache (--kv) cannot resume mid-context from host slots"); |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward/device.rs-539- for (il, (ds, hs)) in self.slots.iter().zip(&m.slots).enumerate() { |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward/device.rs-540- let mut h = vec![0f32; len]; |
| | |
| | --- [expert placement / VRAM cap] 384 lines --- |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward.rs-783- static FIXED: std::sync::OnceLock<Option<f32>> = std::sync::OnceLock::new(); |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward.rs-784- let fixed = *FIXED.get_or_init(|| { |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward.rs-785- let share = std::env::var("STRATA_DS_CPU_SHARE").ok().and_then(\|v\| v.parse().ok()); |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward.rs:786: share.or(std::env::var_os("STRATA_FIXED_EXPERTS").map(\|_\| 0.0)) |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward.rs-787- }); |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward.rs-788- if crate::deepseek::mat::dev_info().is_none() { return (1.0, true); } |
| | /tmp/src_audit/RustingStrata/src/inkling2/forward.rs-789- // A single token (and a draft check) gives every miss to the CPU: staging an expert costs an allocation, | | | -- | | | /tmp/src_audit/RustingStrata/src/gpu_model.rs-616- |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-617-impl<'a> GpuModel<'a> { |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-618- /// `chunk`: prefill batch in tokens (0 = no batched prefill). `mtp`: load the MTP draft head (needs `nextn`). |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:619: pub fn load(m: &'a Model<'a>, gpu: Box<dyn Backend>, ctx: usize, chunk: usize, vram_margin: usize, k: usize) -> anyhow::Result<GpuModel<'a>> { |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:620: Self::load_part(m, gpu, ctx, chunk, vram_margin, k, 0..m.cfg.n_layer, 1) |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-621- } |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-622- |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-623- /// load with n slots: sequences with their own KV cache and recurrent state each (ctx tokens a slot), which |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-624- /// step_rows decodes together. No MTP draft head; not for hyper-connection, PLE or QSA models. |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:625: pub fn load_slots(m: &'a Model<'a>, gpu: Box<dyn Backend>, ctx: usize, chunk: usize, vram_margin: usize, n: usize) -> anyhow::Result<GpuModel<'a>> { |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:626: Self::load_part(m, gpu, ctx, chunk, vram_margin, 0, 0..m.cfg.n_layer, n) |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-627- } |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-628- |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:629: /// load_split with the same VRAM margin on every device. |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:630: pub fn load_split(m: &'a Model<'a>, gpus: Vec<Box<dyn Backend>>, ctx: usize, chunk: usize, vram_margin: usize, k: usize, ns: usize) -> anyhow::Result<GpuModel<'a>> { |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:631: let margins = vec![vram_margin; gpus.len()]; |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-632- Self::load_split_margins(m, gpus, ctx, chunk, &margins, None, k, ns) |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-633- } |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-634- |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-635- /// load with the layers split over gpus in proportion to their free VRAM, or to the shares split (--split, |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-636- /// or the layer counts calibrate chose) when given (each device then fills the rest |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:637: /// of its VRAM with expert slots, keeping its entry of vram_margin free), and ns slots as in load_slots. |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-638- /// One device: load or load_slots. |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:639: pub fn load_split_margins(m: &'a Model<'a>, gpus: Vec<Box<dyn Backend>>, ctx: usize, chunk: usize, vram_margin: &[usize], split: Option<&[f64]>, k: usize, ns: usize) -> anyhow::Result<GpuModel<'a>> { |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:640: ensure!(vram_margin.len() == gpus.len(), "{} VRAM margin(s) for {} device(s)", vram_margin.len(), gpus.len()); |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-641- ensure!(split.is_none_or(|s| s.len() == gpus.len()), "{} layer share(s) for {} device(s)", split.map_or(0, |s| s.len()), gpus.len()); |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-642- let n = m.cfg.n_layer; |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-643- if gpus.len() == 1 { |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-644- let g = gpus.into_iter().next().unwrap(); |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:645: let margin = vram_margin[0]; |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-646- return if ns > 1 { Self::load_slots(m, g, ctx, chunk, margin, ns) } else { Self::load(m, g, ctx, chunk, margin, k) }; |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-647- } |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-648- let rates = gpus.iter().map(\|g\| copy_rate(g.as_ref())).collect::<anyhow::Result<Vec<_>>>()?; |
| | -- |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-662- ensure!(!r.is_empty(), "device {i} gets no layers ({:.0}% of {n}, free VRAM {:.0} MB; see --split)", 100.0 * share[i] / total, free[i] / 1048576.0); | | | /tmp/src_audit/RustingStrata/src/gpu_model.rs-663- ensure!(ple.iter().all(|il| r.contains(il)) || !ple.iter().any(|il| r.contains(il)), "the PLE layers would be split across devices"); |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-664- crate::say!("device {i} ({}): layers {}..{}, host-to-VRAM copy {:.0} MB/s", gpu.name(), r.start, r.end, rates[i]); |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:665: parts.push(Self::load_part(m, gpu, ctx, chunk, vram_margin[i], k, r, ns)?); |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-666- } | | | /tmp/src_audit/RustingStrata/src/gpu_model.rs-667- // Every part holds the state of every slot (a part short of VRAM takes fewer). |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-668- let fit: Vec<usize> = parts.iter().map(\|p\| p.slots()).collect(); |
| | -- |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-677- Ok(acc) |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-678- } | | | /tmp/src_audit/RustingStrata/src/gpu_model.rs-679- | | | /tmp/src_audit/RustingStrata/src/gpu_model.rs:680: fn load_part(m: &'a Model<'a>, gpu: Box<dyn Backend>, ctx: usize, chunk: usize, vram_margin: usize, k: usize, range: std::ops::Range<usize>, ns: usize) -> anyhow::Result<GpuModel<'a>> { | | | /tmp/src_audit/RustingStrata/src/gpu_model.rs-681- let c = &m.cfg; | | | /tmp/src_audit/RustingStrata/src/gpu_model.rs-682- ensure!(ns == 1 || c.hc_n == 0 && c.n_embd_ple == 0 && c.idx_top_k == 0, "--parallel: not supported for this model (hyper-connections, PLE or QSA)"); |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-683- ensure!((1..=255).contains(&ns), "--parallel {ns}: 1 to 255 slots"); |
| | -- |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-742- let lay = &c.layers[range.clone()]; |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-743- let per = |kv0: usize| lay.iter().map(|&k| if k == LayerKind::Delta { 4 * ((c.ssm_conv - 1) * channels + nv * c.ssm_dv() * dk) } else { 2 * (gpu.kv_words(kv0 * kv) + gpu.kv_words_v(kv0 * kv)) }).sum::<usize>(); |
| | |
| | --- [numerics parity vs llama.cpp] 221 lines --- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-3-# committed summary docs/parity/cross-backend.json plus the markdown rows of the report in |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-4-# docs/V100-results.md, with every divergent position attributed to a named, legitimate |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-5-# architectural/arithmetic difference (the registry below) or listed as an open follow-up. |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:6:# Optionally aggregates the --nocapture logs of tests/kernels.rs, tests/llama_numerics.rs |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-7-# and tests/kv_q8.rs into the per-op table, and compares two perplexity --kld-base files. |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-8-# |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-9-# Usage (CPU, phase A — reproduces the documented 9/640): |
| | -- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-89- { |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-90- "id": "q8-kv", |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-91- "title": "q8 KV cache quantization", |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:92: "applies_to": "--kv q8 arms only (not used by --llama-numerics parity)", |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-93- "mechanism": "--kv q8 stores K/V as int8 with per-32 scales, the default path stores f16; the " |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-94- "attention scores read quantized K and the output quantized V. --kv q8 does not " |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:95: "combine with --llama-numerics by design (src/main.rs), so parity keeps f16 KV.", |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-96- "measured": "1.55e-3 .. 2.06e-3 relative L2 q8 vs f16 decode/prefill (docs/V100-results.md:556-558); " |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-97- "KV bytes 341/642 = 53.1 % (M2-T6)", |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-98- "arm": "--kv q8", |
| | -- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-284- # tests/kernels.rs:1640 — dense GEMM per backend |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-285- (re.compile(r"^(cuda\|vulkan): gemm_dense rel err " + NUM), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-286- lambda m, bk: [("gemm_dense", "dense 4096", f"{m[1]}_vs_cpu", "rel_l2", float(m[2]), None)]), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:287: # tests/llama_numerics.rs:99 — llama-mode decode vs the CPU model, default kernel for contrast |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-288- (re.compile(r"^n_pos (\d+) gq_min (-?\d+): llama mode vs CPU model " + NUM + r", default kernel vs CPU model " + NUM), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-289- lambda m, bk: [("attn_decode_llama", f"n_pos {m[1]} gq_min {m[2]}", "llama_vs_cpu", "rel_l2", float(m[3]), None), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-290- ("attn_decode_llama", f"n_pos {m[1]} gq_min {m[2]}", "default_vs_cpu", "rel_l2", float(m[4]), None)]), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:291: # tests/llama_numerics.rs:147 — llama-mode prefill is f32 vs f64 reference |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-292- (re.compile(r"^prefill hd (\d+): llama mode vs f64 " + NUM + r", tensor-core kernel vs f64 " + NUM), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-293- lambda m, bk: [("attn_prefill_llama", f"hd {m[1]}", "llama_vs_cpu", "rel_l2", float(m[2]), None), |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-294- ("attn_prefill_llama", f"hd {m[1]}", "default_vs_cpu", "rel_l2", float(m[3]), None)]), |
| | -- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-492- "note": ("Computed on the M2 build in the M2-T7 GPU window (2026-11-08): both backends re-run " |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-493- "on the same cached reference, plus the STRATA_MMQ= (f16 GEMM) and STRATA_GEMM_FMA=1 " | | | /tmp/src_audit/RustingStrata/tools/consistency.py-494- "attribution arms. Per-op rows come from the --nocapture logs of tests/kernels.rs and " | | | /tmp/src_audit/RustingStrata/tools/consistency.py:495: "tests/llama_numerics.rs." if args.status == "m2" else | | | /tmp/src_audit/RustingStrata/tools/consistency.py-496- "Computed from the pre-M2 artifacts (CUDA from M1 ae95739, Vulkan from M0 d6c2beb): " | | | /tmp/src_audit/RustingStrata/tools/consistency.py-497- "a CPU dry run that reproduces the documented 9/640. History only; the M2-T7 GPU " | | | /tmp/src_audit/RustingStrata/tools/consistency.py-498- "window replaces this file with the current-build run."), |
| | -- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-618- o.append("### Per-op table") |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-619- o.append("") |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-620- o.append("Not generated: run with --kernels <log> on the --nocapture outputs of " |
| | /tmp/src_audit/RustingStrata/tools/consistency.py:621: "tests/kernels.rs and tests/llama_numerics.rs.") |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-622- o.append("") |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-623- o.append("### Legitimate-difference registry") |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-624- o.append("") |
| | -- |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-122- join(KSIGNS_IQ2XS.iter().map(\|v\| v.to_string()).collect()), |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-123- join(KVALUES_IQ4NL.iter().map(\|v\| v.to_string()).collect()), |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-124- join(crate::quant::TQ_LUT.iter().flatten().map(\|v\| format!("{v:e}f")).collect()), |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs:125: crate::cuda::llama_numerics() as u8, |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-126- kv_q8 as u8, |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-127- // STRATA_HIP_WMMA=0 falls back to the CUDA-core multiplications (A/B comparison, and a workaround if a |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-128- // card's matrix cores misbehave). |
| | -- |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-795- } |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-796- |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-797- fn norm_gate_q(&self, o: u64, w: u64, z: u64, n: usize, heads: usize, eps: f32, xq: u64) -> anyhow::Result<u64> { |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs:798: let xq = if crate::cuda::llama_numerics() \|\| n % 32 != 0 { 0 } else { xq }; |
| | /tmp/src_audit/RustingStrata/src/hip/mod.rs-799- launch!(self, "norm_gate", cfg((heads as u32, 1), 128, 0), o, w, z, n as i32, eps, xq, 0i32); |
| | | | | --- [router top-k / bias / tail] 133 lines --- | | | /tmp/src_audit/RustingStrata/src/config.rs-45- pub conv_kernel_size: usize, | | | /tmp/src_audit/RustingStrata/src/config.rs-46- pub conv_group_size: usize, | | | /tmp/src_audit/RustingStrata/src/config.rs-47- pub selector_rank: usize, | | | /tmp/src_audit/RustingStrata/src/config.rs:48: pub selector_top_k: usize, | | | /tmp/src_audit/RustingStrata/src/config.rs-49-} | | | /tmp/src_audit/RustingStrata/src/config.rs-50- | | | /tmp/src_audit/RustingStrata/src/config.rs-51-impl DFlashConfig { |
| | -- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-238-REGISTRY_HINT = {"conv": "summation-order", "conv_state": "summation-order", "conv_seq": "summation-order", |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-239- "conv_l2_norm": "summation-order", "moe_gemv": "expert-slot-layout", | | | /tmp/src_audit/RustingStrata/tools/consistency.py-240- "moe_combine": "expert-slot-layout", "ssm_gates": "summation-order", | | | /tmp/src_audit/RustingStrata/tools/consistency.py:241: "ssm_gates_g": "summation-order", "router_topk": None, "swiglu": None, "add": None, | | | /tmp/src_audit/RustingStrata/tools/consistency.py-242- "rms_norm": None, "l2_norm": None, "rope_neox": None, "norm_gate": None} | | | /tmp/src_audit/RustingStrata/tools/consistency.py-243- |
| | /tmp/src_audit/RustingStrata/tools/consistency.py-244-PATTERNS = [ |
| | -- |
| | /tmp/src_audit/RustingStrata/src/backend.rs-558- /// attn_decode that shares K/V loads across a GQA group from gq_min positions on (tests use 0 to force it). |
| | /tmp/src_audit/RustingStrata/src/backend.rs-559- fn attn_decode_gq(&self, q: u64, kc: u64, vc: u64, qg: u64, out: u64, part: u64, step: u64, nh: usize, nkv: usize, hd: usize, scale: f32, gq_min: i32, nt: usize, sink: u64, win: usize) -> anyhow::Result<()>; |
| | /tmp/src_audit/RustingStrata/src/backend.rs-560- /// Route t tokens (logit rows of n, ids / wts rows of k). sigmoid selects sigmoid scores instead of softmax. |
| | /tmp/src_audit/RustingStrata/src/backend.rs:561: fn router_topk(&self, p: u64, n: usize, k: usize, extra_scale: f32, ids: u64, wts: u64, t: usize, sigmoid: bool) -> anyhow::Result<()>; |
| | /tmp/src_audit/RustingStrata/src/backend.rs:562: /// Decode routing: `router_topk`, the expert cache lookup (slots[j] = table[ids[j]], -1 = not resident; wh[j] = |
| | /tmp/src_audit/RustingStrata/src/backend.rs-563- /// wts[j] on a hit, else 0), then the routing and (on a miss) `h` (rows of nh) written to the layer mailbox at |
| | /tmp/src_audit/RustingStrata/src/backend.rs-564- /// mb and its request flag raised. mb = 0 skips every mailbox store where moe_mailbox_optional holds. pid |
| | /tmp/src_audit/RustingStrata/src/backend.rs-565- /// (0 = none) receives the last token's ids, the prediction the next token's prefetch uses. |
| | -- |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-883- succ_raw: st.data.to_vec(), |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-884- succ_ty: st.ty, |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-885- rank: dc.selector_rank, |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs:886: top_k: dc.selector_top_k.max(1), |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-887- }) |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-888- } else { None }; |
| | /tmp/src_audit/RustingStrata/src/gpu_model.rs-889- let conv_dyn_len = if dc.conv_kernel_size > 0 && dc.conv_group_size > 0 { |
| | -- |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-173- } |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-174- |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-175- let selector_rank = u("dflash.selector_rank", 0); |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs:176: let selector_top_k = u("dflash.selector_top_k", 16); |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-177- let selector = if selector_rank > 0 && g.tensors.contains_key("selector_hidden.weight") { |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-178- Some(Selector { |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-179- hidden: hm("selector_hidden.weight").context("selector_hidden.weight")?, |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-180- pred: hm("selector_predecessor.weight").context("selector_predecessor.weight")?, |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-181- succ: hm("selector_successor.weight").context("selector_successor.weight")?, |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-182- rank: selector_rank, |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs:183: top_k: selector_top_k, |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-184- }) |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-185- } else { |
| | /tmp/src_audit/RustingStrata/src/raon/dflash.rs-186- None |
| | -- |
| | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-85- ("qsa_select", include_bytes!("spv/qsa_select.spv")), |
| | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-86- ("rms_norm", include_bytes!("spv/rms_norm.spv")), |
| | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-87- ("rope_neox", include_bytes!("spv/rope_neox.spv")), |
| | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs:88: ("router_topk", include_bytes!("spv/router_topk.spv")), |
| | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-89- ("ssm_gates", include_bytes!("spv/ssm_gates.spv")), |
| | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-90- ("situ", include_bytes!("spv/situ.spv")), |
| | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-91- ("situ_q", include_bytes!("spv/situ_q.spv")), |
| | -- |
| | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-1707- self.run("qsa_score", &[], [64, rows.div_ceil(8), 1], &[&q, &pool, &score, &step, &(r0 as i32), &(rows as u32), &(nbs as u32), &(top as u32)])?; | | | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-1708- self.run("qsa_select", &[], [rows, 1, 1], &[&score, &sel, &mask, &step, &(r0 as i32), &(nbs as u32), &(top as u32), &(sst as u32), &(mw as u32)]) | | | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs-1709- } | | | /tmp/src_audit/RustingStrata/src/vulkan/mod.rs:1710: fn router_topk(&self, p: u64, n: usize, k: usize, extra_scale: f32, ids: u64, wts: u64, t: usize, sigmoid: bool) -> anyhow::Result<()> { | | | |
| | --- [prune / approx / lossy] 271 lines --- |
| | /tmp/src_audit/RustingStrata/src/serve.rs-310- let Ok(rd) = std::fs::read_dir(&d) else { continue }; |
| | /tmp/src_audit/RustingStrata/src/serve.rs-311- for p in rd.flatten().map(\|e\| e.path()) { |
| | /tmp/src_audit/RustingStrata/src/serve.rs-312- if p.is_dir() { if depth < 2 { dirs.push((p, depth + 1)); } continue; } |
| | /tmp/src_audit/RustingStrata/src/serve.rs:313: let id = p.strip_prefix(dir).unwrap_or(&p).to_string_lossy().replace('\\', "/"); |
| | /tmp/src_audit/RustingStrata/src/serve.rs-314- files.push((id, std::fs::metadata(&p).map_or(0, \|m\| m.len()))); |
| | /tmp/src_audit/RustingStrata/src/serve.rs-315- } |
| | /tmp/src_audit/RustingStrata/src/serve.rs-316- } |
| | -- |
| | /tmp/src_audit/RustingStrata/src/deepseek/chat.rs-81-} |
| | /tmp/src_audit/RustingStrata/src/deepseek/chat.rs-82- |
| | /tmp/src_audit/RustingStrata/src/deepseek/chat.rs-83-/// Prompt plus reply limit per request: --ctx, else STRATA_DS_CTX, else the model's trained context. |
| | /tmp/src_audit/RustingStrata/src/deepseek/chat.rs:84:/// ponytail: only checked against llama.cpp up to a 1425-token prompt; the candidate-block prune (beyond 4096 compressed rows) is not implemented. |
| | /tmp/src_audit/RustingStrata/src/deepseek/chat.rs-85-fn ctx_limit(g: &Gguf) -> usize { |
| | /tmp/src_audit/RustingStrata/src/deepseek/chat.rs-86- let arch = g.meta.get("general.architecture").and_then(Value::as_str).unwrap_or_default(); |
| | /tmp/src_audit/RustingStrata/src/deepseek/chat.rs-87- crate::ctx_limit(std::env::var("STRATA_DS_CTX").ok().and_then(\|v\| v.parse().ok()) |
| | -- |
| | /tmp/src_audit/RustingStrata/src/deepseek/forward.rs-1-//! Slow single-token CPU reference forward for DeepSeek-V4.1 (mirrors llama.cpp deepseek41.cpp). | | | /tmp/src_audit/RustingStrata/src/deepseek/forward.rs-2-//! Not implemented: indexer top-k (only matters beyond 512 visible compressed rows, i.e. >1024 tokens) | | | /tmp/src_audit/RustingStrata/src/deepseek/forward.rs:3://! and the candidate-block prune (beyond 4096 rows). The window boundary (128) is unverified. |
| | /tmp/src_audit/RustingStrata/src/deepseek/forward.rs-4-use super::mat::{Mat, matvec_many, matvec_many_opt, vec_f32}; |
| | /tmp/src_audit/RustingStrata/src/deepseek/forward.rs-5-use super::ops::*; |
| | /tmp/src_audit/RustingStrata/src/deepseek/forward.rs-6-use super::{AttnKind, DsConfig}; |
| | -- |
| | /tmp/src_audit/RustingStrata/src/ops.rs-56-/// Quick GELU used by llama.cpp's ggml_gelu_quick: x * sigmoid(1.702 * x). |
| | /tmp/src_audit/RustingStrata/src/ops.rs-57-pub fn gelu_quick(x: f32) -> f32 { x * sigmoid(1.702 * x) } |
| | /tmp/src_audit/RustingStrata/src/ops.rs-58- |
| | /tmp/src_audit/RustingStrata/src/ops.rs:59:/// Exact GELU used by llama.cpp's ggml_gelu (tanh approximation). |
| | /tmp/src_audit/RustingStrata/src/ops.rs-60-pub fn gelu(x: f32) -> f32 { |
| | /tmp/src_audit/RustingStrata/src/ops.rs-61- const SQRT_2_OVER_PI: f32 = 0.797_884_56; |
| | /tmp/src_audit/RustingStrata/src/ops.rs-62- const A: f32 = 0.044_715; |
| | -- |
| | /tmp/src_audit/RustingStrata/src/update.rs-41-/// A binary a package manager put in place (the AUR's rustingstrata-bin in /usr/bin, winget's portable folder) is |
| | /tmp/src_audit/RustingStrata/src/update.rs-42-/// updated by that package manager, so update leaves it alone. |
| | /tmp/src_audit/RustingStrata/src/update.rs-43-fn managed(exe: &std::path::Path) -> bool { |
| | /tmp/src_audit/RustingStrata/src/update.rs:44: let p = exe.to_string_lossy().replace('\\', "/").to_ascii_lowercase(); |
| | /tmp/src_audit/RustingStrata/src/update.rs-45- p.starts_with("/usr/") \|\| p.starts_with("/opt/") \|\| p.contains("/winget/packages/") \|\| p.contains("/scoop/apps/") |
| | /tmp/src_audit/RustingStrata/src/update.rs-46-} |
| | /tmp/src_audit/RustingStrata/src/update.rs-47- |
| | -- |
| | /tmp/src_audit/RustingStrata/src/ngram.rs-898- if n_vocab == 0 { |
| | /tmp/src_audit/RustingStrata/src/ngram.rs-899- return 0; | | | /tmp/src_audit/RustingStrata/src/ngram.rs-900- } | | | /tmp/src_audit/RustingStrata/src/ngram.rs:901: let mut pruned = 0usize; | | | /tmp/src_audit/RustingStrata/src/ngram.rs-902- cache.retain(|key, part| { | | | /tmp/src_audit/RustingStrata/src/ngram.rs-903- let key_ok = key.0.iter().all(|&t| t == LLAMA_TOKEN_NULL || (t >= 0 && (t as usize) < n_vocab)); | | | /tmp/src_audit/RustingStrata/src/ngram.rs-904- if !key_ok { | | | /tmp/src_audit/RustingStrata/src/ngram.rs:905: pruned += part.len().max(1); | | | /tmp/src_audit/RustingStrata/src/ngram.rs-906- return false; | | | /tmp/src_audit/RustingStrata/src/ngram.rs-907- } |
| | /tmp/src_audit/RustingStrata/src/ngram.rs-908- let before = part.len(); |
| | /tmp/src_audit/RustingStrata/src/ngram.rs-909- part.retain(\|&tok, _\| (tok as usize) < n_vocab); |
| | /tmp/src_audit/RustingStrata/src/ngram.rs:910: pruned += before - part.len(); |
| | /tmp/src_audit/RustingStrata/src/ngram.rs-911- !part.is_empty() |
| | /tmp/src_audit/RustingStrata/src/ngram.rs-912- }); |
| | /tmp/src_audit/RustingStrata/src/ngram.rs:913: pruned | | | /tmp/src_audit/RustingStrata/src/ngram.rs-914-} | | | /tmp/src_audit/RustingStrata/src/ngram.rs-915- |
| | /tmp/src_audit/RustingStrata/src/ngram.rs-916-// --------------------------------------------------------------------------- |
| | -- |
| | /tmp/src_audit/RustingStrata/src/ngram.rs-945- Some(p) if p.exists() => ngram_cache_load(p, tok).unwrap_or_default(), |