← Back to Pull requests

threads: Honour `JULIA_CPU_THREADS` for `auto`, pin `JULIA_EXCLUSIVE` threads within the affinity mask #64613

Closed
unknown closed this pull request without merging on Nov 04, 2026 17:58 UTC
View on GitHub
unknown unknown commented on Nov 03, 2026 13:09 UTC
Author

--threads=auto ignored JULIA_CPU_THREADS, unlike Sys.EFFECTIVE_CPU_THREADS:

$ JULIA_CPU_THREADS=4 julia -t auto -e 'print(Threads.nthreads(), " ", Threads.ngcthreads())'
32 32    # before (32-core machine)
4 4      # after

On a 128-core CI host with cpu.weight shares and JULIA_CPU_THREADS=12, tests that start julia --threads=auto ran 128 compute plus 127 GC threads, and i686 ran out of address space at startup.

First commit. jl_effective_threads() now also takes the minimum with JULIA_CPU_THREADS, parsed as Base parses it. That fixes --threads=auto, JULIA_NUM_THREADS=auto, --procs=auto, the default GC thread count and the AOT compilation thread count.

Second commit. JULIA_EXCLUSIVE=1 pinned default-pool threads to CPUs 0 to N-1, ignoring the inherited affinity mask. It now uses the mask's CPUs in order:

$ taskset -c 4,9,17 env JULIA_EXCLUSIVE=1 julia -t3,0 ...   # CPU of each thread
0 1 2     # before
4 9 17    # after

The default-pool size is now checked against the mask's CPU count, not against Sys.EFFECTIVE_CPU_THREADS: pinning needs a CPU per thread, not a share of the auto budget. So JULIA_CPU_THREADS=1 JULIA_EXCLUSIVE=1 julia -t2 works when the mask has two CPUs. Where the mask can't be read (macOS), threads still go to CPUs 0 to N-1, now checked against the hardware CPU count.

This does not address the issue's proposal to cap compute plus GC threads on 32-bit systems.

Fixes #64612

Assisted by: Opus 5.5, Sol 6.1

Diff: 191 lines (+143 / -48) across 2 files Reviewer: maleadt Review duration: 1728m
All Vouch review confidence checks passed
Residual risk 0.13 = Change Risk (0.36) × (1 − Review Confidence (0.64)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 191 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 70%
64%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.315
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #64613"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 64% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 35.9% (MEDIUM) · Higher = larger blast radius
35.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 64% · Lower = rushed or shallow review
64%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 12.9% · Safe to merge
12.9%