Reuse managed CPU execution coordination - #1389
Closed
Ryo-wtnb11 wants to merge 6 commits into
Closed
Conversation
Repeated backend entry is the ownership boundary exercised by tensor workloads. Count a sustained warm window so Rayon scheduler tail work cannot hide a per-execution allocation.
Empty backend entry should not allocate in proportion to worker count. Share immutable CPU domains, retain active-request capacity, and register worker execution scopes once so warm execution avoids Rayon broadcasts and tree-node allocation without weakening exclusion or reentry semantics.
Rayon injector blocks grow periodically even after backend-owned entry storage is warm. Gate the mandatory per-entry costs directly, retain sustained allocation evidence, and compare one-, two-, and four-worker latency without making an unbounded zero-allocation claim.
Prepared plans and sessions create their Faer policy before entering the managed Rayon pool. Pin the policy to the configured CPU context degree so an ambient global or custom pool cannot silently change task partitioning.
Prepared policies can be constructed before entering the managed Rayon pool, where rayon(0) captures an unrelated ambient degree. Pass the configured context count explicitly so planning, sessions, and ordinary Faer kernels obey one stable worker contract.
Persistent execution-scope reentry no longer depends on platform affinity, so gate the regression only on Faer and keep the repository's normative worker policy synchronized with the configured CpuContext degree.
Collaborator
Author
|
Superseded by a same-repository PR because the repository-rules workflow intentionally rejects external-head PRs. The failure was the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A persistent managed CPU context still rebuilt execution coordination on every entry: immutable CPU domains were cloned, active arbiter requests used allocating tree nodes, and execution-owner state was broadcast to every worker on entry and exit. Faer policy prepared outside the owned pool could also capture an unrelated ambient Rayon degree.
This made empty warm entry pay costs unrelated to the numerical operation and made provider planning depend on where it was constructed.
Closes #1388.
What changed
CpuSetcontents in sharedArc<[CpuId]>storage.CpuContextdegree, including policies created outside the managed pool.Allocation boundary
The regression contract removes mandatory tenferro-owned allocation from compatible warm managed entry. It does not promise that Rayon never grows injector storage or that third-party providers never allocate. The sustained diagnostic observed occasional scheduler allocations after warmup, so the CI gate verifies that warm entry can complete without a mandatory allocation for one, two, and four configured workers rather than claiming unbounded global zero allocation.
Verification
cpu-faerlib tests: 288 passed on macOS, including the portable cross-pool reentry fixture.install_allocation_tests: 1 passed.cargo check --no-default-features --features cpu-blas: passed.cargo check --no-default-features --features cpu-faer,cpu-tblis: passed with the dynamic-loading TBLIS feature. This is a compile check; an external TBLIS link/runtime was not exercised.cargo fmt --all -- --checkandgit diff --check: passed.Platform note
An earlier broader macOS CPU run on the pre-#1344 base reported five placement/NUMA failures caused by unsupported managed-affinity environment assumptions, not by numerical or execution-scope results. #1344 made those platform requirements explicit and cfg-gated the affected fixtures. On the current base, the macOS
cpu-faerlib suite passes 288/288; the newly portable cross-pool fixture runs on macOS rather than being hidden by the placement gate.