feat(v4): Phase 7 Task 2b -- pipelining and the hot-words cache, built, off as v3 (#189)

Rulings, Captain Bob 2026-11-13: "Build a hot-words cache"; then, v3 being found to have both off
(ENABLE_PIPELINING, ENABLE_HOTWORDS_CACHE: n in Kconfig.physics and kernel/Makefile), "Built, off as v3".

- The kernel, at every call (mesh.c): v3's hit check, the transition, the likeliest next word (kept as each
  count rises; v3 scans 1024 a call -- the same word but in a tie v3's Q48.16 rounding makes), speculation
  at v3's thresholds into the node's cache; a word past heat 50 promoted at its call (v3 promotes at a
  lookup; v4's heat is the kernel's). Counters from the owner's heap, given back when a word goes.
- The node (dict.f18): (LOOKUP) tries (HOT)'s xts first, in F18, calling only C@; the kernel keeps it true
  (entries that go, or whose name is defined again, taken out). Empty unless the build has the cache.
- Tests: test_mesh_boot.c as built (57 checks) and with both on (mesh-boot-on, 65). v4 test: all pass.
- Reported, v3's own: when full, its promote takes the next slot without looking for the word there (a few
  hot words churn all 32 slots); its prefetch misses are never counted. Both reproduced.
- amd64 boots, RESULT: PASS, but 174 s and 181 s against 2a's 146 s, while on the host the mesh boot is no
  slower: being measured. Not pushed (held to the Phase 7 boundary).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-13 21:52:01 +00:00
parent b880a6eaed
commit 3a70e824a2
19 changed files with 473 additions and 145 deletions
+12 -1
View File
@@ -367,6 +367,17 @@ mesh-boot: $(BINDIR)/test_mesh_boot
@echo " [mesh boot, V4_CELL_BITS=64]"
@$(BINDIR)/test_mesh_boot
# The same with pipelining and the hot-words cache on (#189 Phase 7; built, off as v3 by default).
MESH_ON := -DENABLE_PIPELINING=1 -DENABLE_HOTWORDS_CACHE=1
$(BINDIR)/test_mesh_boot_on: $(BINDIR)/test_mesh_boot
$(CC) $(CFLAGS) $(MESH_ON) -D_POSIX_C_SOURCE=200809L -I$(HERE)/include $(V3_INC) -DV4_CELL_BITS=64 $(HOST_DEFS) -c $(HERE)/tests/test_mesh_boot.c -o $(BINDIR)/test_mesh_boot_on.o
$(CC) $(SYSTEM_CFLAGS) $(MESH_ON) $(BINDIR)/test_mesh_boot_on.o $(HERE)/system/mesh.c $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c $(MACHINE_64) $(CAPSULE_DIR_C) $(ENGINE_SRCS) $(SYSTEM_SRCS) $(BINDIR)/v3o-mesh/*.o -o $@
.PHONY: mesh-boot-on
mesh-boot-on: $(BINDIR)/test_mesh_boot_on
@echo " [mesh boot, pipelining and the hot-words cache on]"
@$(BINDIR)/test_mesh_boot_on
# The same, under ASan+UBSan (Captain Bob, 2026-11-13: "Yes, add it to v4-checks"): run by `sanitize`.
MESH_SAN := -O1 -g -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover=all
$(BINDIR)/san-test_mesh_boot: $(BINDIR)/test_mesh_boot
@@ -380,7 +391,7 @@ san-mesh-boot: $(BINDIR)/san-test_mesh_boot
@echo " [ASan+UBSan mesh boot, V4_CELL_BITS=64]"
@$(BINDIR)/san-test_mesh_boot
test: $(addprefix test-,$(WIDTHS)) mesh-boot
test: $(addprefix test-,$(WIDTHS)) mesh-boot mesh-boot-on
@echo "all v4 tests passed"
clean: