STRA-338 size-fn2: allowlist 133 -> 1 entry, baselines tightened, cpu-sys attention test helpers moved to tests/attention/kernel_checks.rs (file back under 400 lines, test ids unchanged), size-fn record of pass 2

Census of these crates: production fn>30 17 -> 2 (igpu gemm WGSL, OpenVino::load FFI table), cx>10 11 -> 0, wide 449 -> 38
(33 USAGE lines of the deploy --help text, 5 WGSL lines); test fn>30 122 -> 0, cx>10 3 -> 0, nesting>4 4 -> 0, wide 150 -> 0.
This commit is contained in:
Pavlo Ratushnyi
2026-11-06 21:52:37 +01:00
parent 1eb70274c7
commit f1723b582d
6 changed files with 274 additions and 1579 deletions
+1 -1
View File
@@ -61,7 +61,7 @@
"instant-now:leleka-npu-service": 5,
"instant-now:leleka-obs": 3,
"instant-now:strata-control": 22,
"instant-now:strata-desktop-core": 15,
"instant-now:strata-desktop-core": 14,
"path-include:leleka-cuda-driver": 118,
"path-include:leleka-engine-qwen35-cuda": 100,
"path-include:leleka-model-format": 12,
+4 -183
View File
@@ -3,6 +3,10 @@
use leleka_cpu_sys as sys;
#[path = "attention/kernel_checks.rs"]
mod kernel_checks;
use kernel_checks::*;
struct Rng(u64);
impl Rng {
@@ -194,10 +198,6 @@ fn the_vector_exp_is_accurate_and_flushes_deep_underflow_to_zero() {
assert!((f64::from(sv) - f64::from(ss)).abs() <= f64::from(ss) * 1e-4);
}
fn expect_mismatch(name: &str, result: Result<(), sys::KernelError>) {
assert_eq!(result, Err(sys::KernelError::LengthMismatch), "{name}");
}
#[test]
fn bad_shapes_are_refused_before_any_read() {
let q = [1.0f32; 16]; // two heads of width 8
@@ -206,79 +206,6 @@ fn bad_shapes_are_refused_before_any_read() {
refuse_weighted_sum_shapes(&keys);
}
fn refuse_score_shapes(q: &[f32; 16], keys: &[f32; 20]) {
let mut out = [0.0f32; 6];
let check = expect_mismatch;
// three positions at stride 8 need 8 * 2 + 8 = 24 floats
check(
"keys too short",
sys::attn_scores_scalar(q, 2, keys, 8, 3, 1.0, &mut out),
);
check(
"output too short",
sys::attn_scores_scalar(q, 2, keys, 8, 2, 1.0, &mut out[..3]),
);
check(
"no heads",
sys::attn_scores_scalar(q, 0, keys, 8, 2, 1.0, &mut out),
);
check(
"heads do not divide q",
sys::attn_scores_scalar(q, 3, keys, 8, 2, 1.0, &mut out),
);
check(
"empty q",
sys::attn_scores_scalar(&[], 1, keys, 8, 2, 1.0, &mut out),
);
check(
"stride overflow",
sys::attn_scores_scalar(q, 2, keys, usize::MAX, 3, 1.0, &mut out),
);
refuse_avx2_score_shape(q, keys);
}
fn refuse_avx2_score_shape(q: &[f32; 16], keys: &[f32; 20]) {
let mut out = [0.0f32; 6];
let check = expect_mismatch;
if sys::avx2_available() {
check(
"avx2 keys too short",
sys::attn_scores_avx2(q, 2, keys, 8, 3, 1.0, &mut out),
);
}
}
fn refuse_weighted_sum_shapes(keys: &[f32; 20]) {
let mut o = [0.0f32; 16];
let check = expect_mismatch;
check(
"weights too short",
sys::attn_weighted_sum_scalar(&[1.0; 5], 2, 3, keys, 4, &mut o),
);
check(
"values too short",
sys::attn_weighted_sum_scalar(&[1.0; 6], 2, 3, &keys[..10], 8, &mut o),
);
check(
"no heads",
sys::attn_weighted_sum_scalar(&[1.0; 6], 0, 3, keys, 4, &mut o),
);
if sys::avx2_available() {
check(
"avx2 values too short",
sys::attn_weighted_sum_avx2(&[1.0; 6], 2, 3, &keys[..10], 8, &mut o),
);
}
}
/// Round `values` to half precision and return the bit patterns and the decoded values.
fn to_half(values: &[f32]) -> (Vec<u16>, Vec<f32>) {
let mut bits = vec![0u16; values.len()];
sys::f32_to_f16_slice_scalar(values, &mut bits).unwrap();
let decoded = bits.iter().map(|b| sys::simd::f16_to_f32(*b)).collect();
(bits, decoded)
}
#[test]
fn half_precision_keys_and_values_match_f64_references_on_the_decoded_values() {
let mut rng = Rng(31);
@@ -297,74 +224,6 @@ fn half_precision_keys_and_values_match_f64_references_on_the_decoded_values() {
}
}
/// The scalar and (when available) AVX2 half-precision scores.
fn half_scores(shape: Shape, q: &[f32], keys16: &[u16]) -> [Vec<f32>; 2] {
let (heads, _hd, stride, n) = shape.parts();
let mut scores_s = vec![0f32; heads * n];
sys::attn_scores_f16_scalar(q, heads, keys16, stride, n, 0.125, &mut scores_s).unwrap();
let mut scores_v = scores_s.clone();
if sys::avx2_available() {
scores_v.fill(f32::NAN);
sys::attn_scores_f16_avx2(q, heads, keys16, stride, n, 0.125, &mut scores_v).unwrap();
}
[scores_s, scores_v]
}
/// The scalar and (when available) AVX2 half-precision weighted sums.
fn half_sums(shape: Shape, weights: &[f32], values16: &[u16]) -> [Vec<f32>; 2] {
let (heads, hd, stride, n) = shape.parts();
let mut sums_s = vec![0f32; heads * hd];
sys::attn_weighted_sum_f16_scalar(weights, heads, n, values16, stride, &mut sums_s).unwrap();
let mut sums_v = sums_s.clone();
if sys::avx2_available() {
sums_v.fill(f32::NAN);
sys::attn_weighted_sum_f16_avx2(weights, heads, n, values16, stride, &mut sums_v).unwrap();
}
[sums_s, sums_v]
}
fn check_f16_scores(shape: Shape, q: &[f32], keys: &[f32], [scores_s, scores_v]: [&[f32]; 2]) {
let (heads, hd, stride, n) = shape.parts();
for g in 0..heads {
for i in 0..n {
let terms: Vec<f64> = (0..hd)
.map(|j| f64::from(q[g * hd + j]) * f64::from(keys[i * stride + j]))
.collect();
let exact = terms.iter().sum::<f64>() * 0.125;
let tol = terms.iter().map(|t| t.abs()).sum::<f64>()
* 0.125
* (hd as f64 + 8.0)
* 2f64.powi(-23);
for got in [scores_s[g * n + i], scores_v[g * n + i]] {
assert!(
(f64::from(got) - exact).abs() <= tol,
"scores {heads}x{hd} head {g} #{i}"
);
}
}
}
}
fn check_f16_sums(shape: Shape, weights: &[f32], values: &[f32], [sums_s, sums_v]: [&[f32]; 2]) {
let (heads, hd, stride, n) = shape.parts();
for g in 0..heads {
for j in 0..hd {
let terms: Vec<f64> = (0..n)
.map(|i| f64::from(weights[g * n + i]) * f64::from(values[i * stride + j]))
.collect();
let exact: f64 = terms.iter().sum();
let tol =
terms.iter().map(|t| t.abs()).sum::<f64>() * (n as f64 + 8.0) * 2f64.powi(-23);
for got in [sums_s[g * hd + j], sums_v[g * hd + j]] {
assert!(
(f64::from(got) - exact).abs() <= tol,
"sums {heads}x{hd} head {g} col {j}"
);
}
}
}
}
#[test]
fn the_vector_half_conversion_is_bit_identical_to_the_portable_one() {
if !sys::avx2_available() {
@@ -418,22 +277,6 @@ fn half_precision_kernels_refuse_short_buffers() {
}
}
/// Gate and up vectors with extremes at the front: far beyond the clamps and at the clamp edges.
fn swiglu_inputs(rng: &mut Rng, len: usize) -> (Vec<f32>, Vec<f32>) {
let mut gate: Vec<f32> = (0..len).map(|_| rng.f32(12.0)).collect();
let mut up: Vec<f32> = (0..len).map(|_| rng.f32(12.0)).collect();
for (i, g) in [-200.0f32, 200.0, -7.0, 7.0, 0.0, -0.0, 50.0, -50.0]
.iter()
.enumerate()
{
if i < len {
gate[i] = *g;
up[i] = if i % 2 == 0 { 100.0 } else { -100.0 };
}
}
(gate, up)
}
#[test]
fn the_expert_activation_matches_an_f64_reference_including_extremes() {
let mut rng = Rng(101);
@@ -460,28 +303,6 @@ fn the_expert_activation_matches_an_f64_reference_including_extremes() {
);
}
fn check_swiglu(
len: usize,
[gate, up]: [&[f32]; 2],
[s, v]: [&[f32]; 2],
(alpha, limit): (f32, f32),
) {
for i in 0..len {
let x = f64::from(gate[i]).min(f64::from(limit));
let y = f64::from(up[i]).clamp(-f64::from(limit), f64::from(limit));
let exact = x / (1.0 + (-f64::from(alpha) * x).exp()) * (1.0 + y);
for (name, got) in [("scalar", s[i]), ("avx2", v[i])] {
let err = (f64::from(got) - exact).abs();
assert!(
err <= 3e-6 * exact.abs() + 1e-30,
"{name} len {len} #{i}: gate {} up {}: {got} vs {exact}",
gate[i],
up[i]
);
}
}
}
#[test]
fn the_vector_half_to_float_conversion_is_exact_for_every_bit_pattern() {
if !sys::avx2_available() {
@@ -0,0 +1,196 @@
//! The shape-refusal, half-precision and activation helpers of the attention tests.
use super::*;
pub(super) fn expect_mismatch(name: &str, result: Result<(), sys::KernelError>) {
assert_eq!(result, Err(sys::KernelError::LengthMismatch), "{name}");
}
pub(super) fn refuse_score_shapes(q: &[f32; 16], keys: &[f32; 20]) {
let mut out = [0.0f32; 6];
let check = expect_mismatch;
// three positions at stride 8 need 8 * 2 + 8 = 24 floats
check(
"keys too short",
sys::attn_scores_scalar(q, 2, keys, 8, 3, 1.0, &mut out),
);
check(
"output too short",
sys::attn_scores_scalar(q, 2, keys, 8, 2, 1.0, &mut out[..3]),
);
check(
"no heads",
sys::attn_scores_scalar(q, 0, keys, 8, 2, 1.0, &mut out),
);
check(
"heads do not divide q",
sys::attn_scores_scalar(q, 3, keys, 8, 2, 1.0, &mut out),
);
check(
"empty q",
sys::attn_scores_scalar(&[], 1, keys, 8, 2, 1.0, &mut out),
);
check(
"stride overflow",
sys::attn_scores_scalar(q, 2, keys, usize::MAX, 3, 1.0, &mut out),
);
refuse_avx2_score_shape(q, keys);
}
pub(super) fn refuse_avx2_score_shape(q: &[f32; 16], keys: &[f32; 20]) {
let mut out = [0.0f32; 6];
let check = expect_mismatch;
if sys::avx2_available() {
check(
"avx2 keys too short",
sys::attn_scores_avx2(q, 2, keys, 8, 3, 1.0, &mut out),
);
}
}
pub(super) fn refuse_weighted_sum_shapes(keys: &[f32; 20]) {
let mut o = [0.0f32; 16];
let check = expect_mismatch;
check(
"weights too short",
sys::attn_weighted_sum_scalar(&[1.0; 5], 2, 3, keys, 4, &mut o),
);
check(
"values too short",
sys::attn_weighted_sum_scalar(&[1.0; 6], 2, 3, &keys[..10], 8, &mut o),
);
check(
"no heads",
sys::attn_weighted_sum_scalar(&[1.0; 6], 0, 3, keys, 4, &mut o),
);
if sys::avx2_available() {
check(
"avx2 values too short",
sys::attn_weighted_sum_avx2(&[1.0; 6], 2, 3, &keys[..10], 8, &mut o),
);
}
}
/// Round `values` to half precision and return the bit patterns and the decoded values.
pub(super) fn to_half(values: &[f32]) -> (Vec<u16>, Vec<f32>) {
let mut bits = vec![0u16; values.len()];
sys::f32_to_f16_slice_scalar(values, &mut bits).unwrap();
let decoded = bits.iter().map(|b| sys::simd::f16_to_f32(*b)).collect();
(bits, decoded)
}
/// The scalar and (when available) AVX2 half-precision scores.
pub(super) fn half_scores(shape: Shape, q: &[f32], keys16: &[u16]) -> [Vec<f32>; 2] {
let (heads, _hd, stride, n) = shape.parts();
let mut scores_s = vec![0f32; heads * n];
sys::attn_scores_f16_scalar(q, heads, keys16, stride, n, 0.125, &mut scores_s).unwrap();
let mut scores_v = scores_s.clone();
if sys::avx2_available() {
scores_v.fill(f32::NAN);
sys::attn_scores_f16_avx2(q, heads, keys16, stride, n, 0.125, &mut scores_v).unwrap();
}
[scores_s, scores_v]
}
/// The scalar and (when available) AVX2 half-precision weighted sums.
pub(super) fn half_sums(shape: Shape, weights: &[f32], values16: &[u16]) -> [Vec<f32>; 2] {
let (heads, hd, stride, n) = shape.parts();
let mut sums_s = vec![0f32; heads * hd];
sys::attn_weighted_sum_f16_scalar(weights, heads, n, values16, stride, &mut sums_s).unwrap();
let mut sums_v = sums_s.clone();
if sys::avx2_available() {
sums_v.fill(f32::NAN);
sys::attn_weighted_sum_f16_avx2(weights, heads, n, values16, stride, &mut sums_v).unwrap();
}
[sums_s, sums_v]
}
pub(super) fn check_f16_scores(
shape: Shape,
q: &[f32],
keys: &[f32],
[scores_s, scores_v]: [&[f32]; 2],
) {
let (heads, hd, stride, n) = shape.parts();
for g in 0..heads {
for i in 0..n {
let terms: Vec<f64> = (0..hd)
.map(|j| f64::from(q[g * hd + j]) * f64::from(keys[i * stride + j]))
.collect();
let exact = terms.iter().sum::<f64>() * 0.125;
let tol = terms.iter().map(|t| t.abs()).sum::<f64>()
* 0.125
* (hd as f64 + 8.0)
* 2f64.powi(-23);
for got in [scores_s[g * n + i], scores_v[g * n + i]] {
assert!(
(f64::from(got) - exact).abs() <= tol,
"scores {heads}x{hd} head {g} #{i}"
);
}
}
}
}
pub(super) fn check_f16_sums(
shape: Shape,
weights: &[f32],
values: &[f32],
[sums_s, sums_v]: [&[f32]; 2],
) {
let (heads, hd, stride, n) = shape.parts();
for g in 0..heads {
for j in 0..hd {
let terms: Vec<f64> = (0..n)
.map(|i| f64::from(weights[g * n + i]) * f64::from(values[i * stride + j]))
.collect();
let exact: f64 = terms.iter().sum();
let tol =
terms.iter().map(|t| t.abs()).sum::<f64>() * (n as f64 + 8.0) * 2f64.powi(-23);
for got in [sums_s[g * hd + j], sums_v[g * hd + j]] {
assert!(
(f64::from(got) - exact).abs() <= tol,
"sums {heads}x{hd} head {g} col {j}"
);
}
}
}
}
/// Gate and up vectors with extremes at the front: far beyond the clamps and at the clamp edges.
pub(super) fn swiglu_inputs(rng: &mut Rng, len: usize) -> (Vec<f32>, Vec<f32>) {
let mut gate: Vec<f32> = (0..len).map(|_| rng.f32(12.0)).collect();
let mut up: Vec<f32> = (0..len).map(|_| rng.f32(12.0)).collect();
for (i, g) in [-200.0f32, 200.0, -7.0, 7.0, 0.0, -0.0, 50.0, -50.0]
.iter()
.enumerate()
{
if i < len {
gate[i] = *g;
up[i] = if i % 2 == 0 { 100.0 } else { -100.0 };
}
}
(gate, up)
}
pub(super) fn check_swiglu(
len: usize,
[gate, up]: [&[f32]; 2],
[s, v]: [&[f32]; 2],
(alpha, limit): (f32, f32),
) {
for i in 0..len {
let x = f64::from(gate[i]).min(f64::from(limit));
let y = f64::from(up[i]).clamp(-f64::from(limit), f64::from(limit));
let exact = x / (1.0 + (-f64::from(alpha) * x).exp()) * (1.0 + y);
for (name, got) in [("scalar", s[i]), ("avx2", v[i])] {
let err = (f64::from(got) - exact).abs();
assert!(
err <= 3e-6 * exact.abs() + 1e-30,
"{name} len {len} #{i}: gate {} up {}: {got} vs {exact}",
gate[i],
up[i]
);
}
}
}
+71 -11
View File
@@ -59,19 +59,79 @@ Per crate (before -> after; production columns, then test columns; "wide" counts
| **total** | 486 -> 17 | 340 -> 11 | 46 -> 0 | 756 -> 449 | 507 -> 122 | 35 -> 3 | 47 -> 4 | 332 -> 150 |
## Pass 2 (drive the census of these crates to zero)
Same method, then the owner's single-responsibility rule: one function does one action, a helper is named verb + object, a name
that needs "and" or "then" is split again, the decision (which branch) is separate from the execution (how), a `check_*` is a
predicate and does not mutate or compute, a test is setup, action and assertion as named steps.
* `strata-desktop-core`: the 15 production functions and the 6 test functions left by pass 1 (`ToolResponse::complete` and
`preflight` with the new module `runtime_tool_response/preflight.rs`, `hardware::inventory`, node `respond` with the new
module `node/respond.rs`, `node_connection::session`, `node_proxy::respond`, `planner::plan`, `Pool::new`, `cli::node`, `main`,
`managed_worker` start/run, ...).
* Test functions and examples over 30 lines in `leleka-deploy` (64), `cpu-sys`, `cpu-kernels`, `igpu`, `experimental-ref`,
`gptoss`, `gptoss-igpu`, `gptoss-npu`, `npu-worker`, `npu-service`: builder, step and assert helpers; test names, ids and
assertions unchanged. `cpu-sys/tests/attention.rs` keeps its test ids and moved its non-test helpers to
`tests/attention/kernel_checks.rs`; `leleka-deploy/tests/e2e_windows.rs` moved its checks to `tests/e2e_windows/checks.rs`.
* Lines over 120 columns: 599 -> 38 in these crates. Comments are re-filled by paragraph; a long message string is broken at a
space with a trailing backslash (Rust strips the leading whitespace of the next line, so the evaluated text is byte-identical)
or split with `concat!`; JSON macros are re-wrapped. A lexer comparison of the evaluated string literals of every changed
file against the previous commit found identical sequences in 234 of 295 files and identical multisets in 34; the other 27
are files whose code changed (a helper took the format arguments, a literal moved to another function) and were read. The
probe script of `desktop-core/src/remote.rs` is a raw string; its `nvidia-smi` line is continued with a shell backslash
(the same command, not the same bytes).
* Single responsibility (review of pass 1): about 50 two-action test helpers split (for example `assert_response_status` and
`assert_response_headers`); `check_*` functions that mutated or computed became a predicate plus an explicit step
(`trace_items::check_call` / `record_call_id`, `verify_still_attached` over `check_snapshot_is_attached`,
`catalog_changed_during_cold_preparation` / `abort_cold_preparation`, `check_context_budget` returning nothing); decision
apart from execution in `runtime_rpc` (`judge_load`, `admit_generation`), the backend worker (`fail_start`,
`served_after_refusal`, `judge_request`), `harmony`, `gateway-text` and `gptoss` (`softmax_scores_in_place` says it rewrites
the scores; `rotate_queries` is pure and `store_rotated_kv` writes the cache; arithmetic and attributes unchanged).
* Regression of pass 1 fixed: `spawn_engine` turned a spawn error into `StartupFailed` with `map_err`, which cannot await, so
the status stayed `Starting`; the original set `Failed` first. Restored, with the test
`a_failed_engine_spawn_marks_the_worker_failed`.
Per crate (pass 1 end -> pass 2; production fn>30, cx>10, wide, then test fn>30, cx>10, nesting>4, wide):
| Crate | prod fn>30 | cx>10 | wide | test fn>30 | cx>10 | nest>4 | wide |
|---|---|---|---|---|---|---|---|
| `leleka-cpu-kernels` | 0 -> 0 | 0 -> 0 | 0 -> 0 | 6 -> 0 | 1 -> 0 | 3 -> 0 | 1 -> 0 |
| `leleka-cpu-sys` | 0 -> 0 | 0 -> 0 | 3 -> 0 | 16 -> 0 | 0 -> 0 | 0 -> 0 | 2 -> 0 |
| `leleka-cpu-worker` | 0 -> 0 | 0 -> 0 | 5 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 5 -> 0 |
| `leleka-deploy` | 0 -> 0 | 0 -> 0 | 247 -> 33 | 64 -> 0 | 0 -> 0 | 0 -> 0 | 60 -> 0 |
| `leleka-experimental-ref` | 0 -> 0 | 0 -> 0 | 4 -> 0 | 9 -> 0 | 1 -> 0 | 1 -> 0 | 37 -> 0 |
| `leleka-gateway-domain` | 0 -> 0 | 0 -> 0 | 16 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 1 -> 0 |
| `leleka-gateway-text` | 0 -> 0 | 0 -> 0 | 61 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 6 -> 0 |
| `leleka-gguf` | 0 -> 0 | 0 -> 0 | 1 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 1 -> 0 |
| `leleka-gptoss` | 0 -> 0 | 0 -> 0 | 1 -> 0 | 5 -> 0 | 0 -> 0 | 0 -> 0 | 7 -> 0 |
| `leleka-gptoss-igpu` | 0 -> 0 | 0 -> 0 | 2 -> 0 | 1 -> 0 | 0 -> 0 | 0 -> 0 | 3 -> 0 |
| `leleka-gptoss-npu` | 0 -> 0 | 0 -> 0 | 2 -> 0 | 1 -> 0 | 0 -> 0 | 0 -> 0 | 5 -> 0 |
| `leleka-gpu-npu-worker` | 0 -> 0 | 0 -> 0 | 2 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 1 -> 0 |
| `leleka-igpu` | 1 -> 1 | 0 -> 0 | 5 -> 5 | 12 -> 0 | 1 -> 0 | 0 -> 0 | 0 -> 0 |
| `leleka-igpu-worker` | 0 -> 0 | 0 -> 0 | 1 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 |
| `leleka-native-parity-bench` | 0 -> 0 | 0 -> 0 | 9 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 |
| `leleka-npu-service` | 0 -> 0 | 0 -> 0 | 3 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 1 -> 0 |
| `leleka-npu-worker` | 0 -> 0 | 0 -> 0 | 2 -> 0 | 2 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 |
| `leleka-openvino` | 1 -> 1 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 |
| `leleka-runtime-client` | 0 -> 0 | 0 -> 0 | 3 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 |
| `leleka-serving-policy` | 0 -> 0 | 0 -> 0 | 5 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 1 -> 0 |
| `leleka-tokenizer` | 0 -> 0 | 0 -> 0 | 14 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 2 -> 0 |
| `strata-control` | 0 -> 0 | 0 -> 0 | 50 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 17 -> 0 |
| `strata-desktop-core` | 15 -> 0 | 11 -> 0 | 13 -> 0 | 6 -> 0 | 0 -> 0 | 0 -> 0 | 0 -> 0 |
| **total** | 17 -> 2 | 11 -> 0 | 449 -> 38 | 122 -> 0 | 3 -> 0 | 4 -> 0 | 150 -> 0 |
Allowlist entries: 133 -> 1 (`OpenVino::load`); the entries of functions that only had wide lines went when the lines were
wrapped. `limits-baseline.json` and `architecture-baseline.json` were regenerated with `--update-baseline` only (nothing raised).
## What stays over a limit, and why
* `igpu/src/shaders/gemm.rs :: gemm` (175 lines): WGSL shader text returned as one string; data, not logic.
* `openvino/src/library.rs :: OpenVino::load` (84): FFI symbol table of about 25 `dlsym` lookups; the table is the point.
* `strata-desktop-core` (15 production functions: `ToolResponse::complete`/`preflight`, `hardware::inventory`,
`node_proxy::respond`, `node_connection::session`, `Agent::respond`, `planner::plan`, `Pool::new`, `managed_worker`
`start`/`run`/`Owner::command`, `cli::node::serve`/`parse_mode`, `main`/`file_command`, `evaluation_measurement`, and a few
within 1 to 4 lines of the limit): time box. They carry allowlist entries (owner STRA-338) and are the first items of the next batch.
* `leleka-deploy` tests (64 functions, all over 30 lines, none over complexity 10; mostly `e2e_windows`, `recipe`, the planner
tests and unit tests in `src/*/tests*`) and the tests/examples of `cpu-sys`, `cpu-kernels`, `igpu`, `experimental-ref`,
`gptoss`, `npu-worker`: time box.
* Wide lines: 449 production lines and 150 test lines remain over 120 columns, mostly long messages and the JSON literals of
fake runtimes; rustfmt cannot wrap them and the text must stay byte-identical.
* `igpu/src/shaders/gemm.rs :: gemm` (175 lines, five lines over 120 columns): WGSL shader text returned as one string; data, not
logic. It has no allowlist entry because no diff touches it; the census baseline holds it.
* `openvino/src/library.rs :: OpenVino::load` (84): FFI symbol table of about 25 `dlsym` lookups; the table is the point
(allowlist entry, owner STRA-338).
* `leleka-deploy/src/cli.rs` `USAGE` (33 lines over 120 columns): the `--help` text is user-visible and
`scripts/release/package-5090.sh` parses it by line.
* The three `Supervisor` types are not renamed (`AttachLoop`, `SessionSupervisor`, `ServiceSupervisor`).
## Kernels
+1 -1255
View File
File diff suppressed because it is too large Load Diff
+1 -129
View File
@@ -13,12 +13,6 @@
"complexity": 2,
"fn_lines": 3
},
"leleka-cpu-sys": {
"width": 3
},
"leleka-cpu-worker": {
"width": 5
},
"leleka-cuda-driver": {
"fn_lines": 586,
"width": 815,
@@ -26,7 +20,7 @@
"nesting": 23
},
"leleka-deploy": {
"width": 247
"width": 33
},
"leleka-engine-core": {
"fn_lines": 11,
@@ -38,37 +32,10 @@
"complexity": 526,
"nesting": 10
},
"leleka-experimental-ref": {
"width": 4
},
"leleka-gateway-domain": {
"width": 16
},
"leleka-gateway-text": {
"width": 61
},
"leleka-gguf": {
"width": 1
},
"leleka-gptoss": {
"width": 1
},
"leleka-gptoss-igpu": {
"width": 2
},
"leleka-gptoss-npu": {
"width": 2
},
"leleka-gpu-npu-worker": {
"width": 2
},
"leleka-igpu": {
"fn_lines": 1,
"width": 5
},
"leleka-igpu-worker": {
"width": 1
},
"leleka-libc-shim": {
"width": 35,
"fn_lines": 2,
@@ -80,41 +47,15 @@
"width": 601,
"nesting": 24
},
"leleka-native-parity-bench": {
"width": 9
},
"leleka-npu-service": {
"width": 3
},
"leleka-npu-worker": {
"width": 2
},
"leleka-openvino": {
"fn_lines": 1
},
"leleka-runtime": {
"width": 2
},
"leleka-runtime-client": {
"width": 3
},
"leleka-serving-policy": {
"width": 5
},
"leleka-tokenizer": {
"width": 14
},
"python": {
"complexity": 1,
"width": 2
},
"strata-control": {
"width": 50
},
"strata-desktop-core": {
"fn_lines": 15,
"complexity": 11,
"width": 13
}
},
"test": {
@@ -125,29 +66,12 @@
"fn_lines": 5,
"complexity": 1
},
"leleka-cpu-kernels": {
"fn_lines": 6,
"nesting": 3,
"complexity": 1,
"width": 1
},
"leleka-cpu-sys": {
"fn_lines": 16,
"width": 2
},
"leleka-cpu-worker": {
"width": 5
},
"leleka-cuda-driver": {
"fn_lines": 106,
"complexity": 31,
"width": 60,
"nesting": 5
},
"leleka-deploy": {
"fn_lines": 64,
"width": 60
},
"leleka-engine-core": {
"fn_lines": 11,
"width": 2,
@@ -160,40 +84,6 @@
"complexity": 12,
"nesting": 6
},
"leleka-experimental-ref": {
"fn_lines": 9,
"width": 37,
"complexity": 1,
"nesting": 1
},
"leleka-gateway-domain": {
"width": 1
},
"leleka-gateway-text": {
"width": 6
},
"leleka-gguf": {
"width": 1
},
"leleka-gptoss": {
"width": 7,
"fn_lines": 5
},
"leleka-gptoss-igpu": {
"width": 3,
"fn_lines": 1
},
"leleka-gptoss-npu": {
"width": 5,
"fn_lines": 1
},
"leleka-gpu-npu-worker": {
"width": 1
},
"leleka-igpu": {
"fn_lines": 12,
"complexity": 1
},
"leleka-libc-shim": {
"width": 2
},
@@ -215,26 +105,8 @@
"width": 130,
"nesting": 6
},
"leleka-npu-service": {
"width": 1
},
"leleka-npu-worker": {
"fn_lines": 2
},
"leleka-serving-policy": {
"width": 1
},
"leleka-tokenizer": {
"width": 2
},
"python": {
"width": 1
},
"strata-control": {
"width": 17
},
"strata-desktop-core": {
"fn_lines": 6
}
}
}