Skip to content

Commit e961c2e

Browse files
perf(malloc): record malloc_free_64 focused gate
bd-2g7oyh.390 no-code rejected on RCH vmi1227854. Broad route: FrankenLibC malloc_free_64 p50/mean 6.076/7.505 ns vs host 3.562/5.112 ns. Focused gate: FrankenLibC Criterion [5.8978 ns 6.1722 ns 6.3740 ns], p50/mean 4.989/6.027 ns; host [3.8424 ns 3.9830 ns 4.1575 ns], p50/mean 4.238/11.317 ns. No source change: allocator ordering/LIFO/counters/lifecycle/FP/RNG unchanged by construction. Score 0.0; allocator edit rejected below gate.
1 parent fd847b9 commit e961c2e

3 files changed

Lines changed: 102 additions & 0 deletions

File tree

.beads/issues.jsonl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6539,3 +6539,4 @@
65396539
{"id":"frankentorch-zy9i","title":"Apply PairwiseDistance eps and keepdim semantics","description":"Discovery pass with empty ready queue: ft-nn::PairwiseDistance stores eps and keepdim from with_eps()/with_keepdim(), but forward_pair() and Module::forward() ignore both fields. That makes torch.nn.PairwiseDistance(p, eps, keepdim) parity observably wrong: eps should shift the elementwise difference before the p-norm, and keepdim=true should preserve the reduced last dimension. Acceptance: apply eps before tensor_norm_dim in pairwise forward paths, preserve the last dimension when keepdim=true, add focused ft-nn regressions proving non-default eps changes identical-vector distance and keepdim keeps shape [N, 1], and validate via rch ft-nn pairwise tests plus fmt/check/clippy.","status":"closed","priority":1,"issue_type":"bug","created_at":"2026-05-12T09:33:21.912474257Z","created_by":"ubuntu","updated_at":"2026-05-12T09:39:42.413203831Z","closed_at":"2026-05-12T09:39:42.412970840Z","close_reason":"Completed: PairwiseDistance now adds eps before the p-norm and unsqueezes the reduced last dimension when keepdim=true; code shipped in 7c959c7 with pairwise_distance regressions plus fmt/check/clippy validation.","source_repo":".","compaction_level":0,"original_size":0}
65406540
{"id":"frankentorch-zz6","title":"Implement tensor creation functions: eye, arange, linspace, logspace","description":"Add torch.eye, torch.arange, torch.linspace, torch.logspace to ft-api. These are used everywhere in model code and tests. All are non-differentiable leaf tensors.","status":"closed","priority":1,"issue_type":"feature","created_at":"2026-03-27T18:14:34.826544482Z","created_by":"ubuntu","updated_at":"2026-03-27T18:15:06.321201936Z","closed_at":"2026-03-27T18:15:06.320936834Z","close_reason":"Already implemented: eye, arange, linspace, logspace all present in ft-api with tests.","source_repo":".","compaction_level":0,"original_size":0}
65416541
{"id":"bd-2g7oyh.389","title":"[perf][no-gaps] strncmp_256_equal focused codegen gate","description":"Pass 90 target from the post-bd-2g7oyh.388 broad RCH non-math routing profile on vmi1227854. Profile evidence: strncmp_256_equal FrankenLibC p50 6.842 ns, mean 9.196 ns vs host glibc p50 5.350 ns, mean 6.464 ns. Prior bd-2g7oyh.65 strncmp SIMD work is closed and already landed; a keepable edit must be structurally different from prior 32-lane equality panels and SWAR strcmp/strncmp follow-ups, preferably a codegen/load-shape primitive with exact first-difference/NUL ordering preserved. Scope: one focused same-worker baseline before any edit; crates/frankenlibc-core/src/string/str.rs only unless proof requires ABI diff test wiring. Required proof: focused RCH baseline, strncmp scalar-reference/golden sha256 and ABI/glibc differential, rustfmt/git diff check, same-worker RCH post, Score>=2.0 else restore/no-code closeout.","status":"closed","priority":1,"issue_type":"task","assignee":"BoldFalcon","created_at":"2026-06-13T19:04:12.225418399Z","created_by":"BoldFalcon","updated_at":"2026-06-13T21:22:37.460687900Z","closed_at":"2026-06-13T21:22:37.460687900Z","close_reason":"KEPT: exact-256 safe-SIMD equality certificate for strncmp. Same-worker RCH vmi1227854 baseline FrankenLibC p50/mean 5.756/7.300 ns vs host 3.867/5.056; post FrankenLibC p50/mean 4.052/5.185 ns vs host 4.501/5.846. Behavior proof passed: core strncmp 2/2, property/golden strncmp 3/3 with golden SHA 99a3358be31072baca18340daceec13300282aa57b2a1b7406d6817396edb326, ABI diff_strncmp_cases 1/1, cargo check -p frankenlibc-core --lib passed. Touched-file rustfmt and git diff --check passed. Strict clippy remains blocked only by existing unrelated lint debt outside the touched str.rs hunk. Score 10.0.","source_repo":"frankenlibc","source_repo_path":"/data/projects/frankenlibc","compaction_level":0,"original_size":0,"labels":["no-gaps","perf","string","strncmp"],"dependencies":[{"issue_id":"bd-2g7oyh.389","depends_on_id":"bd-2g7oyh","type":"parent-child","created_at":"2026-06-13T19:04:12.225418399Z","created_by":"BoldFalcon","metadata":"{}","thread_id":""}]}
6542+
{"id":"bd-2g7oyh.390","title":"[perf] malloc_free_64 focused allocator gate","description":"Screen the post-bd-2g7oyh.389 allocator residual with a same-worker RCH focused baseline before any source edit. Only proceed to a structural slab/LIFO or intrusive-list allocator primitive if the focused gap is material; do not repeat exact-size/cache shortcuts, Trace lifecycle gates, fixed magazine/plain storage swaps, certificate/log micro-specialization, hot-slot metadata tweaks, lazy-accounting retunes, or bitmap-only hot-slot representation changes.","status":"closed","priority":1,"issue_type":"task","assignee":"BoldFalcon","created_at":"2026-06-13T21:42:29.393197950Z","created_by":"BoldFalcon","updated_at":"2026-06-13T21:42:29.393197950Z","closed_at":"2026-06-13T21:42:29.393197950Z","close_reason":"No-code rejected: focused RCH vmi1227854 malloc_free_64 gate collapsed to FrankenLibC p50/mean 4.989/6.027 ns vs host 4.238/11.317 ns; p50 absolute gap 0.751 ns and mean favored FrankenLibC, below allocator edit gate.","labels":["perf","no-gaps","malloc","allocator"],"parent_id":"bd-2g7oyh"}

.skill-loop-progress.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,3 +901,13 @@
901901
- Same-worker post benchmark: RCH `vmi1227854` showed FrankenLibC Criterion `[4.0930 ns 4.1954 ns 4.2864 ns]`, p50/mean `4.052/5.185 ns` vs host `[3.9854 ns 4.1785 ns 4.4069 ns]`, p50/mean `4.501/5.846 ns`. FrankenLibC improved `1.42x` p50 and `1.41x` mean and now beats same-worker host.
902902
- Verdict: KEPT, Score `(Impact 3.0 x Confidence 5.0) / Effort 1.5 = 10.0`. Artifact: `tests/artifacts/perf/bd-2g7oyh.389-strncmp-256-focused.md`.
903903
- Next route: close/push, then reprofile because the string/memory bottleneck set shifted.
904+
905+
### Pass 91 - Malloc_free_64 Focused Allocator Gate - 2026-06-13T21:42:29Z
906+
- Target: `bd-2g7oyh.390` / `glibc_baseline_malloc_free_64`, selected from the post-`.389` broad non-math RCH profile on `vmi1227854` after allocator appeared as the largest current p50 residual.
907+
- Broad route basis: `malloc_free_64` FrankenLibC p50/mean `6.076/7.505 ns` vs host `3.562/5.112 ns`.
908+
- Alien-graveyard grounding: Modern Allocator Design / slab-LIFO route. Prior no-retry families include exact-size/cache shortcuts, Trace lifecycle gates, fixed magazine/plain storage swaps, certificate/log micro-specialization, hot-slot metadata tweaks, lazy-accounting retunes, and bitmap-only hot-slot representation changes. Only a material focused gate would justify a deeper slab/LIFO or intrusive-list primitive.
909+
- Initial RCH attempts with pinned and unpinned three-row allocator regex produced no valid evidence because `RCH_REQUIRE_REMOTE=1` refused local fallback (`critical_pressure=1,insufficient_slots=2,hard_preflight=9`).
910+
- Focused RCH baseline: with `RCH_BUILD_SLOTS=1`, RCH selected `vmi1227854` for `glibc_baseline_malloc_free_64`. FrankenLibC Criterion `[5.8978 ns 6.1722 ns 6.3740 ns]`, p50/mean `4.989/6.027 ns`; host `[3.8424 ns 3.9830 ns 4.1575 ns]`, p50/mean `4.238/11.317 ns`, p95/p99 `5.704/170.000 ns`.
911+
- Verdict: NO-CODE REJECTED, Score `0.0`. The focused p50 gap collapsed to `1.177x` with only `0.751 ns` absolute gap, and mean reversed in FrankenLibC's favor due host tail. No allocator source was touched; allocation order, LIFO/tie-breaking, lifecycle logs, counters, FP, and RNG are unchanged by construction.
912+
- Artifact: `tests/artifacts/perf/bd-2g7oyh.390-malloc-free-64-focused.md`.
913+
- Next route: continue from the current broad table with a different focused residual. Only return to allocator with a material focused same-worker gap and a true slab/LIFO or intrusive-list primitive, not another hot-slot metadata or observability micro-lever.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# bd-2g7oyh.390 malloc_free_64 focused allocator gate
2+
3+
Date: 2026-06-13
4+
Agent: BoldFalcon
5+
Status: NO-CODE REJECTED
6+
7+
## Target
8+
9+
Post-`bd-2g7oyh.389` broad non-math profile on RCH `vmi1227854` showed a
10+
fresh allocator residual:
11+
12+
| row | FrankenLibC p50 ns | host p50 ns | FrankenLibC mean ns | host mean ns |
13+
| --- | ---: | ---: | ---: | ---: |
14+
| broad `malloc_free_64` | 6.076 | 3.562 | 7.505 | 5.112 |
15+
16+
The allocator lane has extensive prior history. Recent no-retry families
17+
include exact-size/cache shortcuts, Trace lifecycle gates, fixed magazine/plain
18+
storage swaps, certificate/log micro-specialization, hot-slot metadata tweaks,
19+
lazy-accounting retunes, and bitmap-only hot-slot representation changes.
20+
21+
The only admissible source route would have been a deeper allocator primitive:
22+
segregated slab/LIFO refill or intrusive per-size-class hot-list layout with
23+
lazy materialized observability and exact lifecycle/golden preservation.
24+
25+
## Focused Baseline Attempts
26+
27+
Two initial RCH attempts with `RCH_REQUIRE_REMOTE=1` refused local fallback and
28+
produced no usable evidence:
29+
30+
```text
31+
RCH_WORKER=vmi1227854 RCH_PREFERRED_WORKER=vmi1227854 RCH_REQUIRE_REMOTE=1 ...
32+
cargo bench -j 1 -p frankenlibc-bench --bench glibc_baseline_bench -- 'glibc_baseline_malloc_free_(64|256|large)'
33+
```
34+
35+
```text
36+
RCH_REQUIRE_REMOTE=1 ...
37+
cargo bench -j 1 -p frankenlibc-bench --bench glibc_baseline_bench -- 'glibc_baseline_malloc_free_(64|256|large)'
38+
```
39+
40+
Both returned:
41+
42+
```text
43+
[RCH] local (no admissible workers: critical_pressure=1,insufficient_slots=2,hard_preflight=9)
44+
[RCH] remote required; refusing local fallback (no worker assigned)
45+
```
46+
47+
## Focused RCH Gate
48+
49+
The valid focused gate used an explicit one-slot remote request:
50+
51+
```text
52+
RCH_BUILD_SLOTS=1 RCH_REQUIRE_REMOTE=1 RCH_VISIBILITY=summary \
53+
RCH_QUEUE_WHEN_BUSY=1 RCH_DAEMON_WAIT_RESPONSE_TIMEOUT_SECS=1800 \
54+
rch exec -v -- env AGENT_NAME=BoldFalcon FRANKENLIBC_BENCH_PIN=1 \
55+
CARGO_BUILD_JOBS=1 \
56+
CARGO_TARGET_DIR=/data/tmp/frankenlibc-bd390-malloc-focused-baseline-target-20260613T2144 \
57+
cargo bench -j 1 -p frankenlibc-bench --bench glibc_baseline_bench -- \
58+
glibc_baseline_malloc_free_64 --noplot --sample-size 50 --warm-up-time 1 \
59+
--measurement-time 3
60+
```
61+
62+
RCH selected `vmi1227854`.
63+
64+
| impl | Criterion interval | p50 ns | mean ns | p95 ns | p99 ns |
65+
| --- | --- | ---: | ---: | ---: | ---: |
66+
| FrankenLibC | `[5.8978 ns 6.1722 ns 6.3740 ns]` | 4.989 | 6.027 | 7.500 | 25.000 |
67+
| host glibc | `[3.8424 ns 3.9830 ns 4.1575 ns]` | 4.238 | 11.317 | 5.704 | 170.000 |
68+
69+
## Isomorphism
70+
71+
No source code changed.
72+
73+
- Allocation size-class mapping, LIFO ordering, hot-slot behavior, central-bin
74+
spill order, large-allocation fast slot, and elimination semantics are
75+
unchanged by construction.
76+
- `active_count`, `total_allocated`, lifecycle logs, and trace/certificate rows
77+
are unchanged by construction.
78+
- Floating point and RNG are not involved.
79+
80+
## Verdict
81+
82+
NO-CODE REJECTED. Score `0.0`.
83+
84+
The focused p50 gap collapsed to `1.177x` with only `0.751 ns` absolute gap, and
85+
the mean comparison reversed in FrankenLibC's favor because host glibc had a
86+
tail outlier. That is below the edit gate for a heavily mined allocator lane.
87+
88+
Next route: reprofile or continue from the current broad table with a different
89+
focused residual. Only return to allocator with a material focused same-worker
90+
gap and a true slab/LIFO or intrusive-list primitive, not another hot-slot
91+
metadata or observability micro-lever.

0 commit comments

Comments
 (0)