feat(v4): Phase 7 Task 3 -- L8, v3's Jacquard selector, in each node's heartbeat cycle (#189)
v3's vm_heartbeat_update_l8 with its table (ssm_jacquard.c, compudynamics.c), rewritten in integers: the regime from the window's entropy, the prediction CV and the locality of the last 32 calls; the current card scored (ANOVA from inference, joint convergence under L5/L6), decayed 0.99, the next chosen by UCB1 over 64 cards; its gates L1-L7 applied to the loops, L1 and L4 within the build's ceilings. Every gate off and card 8 at the start, as v3's kernel boot. Applied through card_bits: v3 applies the card's number, one bit off -- filed #196, ruled "v4 correct, v3 as is". v4_mesh_l8_force as v3's ssm_l8_force_config; the exact decay and window tests hold a card. Test first: test_mesh_boot.c 67 checks, 75 on. amd64 PASS, 156 s. 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:
@@ -196,6 +196,26 @@ int main(void)
|
||||
r = line(V4_MESH_HERA, "3 4 + .", &how);
|
||||
CHECK(how == V4_TEXT_COMPLETED && strcmp(r, "7 ") == 0 && ms.owed == 0, "and nothing more is owed: \"%s\"", r);
|
||||
|
||||
/* ---- L8 (#189 Phase 7, Task 3): v3's Jacquard selector, its 64 cards, applied correctly (#196) ---- */
|
||||
{
|
||||
v4_mesh_physics *p = &ms.physics[0];
|
||||
unsigned k, regimes = 0;
|
||||
uint8_t b = (uint8_t)(((p->l8.current_card & 0x3Fu) << 1) | 1u);
|
||||
for (k = 0; k < V4_L8_REGIMES; k++) regimes += p->l8.total_regime_ticks[k] ? 1u : 0u;
|
||||
CHECK(p->tick > 0 && regimes > 0, "after the boot and POST, L8 has scored its cards over %lu ticks", (unsigned long)p->tick);
|
||||
CHECK(p->l2_window == ((b & 0x20u) != 0) && p->l3_decay == ((b & 0x10u) != 0)
|
||||
&& p->l5_window_inference == ((b & 0x04u) != 0) && p->l6_decay_inference == ((b & 0x02u) != 0)
|
||||
&& p->l7_adaptive_heartrate == 1u, "the gates are the current card's (%u), through card_bits", p->l8.current_card);
|
||||
CHECK(p->l1_cache == (ENABLE_HOTWORDS_CACHE && (b & 0x40u)) && p->l4_pipelining == (ENABLE_PIPELINING && (b & 0x08u)),
|
||||
"and L1 and L4 within the build's ceilings");
|
||||
v4_mesh_l8_force(&ms, 0, 0u, 1);
|
||||
r = line(V4_MESH_HERA, ": L8T 300 0 DO 3 DUP * DROP LOOP ; L8T", &how);
|
||||
CHECK(p->l8.current_card == 0 && !p->l2_window && !p->l3_decay && !p->l1_cache && !p->l4_pipelining
|
||||
&& p->l7_adaptive_heartrate, "card 0 forced and held: only L7 on, and the cycles do not move it");
|
||||
v4_mesh_l8_force(&ms, 0, 0u, 0);
|
||||
r = line(V4_MESH_HERA, "FORGET L8T", &how);
|
||||
}
|
||||
|
||||
/* ---- the words' accounts (#189, Phase 2; Captain Bob, 2026-11-13: the word ID in the header, charged
|
||||
* per heartbeat tick) ---- */
|
||||
{
|
||||
@@ -233,6 +253,9 @@ int main(void)
|
||||
* arithmetic is seen exactly, and seen moving below */
|
||||
CHECK(every == 256u, "a node's heartbeat cycle comes every 256 word calls, as v3's HEARTBEAT_CHECK_FREQUENCY");
|
||||
p->cycle_every = 0xFFFFFFFFu;
|
||||
v4_mesh_l8_force(&ms, 0, 24u, 1); /* L8 held on card 24: L2 and L3 (and L7) -- the window and decay */
|
||||
CHECK(p->l2_window && p->l3_decay && !p->l4_pipelining && !p->l1_cache && p->l7_adaptive_heartrate,
|
||||
"card 24's gates: the window, decay, and L7, which is always on");
|
||||
v4_mesh_set_tick(&ms, 100);
|
||||
total0 = p->total_executions;
|
||||
r = line(V4_MESH_HERA, "2 P7 3 P7 4 P7 + + .", &how);
|
||||
@@ -279,11 +302,7 @@ int main(void)
|
||||
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
|
||||
#define Q7_HOT 90u /* under card 24 (no L4): no speculation to set its heat to 51 */
|
||||
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 */
|
||||
@@ -294,6 +313,7 @@ int main(void)
|
||||
(unsigned long)p->diversity_checks, p->effective_window_size);
|
||||
r = line(V4_MESH_HERA, "FORGET Q7", &how);
|
||||
}
|
||||
v4_mesh_l8_force(&ms, 0, ms.physics[0].l8.current_card, 0); /* L8 chooses again */
|
||||
r = line(V4_MESH_HERA, "FORGET P7", &how);
|
||||
}
|
||||
r = line(V4_MESH_HERA, "3 SQ .", &how);
|
||||
@@ -349,6 +369,7 @@ int main(void)
|
||||
v4_cell pa, pb, pb2, hw;
|
||||
const v4_mesh_account *aa;
|
||||
v4_mesh_physics *p = &ms.physics[0];
|
||||
v4_mesh_l8_force(&ms, 0, 60u, 1); /* L8 held on card 60: L1 (the cache) to L4 (pipelining) */
|
||||
r = line(V4_MESH_HERA, ": PA 1 ; : PB 2 ; ' PA .", &how);
|
||||
pa = (v4_cell)strtol(r, 0, 10);
|
||||
r = line(V4_MESH_HERA, "' PB .", &how); pb = (v4_cell)strtol(r, 0, 10);
|
||||
@@ -368,8 +389,9 @@ int main(void)
|
||||
/* v3's promote, when the cache is full, takes the next slot in turn without looking for the word
|
||||
* already there: a few hot words then churn through all 32 slots (reproduced, as v3; reported). So
|
||||
* the heat promotion is seen on a cache emptied first. */
|
||||
CHECK(v4_mesh_node(&ms, V4_MESH_HERA)->n.mem[im.hot] == V4_IMAGE_HOT_SIZE && p->hot_evictions > 0,
|
||||
"by now the cache is full, and taking slots in turn, as v3's");
|
||||
CHECK(v4_mesh_node(&ms, V4_MESH_HERA)->n.mem[im.hot] <= V4_IMAGE_HOT_SIZE
|
||||
&& (v4_mesh_node(&ms, V4_MESH_HERA)->n.mem[im.hot] < V4_IMAGE_HOT_SIZE || p->hot_evictions > 0),
|
||||
"the cache holds at most 32, and once full takes slots in turn, as v3's");
|
||||
v4_mesh_node(&ms, V4_MESH_HERA)->n.mem[im.hot] = 0;
|
||||
v4_mesh_node(&ms, V4_MESH_HERA)->n.mem[im.hot + 1] = 0;
|
||||
r = line(V4_MESH_HERA, ": HW ; : LH 60 0 DO HW LOOP ; LH ' HW .", &how);
|
||||
@@ -380,6 +402,7 @@ int main(void)
|
||||
"FORGET takes everything from PA on out of the cache, and PA's counters back");
|
||||
r = line(V4_MESH_HERA, "3 4 + .", &how);
|
||||
CHECK(strcmp(r, "7 ") == 0, "and lookups go on as before: \"%s\"", r);
|
||||
v4_mesh_l8_force(&ms, 0, p->l8.current_card, 0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user