fix(phase-30 S43): permuter takes func_8017C6F4 63->42; the "rumour row" was an ADDRESS COLLISION

- THE FLOOR MOVED: permuter_ils on the S42 draft -> masked 65->44 (cycle 1, flat over 5 warm
  restarts); re-measured in match_one terms 63 -> 42 mismatched, 947/947 ins. First movement
  after ~40 hand probes, and it came from repairing an instrument (S43-1), not from new C.
  Draft preserved + allowlisted: .run/s43/func_8017C6F4.ils44.c; logged at closeness 42.
- THE S42 "rumour" CLAIM WAS WRONG (R14): the 2026-07-01 row HAS an artifact, it IS on disk,
  and it reproduces exactly (14 mismatched of 15 target ins, SIZE-MISMATCH/redraft). It is a
  near-worthless draft on a DIFFERENT BODY: 0x8017C6F4 is 15 ins in ov_SC03_010/011/013 and
  948 ins in ov_SC03_126/003 + ov_SC04_021 + ov_SC05_019 (§148-E, ledger side).
- THREE ledger defects fixed: (1) load_best keyed on ADDRESS ALONE -> the two bodies merged and
  the lower ABSOLUTE closeness won, so 14-of-15-wrong (7% correct) masked 63-of-947 (93%);
  now sub-keyed by known nins, legacy rows unchanged. (2) binary=null defaulted to ov_SC01_077,
  where the fn does not exist AT ALL, and "not an open stub" was read as "banked" -> today's
  result was invisible to render/grinder/target-selection (absent != done, R32/R34); now derive
  binary from the draft path + only drop when closed everywhere it exists. (3) `log` had NO
  --binary flag -- the root cause of every null; added + derived in append_record.
- IMPACT DERIVED, NOT ASSERTED (R37): replaying the pre-fix selection = 836 -> 837, 1 appeared
  (func_8017C6F4 nins=947), 0 vanished. One row today; the mechanism would eat every future one.
- PROBED AND NOT BUILT: relative-closeness ranking (only 24/836 rows carry closeness+nins, and
  the two orderings agree 14/15 on those). Documented in the log instead.
This commit is contained in:
Drew T
2026-08-05 16:06:16 -06:00
parent 63d029b563
commit fa122cf62f
7 changed files with 1782 additions and 845 deletions
+6
View File
@@ -43,6 +43,12 @@
/.run/s42/*
!/.run/s42/*/
!/.run/s42/*/*.c
# P30 S43 — the permuter-ILS improvement on the same function (63 -> 42 mismatched), the best
# base that exists for it. Same R20 reasoning as s42 above.
!/.run/s43/
/.run/s43/*
!/.run/s43/*.c
!/.run/s43/*.log
!/.run/probe_jtbl/
/.run/probe_jtbl/*
!/.run/probe_jtbl/verdict.md
+2 -1
View File
@@ -178,7 +178,7 @@
{"ts": "2026-07-01 06:03:59", "addr": null, "name": "func_80181FCC", "reach": null, "klass": null, "nins": null, "status": "near", "closeness": 1, "where_stuck": "residual: 1 mismatch", "best_draft": ".run/backlog_drafts/func_80181FCC.c", "binary": "ov_SC05_001", "source": "bulk-harvest", "residual": null, "passes_tried": null}
{"ts": "2026-07-01 06:04:00", "addr": null, "name": "func_8017E76C", "reach": null, "klass": null, "nins": null, "status": "failed", "closeness": null, "where_stuck": "won't compile standalone (loose-typing / missing decl)", "best_draft": ".run/backlog_drafts/func_8017E76C.c", "binary": "ov_SC05_004", "source": "bulk-harvest", "residual": null, "passes_tried": null}
{"ts": "2026-07-01 06:03:20", "addr": null, "name": "func_8017C6B8", "reach": null, "klass": null, "nins": null, "status": "near", "closeness": 21, "where_stuck": "residual: 21 mismatch", "best_draft": ".run/backlog_drafts/func_8017C6B8.c", "binary": "ov_SC03_010", "source": "bulk-harvest", "residual": null, "passes_tried": null}
{"ts": "2026-07-01 06:03:20", "addr": null, "name": "func_8017C6F4", "reach": null, "klass": null, "nins": null, "status": "near", "closeness": 14, "where_stuck": "residual: 14 mismatch", "best_draft": ".run/backlog_drafts/func_8017C6F4.c", "binary": "ov_SC03_010", "source": "bulk-harvest", "residual": null, "passes_tried": null}
{"ts": "2026-07-01 06:03:20", "addr": null, "name": "func_8017C6F4", "reach": null, "klass": null, "nins": 15, "status": "near", "closeness": 14, "where_stuck": "residual: 14 mismatch", "best_draft": ".run/backlog_drafts/func_8017C6F4.c", "binary": "ov_SC03_010", "source": "bulk-harvest", "residual": null, "passes_tried": null}
{"ts": "2026-07-01 06:03:15", "addr": null, "name": "func_80180014", "reach": null, "klass": null, "nins": null, "status": "near", "closeness": 10, "where_stuck": "residual: 10 mismatch", "best_draft": ".run/backlog_drafts/func_80180014.c", "binary": "ov_SC03_002", "source": "bulk-harvest", "residual": null, "passes_tried": null}
{"ts": "2026-07-01 06:03:24", "addr": null, "name": "func_801828C8", "reach": null, "klass": null, "nins": null, "status": "near", "closeness": 2, "where_stuck": "residual: 2 mismatch", "best_draft": ".run/backlog_drafts/func_801828C8.c", "binary": "ov_SC03_029", "source": "bulk-harvest", "residual": null, "passes_tried": null}
{"ts": "2026-07-01 06:03:20", "addr": "0x8017f7e8", "name": "func_8017F7E8", "reach": 1, "klass": "WAVE", "nins": 177, "status": "near", "closeness": 11, "where_stuck": "WAVE: 11 mismatch", "best_draft": ".run/backlog_drafts/func_8017F7E8.c", "binary": "ov_SC03_013", "source": "bulk-harvest", "residual": null, "passes_tried": null}
@@ -836,3 +836,4 @@
{"ts": "2026-08-04 23:17:33", "addr": "0x801865ec", "name": "func_801865EC", "reach": 1, "klass": "WAVE", "nins": 125, "status": "near", "closeness": 65, "where_stuck": "WAVE: 65 mismatch", "best_draft": ".run/backlog_drafts/func_801865EC.c", "binary": "ov_SC01_077", "source": "worker", "residual": [[36, "00023023 negu\ta2,v0", "00022823 negu $a1, $v0"], [37, "24c40400 addiu\ta0,a2,1024", "24a30400 addiu $v1, $a1, 0x400"], [38, "00041040 sll\tv0,a0,0x1", "00031040 sll $v0, $v1, 1"], [39, "00442821 addu\ta1,v0,a0", "00432021 addu $a0, $v0, $v1"], [40, "00051100 sll\tv0,a1,0x4", "00041100 sll $v0, $a0, 4"], [42, "00401821 move\tv1,v0", "26260024 addiu $a2, $s1, 0x24"], [43, "244307ff addiu\tv1,v0,2047", "244207ff addiu $v0, $v0, 0x7FF"], [44, "000312c3 sra\tv0,v1,0xb", "000212c3 sra $v0, $v0, 11"], [46, "00051140 sll\tv0,a1,0x5", "00041140 sll $v0, $a0, 5"], [52, "00801021 move\tv0,a0", "00601021 addu $v0, $v1, $zero"], [55, "24c2043f addiu\tv0,a2,1087", "24a2043f addiu $v0, $a1, 0x43F"], [63, "8e230020 lw\tv1,32(s1)", "8e220020 lw $v0, 0x20($s1)"], [64, "26220024 addiu\tv0,s1,36", "00000000 nop"], [65, "ac620080 sw\tv0,128(v1)", "ac460080 sw $a2, 0x80($v0)"], [67, "00000000 nop", "02202021 addu $a0, $s1, $zero"], [69, "00000000 nop", "3c058018 lui $a1, %hi(D_80186E48)"], [70, "34420010 ori\tv0,v0,0x10", "24a56e48 addiu $a1, $a1, %lo(D_80186E48)"], [71, "a462002c sh\tv0,44(v1)", "34420010 ori $v0, $v0, 0x10"], [72, "8e230020 lw\tv1,32(s1)", "a462002c sh $v0, 0x2C($v1)"], [73, "24022000 li\tv0,8192", "8e230020 lw $v1, 0x20($s1)"], [74, "a462001c sh\tv0,28(v1)", "24022000 addiu $v0, $zero, 0x2000"], [75, "8e230020 lw\tv1,32(s1)", "a462001c sh $v0, 0x1C($v1)"], [76, "02202021 move\ta0,s1", "a462001a sh $v0, 0x1A($v1)"], [77, "a462001a sh\tv0,26(v1)", "0c04aa0a jal func_8012A828"]], "passes_tried": null}
{"ts": "2026-08-05 14:54:19", "addr": "0x8017C294", "name": "func_8017C294", "reach": 16, "klass": "regalloc: qty_compare tie + stratum-3 frame slot (cookbook 147)", "nins": 246, "status": "near", "closeness": 12, "where_stuck": "ov_SC01_077", "best_draft": ".run/s42/ov_SC01_077/func_8017C294.c", "binary": null, "source": "s42-serial", "residual": null, "passes_tried": null}
{"ts": "2026-08-05 14:54:22", "addr": "0x8017C6F4", "name": "func_8017C6F4", "reach": 3, "klass": "regalloc: one register rotation; permuter UNTRIED (make_base_c fails on gte_ macros) - demacroize first (cookbook 148)", "nins": 947, "status": "near", "closeness": 63, "where_stuck": "ov_SC03_126", "best_draft": ".run/s42/ov_SC03_126/func_8017C6F4.c", "binary": null, "source": "s42-serial", "residual": null, "passes_tried": null}
{"ts": "2026-08-05 16:05:31", "addr": "0x8017C6F4", "name": "func_8017C6F4", "reach": 3, "klass": "regalloc: register rotation (mnc/xmx1/cell/prim); ILS took hand-63 -> 42, flat across 5 restarts", "nins": 947, "status": "near", "closeness": 42, "where_stuck": "ov_SC03_126; permuter ILS plateau (masked 44 over 6 warm restarts); residual still the register rotation, fewer instances", "best_draft": ".run/s43/func_8017C6F4.ils44.c", "binary": "ov_SC03_126", "source": "s43-permuter-ils", "residual": null, "passes_tried": null}
+823
View File
@@ -0,0 +1,823 @@
typedef struct
{
u32 w0;
u32 w1;
u32 w2;
} Prim126;
typedef struct
{
u8 *vtx;
u32 f4;
u32 xx;
u32 yy;
u32 zz;
Prim126 *prim;
Prim126 *end;
} Cell126;
typedef struct
{
s16 vx;
s16 vy;
} DVECTOR2;
typedef struct
{
s16 vx;
s16 vy;
s16 vz;
s16 pad;
} SVECTOR2;
typedef struct
{
s16 m[3][3];
s32 t[3];
} MATRIX2;
typedef struct
{
u32 tag;
u32 rgbc;
s16 x0;
s16 y0;
s16 x1;
s16 y1;
s16 x2;
s16 y2;
} PolyF3;
typedef struct
{
u32 tag;
u32 rgbc;
s16 x0;
s16 y0;
s16 x1;
s16 y1;
s16 x2;
s16 y2;
s16 x3;
s16 y3;
} PolyF4;
typedef struct
{
u32 tag;
u32 rgbc;
s16 x0;
s16 y0;
u32 uvc0;
s16 x1;
s16 y1;
u32 uvp1;
s16 x2;
s16 y2;
u16 uv2;
u16 p2;
} PolyFT3;
typedef struct
{
u32 tag;
u32 rgbc;
s16 x0;
s16 y0;
u32 uvc0;
s16 x1;
s16 y1;
u32 uvp1;
s16 x2;
s16 y2;
u16 uv2;
u16 p2;
s16 x3;
s16 y3;
u16 uv3;
u16 p3;
} PolyFT4;
void func_8017C6F4(s32 arg0)
{
extern s32 func_800491EC(void);
extern void func_800547D8(s32, MATRIX2 *);
extern void func_80052E38(MATRIX2 *);
extern void func_8017C014(void *, void *, s32);
extern u8 D_8018F9C0[];
extern u8 *D_800A5E60;
extern u8 D_800A6610[];
extern short D_800B9A02;
s16 rect[4];
DVECTOR2 tmpxy[4];
SVECTOR2 box[8];
SVECTOR2 sxy[8];
MATRIX2 mtx;
struct
{
long flag;
long opz;
long sz0;
long sz1;
long sz2;
long sz3;
} g;
s32 cx0;
s32 cx1;
s32 cy0;
s32 cy1;
s32 y;
s32 col;
Cell126 **rowptr;
Cell126 **p;
Cell126 *cell;
Prim126 *prim;
Prim126 *end;
u8 *pkt;
u32 ot;
u8 *vtx;
u8 *va;
u8 *vb;
u8 *vc;
u8 *vd;
u32 w;
u32 code;
u32 wx;
u32 wy;
u32 wz;
u32 xlo;
u32 xhi;
u32 ylo;
u32 yhi;
u32 zlo;
s16 new_var;
u32 zhi;
s32 xa32;
s32 xb32;
s32 xmn1;
s32 xmx1;
s32 xmn2;
s32 xmx2;
s32 mnc;
s32 mxc;
s32 t32;
s32 my;
s32 mny;
s32 mx;
s32 mn;
func_800491EC();
func_800547D8(arg0 + 0x10, &mtx);
func_80052E38(&mtx);
func_8017C014(D_8018F9C0, rect, *((s32 *) (arg0 + 0x60)));
pkt = D_800A5E60;
ot = (u32) (&D_800A6610[(*((u16 *) (&D_800B9A02))) << 14]);
cx0 = (rect[0] + 0x4000) / 512;
cx1 = (((rect[0] + rect[2]) + 0x4000) / 512) + 2;
cx0 = (cx0 < 0) ? (0) : ((cx0 > 0x3F) ? (0x3F) : (cx0));
cx1 = (cx1 < 0) ? (0) : ((cx1 > 0x3F) ? (0x3F) : (cx1));
cy0 = ((rect[1] + 0x4000) / 512) - 1;
cy1 = (((rect[1] + rect[3]) + 0x4000) / 512) + 2;
cy0 = (cy0 < 0) ? (0) : ((cy0 > 0x3F) ? (0x3F) : (cy0));
cy1 = (cy1 < 0) ? (0) : ((cy1 > 0x3F) ? (0x3F) : (cy1));
rowptr = ((Cell126 **) (*((s32 *) (arg0 + 0xC)))) + ((cy0 * 64) + cx0);
for (y = cy0; y < cy1; y++, rowptr += 0x40)
{
for (col = cx0, p = rowptr; col < cx1; col++, p++)
{
cell = *p;
if (cell == 0)
{
continue;
}
wx = cell->xx;
xlo = wx & 0xFFFF;
xhi = wx >> 16;
wy = cell->yy;
ylo = wy & 0xFFFF;
yhi = (wy >> 15) >> 1;
wz = cell->zz;
zlo = wz & 0xFFFF;
zhi = wz >> 16;
box[0].vx = xlo;
box[0].vy = ylo;
box[0].vz = zlo;
box[1].vx = xhi;
box[1].vy = ylo;
box[1].vz = zlo;
box[2].vx = xlo;
box[2].vy = ylo;
box[2].vz = zhi;
box[3].vx = xhi;
box[3].vy = ylo;
box[3].vz = zhi;
box[4].vx = xlo;
box[4].vy = yhi;
box[4].vz = zlo;
box[5].vx = xhi;
box[5].vy = yhi;
box[5].vz = zlo;
box[6].vx = xlo;
box[6].vy = yhi;
box[6].vz = zhi;
box[7].vx = xhi;
box[7].vy = yhi;
box[7].vz = zhi;
__asm__ volatile ( "lwc2 $0, 0( %0 );" "lwc2 $1, 4( %0 );" "lwc2 $2, 8( %0 );" "lwc2 $3, 12( %0 );" "lwc2 $4, 16( %0 );" "lwc2 $5, 20( %0 )" : : "r"( &box[0] ) );
__asm__ volatile ("nop;nop;rtpt");
__asm__ volatile ( "swc2 $12, 0( %0 );" "swc2 $13, 0( %1 );" "swc2 $14, 0( %2 )" : : "r"( &sxy[0] ), "r"( &sxy[1] ), "r"( &sxy[2] ) : "memory" );
__asm__ volatile ( "lwc2 $0, 0( %0 );" "lwc2 $1, 4( %0 )" : : "r"( &box[3] ) );
__asm__ volatile ("nop;nop;rtps");
__asm__ volatile ( "swc2 $14, 0( %0 )" : : "r"( &sxy[3] ) : "memory" );
__asm__ volatile ( "lwc2 $0, 0( %0 );" "lwc2 $1, 4( %0 );" "lwc2 $2, 8( %0 );" "lwc2 $3, 12( %0 );" "lwc2 $4, 16( %0 );" "lwc2 $5, 20( %0 )" : : "r"( &box[4] ) );
__asm__ volatile ("nop;nop;rtpt");
__asm__ volatile ( "swc2 $12, 0( %0 );" "swc2 $13, 0( %1 );" "swc2 $14, 0( %2 )" : : "r"( &sxy[4] ), "r"( &sxy[5] ), "r"( &sxy[6] ) : "memory" );
__asm__ volatile ( "lwc2 $0, 0( %0 );" "lwc2 $1, 4( %0 )" : : "r"( &box[7] ) );
__asm__ volatile ("nop;nop;rtps");
__asm__ volatile ( "swc2 $14, 0( %0 )" : : "r"( &sxy[7] ) : "memory" );
xa32 = sxy[0].vx;
xb32 = sxy[1].vx;
if (xb32 < xa32)
{
xmx1 = xa32;
xmn1 = xb32;
}
else
{
xmn1 = xa32;
xmx1 = xb32;
}
t32 = sxy[2].vx;
if (xmx1 < t32)
{
xmx1 = t32;
}
else
if (t32 < xmn1)
{
xmn1 = t32;
}
t32 = sxy[3].vx;
if (xmx1 < t32)
{
xmx1 = t32;
}
else
if (t32 < xmn1)
{
xmn1 = t32;
}
xa32 = sxy[4].vx;
xb32 = sxy[5].vx;
new_var = sxy[6].vx;
if (xb32 < xa32)
{
xmx2 = xa32;
xmn2 = xb32;
}
else
{
xmn2 = xa32;
xmx2 = xb32;
}
t32 = new_var;
if (xmx2 < t32)
{
xmx2 = t32;
}
else
if (t32 < xmn2)
{
xmn2 = t32;
}
t32 = sxy[7].vx;
if (xmx2 < t32)
{
xmx2 = t32;
}
else
if (t32 < xmn2)
{
xmn2 = t32;
}
mnc = xmn1;
if (xmn2 < mnc)
{
mnc = xmn2;
}
mxc = xmx1;
if (mxc < xmx2)
{
mxc = xmx2;
}
if (mxc < (-0xA0))
{
continue;
}
if (!(mnc < 0xA1))
{
continue;
}
xa32 = sxy[0].vy;
xb32 = sxy[1].vy;
if (xb32 < xa32)
{
xmx1 = xa32;
xmn1 = xb32;
}
else
{
xmn1 = xa32;
xmx1 = xb32;
}
t32 = sxy[2].vy;
if (xmx1 < t32)
{
xmx1 = t32;
}
else
if (t32 < xmn1)
{
xmn1 = t32;
}
t32 = sxy[3].vy;
if (xmx1 < t32)
{
xmx1 = t32;
}
else
if (t32 < xmn1)
{
xmn1 = t32;
}
xa32 = sxy[4].vy;
xb32 = sxy[5].vy;
if (xb32 < xa32)
{
xmx2 = xa32;
xmn2 = xb32;
}
else
{
xmn2 = xa32;
xmx2 = xb32;
}
t32 = sxy[6].vy;
if (xmx2 < t32)
{
xmx2 = t32;
}
else
if (t32 < xmn2)
{
xmn2 = t32;
}
t32 = sxy[7].vy;
if (xmx2 < t32)
{
xmx2 = t32;
}
else
if (t32 < xmn2)
{
xmn2 = t32;
}
mnc = xmn1;
if (xmn2 < mnc)
{
mnc = xmn2;
}
mxc = xmx1;
if (mxc < xmx2)
{
mxc = xmx2;
}
if (mxc < (-0x78))
{
continue;
}
if (!(mnc < 0x79))
{
continue;
}
prim = cell->prim;
end = cell->end;
vtx = cell->vtx;
while (prim < end)
{
w = prim->w1;
va = vtx + (w & 0xFFFF);
vb = vtx + (w >> 16);
w = prim->w2;
vc = vtx + (w & 0xFFFF);
w = w >> 16;
__asm__ volatile ( "lwc2 $0, 0( %0 );" "lwc2 $1, 4( %0 );" "lwc2 $2, 0( %1 );" "lwc2 $3, 4( %1 );" "lwc2 $4, 0( %2 );" "lwc2 $5, 4( %2 )" : : "r"( va ), "r"( vb ), "r"( vc ) );
__asm__ volatile ("nop;nop;rtpt");
__asm__ volatile ( "cfc2 $12, $31;" "nop;" "sw $12, 0( %0 )" : : "r"( &g.flag ) : "$12", "memory" );
if (!(g.flag & 0x7F85E000))
{
__asm__ volatile ("nop;nop;nclip");
code = w & 0xF;
vd = vtx + ((w & 0xFFF0) >> 1);
__asm__ volatile ( "swc2 $24, 0( %0 )" : : "r"( &g.opz ) : "memory" );
if (g.opz > 0)
{
switch (code)
{
case 4:
case 5:
__asm__ volatile ( "swc2 $12, 8( %0 );" "swc2 $13, 12( %0 );" "swc2 $14, 16( %0 )" : : "r"( pkt ) : "memory" );
__asm__ volatile ( "swc2 $17, 0( %0 );" "swc2 $18, 0( %1 );" "swc2 $19, 0( %2 )" : : "r"( &g.sz0 ), "r"( &g.sz1 ), "r"( &g.sz2 ) : "memory" );
if (((PolyFT3 *) pkt)->x0 > ((PolyFT3 *) pkt)->x1)
{
mx = ((PolyFT3 *) pkt)->x0;
mn = ((PolyFT3 *) pkt)->x1;
}
else
{
mn = ((PolyFT3 *) pkt)->x0;
mx = ((PolyFT3 *) pkt)->x1;
}
if (((PolyFT3 *) pkt)->x2 > mx)
{
mx = ((PolyFT3 *) pkt)->x2;
}
else
if (((PolyFT3 *) pkt)->x2 < mn)
{
mn = ((PolyFT3 *) pkt)->x2;
}
if ((mx >= (-0xA0)) && (mn < 0xA1))
{
if (((PolyFT3 *) pkt)->y0 > ((PolyFT3 *) pkt)->y1)
{
my = ((PolyFT3 *) pkt)->y0;
mny = ((PolyFT3 *) pkt)->y1;
}
else
{
mny = ((PolyFT3 *) pkt)->y0;
my = ((PolyFT3 *) pkt)->y1;
}
if (((PolyFT3 *) pkt)->y2 > my)
{
my = ((PolyFT3 *) pkt)->y2;
}
else
if (((PolyFT3 *) pkt)->y2 < mny)
{
mny = ((PolyFT3 *) pkt)->y2;
}
if ((my >= (-0x78)) && (mny < 0x79))
{
s32 za;
u32 *otp;
if (g.sz0 > g.sz1)
{
za = g.sz0;
if (za < g.sz2)
{
za = g.sz2;
}
}
else
{
za = g.sz1;
if (za < g.sz2)
{
za = g.sz2;
}
}
g.opz = za;
if (code != 4)
{
g.opz = za + 0x200;
}
((PolyF3 *) pkt)->rgbc = prim->w0;
otp = (u32 *) (((g.opz >> 2) << 2) + ot);
*((u32 *) pkt) = ((*otp) & 0xFFFFFF) | 0x4000000;
*otp = ((*otp) & 0xFF000000) | (((u32) pkt) & 0xFFFFFF);
pkt += 0x14;
}
}
break;
case 6:
case 7:
__asm__ volatile ( "swc2 $12, 0( %0 );" "swc2 $13, 4( %0 );" "swc2 $14, 8( %0 )" : : "r"( &tmpxy[0] ) : "memory" );
__asm__ volatile ( "swc2 $17, 0( %0 );" "swc2 $18, 0( %1 );" "swc2 $19, 0( %2 )" : : "r"( &g.sz0 ), "r"( &g.sz1 ), "r"( &g.sz2 ) : "memory" );
if (tmpxy[0].vx > tmpxy[1].vx)
{
mx = tmpxy[0].vx;
mn = tmpxy[1].vx;
}
else
{
mn = tmpxy[0].vx;
mx = tmpxy[1].vx;
}
if (tmpxy[2].vx > mx)
{
mx = tmpxy[2].vx;
}
else
if (tmpxy[2].vx < mn)
{
mn = tmpxy[2].vx;
}
if ((mx >= (-0xA0)) && (mn < 0xA1))
{
if (tmpxy[0].vy > tmpxy[1].vy)
{
my = tmpxy[0].vy;
mny = tmpxy[1].vy;
}
else
{
mny = tmpxy[0].vy;
my = tmpxy[1].vy;
}
if (tmpxy[2].vy > my)
{
my = tmpxy[2].vy;
}
else
if (tmpxy[2].vy < mny)
{
mny = tmpxy[2].vy;
}
if ((my >= (-0x78)) && (mny < 0x79))
{
s32 za;
u32 *otp;
u32 *tp;
__asm__ volatile ("nop;nop;avsz3");
if (g.sz0 > g.sz1)
{
za = g.sz0;
if (za < g.sz2)
{
za = g.sz2;
}
}
else
{
za = g.sz1;
if (za < g.sz2)
{
za = g.sz2;
}
}
g.opz = za;
if (code != 6)
{
g.opz = za + 0x200;
}
*((u32 *) (&((PolyFT3 *) pkt)->x0)) = *((u32 *) (&tmpxy[0]));
*((u32 *) (&((PolyFT3 *) pkt)->x1)) = *((u32 *) (&tmpxy[1]));
*((u32 *) (&((PolyFT3 *) pkt)->x2)) = *((u32 *) (&tmpxy[2]));
tp = (u32 *) prim->w0;
((PolyFT3 *) pkt)->rgbc = tp[0];
((PolyFT3 *) pkt)->uvc0 = tp[1];
((PolyFT3 *) pkt)->uvp1 = tp[2];
((PolyFT3 *) pkt)->uv2 = tp[3];
otp = (u32 *) (((g.opz >> 2) << 2) + ot);
*((u32 *) pkt) = ((*otp) & 0xFFFFFF) | 0x7000000;
*otp = ((*otp) & 0xFF000000) | (((u32) pkt) & 0xFFFFFF);
pkt += 0x20;
}
}
break;
case 0:
case 1:
__asm__ volatile ( "swc2 $12, 8( %0 );" "swc2 $13, 12( %0 );" "swc2 $14, 16( %0 )" : : "r"( pkt ) : "memory" );
__asm__ volatile ( "lwc2 $0, 0( %0 );" "lwc2 $1, 4( %0 )" : : "r"( vd ) );
__asm__ volatile ("nop;nop;rtps");
if (((PolyF4 *) pkt)->x0 > ((PolyF4 *) pkt)->x1)
{
mx = ((PolyF4 *) pkt)->x0;
mn = ((PolyF4 *) pkt)->x1;
}
else
{
mn = ((PolyF4 *) pkt)->x0;
mx = ((PolyF4 *) pkt)->x1;
}
if (((PolyF4 *) pkt)->x2 > mx)
{
mx = ((PolyF4 *) pkt)->x2;
}
else
if (((PolyF4 *) pkt)->x2 < mn)
{
mn = ((PolyF4 *) pkt)->x2;
}
if (((PolyF4 *) pkt)->y0 > ((PolyF4 *) pkt)->y1)
{
my = ((PolyF4 *) pkt)->y0;
mny = ((PolyF4 *) pkt)->y1;
}
else
{
mny = ((PolyF4 *) pkt)->y0;
my = ((PolyF4 *) pkt)->y1;
}
if (((PolyF4 *) pkt)->y2 > my)
{
my = ((PolyF4 *) pkt)->y2;
}
else
if (((PolyF4 *) pkt)->y2 < mny)
{
mny = ((PolyF4 *) pkt)->y2;
}
__asm__ volatile ( "cfc2 $12, $31;" "nop;" "sw $12, 0( %0 )" : : "r"( &g.flag ) : "$12", "memory" );
if (!(g.flag & 0x7F85E000))
{
__asm__ volatile ( "swc2 $16, 0( %0 );" "swc2 $17, 0( %1 );" "swc2 $18, 0( %2 );" "swc2 $19, 0( %3 )" : : "r"( &g.sz0 ), "r"( &g.sz1 ), "r"( &g.sz2 ), "r"( &g.sz3 ) : "memory" );
__asm__ volatile ( "swc2 $14, 0( %0 )" : : "r"( (long *)&((PolyF4 *)pkt)->x3 ) : "memory" );
if (((PolyF4 *) pkt)->x3 < mn)
{
mn = ((PolyF4 *) pkt)->x3;
}
else
if (mx < ((PolyF4 *) pkt)->x3)
{
mx = ((PolyF4 *) pkt)->x3;
}
if ((mx >= (-0xA0)) && (mn < 0xA1))
{
if (((PolyF4 *) pkt)->y3 < mny)
{
mny = ((PolyF4 *) pkt)->y3;
}
else
if (my < ((PolyF4 *) pkt)->y3)
{
my = ((PolyF4 *) pkt)->y3;
}
if ((my >= (-0x78)) && (mny < 0x79))
{
s32 za;
s32 zb;
u32 *otp;
zb = g.sz2;
if (zb < g.sz3)
{
zb = g.sz3;
}
za = g.sz0;
if (za < g.sz1)
{
za = g.sz1;
}
if (za < zb)
{
za = zb;
}
g.opz = za;
if (code != 0)
{
g.opz = za + 0x200;
}
((PolyF4 *) pkt)->rgbc = prim->w0;
otp = (u32 *) (((g.opz >> 2) << 2) + ot);
*((u32 *) pkt) = ((*otp) & 0xFFFFFF) | 0x5000000;
*otp = ((*otp) & 0xFF000000) | (((u32) pkt) & 0xFFFFFF);
pkt += 0x18;
}
}
}
break;
case 2:
case 3:
__asm__ volatile ( "swc2 $12, 0( %0 );" "swc2 $13, 4( %0 );" "swc2 $14, 8( %0 )" : : "r"( &tmpxy[0] ) : "memory" );
__asm__ volatile ( "lwc2 $0, 0( %0 );" "lwc2 $1, 4( %0 )" : : "r"( vd ) );
__asm__ volatile ("nop;nop;rtps");
__asm__ volatile ( "cfc2 $12, $31;" "nop;" "sw $12, 0( %0 )" : : "r"( &g.flag ) : "$12", "memory" );
if (!(g.flag & 0x7F85E000))
{
__asm__ volatile ( "swc2 $14, 0( %0 )" : : "r"( &tmpxy[3] ) : "memory" );
__asm__ volatile ( "swc2 $16, 0( %0 );" "swc2 $17, 0( %1 );" "swc2 $18, 0( %2 );" "swc2 $19, 0( %3 )" : : "r"( &g.sz0 ), "r"( &g.sz1 ), "r"( &g.sz2 ), "r"( &g.sz3 ) : "memory" );
if (tmpxy[0].vx > tmpxy[1].vx)
{
mx = tmpxy[0].vx;
mn = tmpxy[1].vx;
}
else
{
mn = tmpxy[0].vx;
mx = tmpxy[1].vx;
}
if (tmpxy[2].vx > mx)
{
mx = tmpxy[2].vx;
}
else
if (tmpxy[2].vx < mn)
{
mn = tmpxy[2].vx;
}
if (tmpxy[3].vx > mx)
{
mx = tmpxy[3].vx;
}
else
if (tmpxy[3].vx < mn)
{
mn = tmpxy[3].vx;
}
if ((mx >= (-0xA0)) && (mn < 0xA1))
{
if (tmpxy[0].vy > tmpxy[1].vy)
{
my = tmpxy[0].vy;
mny = tmpxy[1].vy;
}
else
{
mny = tmpxy[0].vy;
my = tmpxy[1].vy;
}
if (tmpxy[2].vy > my)
{
my = tmpxy[2].vy;
}
else
if (tmpxy[2].vy < mny)
{
mny = tmpxy[2].vy;
}
if (tmpxy[3].vx > my)
{
my = tmpxy[3].vx;
}
else
if (tmpxy[3].vx < mny)
{
mny = tmpxy[3].vx;
}
if ((my >= (-0x78)) && (mny < 0x79))
{
s32 za;
s32 zb;
u32 *otp;
u32 *tp;
u32 uvw;
__asm__ volatile ("nop;nop;avsz4");
zb = g.sz2;
if (zb < g.sz3)
{
zb = g.sz3;
}
za = g.sz0;
if (za < g.sz1)
{
za = g.sz1;
}
if (za < zb)
{
za = zb;
}
g.opz = za;
if (code != 2)
{
g.opz = za + 0x200;
}
*((u32 *) (&((PolyFT4 *) pkt)->x0)) = *((u32 *) (&tmpxy[0]));
*((u32 *) (&((PolyFT4 *) pkt)->x1)) = *((u32 *) (&tmpxy[1]));
*((u32 *) (&((PolyFT4 *) pkt)->x2)) = *((u32 *) (&tmpxy[2]));
*((u32 *) (&((PolyFT4 *) pkt)->x3)) = *((u32 *) (&tmpxy[3]));
tp = (u32 *) prim->w0;
((PolyFT4 *) pkt)->rgbc = tp[0];
((PolyFT4 *) pkt)->uvc0 = tp[1];
((PolyFT4 *) pkt)->uvp1 = tp[2];
uvw = tp[3];
((PolyFT4 *) pkt)->uv2 = uvw;
((PolyFT4 *) pkt)->uv3 = uvw >> 16;
otp = (u32 *) (((g.opz >> 2) << 2) + ot);
*((u32 *) pkt) = ((*otp) & 0xFFFFFF) | 0x9000000;
*otp = ((*otp) & 0xFF000000) | (((u32) pkt) & 0xFFFFFF);
pkt += 0x28;
}
}
}
break;
}
}
}
prim++;
}
}
}
D_800A5E60 = pkt;
}
+8
View File
@@ -0,0 +1,8 @@
ILS func_8017C6F4: 6 cycles x 240s @ -j12, klass=REGALLOC
cycle 1: best score = 44 [output-44-1]
cycle 2: best score = 44 (unchanged) [output-44-1]
cycle 3: best score = 44 (unchanged) [output-44-1]
cycle 4: best score = 44 (unchanged) [output-44-1]
cycle 5: best score = 44 (unchanged) [output-44-1]
cycle 6: best score = 44 (unchanged) [output-44-1]
ILS done: best=44 (no score-0; seed for Fable5 or a longer run)
+837 -836
View File
File diff suppressed because it is too large Load Diff
+37
View File
@@ -2087,6 +2087,43 @@ sweep) were run with the permuter *unavailable*. "The permuter also plateaus" wa
these functions — do not treat those floors as permuter-tested. → cookbook §148 tooling note corrected
in place.
### ▶ S43-2 — the permuter took the "unmovable" 63 to 42; and the ledger row was NOT a rumour (2026-08-05)
**The floor moved.** With `base.c` fixed (S43-1), `permuter_ils` on the S42 hand draft: masked base 65
→ **44 in cycle 1**, then flat across 5 warm restarts. Re-measured in `match_one` terms (the metrics are
NOT interchangeable — always re-measure before comparing): **63 → 42 mismatched**, same 947/947 ins,
residual still the register-rotation class but with fewer instances. **The first movement on this
function after ~40 hand probes** — and it came from repairing an instrument, not from new C.
Draft preserved + allowlisted: `.run/s43/func_8017C6F4.ils44.c` (+ `ils_8017C6F4.log`), logged to the
backlog at closeness 42.
**The S42 "rumour row" claim was WRONG (R14) — and the truth is a worse defect.** The 2026-07-01 row
*does* have an artifact, it *is* on disk (`.run/backlog_drafts/func_8017C6F4.c`, one of 3,335 there),
and it *reproduces exactly*: `match_one` vs `ov_SC03_010` → **14 mismatched of 15 target ins**,
`SIZE-MISMATCH/redraft`. It is not a rumour; it is a near-worthless draft on a **different function**.
**`0x8017C6F4` hosts TWO bodies:** 15 ins in `ov_SC03_010/011/013`, **948 ins** in
`ov_SC03_126/003`, `ov_SC04_021`, `ov_SC05_019` (§148-E, ledger side).
Three defects, all in `tools/backlog.py`, all fixed:
1. **`load_best` keyed on address alone**, so the two bodies merged and the LOWER absolute closeness
won — a 14-of-15-wrong draft (7% correct) masked a hand-won 63-of-947 (**93% correct**). Now
sub-keyed by known `nins`; unknown-`nins` rows keep the old behaviour and fold into the sole known
body when unambiguous (so legacy name-vs-addr dedup is preserved).
2. **`binary: null` defaulted to `ov_SC01_077`, where `func_8017C6F4` does not exist at all** — and
"not an open stub there" was read as "banked", so today's real result was **invisible to render,
the grinder, and target selection**. *Absent ≠ done* (R32/R34). Now: derive the binary from the
draft path, and only drop when the fn is closed in every binary that has it (`_open_anywhere`).
3. **`backlog.py log` had no `--binary` flag at all** — the root cause of every null. Added, plus
`append_record` derives it from the draft path (the S20 `addr_of` lesson, applied to `binary`).
**Measured impact, derived not asserted (R37):** replaying the exact pre-fix selection → **836 → 837
rows, 1 appeared, 0 vanished**, and the one that appeared is `func_8017C6F4 nins=947`. The live blast
radius is one row *today* — `s42-serial` is the only logger that omitted `binary` — but the mechanism
would silently eat every future serial/agent result logged the same way.
**Note on ranking (documented, NOT fixed):** `closeness` is an ABSOLUTE mismatch count, so it is not
comparable across sizes — 14/15 outranks 63/947. A relative-closeness rank was probed and **not built**:
only **24 of 836** live rows carry both `closeness` and `nins`, and on those the two orderings agree
14/15 (most are closeness=0 integration-stranded). Revisit if `nins` coverage ever rises.
### ▶ S11 — the propagation lag: EXTEND 0/36 -> 31/36, and every blocker was a DECLARATION (2026-08-03/04)
Lane 2 of the S10 checkpoint ("26,006 ins, ~0 agent tokens, PARTLY BLOCKED"), taken first on the
standing doctrine that the cheap deterministic lever is probed before the expensive agent one.
+69 -8
View File
@@ -28,7 +28,7 @@ Usage:
tools/backlog.py show [-n 40] # print the top N to stdout
Importable: append_record(dict), render(), save_draft(name, text)->path.
"""
import argparse, glob, json, os, re, shutil, time
import argparse, collections, glob, json, os, re, shutil, time
REPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
JSONL = os.path.join(REPO, ".run/backlog.jsonl")
@@ -95,6 +95,11 @@ def append_record(rec):
a = addr_of(r)
if a is not None:
r["addr"] = "0x%08x" % a
# Same lesson as addr (S20) applied to `binary` (S43): a null binary defaults to ov_SC01_077
# downstream, and if the function does not exist there the row reads as "banked" and disappears.
# The draft path states the binary -- derive it rather than let a caller's omission cost a result.
if not r.get("binary"):
r["binary"] = _binary_of(r)
os.makedirs(os.path.dirname(JSONL), exist_ok=True)
with open(JSONL, "a") as f:
f.write(json.dumps(r) + "\n")
@@ -110,6 +115,7 @@ def save_draft(name, text):
_STUB_CACHE = {}
_ANYWHERE_CACHE = set()
def _open_stubs(binary):
@@ -128,6 +134,28 @@ def _open_stubs(binary):
return _STUB_CACHE[binary]
_BINARY_IN_PATH_RE = re.compile(r"\b(ov_[A-Z0-9]+_\d+|resident|main)\b")
def _binary_of(rec):
"""Recover the record's binary from its draft path when the logger omitted the field
(`.run/s42/ov_SC03_126/func_X.c` -> `ov_SC03_126`). Cheaper and more honest than defaulting."""
m = _BINARY_IN_PATH_RE.search(str(rec.get("best_draft") or ""))
return m.group(1) if m else None
def _open_anywhere(nm):
"""True iff `nm` is still an INCLUDE_ASM stub in ANY onboarded binary. Used only to distinguish
'absent from the binary we guessed' from 'genuinely banked' — never to widen the queue."""
key = nm.upper().replace("FUNC_", "func_")
if not _ANYWHERE_CACHE:
import corpus, dup_report
for b in sorted(dup_report.BINARIES): # the audited citizenship list (R36)
for x in corpus.stubs(b):
_ANYWHERE_CACHE.add(("func_%08X" % x) if isinstance(x, int) else str(x))
return key in _ANYWHERE_CACHE
def load_best():
"""Best (lowest closeness, latest ts) record per addr, restricted to fns still OPEN in their OWN
binary (rec['binary']; legacy records default ov_SC01_077). Fleet-aware so a 077-matched-but-
@@ -143,22 +171,54 @@ def load_best():
continue
r = json.loads(line)
nm = r.get("name")
binary = r.get("binary") or "ov_SC01_077"
binary = r.get("binary") or _binary_of(r) or "ov_SC01_077"
# banked in ITS binary since logged -> drop (P9). Hex-case-canonical on BOTH sides (T0d):
# corpus-derived names are upper-hex; a lower-hex record name must not silently drop (R32).
if nm and nm.upper().replace("FUNC_", "func_") not in _open_stubs(binary):
continue
# "not an open stub in <binary>" has TWO causes and only one of them is `banked`:
# the function may simply NOT EXIST in that binary. P30 S43: the s42-serial rows log
# binary=None, so they defaulted to ov_SC01_077 -- which does not contain
# func_8017C6F4 at all -- and a hand-won 947-ins result was dropped as "banked",
# invisible to render/grinder/target-selection. Absent != done (R32/R34). Only drop
# when the function is genuinely closed everywhere it exists.
if nm and _open_anywhere(nm):
pass
else:
continue
# Key on the DERIVED address (addr_of), never on `addr or name`: 93% of rows carry only
# `name`, so the old key split one function into TWO "best" records whenever it had been
# logged both ways — the same silent-skip class as the null-addr defect itself.
a = addr_of(r)
# An address is unique only WITHIN a binary: overlays reuse the same vram slot for
# DIFFERENT bodies (P30 S43 — 0x8017C6F4 is a 15-ins function in ov_SC03_010/011/013 and a
# 948-ins renderer in ov_SC03_126/003, ov_SC04_021, ov_SC05_019). Keying on address alone
# merged the two and kept the LOWER absolute closeness, so a 14-of-15-wrong draft (7%
# correct) masked a hand-won 63-of-947 (93% correct) and the giant vanished from every
# consumer — render, grinder, target selection. So sub-key by KNOWN nins: different sizes
# are different bodies, full stop. Rows without nins keep the old addr-only behaviour
# (they are the 97% legacy case and must still dedup name-vs-addr duplicates), and are
# folded into the sole known-nins body when there is exactly one — only a genuine
# collision splits them out. §148-E, ledger side.
key = a if a is not None else nm
cur = best.get(key)
n = r.get("nins")
subkey = n if isinstance(n, int) and n > 0 else None
cur = best.get((key, subkey))
c = r.get("closeness")
cscore = c if isinstance(c, int) else 10 ** 9
if cur is None or (cscore, r.get("ts", "")) <= (cur[0], cur[1]):
best[key] = (cscore, r.get("ts", ""), r)
return [v[2] for v in best.values()]
best[(key, subkey)] = (cscore, r.get("ts", ""), r)
# fold each addr's unknown-nins record into its body when that body is unambiguous
sized = collections.defaultdict(list)
for (key, subkey) in best:
if subkey is not None:
sized[key].append(subkey)
out = []
for (key, subkey), v in best.items():
if subkey is None and len(sized.get(key, ())) == 1:
continue # same function, logged before nins was recorded
out.append(v[2])
return out
def _rank_key(r):
@@ -228,7 +288,7 @@ def main():
ap = argparse.ArgumentParser()
sub = ap.add_subparsers(dest="cmd", required=True)
lg = sub.add_parser("log")
for fl in ("addr", "name", "klass", "status", "where", "draft", "source"):
for fl in ("addr", "name", "klass", "status", "where", "draft", "source", "binary"):
lg.add_argument(f"--{fl if fl != 'klass' else 'class'}", dest=fl, default=None)
for fl in ("reach", "nins", "closeness"):
lg.add_argument(f"--{fl}", type=int, default=None)
@@ -239,7 +299,8 @@ def main():
if a.cmd == "log":
rec = append_record({"addr": a.addr, "name": a.name, "klass": a.klass, "status": a.status,
"where_stuck": a.where, "best_draft": a.draft, "source": a.source,
"reach": a.reach, "nins": a.nins, "closeness": a.closeness})
"reach": a.reach, "nins": a.nins, "closeness": a.closeness,
"binary": a.binary})
n = render()
print(f"logged {rec.get('name') or rec.get('addr')}; backlog open={n}")
elif a.cmd == "render":