user_parallelism = yes so the compiler may use par_iter (ADR-363 D1)Open and answer this issue on GitHub.
ready · opened 2026-10-17 · updated 2026-10-17 · 1 comment
The owner asked whether overlap is the right way to parallelism, since the compiler itself does not use it (decision basis of 2026-10-17). Findings: the compiler’s work (checking and lowering 210 tools files against one ledger, prover queries) is CPU-bound over a varying count, the job of par_iter/task::scope, not overlap. But tests/sysroot.rs::stds_nikaia_half_lowers_the_same_at_both_switches requires the tools package to lower byte-identically at no and yes (ADR-002 D4), and par_iter/task::scope lower differently per setting: one use in tools/*.nika turns develop red.
The rule exists for std: it is lowered once and linked into programs at either setting, and code lowered at no (a Shared with the cheap count, ADR-312 D10) is unsound at yes. The tools only share the crate (ADR-294 D18); no program runs them. Lowering at yes is the safe direction.
Option a: the tools package is always lowered at yes; std’s own modules keep the byte comparison. Option b (a crate of its own) later: #647.
nikaia lower-std lowers src/tools with a fixed build at user_parallelism = yes (sysroot::lower_tools_files / lower_tools_at), whatever the binary’s default. Re-run lower-std; package.rs should not change today (nothing in it is switch-sensitive yet).tests/sysroot.rs: the byte comparison keeps std’s modules and drops the tools package; a new assertion checks that the committed package.rs equals the tools lowered at yes. Update the test’s comment (ADR-363).std crate links rayon already (par::iter); check that task::scope_on_pool and par::iter build inside nikaia-std without a feature, and that a program at no that never calls tools:: is unaffected (cargo test -p nikaia --test sysroot --test runtime).par_iter where each element yields its own result (no outer name changed, NK2107), e.g. a per-file pure step; counted with callgrind instructions before/after (never seconds), output byte-identical. If no such loop is pure today, report which state blocks it (#558) instead of forcing one.Related: the overlap decision basis (questions still open), #645 (concurrency defects, including par_iter().map over Vec[i64], which step 4 may hit).
Steps 1-3 built in 6755f82 (0.0.1008): lower-std lowers src/tools at yes (sysroot::tools_build); the sysroot test compares std’s own modules at both settings and checks that package.rs is the package lowered at yes. A probe showed par::iter and task::scope_on_pool build inside nikaia-std without a feature.
For step 4 (the pilot):
task::scope lowers as pub async fn, so its callers must pause or poll it — prefer par_iter for the pilot;catch { 0 } lowers to a match that trips clippy::manual_unwrap_or_default in the tools module: fix the emitter (or allow the lint on tools in crates/nikaia-std/src/lib.rs).Generated by Claude Code