code wiki / (root) / nx_swarm_tile.nx

nx_swarm_tile.nx

buildroot/runtime/nx_swarm_tile.nx

15585 B387 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind tooltopic swarm
docsdependenciesstructsconstsfunctions

about

nx_swarm_tile.nx -- SWARM FABRIC chunk EXECUTOR (SF-R3 real-artifact): a sovereign, embarrassingly- parallel image generator. Each "chunk" = a horizontal BAND of a fixed-point Mandelbrot render; bands are INDEPENDENT (no cross-tile state) = the exact workload class the operator named (3D render / Monte Carlo / brute-force). The job engine (nx_swarm_job) stays GENERIC -- it leases opaque chunk ids; THIS organ turns chunk id -> real pixels; a DRIVER wires place->lease->render->complete->assemble (rule 9). Proves the north-star "generate an image by combining/parallelizing across the fabric" with REAL output (was SIMULATED in the SF-R3 gate). When remote workers join, the SAME job engine dispatches the SAME bands to them -- distribution is placement, already proven; this is the executor + assembler. render <W> <H> <ntiles> <tile_id> <outdir> -- render band tile_id -> outdir/tile_<id>.raw (RGB) assemble <W> <H> <ntiles> <outdir> <out.ppm> -- stitch bands in order -> a real P6 PPM image [gate] -- self-gate: determinism + structure + coverage + size Fully integer (Q16 fixed-point escape-time) -> bit-identical across any device (the sovereign EXCEED axis: float raster is non-deterministic across hardware). outdir: bare name or under /tmp/. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_swarm_lib.nx nx_swarm_tile.nx

imports: nx_swarm_lib.nx

imported by: nobody (leaf or entry point)

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

main tl_eq sb_pint fa_len tl_preview tl_iter tl_puts fa_len ↻ tl_dir_ok fa_len ↻ tl_render tl_y0 tl_y1 tl_iter ↻ tl_color tl_tile_path fa_cat fa_catn sys_mmap sys_openat_wr tl_write_all fa_cat ↻ fa_catn ↻ tl_assemble sys_openat_wr ↻ fa_cat ↻ fa_catn ↻ tl_write_all ↻ tl_tile_path ↻ sys_read tl_gate sys_now_us sys_mmap ↻ sys_clock_gettime_mono fa_cat ↻ fa_catn ↻ tl_render ↻ tl_y1 ↻ tl_y0 ↻ tl_puts ↻

structs

none

consts

16const T_MAGIC_1048576: i64 = 1048576
17const T_MAGIC_65536: i64 = 65536
19const T_SCALE: i64 = 65536 // Q16
20const T_MAXITER: i64 = 128
21const T_ESCAPE: i64 = 262144 // 4 << 16 (|z|^2 > 4)
23const T_XMIN: i64 = 0 - 163840 // -2.5 * 65536
24const T_XSPAN: i64 = 229376 // 3.5 * 65536
25const T_YMIN: i64 = 0 - 81920 // -1.25 * 65536
26const T_YSPAN: i64 = 163840 // 2.5 * 65536

functions

28func tl_puts(s: *u8) -> i64 { sys_write(1, s, fa_len(s)); return 0 }
called by 2: tl_gatemain calls 1: fa_len
29func tl_eq(a: *u8, b: *u8) -> i64
called by 1: main
37func tl_dir_ok(p: *u8) -> i64
called by 1: main calls 1: fa_len
57func tl_iter(cre: i64, cim: i64) -> i64
called by 2: tl_rendertl_preview
80func tl_color(it: i64, rgb: *u8) -> i64
called by 1: tl_render
92func tl_y0(H: i64, ntiles: i64, tid: i64) -> i64 { return tid * H / ntiles }
called by 2: tl_rendertl_gate
93func tl_y1(H: i64, ntiles: i64, tid: i64) -> i64 { return (tid + 1) * H / ntiles }
called by 2: tl_rendertl_gate
96func tl_tile_path(dir: *u8, tid: i64, out: *u8) -> i64
107func tl_write_all(fd: i64, buf: *u8, n: i64) -> i64
118func tl_render(W: i64, H: i64, ntiles: i64, tid: i64, outdir: *u8) -> i64
152func tl_assemble(W: i64, H: i64, ntiles: i64, outdir: *u8, outfile: *u8) -> i64
194func tl_distinct_colors(path: *u8, cap: i64) -> i64
called by 1: tl_gate calls 1: sb_read
211func tl_filesize(path: *u8) -> i64
called by 1: tl_gate calls 1: sys_read
225func tl_gate() -> i64
318func tl_preview(W: i64, H: i64) -> i64
called by 1: main calls 1: tl_iter
340func main(argc: i64, argv: *i64) -> i64