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:
@@ -201,11 +201,35 @@ set HDR-NFA here ", (TELL-FORGOTTEN) #id, #, 0 #, HDR-NFA #, HDR-LINK set
|
||||
\ name fetched, the two names compared byte by byte -- so that the only call
|
||||
\ it makes is C@: it is called from the interpreter for every word of every
|
||||
\ line, with the user's return stack beneath it.
|
||||
\ THE HOT-WORDS CACHE first (v3's hotwords_cache_lookup; #189 Phase 7, Captain
|
||||
\ Bob 2026-11-13: "Build a hot-words cache", "Built, off as v3"): (HOT) holds
|
||||
\ its count, the kernel's next slot, this word's index, then up to 32 xts the
|
||||
\ kernel has put there. A visible one with the name is the answer; then the
|
||||
\ dictionary, as before. The kernel keeps it true: an entry that goes, or
|
||||
\ one whose name is defined again, it takes out. Empty unless the kernel's
|
||||
\ build has ENABLE_HOTWORDS_CACHE.
|
||||
: (LOOKUP)
|
||||
dup (D)+1 a! ! \ cut the string to 31 characters
|
||||
C@ -32 + -if LONG drop jump CUT
|
||||
LONG: drop 31 (D)+1 a! @ C!
|
||||
CUT:
|
||||
0 (HOT)+2 a! !
|
||||
H: (HOT)+2 a! @ (HOT) a! @ xor if HDONE drop
|
||||
(HOT)+2 a! @ dup 1 + ! \ i, and i + 1 kept
|
||||
(HOT)+3 + a! @ if HNONE
|
||||
(D)+2 a! !
|
||||
(D)+2 a! @ -3 + a! @ 2 and if HVIS drop jump H
|
||||
HVIS: drop
|
||||
(D)+2 a! @ -2 + a! @ 4* (D) a! ! \ its name
|
||||
(D)+1 a! @ C@ 1 + (D)+3 a! !
|
||||
HC: (D)+3 a! @ if HSAME -1 + dup !
|
||||
dup (D) a! @ + C@
|
||||
SWAP (D)+1 a! @ + C@
|
||||
xor if HEQ drop jump H
|
||||
HEQ: drop jump HC
|
||||
HSAME: drop (D)+2 a! @ ;
|
||||
HNONE: drop jump H
|
||||
HDONE: drop
|
||||
0 (D)+4 a! ! \ not yet on to FORTH
|
||||
CONTEXT a! @ a! @
|
||||
L: if END
|
||||
|
||||
Reference in New Issue
Block a user