feat(v4): Phase 7 Task 3 -- background decay and the window's adaptive pass in each node's heartbeat cycle (#189)
In v3's order (vm_heartbeat_run_cycle): the tick; background decay -- 64 words a cycle from a cursor down the dictionary (v3's vm_tick_apply_background_decay), so a word not called cools; the window's adaptive pass on its diversity (v3's rolling_window_run_adaptive_pass: halve to 256, double to 4096). Test first: test_mesh_boot.c, 62 checks (70 with pipelining and the cache on). Inference, L8 and the snapshot next. Not pushed (held to the end of Phase 7). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -207,8 +207,8 @@ int main(void)
|
||||
CHECK(how == V4_TEXT_COMPLETED && xt > 0 && a && a->calls == 0 && a->xt == xt,
|
||||
"a word defined at the prompt has a record, called 0 times: \"%s\"", r);
|
||||
/* Phase 7, Task 1: v3's physics on the record (DictPhysics; v3/include/vm.h) */
|
||||
CHECK(a && a->heat == 0 && a->temperature_q8 == 0 && a->last_decay_tick == 0 && a->state_flags == 0,
|
||||
"a new word's physics: no heat, no temperature, never decayed, no state flags");
|
||||
CHECK(a && a->heat == 0 && a->temperature_q8 == 0 && a->state_flags == 0,
|
||||
"a new word's physics: no heat, no temperature, no state flags (background decay may have touched it, as v3's)");
|
||||
CHECK(ms.physics[0].decay_slope_q48 == 21845u && ms.physics[0].l3_decay == 1,
|
||||
"each node has v3's initial decay slope (Q48.16, 1/3) and Loop #3 on");
|
||||
r = line(V4_MESH_HERA, ": IMM ; IMMEDIATE ' IMM .", &how);
|
||||
@@ -270,6 +270,30 @@ int main(void)
|
||||
"300 calls of P7, and the many the line's compiling makes: the tick moves, a cycle per 256 (%lu)",
|
||||
(unsigned long)(p->tick - t0));
|
||||
}
|
||||
/* the cycle's loops (Task 3): background decay, 64 words a cycle from a cursor down the dictionary,
|
||||
* so a word not called decays too; and the window's adaptive pass on its diversity */
|
||||
{
|
||||
v4_cell q7;
|
||||
const v4_mesh_account *qa;
|
||||
uint64_t c0 = p->decay_cycles;
|
||||
r = line(V4_MESH_HERA, ": Q7 ; : LQ7 100 0 DO Q7 LOOP ; LQ7 ' Q7 .", &how);
|
||||
q7 = (v4_cell)strtol(r, 0, 10);
|
||||
qa = v4_mesh_account_at(&ms, 0, q7);
|
||||
#if ENABLE_PIPELINING && ENABLE_HOTWORDS_CACHE
|
||||
#define Q7_HOT 51u /* speculation on a word that follows itself sets its heat to 51, as v3's */
|
||||
#else
|
||||
#define Q7_HOT 90u
|
||||
#endif
|
||||
CHECK(qa && qa->heat >= Q7_HOT && p->decay_cycles > c0, "Q7 hot after 100 calls (%lu), and the cycles decay in the background",
|
||||
qa ? (unsigned long)qa->heat : 0ul);
|
||||
r = line(V4_MESH_HERA, ": NOP ; : LZ 20000 0 DO NOP LOOP ; LZ", &how); /* many cycles of calls, none to Q7 */
|
||||
CHECK(qa && qa->heat < Q7_HOT && qa->last_decay_tick > 0, "Q7, never called again, has cooled in the background: %lu",
|
||||
qa ? (unsigned long)qa->heat : 0ul);
|
||||
CHECK(p->diversity_checks > 0 && p->effective_window_size >= 256u && p->effective_window_size <= V4_MESH_WINDOW,
|
||||
"the window, warm, checked its diversity (%lu checks), its size within 256..4096: %u",
|
||||
(unsigned long)p->diversity_checks, p->effective_window_size);
|
||||
r = line(V4_MESH_HERA, "FORGET Q7", &how);
|
||||
}
|
||||
r = line(V4_MESH_HERA, "FORGET P7", &how);
|
||||
}
|
||||
r = line(V4_MESH_HERA, "3 SQ .", &how);
|
||||
|
||||
Reference in New Issue
Block a user