Commit Graph
1800 Commits
Author SHA1 Message Date
Pavlo Ratushnyi 3cdcb5edc5 STRA-338 size-nce: merge branch nce-f (native-cpu-expert function sizes) 2026-11-06 23:39:13 +01:00
Pavlo Ratushnyi af889465a9 STRA-338 size-nce: merge branch nce-e (native-cpu-expert function sizes) 2026-11-06 23:39:12 +01:00
Pavlo Ratushnyi b33aa42d27 STRA-338 size-nce: merge branch nce-d (native-cpu-expert function sizes) 2026-11-06 23:39:11 +01:00
Pavlo Ratushnyi 7fc6801d92 STRA-338 size-nce: merge branch nce-c (native-cpu-expert function sizes) 2026-11-06 23:39:10 +01:00
Pavlo Ratushnyi 089190cd2d STRA-338 size-nce: merge branch nce-b (native-cpu-expert function sizes) 2026-11-06 23:39:08 +01:00
Pavlo Ratushnyi 6fa7b73e01 STRA-338 size-nce: SAFETY comments on the new unsafe helper bodies in rust_iq and rust_k_blocks
The helpers split out of dot_multi512_impl, dot_single_iq3, iq4xs, dot_multi256, dot_multi512 and the K-block dot wrap their
bodies in `unsafe { }` as the surrounding code does; each now carries a SAFETY line (target features cover the intrinsics and
helpers called, loads follow the file's Bounds note). Comments only; harness re-run identical.
2026-11-06 23:38:37 +01:00
Pavlo Ratushnyi 3e950869e0 STRA-338 size-nce: rust_kq Q4_K helpers move to rust_kq/q4_k_block.rs (file back under 400 lines)
The Q4_K helper split made rust_kq.rs 404 lines (architecture gate: 400). The helpers (Q4kBlock, q4k_scales_mins,
q4k_spread_scales, q4k_expand, q4k_add_mins, q4k_sum, q4k_reduce) move verbatim into the private sibling module
rust_kq::q4_k_block; q4_k_dot stays in rust_kq with the same pub(super) path. rust_kq.rs 404 -> 311 lines. No code change
otherwise; the differential harness (q4_k_dot 960 cases, small_dot, bf16) re-run identical. codegen not A/B-measured.
2026-11-06 23:38:37 +01:00
Pavlo Ratushnyi fa39cf7cdc STRA-338 size-nce: rust_ggml_native probe split into predicates, float_dot into per-format selectors
probe (48 lines, cx26) becomes probe -> probe_cpu (CPUID leaf 0/1, XGETBV, leaf 7 in the same order, each early return kept)
over the pure predicates leaf1_ok / wide_state_ok / fp16_ok / vnni512_ok / subleaf1_ok; the sub-leaf 1 CPUID is still read only
when a BF16 / AVX-VNNI / AVX-VNNI-INT8 branch is compiled in and leaf 7 EAX allows it. float_dot (cx12, match guards) becomes a
match on the kind over f32_dot_native / f16_dot_native / bf16_dot_native with the same branch priority (FP16 before F, BF16
before F). The test comment that was over 120 columns is re-wrapped. Functions over a limit in the file: 2 -> 0 (+1 wide line).

Differential check old vs new on the AVX-512 WSL host, per RUSTFLAGS build: default (all branches off: float_dot None, 1120
cases), +avx512f/vl/vnni/bw (F32, F16-F, BF16-F branches run: 1120 cases, 672 Some, identical bits), and +avx512bf16 / +avx512fp16 /
+avxvnni / +avxvnniint8 (this CPU lacks them: probe() and compiled_admitted() agree on false). The BF16-native and FP16-native
float_dot branches could not run on this host; they are covered by review only (the selector order is unchanged).
codegen not A/B-measured.
2026-11-06 23:33:52 +01:00
Pavlo Ratushnyi 64829ed582 STRA-338 size-nce: rust_ggml_extra ternary and iq1 split by stage
ternary (69 lines, cx13, nesting 6) becomes tq2_half / tq2_sums (TQ2_0) and tq1_main_products / tq1_tail_product / tq1_sums
(TQ1_0, powers as TQ1_POWERS) with the final FMA-free accumulate in ternary. iq1 (84 lines, cx21, nesting 8) becomes
iq1_block_scale / iq1_block_sums / iq1_pair / iq1_group_s / iq1_group_m (+ iq1m_sign) / iq1_group_terms; the IQ1_S scalar
correction is returned per group and summed in the same order instead of mutated in place. Bounds comment re-wrapped.
Functions over a limit in the file: 2 -> 0 (+1 wide line). New unsafe blocks carry SAFETY comments; vector helpers keep
target_feature and are #[inline].

Bitwise old-vs-new check (AVX2 path ran on the AVX-512 WSL host): ternary 800 cases (TQ1_0 and TQ2_0 x 0..9 blocks x 80
rounds incl. non-finite scales), iq1 800 cases (IQ1_S and IQ1_M likewise), 0 payload differences; mxfp4/nvfp4 unchanged code
as control (300 cases). codegen not A/B-measured.
2026-11-06 23:31:07 +01:00
Pavlo Ratushnyi 97321aae83 STRA-338 size-nce: rust_ggml (Kind table, Activation::quantize, NativeFormat::new/dot, float_dot, q1_dot, quantize_raw, dot_raw)
Functions over a limit in rust_ggml.rs and rust_ggml/: 10 -> 0 (plus 1 wide-only test and 6 wide comment lines -> 0).
- Kind::from_original / original_id / block read one KIND_TABLE (new rust_ggml/kind_table.rs, one row per variant, compile-time
  check that row i is variant i); every mapping is the previous one.
- Activation::quantize split by encoding (encode_f32/f16/bf16/zero/one/k); bf16 rounding shared by quantize and quantize_raw.
- NativeFormat::new split into activation_sizes and bank_layout (same error order); dot split into dot_storage,
  dot_zero_blocks, dot_k_blocks, iq4nl_dot, iq4nl_tail (shared with dot_raw).
- float_dot / q1_dot split into #[inline] #[target_feature] helpers with the same arithmetic and accumulation order.
- quantize_raw split into assert_destination and write_half; dot_raw uses the shared block dispatchers.
Bitwise identity old vs new proven by a differential harness (AVX2 and AVX-512 builds); codegen not A/B-measured.
2026-11-06 23:29:19 +01:00
Pavlo Ratushnyi b7045e53b8 STRA-338 size-nce: rust_kq q4_k_dot and small_dot split by stage, wide SAFETY comments moved
q4_k_dot (68 lines) becomes q4k_scales_mins / q4k_expand (+ q4k_spread_scales) / q4k_add_mins / q4k_sum / q4k_reduce, the
per-token FMA order unchanged (min correction first, then the block accumulator). small_dot (49 lines, cx16) becomes
small_block_bytes / small_activation (returns the Q8One min term instead of mutating `sums`; the caller adds it in the same
position) / small_weights / small_products. bf16_rows and bf16_rows_multi: the one-line SAFETY block comments become line
comments before the unsafe call; header comment re-wrapped. Functions over a limit in the file: 4 -> 0. New unsafe blocks
carry SAFETY comments; vector helpers keep target_feature and are #[inline].

Bitwise old-vs-new check (AVX2 path ran on the AVX-512 WSL host): q4_k_dot 960 cases (1..8 tokens x 1/2/3/8 blocks, incl.
non-finite scales; 3 token results where both are NaN differ in NaN payload/sign only, an fadd of two NaNs keeps the first
operand and LLVM may commute it), small_dot 3000 cases (kinds 2/3/6/7/8 x Q8Zero/Q8One x 0..10 blocks, empty row, missing
activation panic), bf16_rows/bf16_rows_multi 3168 cases incl. shape errors, q8_zero_dot/q5_one_dot/quant_one unchanged code
run as a control. codegen not A/B-measured.
2026-11-06 23:27:42 +01:00
Pavlo Ratushnyi e845de65db STRA-338 size-nce: rust_k_blocks dot split by stage (unpack / mins correction / group products / block sum)
dot (101 lines, cx24, nesting 5) becomes block_bytes + unpack (unpack_q2k/q3k/q5k/q6k into one Unpacked value) + add_q2k_mins /
q5k_mins_term (the min corrections, same position in the accumulation order) + sum_block (group_products, add_group,
q6k_offset) + the FMA in dot. Wide header comments re-wrapped. Functions over a limit in the file: 1 -> 0. New unsafe blocks
carry SAFETY comments; every vector helper keeps target_feature and is #[inline].

Bitwise old-vs-new check (AVX2 path ran on the AVX-512 WSL host), kinds 10/11/13/14 x 0..16 blocks x 60 random rounds incl.
non-finite block scales: 1440 cases identical except 3 where both results are NaN with different payloads (kind 13, 16
blocks, scale bytes arbitrary: acc and mins_sum are both NaN and which payload an fadd of two NaNs keeps is operand order,
which LLVM may commute); no finite or infinite result differs. Wrong-length panics match. codegen not A/B-measured.
2026-11-06 23:23:33 +01:00
Pavlo Ratushnyi 7a1bdddc37 STRA-338 size-nce: rust_iq kernels and tests within the function limits
dot_multi512_impl (73 lines/cx17/n6) is split into sum_block512 / operands512 / register_operands512 / stack_operands512 /
gather_grid512; dot_single_iq3 (48/n6) uses iq3_half and sum_block_iq3; iq4xs (35/n5) uses sum_block_iq4xs / iq4xs_scale;
iq4nl_n (31) uses iq4nl_codes; decode (88/cx17) is a dispatch over decode_iq2xxs..decode_iq4xs; dot_multi256 and dot_multi512
take sum_block256 / dot_multi512_by_tokens; the four over-limit tests are split into arrange/act/assert helpers (test names
and module paths unchanged). Wide lines re-wrapped. Functions over a limit in rust_iq/: 11 -> 0.

Same arithmetic and accumulation order, target_feature kept on every vector helper. Bitwise old-vs-new proof with to_bits()
on xorshift inputs (AVX2 and AVX-512 paths both ran): decode 144000 cases, multi256 1152, multi512 + impl(fast/stack) 2880,
single (dot_single, generic, iq3, iq4xs) 2400, iq4nl 768, also under STRATA_IQ_GATHER, LELEKA_IQ_SINGLE=legacy,
LELEKA_IQ_MULTI=register. Test-id list identical to the base. codegen not A/B-measured.
2026-11-06 23:19:51 +01:00
Pavlo Ratushnyi f154949c6d STRA-338 size-nce: integration tests split into arrange/act/assert helpers (9 test functions over a limit -> 0, wide comment lines rewrapped), kernel_ab type alias and header trim; test ids unchanged (62 -> 62), DIGEST lines and bench output lines identical old vs new 2026-11-06 23:15:15 +01:00
Pavlo Ratushnyi 90d43a2cb0 STRA-338 size-nce: split dequantize, quantize_chunk, the bench oracle, the layout/GGUF parsers and the parity frontend; re-wrap the codebook tables
Functions over a limit in these files: 19 -> 0 (dequantize 271 lines/cx83/nest7, quantize_chunk, dequantize_expert, float_oracle,
synthetic_blob, ExpertLayout::parse, DecimalStream::number, Cursor::value, Shard::open, Model::open, split_paths, cpu_blob 229/cx81,
float_reference, check_blob 102/cx43, check_q5_one, check_bf16, iq4nl_hq, run, run_modes); wide lines 17 -> 0 (cpu_name, pairs, SAFETY
comments, the usage text as concat!, report! formats with a backslash continuation that keeps the same bytes). rust_codebooks.rs,
rust_iq1_grid.rs: wide data lines re-wrapped to <= 120 columns with identical elements (parsed-sequence sha256 equal: codebooks 7 tables
2704 elements, iq1 grid 2048); the three 2-bit grids move to the child module rust_codebooks/iq2_grids.rs (re-exported, same paths).
Proof: differential harness old vs new (quantize 28728+14000 cases, dequantize 179648, bench oracle 168, layout parse 40320, GGUF
model 6486, split_paths 128; 42 parity-frontend runs old vs new with a fake GPU, stdout/stderr/exit identical). Codegen not A/B-measured.
2026-11-06 22:59:51 +01:00
Pavlo Ratushnyi 6ae2eae20e STRA-338 size-nce: cpu_report, rust_platform and rust_topology parsers take text / data
probe (read_brand, has_avx2, avx512_flags, brand_text), cpu_kernel_report (probe_groups, core_line, process_line,
differs_in_avx512), stack_size (check_stack_limit, check_stack_size), cores (parse_leading_number, mask_cpus,
first_cpu_of_each_core), detect_cpu_topology (CpuInfo, scan_cpus, count_cores, plain_cores, hybrid_cores, topology_from).
The pure steps take the sysfs text or the CPU table; the reads keep their order. rust_platform_win.rs: wide doc lines
wrapped only (type-checked and tested on the Windows host).

Functions over a limit in these files 5 -> 0, functions or lines over the width 9 -> 0. Proof: old vs new on the live host
and on captured sysfs text, synthetic hybrid / multi-package tables and 120k fuzzed tables.
2026-11-06 22:54:49 +01:00
Pavlo Ratushnyi 2a01703b64 STRA-338 size-nce: CpuPool, PreparedJob and plan_pool_workers split by stage
CpuPool::new (coordinator thread body -> run_coordinator / serve_batches), CpuPool::start (admit_batch, batch_charge),
PreparedJob::new (validate_input, matrix_sizes, validate_headers, join_blob, zeroed_output), plan_pool_workers (layout,
host bound, reserve, hybrid, quota, cap as pure steps). Same errors in the same order. Wide doc lines wrapped.

Functions over a limit in these files 4 -> 0, functions or lines over the width 13 -> 0. Proof: differential harness
(batches over 12 format pairs, 86k plan inputs), crate tests.
2026-11-06 22:54:49 +01:00
Pavlo Ratushnyi 8bf7d3c590 STRA-338 size-nce: worker pools (rust_general_pool, rust_pool) split by stage
ExpertPool::new/whole/run_split/run_split_multi/run_split_multi_native/multi, NativePool::new/phase_timed/compute_batch/
run_published/prefetch_borrowed/compute_borrowed and both Shared::execute / Shared::worker are now stage helpers
(admission, header building, epoch opening, requantization, job table, row segments by mode, spin/sleep wait). Atomic
operations keep their Ordering and their order; the publish / drain / wait_done / wait_parked sequence, the abort-on-stall
paths and the stage counters are unchanged. New sibling modules: rust_general_pool/execute_rows.rs,
rust_pool/execute_rows.rs, rust_pool/borrowed_group.rs. Wide doc/SAFETY lines wrapped.

Functions over a limit in these files 16 -> 0, functions or lines over the width 18 -> 0. Proof: differential harness
old vs new (bitwise outputs, equal Errors, same stage-counter patterns), crate tests, test-id list identical. Hot
dispatch split only; codegen not A/B-measured, no performance claim.
2026-11-06 22:54:48 +01:00
Pavlo Ratushnyi 88006baf59 STRA-338 size-nce: split the native-general / legacy / q2 / quant row drivers and quantizer kernels under the size limits
Functions over a limit in rust_native_general*, rust_legacy*, rust_q2*, rust_quant*, rust_simd, rust_types: 27 over a
size limit + 3 wide-only -> 0; 34 wide lines outside functions (comments, headers) -> 0 (comments re-wrapped only).
New private helper modules: rust_native_general/{admission,typed_dots}, rust_legacy/row_slices. Tests of rust_q2 and
rust_quant moved to rust_q2/tests.rs, rust_quant/{tests,q8k_tests}.rs (same module paths and test names).
Kernels (q8_k_avx2, q8_zero, q8_one_avx2/avx512, row256, row512, dot512_n) are split into #[inline] helpers with the same
target_feature, arithmetic and accumulation order; codegen not A/B-measured. Old-vs-new bitwise harness: 7 suites,
7 env settings, all identical (AVX-512 paths executed). Test-id list identical to the base.
2026-11-06 22:33:55 +01:00
Pavlo Ratushnyi 08fc0785ff STRA-338 size-nce: kernel_ab example split into one-action functions (23 functions over a limit and 8 wide-only -> 0; behaviour unchanged, 29 example tests pass; differential proof follows) 2026-11-06 22:21:09 +01:00
Pavlo Ratushnyi 372ccb08ea STRA-338 size-nce: split the weight quantizers (rust_weight_quant, rust_weight_iq) into stage helpers
Functions over a limit in these two directories: 26 -> 0 (iq1_s, iq1_m, iq2_xxs, iq2_xs, iq3, iq2_s, row, Grid::new,
Grid::resolve_one, signs, ternary, q2k, q3k, iq4, row_without_iq, qx, q3, qkx, q45k, q6k, qp, small). Same arithmetic and
accumulation order; bitwise identical to the base on 28728 quantize_chunk/quantize_row_ref cases over all 28 formats,
180k dequantize cases (differential harness). New private modules block_stats, candidates, iq1_split. Codegen not A/B-measured.
2026-11-06 22:19:21 +01:00
Pavlo Ratushnyi a337119255 Merge remote-tracking branch 'origin/claude/hexagonal-size-gw' into claude/hexagonal-integ 2026-11-06 21:30:32 +01:00
Pavlo Ratushnyi 0e3216bf45 STRA-338 size (fix): review findings of the size splits: native_prompt_device finish phases keep the failure path on a poisoned workspace, the DBG window and nan-guard log lines are one line again, with_qsa_moe binds QSA before MoE as before 2026-11-06 21:02:00 +01:00
Pavlo Ratushnyi cbc1a9587a STRA-338 size-fn: record the test parity result 2026-11-06 19:23:55 +01:00
Pavlo Ratushnyi b8765786b7 STRA-338 size-fn: fetch_steps within the limits, allowlist 429 -> 133 entries (fixed functions dropped, 18 unfinished desktop-core functions recorded), baselines tightened, size-fn record 2026-11-06 19:16:24 +01:00
Pavlo Ratushnyi 39f67e9d05 Merge origin/claude/hexagonal-integ into claude/hexagonal-size-gw 2026-11-06 19:11:51 +01:00
Pavlo Ratushnyi ec2dbe54e1 STRA-338 size-fn: rustfmt of the files this batch changed (strata-control, strata-desktop-core, runtime-client, deploy) 2026-11-06 19:11:35 +01:00
Pavlo Ratushnyi 521c3d0d91 STRA-338 size-fn: dyn-trait aliases in desktop-core bins, result_large_err allowed where the error is the HTTP response 2026-11-06 19:11:19 +01:00
Pavlo Ratushnyi 5da74034ef Merge branch 'claude/szfn-cpc' into claude/hexagonal-size-gw 2026-11-06 19:06:55 +01:00
Pavlo Ratushnyi 06ee0c185b Merge branch 'claude/szfn-dc' into claude/hexagonal-size-gw 2026-11-06 19:06:17 +01:00
Pavlo Ratushnyi 00c8e39fcc STRA-338 size-fn: desktop-core: handle_generate and Sizing::dedicated within the limits 2026-11-06 19:04:22 +01:00
Pavlo Ratushnyi 113231a5df STRA-338 size-fn: strata-control: part_layout and plan_parts within the limits (fn>30 2 -> 0) 2026-11-06 19:03:31 +01:00
Pavlo Ratushnyi 44b428dd9a STRA-338 size-fn: strata-control: stream_parts layout/plan, loopback url, switch begin, run_session split into engine_io (fn>30 8 -> 0) 2026-11-06 19:01:38 +01:00
Pavlo Ratushnyi 03c7e83b07 STRA-338 size-fn: desktop-core planner, evaluation_measurement, managed_worker within the function limits 2026-11-06 19:00:46 +01:00
Pavlo Ratushnyi e9a82e5f73 STRA-338 size-fn: desktop-core runtime_gateway: responses, render, load, tool_responses, credential within the function limits 2026-11-06 19:00:08 +01:00
Pavlo Ratushnyi da0d931a83 Merge branch 'claude/szfn-dep' into claude/hexagonal-size-gw 2026-11-06 18:59:26 +01:00
Pavlo Ratushnyi b896072b03 Merge branch 'claude/szfn-r2' into claude/hexagonal-size-gw 2026-11-06 18:59:24 +01:00
Pavlo Ratushnyi b1191fa963 Merge branch 'claude/szfn-r1' into claude/hexagonal-size-gw 2026-11-06 18:59:23 +01:00
Pavlo Ratushnyi d04ad93149 STRA-338 size-fn: Gpu::with_tile within 30 lines 2026-11-06 18:58:22 +01:00
Pavlo Ratushnyi 6d64ad9919 STRA-338 size-fn: leleka-deploy: split the persisted-numbers check 2026-11-06 18:58:17 +01:00
Pavlo Ratushnyi b3aca3ddd9 STRA-338 size-fn: desktop-core journal, remote install, remote probe and ssh tunnel within the function limits 2026-11-06 18:57:47 +01:00
Pavlo Ratushnyi e6306202c3 STRA-338 size-fn: desktop-core runtime_rpc: generate, load, unload, reconfigure, watch, pump, snapshot and four tests within the limits 2026-11-06 18:57:40 +01:00
Pavlo Ratushnyi 0b20e0250f STRA-338 size-fn: leleka-deploy: reconfigure e2e checks in their own module 2026-11-06 18:55:05 +01:00
Pavlo Ratushnyi 00ad202f28 STRA-338 size-fn: strata-control: worker generate and Generation::new within the limits (fn>30 2 -> 0) 2026-11-06 18:53:46 +01:00
Pavlo Ratushnyi 04d945da7a STRA-338 size-fn: strata-control: tensor_export record builder (fn>30 1 -> 0) 2026-11-06 18:53:45 +01:00
Pavlo Ratushnyi 8d1b2fbb21 STRA-338 size-fn: ab_slots and ab_speculation last trims 2026-11-06 18:53:42 +01:00
Pavlo Ratushnyi 01ff42428e STRA-338 size-fn: leleka-deploy: remaining e2e and unit test helpers 2026-11-06 18:53:20 +01:00
Pavlo Ratushnyi f47b501f17 STRA-338 size-fn: strata-control: switch transaction, wait_ready, runtime_config resolve, tokenizer extract within the function limits (fn>30 12 -> 0) 2026-11-06 18:53:09 +01:00
Pavlo Ratushnyi 0c95bca7d1 STRA-338 size-fn: strata-control: stream_parts layout and shard planning split into modules (fn>30 2 -> 0) 2026-11-06 18:52:52 +01:00
Pavlo Ratushnyi e4da26d74b STRA-338 size-fn: ab_speculation: replay policies in their own file 2026-11-06 18:52:42 +01:00