Consolidate together Bevy's TaskPools #20699
Draft
james7132 wants to merge 74 commits intobevyengine:mainfrom
Draft
Consolidate together Bevy's TaskPools #20699james7132 wants to merge 74 commits intobevyengine:mainfrom
james7132 wants to merge 74 commits intobevyengine:mainfrom
Conversation
This reverts commit 8f1eaa7.
Contributor
|
The generated |
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.
Objective
Fixes #1907. Spiritual successor to #4740, #12090, and #18163. Third time's the charm!
Bevy currently creates a 50%/25%/25% split between the Compute, AsyncCompute, and IO task pools, meaning that any given operation can only be scheduled onto that subset of threads. This is suboptimal in the cases where apps are not using any IO or Async Compute, or vice versa, where available parallelism would be under utilized due to the split not reflecting the actual use case. This PR aims to fix that under utilization.
Solution
This is based on #20649 and #20331. Unlike #12090 and #18163, this does not introduce any blocking thread pool (albiet those do still exist since we use
async-fs/unblockinbevy_assets), and, in fact, does not make a major departure from the current status quo:RunNow- When woken, these tasks are scheduled to immediately run after the currently running task yields.Compute- Replaces theComputeTaskPool's purpose.AsyncIO- New. Dedicated to IO tasks that yield regularly with fairly low amounts of compute when woken. Ideal for network IO.BlockingCompute- Replaces theAsyncTaskPool's purpose.BlockingIO- Replaces theIoTaskPool's purpose.Compute. This allows any task to freely use any thread in the task pool when scheduled, and prevents the lower priority groups from starving out higher priority tasks.This isn't strictly reliant on #20649, but it does make it easier to implement. The diff with that PR can be seen here.
This PR will remain in draft until #20649 or some equivalent is merged.
Testing
Right now, just bsaic example testing.
Future Work
Co-Authored By: Mike Hsu mike.hsu@gmail.com