code wiki / (root) / nx_swarm_coord.nx

nx_swarm_coord.nx

buildroot/runtime/nx_swarm_coord.nx

12605 B245 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic swarm
docsdependenciesstructsconstsfunctions

about

nx_swarm_coord.nx -- SWARM FABRIC class-aware COORDINATOR (SF-R-COORD): the missing UNIFIER that routes any job to the right COMPUTE CLASS across the heterogeneous pool. Fixes the "ignored the GPU" gap in the fabric AND coordinates the fabric with the EXISTING mesh -- it does NOT duplicate them: * GPU classes (image/video/render/train) -> the GPU worker roster from nx_worker_dispatch (wd_route/ wd_worker_where: gpu-image=laptop 5080, gpu-video=west 3090). Roles/endpoints are that organ's SSOT; inlined here (like nx_dispatch_lease inlined rt_lock) to keep ONE nx_syscalls surface + dodge the double-main trap of importing an executable organ. * CPU classes (cpu/tile/transcode/hash) -> the fabric's nx_swarm_place over live beacon telemetry. * CLOUD/LLM classes -> the cloud/no-float lane. * ALLOCATION under contention (VRAM/GPU-us/CPU-us fairness+preempt) = nx_resource_arbiter (already models these as first-class; its budgets are "fed by nothing" today -> the beacon telemetry is the FEED to wire). ★★THE LIAR-KILLER = THE OPERATOR'S CORRECTION, MECHANIZED: a GPU-class job is NEVER placed on a GPU-less node. If no GPU is available it QUEUES (or falls back to ANOTHER GPU) -- it must NOT silently run gen on CPU. The gate proves this can't happen. That is "don't ignore the GPU", turned into a test. route <class> <gpu_avail_csv> -- decide subsystem+target for a job class given which GPU roles are up [gate] -- self-gate: routing discriminates + the never-ignore-GPU liar-killers gpu_avail_csv = comma list of live GPU roles, e.g. "gpu-image,gpu-video" or "" (none up). In production this comes from the mesh probe / the beat store once GPU nodes beacon. license_tier: ORIGINAL expect_exit:0

dependencies 2 imports · 0 importers

nx_swarm_lib.nx nx_swarm_endpoint_lib.nx nx_swarm_coord.nx

imports: nx_swarm_lib.nxnx_swarm_endpoint_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main co_eq co_puts fa_len co_route co_kind co_eq ↻ fa_cat co_pref_role co_eq ↻ co_usable co_csv_has fa_len ↻ se_addr se_ctx sys_mmap se_slurp sys_openat_rd sys_read sys_close se_field se_find se_seq se_len sys_mmap ↻ se_putn co_endpoint co_eq ↻ se_addr_desc se_ctx ↻ se_find ↻ sys_mmap ↻ se_putn ↻ se_put co_eq ↻ co_gate co_route ↻ co_puts ↻ co_usable ↻ fa_cat ↻

structs

none

consts

26const CO_GPU: i64 = 0
27const CO_CPU: i64 = 1
28const CO_CLOUD: i64 = 2
29const CO_UNKNOWN: i64 = 3

functions

31func co_puts(s: *u8) -> i64 { sys_write(1, s, fa_len(s)); return 0 }
called by 2: co_gatemain calls 1: fa_len
32func co_eq(a: *u8, b: *u8) -> i64
40func co_kind(cls: *u8) -> i64
called by 1: co_route calls 1: co_eq
60func co_pref_role(cls: *u8) -> *u8
called by 1: co_route calls 1: co_eq
67func co_endpoint(role: *u8) -> *u8
called by 1: co_route calls 2: co_eqse_addr_desc
74func co_csv_has(csv: *u8, role: *u8) -> i64
called by 1: co_usable calls 1: fa_len
108func co_usable(role: *u8, gpu_avail: *u8) -> i64
called by 2: co_routeco_gate calls 2: co_csv_hasse_addr
119func co_route(cls: *u8, gpu_avail: *u8) -> i64
164func co_gate() -> i64
234func main(argc: i64, argv: *i64) -> i64