feat: background placement for anytime tasks - #1248
Draft
Scofield626 wants to merge 8 commits into
Draft
Conversation
Also fix a stale test comment and the example crate description.
|
Hi! Thanks for opening this pull request. Because this is your first time contributing to this repository, please read our contributor guide: |
The hooks run when the wrapped task is idle and are skipped while a background run holds it, so a backgrounded anytime task now sees them.
One precomputed vec replaces the per-site background_inner_type calls and the index threading through the type-building closures.
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.
An
anytime:node can now setbackground: true. It compiles toCuAsyncTask<CuAnytimeRunner<T, Policy>, O>: the node keeps a singleWholepoll step in the plan, and the worker thread runs one whole job per dispatch — age check,base(), refine quanta under the policy ZST,finish.CuAnytimeRunner(doc(hidden), like the rest of the anytime machinery) holds the refinement loop in library code; every policy check const-folds exactly as in the emitted foreground blocks, with the same one-clock-read-per-quantum shape and stop-cause attribution.AnytimePolicy::MAX_REFINESis read only by the runner's loop; a foreground plan still encodes the count positionally and never reads it.anchor_from_tovhelper replaces the emitted anchor match; the foreground base block now calls it too.background_inner_typehelper at every background type site; background anytime nodes keep their single plan step (no expansion, no hoisted job local).max_refines: a time bound alone closes the loop, which config validation already guarantees.CuAsyncTask: job-final delivery at the first poll at or after the worker finished; the input clone preservestov, somax_age_msabsorbs upstream delay and pool queueing; task errors surface at the next poll; freeze cannot happen mid-job.Tests: runner unit tests for every stop cause (converge, quanta bound, budget, stale skip, abort at base, quality floor), a composition test through
CuAsyncTaskasserting the status stamp survives the buffered-output copy, compile-pass apps (default and sim mode) covering a time-only background node and a named pool with resources, and a runnable example with foreground and background nodes sharing one task type.