code wiki / _hdl_build / nx_pm_w2_backlog.nx
nx_pm_w2_backlog.nx source
↩ module page · 48 lines · 3982 B
1// nx_pm_w2_backlog.nx -- PM backlog breakdown for W2 (sovereign compiler regalloc -> S-class build speed),
2// grounded in the actual allocator code (operator: "give the pm info on what to backlog + assign; tutor as
3// it goes"). The allocator (nx_regalloc.nx) is ALREADY interval/linear-scan-shaped, yet the Auditor measured
4// O(n^1.7) in function-body size -> a hidden superlinear regression. Do NOT theorize the hotspot -- PROFILE.
5// license_tier: ORIGINAL
6import "nx_pm_review_log.nx"
7import "nx_syscalls.nx"
8
9func w2_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
10
11func main() -> i64 {
12 w2_puts("=== PM BACKLOG: W2 sovereign-compiler regalloc -> S-class (grounded in nx_regalloc.nx) ===\n\n" as *u8)
13 let fd: i64 = sys_openat_append("/tmp/nishi_pm_plan.log" as *u8, 0x1a4)
14 let pm: i64 = pm_open("/tmp/nishi_pm_review.log" as *u8)
15 pm_w(fd, "\n# W2 BACKLOG 2026-06-06 (regalloc; profile-first, no theorizing)\n" as *u8)
16
17 w2_puts("W2.1 PROFILE (measured, not theorized): instrument the regalloc on a function with K sequential\n" as *u8)
18 w2_puts(" locals (K=200/400/800/1600) -> count work per phase (build_intervals / compute_liveness /\n" as *u8)
19 w2_puts(" active_insert / spill). Find which phase grows superlinearly. Auditor measured O(n^1.7) overall.\n" as *u8)
20 w2_puts(" Candidates (to confirm, NOT assume): active_insert (sorted-shift O(active) per insert) and the\n" as *u8)
21 w2_puts(" bitset compute_liveness (O(values/64) per block per fixpoint iteration).\n" as *u8)
22 pm_w(fd, "W2.1 profile regalloc phases vs K -> measured O(K^2) hotspot status=ASSIGNED(team; Claude tutors instrumentation)\n" as *u8)
23 pm_flag(pm, "BACKLOG" as *u8, "W2/regalloc-profile" as *u8, "ASSIGNED" as *u8,
24 "profile regalloc phases at K=200..1600 to find the superlinear hotspot (measured)" as *u8,
25 "candidates active_insert / compute_liveness; do NOT theorize -- count work per phase" as *u8)
26
27 w2_puts("\nW2.2 FIX the measured hotspot to O(K log K) / O(K). Linear-scan SHOULD be ~O(K log K): active list as a\n" as *u8)
28 w2_puts(" min-heap keyed by interval END (expire = pop-min, insert = O(log K)) instead of O(active) shifting;\n" as *u8)
29 w2_puts(" liveness bitset ops touched only for live words. Root-cause, not a patch (Cardinal 3).\n" as *u8)
30 pm_w(fd, "W2.2 fix hotspot O(K^2)->O(K log K) (heap active list / tighter liveness) status=QUEUED(after W2.1)\n" as *u8)
31 pm_flag(pm, "BACKLOG" as *u8, "W2/regalloc-fix" as *u8, "QUEUED" as *u8,
32 "replace the measured O(K^2) with O(K log K) (heap-by-end active list / tighter liveness)" as *u8,
33 "Claude tutors the linear-scan data structure; Builder authors; root-cause not patch" as *u8)
34
35 w2_puts("\nW2.3 GATE (Engineer/Referee, measured): nx_regalloc_soundness_test PASS; BYTE-IDENTICAL self-host\n" as *u8)
36 w2_puts(" (compiler compiles itself bit-stable); compile-time-vs-gcc bench shows the daemon build drops\n" as *u8)
37 w2_puts(" from ~40min toward seconds. Auditor RE-GRADES L1 TOY->S only on these numbers.\n" as *u8)
38 pm_w(fd, "W2.3 gate: soundness + byte-stable self-host + compile-time-vs-gcc; Auditor re-grade L1 status=QUEUED\n" as *u8)
39 pm_flag(pm, "BACKLOG" as *u8, "W2/regalloc-gate" as *u8, "QUEUED" as *u8,
40 "soundness + byte-stable self-host + compile-time-vs-gcc; re-grade L1 TOY->S on measured numbers" as *u8,
41 "no self-grade -- the bench is the verdict" as *u8)
42 sys_close(fd); sys_close(pm)
43
44 w2_puts("\n>>> Backlogged + assigned: W2.1 (profile) WORKING; W2.2/W2.3 queued. Claude tutors instrumentation +\n" as *u8)
45 w2_puts(">>> the linear-scan algorithm; the team measures; the Auditor re-grades. W2 unblocks <10s sovereign\n" as *u8)
46 w2_puts(">>> builds for crypto/SSH/daemon -> then A1->A3 + deploy land fast on S-class infra.\n" as *u8)
47 sys_exit(0); return 0
48}