nx_thread_pool.nx
buildroot/runtime/nx_thread_pool.nx
about
dependencies 5 imports · 38 importers
diagram shows first 10 each side; +0 more imports, +28 more importers in the complete lists below.
imports: nx_syscalls.nxnx_atom.nxnx_thread.nxnx_chan.nxnx_hw.nx
imported by: nx_conv2d.nxnx_conv_speedup.nxnx_dot_simd_demo.nxnx_f32_llama_block_v4.nxnx_f32_llama_v4b.nxnx_f32_llama_v4p.nxnx_f32_matmul_t.nxnx_f32_q4k_matmul.nxnx_intfp_lm_simd_gate.nxnx_natfu_probe.nxnx_nofloat_llm.nxnx_parallel.nxnx_parallel_simd_reduce.nxnx_parallel_test.nxnx_pipeline.nxnx_pipeline_test.nxnx_pool_ring_gate.nxnx_pool_stale_gate.nxnx_poolheavy.nxnx_ppdemo_parallel.nxnx_pteam.nxnx_q5_0_threaded_gate.nxnx_q5q8_ab.nxnx_q8_0_simd_gate.nxnx_q8_coldwarm.nxnx_q8_matmul_micro.nxnx_q8_mix_ab.nxnx_q8_scaling.nxnx_q8_st_bw.nxnx_qwen_native_gate.nxnx_qwen_wsl_timing_gate.nxnx_reader_squad_f32_gate.nxnx_sdfrender_mt.nxnx_sum_bench_all.nxnx_ta_parallel_grad_gate.nxnx_task_graph.nxnx_task_graph_test.nxnx_thread_pool_test.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 43 | struct NxPoolTask |
| 56 | struct NxThreadPool |
consts
| 39 | const NX_MAGIC_2147483647: i64 = 2147483647 |
| 40 | const NX_MAGIC_65536: i64 = 65536 |
| 41 | const NX_MAGIC_2000000000: i64 = 2000000000 |
| 49 | const NX_POOL_TASK_BYTES: i64 = 24 |
| 54 | const NX_POOL_ARENA_DEFAULT: i64 = 16384 |
| 74 | const NX_POOL_OFF_NEXT_SLOT: i64 = 24 |
| 75 | const NX_POOL_OFF_ALIVE: i64 = 40 |
| 76 | const NX_POOL_OFF_SUBMITTED: i64 = 48 |
| 77 | const NX_POOL_OFF_COMPLETED: i64 = 56 |
| 78 | const NX_POOL_OFF_TASK_EPOCH: i64 = 64 |
| 79 | const NX_POOL_OFF_WAITING: i64 = 72 |
| 96 | const NX_FUTEX: i64 = 98 // rv64 futex (table -> x86_64 202) |
| 97 | const NX_FUTEX_WAIT_PRIV: i64 = 128 // FUTEX_WAIT | FUTEX_PRIVATE_FLAG |
| 98 | const NX_FUTEX_WAKE_PRIV: i64 = 129 // FUTEX_WAKE | FUTEX_PRIVATE_FLAG |
| 99 | const NX_POOL_SPIN: i64 = 64 // yields before sleeping. (TESTED 2026-07-10: busy-spin@50k helped pteam +54% but pool only +3% = noise, at the cost of idle-CPU burn for ALL shared-pool users -> reverted to idle-friendly yield-spin.) |
functions
| 107 | func nx_pool_set_native(v: i64) -> i64 { g_pool_native = v; return 0 } called by 1: main |
| 108 | func nx_pool_is_native() -> i64 { return g_pool_native } |
| 113 | func sys_futex_wait(addr: i64, seen: i64) -> i64 |
| 116 | func sys_futex_wake(addr: i64) -> i64 |
| 119 | func _pool_futex_wait(addr: *i64, seen: i64) -> i64 |
| 123 | func _pool_futex_wake_all(addr: *i64) -> i64 |
| 129 | func _nx_pool_worker_main(arg: *u8) -> i64 |
| 180 | func nx_pool_new(n_workers: i64, queue_cap: i64) -> *NxThreadPool |
| 245 | func nx_pool_set_serial(v: i64) -> i64 { g_pool_serial = v; return 0 } called by 1: main |
| 247 | func nx_pool_submit(pool: *NxThreadPool, fn: func(i64) -> i64, ctx: i64) -> i64 |
| 277 | func nx_pool_wait(pool: *NxThreadPool, expected: i64) -> i64 |
| 304 | func nx_pool_shutdown(pool: *NxThreadPool) -> i64 |
| 332 | func nx_pool_n_alive(pool: *NxThreadPool) -> i64 |
| 337 | func nx_pool_n_completed(pool: *NxThreadPool) -> i64 |
| 345 | func _nx_pool_self_test_task(ctx: i64) -> i64 |
| 349 | func main() -> i64 |