v4 fabric: each pass of a step walks only the places that hold a node (mechanism A)
The fabric keeps its occupied places as a list in ascending order, and the step's nine passes walk that list in the same order as before. A place removed mid-walk keeps its link, so the walk goes on to the next node. Test first: test_fabric_walk.c, 13 checks. Every existing fabric and mesh test passes with the same checks, and so do test-32 and ASan/UBSan. The host mesh boot runs POST 990/990. Over five alternating runs its median falls from 11.695 s to 7.999 s. Logs are in logs/20261117-mechanism-a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -56,6 +56,7 @@ typedef struct {
|
||||
int asleep;
|
||||
int cut; /* not 0: a wire of this node's has been cut since it was last woken by that (operation 9) */
|
||||
v4_wire wire[V4_PORTS];
|
||||
unsigned next; /* the walk (mechanism A): the next place that holds a node, plus one; 0: none. The fabric's own. */
|
||||
} v4_place;
|
||||
|
||||
typedef struct {
|
||||
@@ -65,6 +66,7 @@ typedef struct {
|
||||
unsigned queue_count, queue_free; /* how many, and how many are not on a wire */
|
||||
unsigned queue_first; /* the first that is not, and the index plus one; 0: none. Each links to the next by its `head`. */
|
||||
v4_cell gone_error; /* see v4_fabric_gone_error; 0: none */
|
||||
unsigned first; /* the walk: the first place that holds a node, plus one; 0: none */
|
||||
} v4_fabric;
|
||||
|
||||
/* An empty fabric with room for `capacity` nodes, in `places`. */
|
||||
@@ -115,6 +117,13 @@ void v4_fabric_gone_error(v4_fabric *f, v4_cell code);
|
||||
* a word at a time, which executes from its ports and has asked nothing of
|
||||
* a wire. */
|
||||
|
||||
/* THE WALK (mechanism A, docs/v4.0.0/plans/2026-11-17-the-fabric-step-cost.md). The places that hold
|
||||
* a node, in ascending number: each pass of a step walks these, not every place, in the same order.
|
||||
* v4_fabric_first gives the first, v4_fabric_next the one after `id` -- also when `id` has just been
|
||||
* removed -- and each gives the capacity when there are no more. */
|
||||
unsigned v4_fabric_first(const v4_fabric *f);
|
||||
unsigned v4_fabric_next(const v4_fabric *f, unsigned id);
|
||||
|
||||
/* More room: `places`, of `capacity` no less than before, takes over; every
|
||||
* node keeps its number and its wiring. */
|
||||
void v4_fabric_grow(v4_fabric *f, v4_place *places, unsigned capacity);
|
||||
|
||||
Reference in New Issue
Block a user