diff --git a/architecture-baseline.json b/architecture-baseline.json index 72775aca..040f6759 100644 --- a/architecture-baseline.json +++ b/architecture-baseline.json @@ -5,27 +5,7 @@ "forbidden-dep leleka-memory windows-sys" ], "oversize": { - "crates/backend-api/src/lib.rs": 756, - "crates/cpu-kernels/src/lib.rs": 464, - "crates/cpu-sys/src/lib.rs": 1007, - "crates/cpu-sys/src/simd.rs": 1503, - "crates/cpu-worker/tests/serve_loop.rs": 477, - "crates/experimental-ref/tests/emulated_kernels.rs": 467, - "crates/gateway-domain/src/responses/render.rs": 405, - "crates/gateway-text/src/tool_output/tests.rs": 654, - "crates/gguf/src/lib.rs": 560, - "crates/gguf/tests/synthetic.rs": 460, - "crates/gptoss-igpu/src/lib.rs": 524, - "crates/gptoss-npu/src/lib.rs": 809, - "crates/gptoss/src/lib.rs": 1788, - "crates/gptoss/tests/synthetic_model.rs": 922, - "crates/igpu/src/lib.rs": 1386, - "crates/igpu/src/shaders.rs": 440, - "crates/openvino/src/lib.rs": 676, - "crates/quant-core/src/iq2s_grid.rs": 1032, - "crates/runtime-client/tests/grpc_backend.rs": 689, - "crates/shm/src/lib.rs": 432, - "crates/tokenizer/src/lib.rs": 840 + "crates/backend-api/src/lib.rs": 756 }, "source": { "dyn-trait:leleka-backend-api": 1, diff --git a/crates/gateway-domain/src/responses/render.rs b/crates/gateway-domain/src/responses/render.rs index a1ab3953..80e2b8a1 100644 --- a/crates/gateway-domain/src/responses/render.rs +++ b/crates/gateway-domain/src/responses/render.rs @@ -38,6 +38,16 @@ pub fn render_request_with( // Keep all instruction text and its order/authority; never demote a late // developer instruction (including approval criteria) into user content. owned.sort_by_key(|o| !matches!(o.role, Role::System | Role::Developer)); + render_messages(&owned, request, marks, template_span) +} + +/// The template over the ordered messages, with the tool declarations of the request. +fn render_messages( + owned: &[Owned], + request: &CreateRequest, + marks: &LiteralMarks, + template_span: impl FnOnce() -> S, +) -> Result<(String, Vec), String> { let messages = owned .iter() .map(|o| Message { diff --git a/docs/architecture/size-split-rest.md b/docs/architecture/size-split-rest.md new file mode 100644 index 00000000..428e89b2 --- /dev/null +++ b/docs/architecture/size-split-rest.md @@ -0,0 +1,69 @@ +# Size split of the remaining crates (STRA-338, batch size-rest) + +The owner order: no `.rs` file over 400 lines. This page records how the 24 oversize files of the CPU, iGPU and NPU +runtime crates, the formats and the gateway libraries were split, and how the test ids moved. Every module is named after +what it holds, never `_2`/`_3`. The method is that of `size-split-control-plane-desktop-core.md` and +`size-split-deploy.md`; no logic was edited except in `leleka-gateway-domain` (below). + +## Test ids + +A test id is `::`. A split changes the module path and nothing else: + +* `cargo test -p --all-targets` on Linux (WSL) for the 27 crates of the batch, before and after, compared with + `scripts/dev/test-outcomes.py compare`: 0 missing, 0 new, 0 outcome changes. Ids that differ only in the module path + (the topic module is inserted) are the integration targets and test files listed below; unit tests moved to + `tests.rs` keep their ids. +* Integration targets keep their Cargo target names: the children sit in a directory named like the target and are loaded + with explicit `#[path]` attributes from the target root, which stays `tests/.rs`. +* `igpu` runs 21 tests on the Linux host without an adapter (the GPU tests skip); `openvino`, `gptoss-igpu` and `gptoss-npu` + have no hardware on the host either. All of them are also type-checked with `cargo check --all-targets` on Windows and + Linux with no new warning. + +## Sources + +| Was | Now | +| --- | --- | +| `gptoss/src/lib.rs` (1788 lines) | `bytes_and_errors`, `config`, `weights`, `tensor_loading`, `quant_probes`, `model`, `profile`, `state_and_cache`, `numeric_helpers`, `parallel_jobs`, `parallel_region`, `prefill`, `forward_pass`, `generation`, `tests` | +| `cpu-sys/src/lib.rs` (1007) | `checks`, `portable`, `avx2_and_avxvnni`, `attention_and_elementwise`, `tiles`, `oracle`, `tests`; the `with_avx2!` and `with_avxvnni!` macros stay in `lib.rs` so every kernel module sees them | +| `cpu-sys/src/simd.rs` (1503) | `simd/scalar_dots_and_formats`, `simd/scalar_tiles_and_elementwise`, `simd/x86` (the former inline module) with `simd/x86/{reductions_and_int_dots, mxfp4_q8_dots, q8_dots_and_mxfp4_tiles, tile_kernels, attention_kernels, f16_attention_and_elementwise, quantize_q8_0}` | +| `igpu/src/lib.rs` (1386) | `error_and_kind`, `handles`, `params`, `repacking`, `device`, `readback`, `matrices_and_moe_plan`, `recorder_core`, `recorder_norm_and_routing`, `recorder_moe`, `recorder_attention_and_submit`, `tests`; the long `impl Gpu` and `impl Recorder` blocks are cut between methods | +| `igpu/src/shaders.rs` (440) | `shaders/{tiling_norm_and_rope, kv_store, attention, quantize_and_swiglu, routing_and_combine, f16_round}` (WGSL text constants) | +| `gguf/src/lib.rs` (560) | `error`, `value`, `tensor_type`, `file`, `reader` | +| `tokenizer/src/lib.rs` (840) | `construction`, `encoding`, `decoding`, `bpe_merge`, `vocabulary`, `tests` | +| `quant-core/src/iq2s_grid.rs` (1032) | the same table, four entries per line under `#[rustfmt::skip]` (265 lines); the entries and their order are unchanged and the SHA-256 test of the crate still pins them | +| `openvino/src/lib.rs` (676) | `error`, `c_api_types`, `library`, `compile_and_infer`, `tensor`, `tests` | +| `cpu-kernels/src/lib.rs` (464) | `isa`, `dispatch`, `tests` | +| `shm/src/lib.rs` (432) | `unix`, `windows` (each loaded as `imp` through a `use ... as imp`), `tests` | +| `gptoss-igpu/src/lib.rs` (524) | `prefill_pass`, `tests` | +| `gptoss-npu/src/lib.rs` (809) | `construction_and_estimates`, `service_transfers`, `prefill_part_pass`, `expert_pass`, `accelerator`, `tests` | +| `gateway-domain/src/responses/render.rs` (405, one function of 385 lines) | `render.rs` (the entry), `render/instructions` (one function per system message), `render/replay` (one method per input item kind) | + +Every `unsafe` block and its `SAFETY` comment moved verbatim with the code it belongs to (the `unsafe` counts of `cpu-sys` +`lib.rs` and `simd.rs` are 12 and 58 before and after over the files they became; `openvino` 110). + +## Test files + +| Was | Now (modules next to the target root or under `tests/`) | +| --- | --- | +| `runtime-client/tests/grpc_backend.rs` | `attach_and_reconfigure`, `generation`, `stream_lifecycle`, `runtime_restart_and_loss`, `fixtures`, `scripted_service`, `server_and_frames`, `scripted_types` | +| `gateway-text/src/tool_output/tests.rs` | `upstream_fixtures_and_undeclared_calls`, `call_terminators`, `array_arguments_and_typed_values`, `string_unions_and_incremental_parsing`, `quoted_values_and_drifted_forms`, `bare_function_recovery` | +| `cpu-worker/tests/serve_loop.rs` | `generation_and_cancellation`, `failure_shutdown_and_speculation` | +| `experimental-ref/tests/emulated_kernels.rs` | `fwht_and_q4_append`, `int8_and_k8v4_append`, `kv_stream_and_keyless_routing`, `cvec_reduction`, `quantized_attention` | +| `gguf/tests/synthetic.rs` | `metadata_and_headers`, `hostile_input_and_tensor_layout`, `limits_and_inventory` | +| `gptoss/tests/synthetic_model.rs` | `decoder_and_prefill`, `prefix_reuse_and_generation`, `prefix_copy`, `world_types`, `gguf_builder`, `synthetic_world`, `reference_forward`, `decoder_runs` | + +## The one rewrite: `render_request_with` + +`render_request_with` of `leleka-gateway-domain` was a single function (385 lines, complexity 93). It is now an entry +function of 40 lines that calls `instructions::push_system_messages` and `replay::replay_items`; the replay is a `Replay` +value whose methods handle one item kind each (`reasoning_item`, `message_item`, `call_item`, `output_item`) and whose +helpers parse one part (`message_content`, `call_identity`, `call_arguments`, `call_markup`, `output_text`, +`flush_exchange`). The order of the checks, the error texts and the rendered text are unchanged. Evidence: the +`leleka-gateway-domain` tests (17) and the `strata-control` `responses` unit tests (72, which render through this function) +pass before and after; no function in the new files is over 30 lines, complexity 10 or nesting 4. + +## Why the limits allowlist grew + +The diff gate treats a function that moved to another file as added. The functions that moved verbatim and still miss a +limit are in `limits-allowlist.json` (owner STRA-338, reason "moved verbatim"). Each entry can only fall; +`scripts/check-limits.py --update-baseline` drops an entry when its function is brought within the limits. diff --git a/limits-allowlist.json b/limits-allowlist.json index 9b909407..a2b7b244 100644 --- a/limits-allowlist.json +++ b/limits-allowlist.json @@ -1291,6 +1291,103 @@ "reason": "moved verbatim from the oversize test/source file it was split out of (STRA-338 size-gw); the function itself is legacy and shrinks in later batches", "owner": "STRA-338" }, + { + "path": "crates/cpu-kernels/src/dispatch.rs", + "name": "Dispatch::with_isa", + "fn_lines": 73, + "complexity": 5, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/checks.rs", + "name": "check_tile", + "fn_lines": 16, + "complexity": 11, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/simd/x86.rs", + "name": "", + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/simd/x86/attention_kernels.rs", + "name": "attn_weighted_sum_avx2", + "fn_lines": 51, + "complexity": 11, + "nesting": 5, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/simd/x86/f16_attention_and_elementwise.rs", + "name": "attn_weighted_sum_f16_avx2", + "fn_lines": 50, + "complexity": 11, + "nesting": 5, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/simd/x86/mxfp4_q8_dots.rs", + "name": "dot_mxfp4_q8r4_avx2", + "fn_lines": 40, + "complexity": 3, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/simd/x86/q8_dots_and_mxfp4_tiles.rs", + "name": "dot_mxfp4_q8r4_avxvnni", + "fn_lines": 40, + "complexity": 3, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/simd/x86/quantize_q8_0.rs", + "name": "quantize_q8_0_avx2", + "fn_lines": 39, + "complexity": 3, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/simd/x86/reductions_and_int_dots.rs", + "name": "dot_i4i8_avxvnni", + "fn_lines": 47, + "complexity": 3, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/cpu-sys/src/simd/x86/reductions_and_int_dots.rs", + "name": "dot_i8i8_avxvnni", + "fn_lines": 34, + "complexity": 4, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, { "path": "crates/deploy/src/app/entry.rs", "name": "", @@ -2741,6 +2838,697 @@ "reason": "moved verbatim from the oversize file it was split out of (STRA-338 size-deploy); the function itself is legacy and shrinks in later batches", "owner": "STRA-338" }, + { + "path": "crates/experimental-ref/tests/emulated_kernels/cvec_reduction.rs", + "name": "cvec_kernel_matches_the_reduction_tree_twin", + "fn_lines": 106, + "complexity": 5, + "nesting": 3, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/experimental-ref/tests/emulated_kernels/fwht_and_q4_append.rs", + "name": "q4_0_append_batch_and_gather_match_the_reference", + "fn_lines": 74, + "complexity": 3, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/experimental-ref/tests/emulated_kernels/int8_and_k8v4_append.rs", + "name": "int8_valueonly_and_k8v4_append_and_gather_match_the_reference", + "fn_lines": 123, + "complexity": 6, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/experimental-ref/tests/emulated_kernels/kv_stream_and_keyless_routing.rs", + "name": "kv_stream_resolver_copy_and_ring_match_the_model", + "fn_lines": 103, + "complexity": 10, + "nesting": 4, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/experimental-ref/tests/emulated_kernels/quantized_attention.rs", + "name": "quantized_attention_kernels_match_the_double_precision_reference", + "fn_lines": 143, + "complexity": 13, + "nesting": 6, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/array_arguments_and_typed_values.rs", + "name": "damaged_array_arguments_are_read_as_written_but_never_completed_or_pruned", + "fn_lines": 36, + "complexity": 3, + "nesting": 4, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/array_arguments_and_typed_values.rs", + "name": "parses_typed_values_and_preserves_text_around_calls", + "fn_lines": 16, + "complexity": 1, + "nesting": 4, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/bare_function_recovery.rs", + "name": "a_bare_function_is_a_call_only_at_a_line_start_outside_code", + "fn_lines": 32, + "complexity": 2, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/call_terminators.rs", + "name": "a_missing_wrapper_close_is_confirmed_only_by_the_next_call_or_a_natural_end", + "fn_lines": 63, + "complexity": 2, + "nesting": 4, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/quoted_values_and_drifted_forms.rs", + "name": "a_quoted_call_in_a_value_does_not_end_the_value_and_a_cut_outer_call_is_not_published", + "fn_lines": 35, + "complexity": 1, + "nesting": 4, + "width": 3, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/quoted_values_and_drifted_forms.rs", + "name": "drifted_forms_are_calls_only_with_recovery_and_only_for_declared_tools", + "fn_lines": 61, + "complexity": 6, + "nesting": 2, + "width": 3, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/string_unions_and_incremental_parsing.rs", + "name": "incremental_parser_holds_partial_markers_and_nested_tag_examples", + "fn_lines": 41, + "complexity": 5, + "nesting": 4, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/string_unions_and_incremental_parsing.rs", + "name": "string_type_unions_preserve_raw_text_and_decode_declared_json_types", + "fn_lines": 37, + "complexity": 3, + "nesting": 5, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/upstream_fixtures_and_undeclared_calls.rs", + "name": "a_call_without_function_close_is_read_when_the_wrapper_closes_it", + "fn_lines": 18, + "complexity": 2, + "nesting": 4, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/upstream_fixtures_and_undeclared_calls.rs", + "name": "an_undeclared_apply_patch_call_runs_through_the_declared_shell_tool", + "fn_lines": 39, + "complexity": 1, + "nesting": 4, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gateway-text/src/tool_output/tests/upstream_fixtures_and_undeclared_calls.rs", + "name": "parses_upstream_terminator_fixture_without_truncating_content", + "fn_lines": 15, + "complexity": 1, + "nesting": 4, + "width": 2, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gguf/src/error.rs", + "name": "Display for GgufError::fmt", + "fn_lines": 21, + "complexity": 15, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gguf/src/file.rs", + "name": "Gguf::read_with_limits", + "fn_lines": 125, + "complexity": 42, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gguf/src/reader.rs", + "name": "Reader::value", + "fn_lines": 40, + "complexity": 35, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gguf/src/tensor_type.rs", + "name": "TensorType::from_code", + "fn_lines": 35, + "complexity": 31, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gguf/src/tensor_type.rs", + "name": "TensorType::geometry", + "fn_lines": 28, + "complexity": 24, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gguf/src/tensor_type.rs", + "name": "TensorType::name", + "fn_lines": 34, + "complexity": 30, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gguf/tests/synthetic/hostile_input_and_tensor_layout.rs", + "name": "hostile_counts_and_lengths_are_bounded_before_allocation", + "fn_lines": 32, + "complexity": 2, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gguf/tests/synthetic/metadata_and_headers.rs", + "name": "every_prefix_of_a_valid_header_is_rejected_without_panic", + "fn_lines": 36, + "complexity": 4, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss-igpu/src/prefill_pass.rs", + "name": "GpuPrefill::prefill_part", + "fn_lines": 177, + "complexity": 52, + "nesting": 4, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss-npu/src/accelerator.rs", + "name": "PrefillAccelerator for NpuPrefill::admit", + "fn_lines": 18, + "complexity": 2, + "nesting": 1, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss-npu/src/expert_pass.rs", + "name": "NpuPrefill::experts", + "fn_lines": 138, + "complexity": 17, + "nesting": 3, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss-npu/src/prefill_part_pass.rs", + "name": "NpuPrefill::prefill_part", + "fn_lines": 217, + "complexity": 41, + "nesting": 5, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss-npu/src/service_transfers.rs", + "name": "NpuPrefill::product", + "fn_lines": 55, + "complexity": 13, + "nesting": 2, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/config.rs", + "name": "Config::from_gguf", + "fn_lines": 49, + "complexity": 22, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/forward_pass.rs", + "name": "Model::forward_hidden", + "fn_lines": 290, + "complexity": 47, + "nesting": 4, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/generation.rs", + "name": "Model::logits_after_each", + "fn_lines": 33, + "complexity": 6, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/model.rs", + "name": "Model::load", + "fn_lines": 41, + "complexity": 25, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/parallel_region.rs", + "name": "Model::run_region", + "fn_lines": 80, + "complexity": 19, + "nesting": 6, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/prefill.rs", + "name": "Model::prefill_reuse_accelerated", + "fn_lines": 32, + "complexity": 6, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/profile.rs", + "name": "Profile::report", + "fn_lines": 24, + "complexity": 1, + "nesting": 0, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/quant_probes.rs", + "name": "kar_roundtrip", + "fn_lines": 39, + "complexity": 10, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/tensor_loading.rs", + "name": "q_tensor", + "fn_lines": 68, + "complexity": 13, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/src/tests.rs", + "name": "the_kar_probe_loses_less_with_more_levels_and_keeps_q8_0_layout", + "fn_lines": 38, + "complexity": 3, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/tests/synthetic_model/decoder_and_prefill.rs", + "name": "", + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/tests/synthetic_model/decoder_and_prefill.rs", + "name": "chunked_prefill_is_bit_identical_to_feeding_tokens_one_at_a_time", + "fn_lines": 39, + "complexity": 5, + "nesting": 3, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/tests/synthetic_model/gguf_builder.rs", + "name": "build_gguf", + "fn_lines": 55, + "complexity": 6, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/tests/synthetic_model/prefix_copy.rs", + "name": "a_copied_prefix_continues_bit_identically_and_leaves_the_source_alone", + "fn_lines": 40, + "complexity": 1, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/tests/synthetic_model/prefix_reuse_and_generation.rs", + "name": "prefix_reuse_keeps_the_common_prefix_and_matches_a_fresh_prefill_bit_for_bit", + "fn_lines": 47, + "complexity": 1, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/tests/synthetic_model/reference_forward.rs", + "name": "reference_logits", + "fn_lines": 106, + "complexity": 13, + "nesting": 4, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/gptoss/tests/synthetic_model/synthetic_world.rs", + "name": "build_world", + "fn_lines": 104, + "complexity": 2, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/device.rs", + "name": "Gpu::with_tile", + "fn_lines": 79, + "complexity": 9, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/matrices_and_moe_plan.rs", + "name": "Gpu::plan_moe", + "fn_lines": 45, + "complexity": 8, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/matrices_and_moe_plan.rs", + "name": "Gpu::upload_matrix", + "fn_lines": 40, + "complexity": 8, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/recorder_attention_and_submit.rs", + "name": "Recorder::attention", + "fn_lines": 55, + "complexity": 11, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/recorder_core.rs", + "name": "Recorder::matmul_rows", + "fn_lines": 54, + "complexity": 7, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/recorder_moe.rs", + "name": "Recorder::moe_matmul", + "fn_lines": 59, + "complexity": 9, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/recorder_norm_and_routing.rs", + "name": "Recorder::rmsnorm_quant", + "fn_lines": 45, + "complexity": 8, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/recorder_norm_and_routing.rs", + "name": "Recorder::router", + "fn_lines": 40, + "complexity": 8, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/recorder_norm_and_routing.rs", + "name": "Recorder::swiglu_quant", + "fn_lines": 31, + "complexity": 7, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/igpu/src/tests.rs", + "name": "threaded_repacking_equals_the_plain_definition", + "fn_lines": 34, + "complexity": 6, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/openvino/src/compile_and_infer.rs", + "name": "Core::compile", + "fn_lines": 35, + "complexity": 7, + "nesting": 2, + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/openvino/src/library.rs", + "name": "OpenVino::load", + "fn_lines": 84, + "complexity": 2, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/runtime-client/tests/grpc_backend/fixtures.rs", + "name": "Fake::snapshot", + "fn_lines": 32, + "complexity": 2, + "nesting": 1, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/runtime-client/tests/grpc_backend/generation.rs", + "name": "a_generation_sends_the_identity_and_every_sampling_field_and_maps_frames", + "fn_lines": 52, + "complexity": 1, + "nesting": 0, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/runtime-client/tests/grpc_backend/scripted_service.rs", + "name": "Runtime for Fake::generate", + "fn_lines": 50, + "complexity": 7, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/shm/src/windows.rs", + "name": "open_read", + "fn_lines": 54, + "complexity": 7, + "nesting": 3, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/tokenizer/src/bpe_merge.rs", + "name": "Tokenizer::bpe_heap", + "fn_lines": 50, + "complexity": 12, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/tokenizer/src/bpe_merge.rs", + "name": "Tokenizer::encode_plain", + "fn_lines": 34, + "complexity": 9, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/tokenizer/src/construction.rs", + "name": "Tokenizer::from_assets", + "fn_lines": 52, + "complexity": 23, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/tokenizer/src/construction.rs", + "name": "Tokenizer::from_vocabulary", + "fn_lines": 80, + "complexity": 22, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/tokenizer/src/decoding.rs", + "name": "", + "width": 1, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/tokenizer/src/encoding.rs", + "name": "", + "width": 3, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/tokenizer/src/encoding.rs", + "name": "Tokenizer::encode_segment", + "fn_lines": 31, + "complexity": 7, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, + { + "path": "crates/tokenizer/src/tests.rs", + "name": "qwen35_matches_oracle_ids_for_merges_unicode_and_specials", + "fn_lines": 74, + "complexity": 4, + "nesting": 2, + "width": 0, + "reason": "moved verbatim by the size split of STRA-338 (size-rest); not yet decomposed", + "owner": "STRA-338" + }, { "path": "desktop-core/src/bin/leleka-inference/evaluation_output.rs", "name": "operator_public_evaluation_output", diff --git a/limits-baseline.json b/limits-baseline.json index dbd983a5..944cff96 100644 --- a/limits-baseline.json +++ b/limits-baseline.json @@ -17,8 +17,8 @@ "fn_lines": 1 }, "leleka-cpu-sys": { - "fn_lines": 19, - "width": 5, + "fn_lines": 11, + "width": 3, "complexity": 3, "nesting": 2 }, @@ -56,10 +56,10 @@ "nesting": 1 }, "leleka-gateway-domain": { - "width": 53, - "fn_lines": 16, - "complexity": 13, - "nesting": 6 + "width": 45, + "fn_lines": 15, + "complexity": 12, + "nesting": 5 }, "leleka-gateway-text": { "width": 64, @@ -68,26 +68,26 @@ "nesting": 1 }, "leleka-gguf": { + "complexity": 6, "fn_lines": 6, - "width": 3, - "complexity": 6 + "width": 3 }, "leleka-gptoss": { - "fn_lines": 13, + "fn_lines": 12, "complexity": 6, "nesting": 1, "width": 1 }, "leleka-gptoss-igpu": { + "width": 2, "fn_lines": 1, - "complexity": 1, - "width": 2 + "complexity": 1 }, "leleka-gptoss-npu": { + "width": 3, "fn_lines": 5, "complexity": 3, - "nesting": 2, - "width": 3 + "nesting": 2 }, "leleka-gpu-npu-worker": { "fn_lines": 3, @@ -101,7 +101,7 @@ "nesting": 2 }, "leleka-igpu": { - "fn_lines": 12, + "fn_lines": 10, "complexity": 1, "width": 5 }, @@ -169,12 +169,12 @@ "width": 6 }, "leleka-shm": { - "fn_lines": 2 + "fn_lines": 1 }, "leleka-tokenizer": { - "width": 21, "fn_lines": 13, - "complexity": 7 + "complexity": 7, + "width": 21 }, "leleka-worker-protocol": { "fn_lines": 3, @@ -245,7 +245,7 @@ }, "leleka-experimental-ref": { "fn_lines": 14, - "width": 58, + "width": 37, "complexity": 2, "nesting": 2 }, @@ -259,13 +259,13 @@ "width": 20 }, "leleka-gguf": { - "fn_lines": 5, + "fn_lines": 3, "width": 1 }, "leleka-gptoss": { - "fn_lines": 16, + "fn_lines": 14, "complexity": 4, - "width": 7 + "width": 8 }, "leleka-gptoss-igpu": { "fn_lines": 5, @@ -325,7 +325,7 @@ "complexity": 1 }, "leleka-runtime-client": { - "fn_lines": 9 + "fn_lines": 6 }, "leleka-sampler-ref": { "fn_lines": 14,