nx_swarm_tile.nx
buildroot/runtime/nx_swarm_tile.nx
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
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
structs
| none |
consts
| 16 | const T_MAGIC_1048576: i64 = 1048576 |
| 17 | const T_MAGIC_65536: i64 = 65536 |
| 19 | const T_SCALE: i64 = 65536 // Q16 |
| 20 | const T_MAXITER: i64 = 128 |
| 21 | const T_ESCAPE: i64 = 262144 // 4 << 16 (|z|^2 > 4) |
| 23 | const T_XMIN: i64 = 0 - 163840 // -2.5 * 65536 |
| 24 | const T_XSPAN: i64 = 229376 // 3.5 * 65536 |
| 25 | const T_YMIN: i64 = 0 - 81920 // -1.25 * 65536 |
| 26 | const T_YSPAN: i64 = 163840 // 2.5 * 65536 |
functions
| 28 | func tl_puts(s: *u8) -> i64 { sys_write(1, s, fa_len(s)); return 0 } |
| 29 | func tl_eq(a: *u8, b: *u8) -> i64 called by 1: main |
| 37 | func tl_dir_ok(p: *u8) -> i64 |
| 57 | func tl_iter(cre: i64, cim: i64) -> i64 |
| 80 | func tl_color(it: i64, rgb: *u8) -> i64 called by 1: tl_render |
| 92 | func tl_y0(H: i64, ntiles: i64, tid: i64) -> i64 { return tid * H / ntiles } |
| 93 | func tl_y1(H: i64, ntiles: i64, tid: i64) -> i64 { return (tid + 1) * H / ntiles } |
| 96 | func tl_tile_path(dir: *u8, tid: i64, out: *u8) -> i64 |
| 107 | func tl_write_all(fd: i64, buf: *u8, n: i64) -> i64 |
| 118 | func tl_render(W: i64, H: i64, ntiles: i64, tid: i64, outdir: *u8) -> i64 |
| 152 | func tl_assemble(W: i64, H: i64, ntiles: i64, outdir: *u8, outfile: *u8) -> i64 |
| 194 | func tl_distinct_colors(path: *u8, cap: i64) -> i64 |
| 211 | func tl_filesize(path: *u8) -> i64 |
| 225 | func tl_gate() -> i64 |
| 318 | func tl_preview(W: i64, H: i64) -> i64 |
| 340 | func main(argc: i64, argv: *i64) -> i64 |