v4/system/inference.c: v3's inference_engine.c and its Q48.16 arithmetic ported to the bit, no C library -- the variance, the window width (Levene), the decay slope (log-linear regression), the run with its 5% early exit. v4/tests/test_inference.c links v3's own and compares them: POST's fixed cases, 20000 random multiply/log pairs, 400 random trajectories (make -C v4 inference; in make -C v4 test). In each node's cycle every 1000 ticks (HEARTBEAT_INFERENCE_FREQUENCY), once the window is warm: the trajectory from the window's words' heat, the width and slope applied unless it exits early, then Loop #7 -- the heartrate slower when stable, faster when not, within 1/4..4x; Hera's re-arms the kernel's heartbeat (heartbeat_set_adaptive_period_ns), as v3's Hera. L8 reads its outcome. Test first: test_mesh_boot.c 72 checks, 80 on. amd64 PASS, 163 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:
+17
-5
@@ -354,13 +354,14 @@ sanitize: $(foreach w,$(WIDTHS),$(foreach t,$(TESTS),san-$(w)-$(notdir $(t)))) s
|
||||
# THE MESH BOOT (system/mesh.c; #189, ENGINE step 4 Phase 1, Task 5b): the kernel's boot of the
|
||||
# fabric, tested on the host with tests/test_mesh_boot.c as its owner. Linked as the hosted product
|
||||
# is, with the registry (src/manage.c) and a mesh node's ROM; 64-bit cells, as the capsules are.
|
||||
MESH_BOOT_SRCS := $(HERE)/system/mesh.c $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c
|
||||
MESH_BOOT_SRCS := $(HERE)/system/mesh.c $(HERE)/system/inference.c $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c
|
||||
$(BINDIR)/test_mesh_boot: $(HERE)/tests/test_mesh_boot.c $(MESH_BOOT_SRCS) $(MACHINE_64) $(CAPSULE_DIR_C) $(ENGINE_SRCS) $(SYSTEM_SRCS) $(BLOCKS_SRC) $(V3_BLOCK_SRCS) $(wildcard $(HERE)/include/v4/*.h) $(HERE)/Makefile
|
||||
$(CC) $(CFLAGS) -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.o
|
||||
$(CC) $(SYSTEM_CFLAGS) -c $(HERE)/system/mesh.c -o $(BINDIR)/mesh-64.o
|
||||
$(CC) $(SYSTEM_CFLAGS) -c $(HERE)/system/inference.c -o $(BINDIR)/inference-64.o
|
||||
@rm -rf $(BINDIR)/v3o-mesh && mkdir -p $(BINDIR)/v3o-mesh
|
||||
cd $(BINDIR)/v3o-mesh && $(CC) $(V3_CFLAGS) -I$(HERE)/include -DV4_CELL_BITS=64 $(HOST_DEFS) -c $(V3_BLOCK_SRCS) $(BLOCKS_SRC)
|
||||
$(CC) $(SYSTEM_CFLAGS) $(BINDIR)/test_mesh_boot.o $(BINDIR)/mesh-64.o $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c $(MACHINE_64) $(CAPSULE_DIR_C) $(ENGINE_SRCS) $(SYSTEM_SRCS) $(BINDIR)/v3o-mesh/*.o -o $@
|
||||
$(CC) $(SYSTEM_CFLAGS) $(BINDIR)/test_mesh_boot.o $(BINDIR)/mesh-64.o $(BINDIR)/inference-64.o $(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
|
||||
mesh-boot: $(BINDIR)/test_mesh_boot
|
||||
@@ -371,7 +372,7 @@ mesh-boot: $(BINDIR)/test_mesh_boot
|
||||
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 $@
|
||||
$(CC) $(SYSTEM_CFLAGS) $(MESH_ON) $(BINDIR)/test_mesh_boot_on.o $(HERE)/system/mesh.c $(HERE)/system/inference.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
|
||||
@@ -384,14 +385,25 @@ $(BINDIR)/san-test_mesh_boot: $(BINDIR)/test_mesh_boot
|
||||
$(CC) $(CFLAGS) $(MESH_SAN) -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)/san-test_mesh_boot.o
|
||||
@rm -rf $(BINDIR)/san-v3o-mesh && mkdir -p $(BINDIR)/san-v3o-mesh
|
||||
cd $(BINDIR)/san-v3o-mesh && $(CC) $(V3_CFLAGS) $(MESH_SAN) -I$(HERE)/include -DV4_CELL_BITS=64 $(HOST_DEFS) -c $(V3_BLOCK_SRCS) $(BLOCKS_SRC)
|
||||
$(CC) $(SYSTEM_CFLAGS) $(MESH_SAN) $(BINDIR)/san-test_mesh_boot.o $(HERE)/system/mesh.c $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c $(MACHINE_64) $(CAPSULE_DIR_C) $(ENGINE_SRCS) $(SYSTEM_SRCS) $(BINDIR)/san-v3o-mesh/*.o -o $@
|
||||
$(CC) $(SYSTEM_CFLAGS) $(MESH_SAN) $(BINDIR)/san-test_mesh_boot.o $(HERE)/system/mesh.c $(HERE)/system/inference.c $(HERE)/src/manage.c $(BINDIR)/mesh-rom-64.c $(MACHINE_64) $(CAPSULE_DIR_C) $(ENGINE_SRCS) $(SYSTEM_SRCS) $(BINDIR)/san-v3o-mesh/*.o -o $@
|
||||
|
||||
.PHONY: san-mesh-boot
|
||||
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 mesh-boot-on
|
||||
# THE INFERENCE ENGINE against v3's own (v4/inference.h; #189 Phase 7): v3's inference_engine.c and its Q48.16
|
||||
# code linked in, the two compared to the bit.
|
||||
$(BINDIR)/test_inference: $(HERE)/tests/test_inference.c $(HERE)/system/inference.c $(HERE)/include/v4/inference.h $(ROOT_DIR)/v3/src/inference_engine.c $(ROOT_DIR)/v3/src/word_source/q48_16_words.c $(HERE)/Makefile
|
||||
@mkdir -p $(BINDIR)/v3o-inf
|
||||
cd $(BINDIR)/v3o-inf && $(CC) $(V3_CFLAGS) -c $(ROOT_DIR)/v3/src/inference_engine.c $(ROOT_DIR)/v3/src/word_source/q48_16_words.c
|
||||
$(CC) $(CFLAGS) -I$(HERE)/include $(HERE)/tests/test_inference.c $(HERE)/system/inference.c $(BINDIR)/v3o-inf/*.o -o $@
|
||||
|
||||
.PHONY: inference
|
||||
inference: $(BINDIR)/test_inference
|
||||
@$(BINDIR)/test_inference
|
||||
|
||||
test: $(addprefix test-,$(WIDTHS)) mesh-boot mesh-boot-on inference
|
||||
@echo "all v4 tests passed"
|
||||
|
||||
clean:
|
||||
|
||||
Reference in New Issue
Block a user