code wiki / (root) / nx_attention_class.nx

nx_attention_class.nx

buildroot/runtime/nx_attention_class.nx

5279 B128 linesdepth 2pulls 2 transitivereach 46 importersview sourcekind librarytopic attention
docsdependenciesstructsconstsfunctions

about

nx_attention_class.nx -- sealed enum: cell attention class. Per cardinal: cooperative-resource-arbitration. The attention class is the cell's declared priority intent. Foreground game holds concurrent VRAM and CPU against background inference; idle work runs only when nothing else is asking. Distinct from nx_attention.nx (ML scaled-dot-product attention). The semantic collision is at the name prefix only; this primitive concerns OS-level resource arbitration, not transformer kernels. Composes: nx_budget -- budget grant decisions honor class priority nx_yield -- yield request from lower class is auto-granted when higher class is contending nx_evict_journal -- evictions log displacing class for forensics nx_homeostasis -- migration tropism preferences vary by class (foreground stays local; idle is offload-OK) V1 ships seven classes per cardinal. Priority order is FIXED here so substrate-wide behavior remains reproducible across hardware tiers. Gap list (V1 honest perf verdict): - no nested classes (cell has exactly one class at a time) - no temporary boost (priority does not change on key-press; callers must re-instantiate cell with new class) - no fairness within same class (FIFO on contention, not weighted) genealogy_id: nishi_cardinal_2026-05-17_cooperative_resource_arbitration lineage_id: substrate_attention_class_v1 nx_safety_envelope: intended_use: "Declared cell priority class for resource arbitration; honored by budget + yield layers" sil_target: SIL1 evidence: [enum_sealed, priority_total_order] verdict: NOT_YET_EVALUATED

dependencies 2 imports · 40 importers

nx_syscalls.nx nx_tier.nx nx_attention_class.nx nx_attention_class_test.nx nx_cell.nx nx_cell_anatomy_compose_test.nx nx_cell_test.nx nx_dyad.nx nx_dyad_test.nx nx_ecosystem_compose_test.nx nx_failover_compose_test.nx nx_homeostasis.nx nx_homeostasis_test.nx

diagram shows first 10 each side; +0 more imports, +30 more importers in the complete lists below.

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_attention_class_test.nxnx_cell.nxnx_cell_anatomy_compose_test.nxnx_cell_test.nxnx_dyad.nxnx_dyad_test.nxnx_ecosystem_compose_test.nxnx_failover_compose_test.nxnx_homeostasis.nxnx_homeostasis_test.nxnx_lysis.nxnx_lysis_test.nxnx_metabolism_test.nxnx_microbiome.nxnx_microbiome_test.nxnx_mimicry_compose_test.nxnx_observatory_test.nxnx_organism.nxnx_organism_test.nxnx_pathway.nxnx_pathway_test.nxnx_pollinate.nxnx_promote.nxnx_reclaim.nxnx_reclaim_test.nxnx_ribosome_test.nxnx_sovereign_compose_test.nxnx_substrate_compose_test.nxnx_symbiote.nxnx_symbiote_test.nxnx_tier1_immune_compose_test.nxnx_tier3_ecology_compose_test.nxnx_treaty.nxnx_treaty_test.nxnx_tropism.nxnx_tropism_test.nxnx_xenocell.nxnx_xenocell_test.nxnx_yield.nxnx_yield_test.nx

structs

none

consts

41const NX_MAGIC_16000: i64 = 16000
42const NX_MAGIC_8000: i64 = 8000
43const NX_MAGIC_4000: i64 = 4000
44const NX_MAGIC_2000: i64 = 2000
52const NX_AC_INTERACTIVE_FOREGROUND_GAME: nx_int = 0
53const NX_AC_VIDEO_CALL: nx_int = 1
54const NX_AC_DEV: nx_int = 2
55const NX_AC_BACKGROUND_INFERENCE: nx_int = 3
56const NX_AC_BACKGROUND_BUILD: nx_int = 4
57const NX_AC_BACKGROUND_HEALTH: nx_int = 5
58const NX_AC_IDLE_OPPORTUNISTIC: nx_int = 6
59const NX_AC_N_CLASSES: nx_int = 7

functions

63func nx_ac_is_valid(c: nx_int) -> nx_int
75func nx_ac_is_foreground(c: nx_int) -> nx_int
83func nx_ac_is_background(c: nx_int) -> nx_int
called by 1: main
97func nx_ac_priority(c: nx_int) -> nx_int
107func nx_ac_higher_priority(a: nx_int, b: nx_int) -> nx_int
called by 1: main calls 1: nx_ac_priority
119func nx_ac_yield_quantum_us(c: nx_int) -> nx_size
called by 1: main