You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose the effective runtime worker count to Bend programs #971
On native builds this should return the runtime's effective worker-pool size: the value selected by --threads, or the detected available CPU count when the flag is omitted, after runtime clamping. A generated JavaScript program should return 1, since that lane is sequential.
The native runtime already computes this as pool_size, but it is not exposed to Bend code. IO.args() cannot recover it because the runtime consumes --threads before invoking the program. A public Base API would avoid relying on a custom effect that reaches into runtime implementation details.
Why
Programs with bounded parallel pipelines need to choose their amount of in-flight work from the actual runtime concurrency. A fixed queue either leaves workers idle or retains much more input, output, and scratch memory than necessary.
For example, a parallel compressor should usually retain only a small multiple of the active worker count. Today it cannot distinguish --threads 1, --threads 8, and the default, so it must over-allocate, under-utilize the machine, add its own unrelated configuration flag, or duplicate the runtime's CPU-detection logic in foreign code.
Activity
IO.thread_count answers the worker pool's size, and 1 on the JS lanes (…