Add parallel_for to ThreadPool and ParallelFor convenience function#62
Draft
Add parallel_for to ThreadPool and ParallelFor convenience function#62
Conversation
Implement ThreadPool and AsyncTaskHandle to replace tf::Executor and tf::AsyncTask. Update all files that used taskflow types: - core/async/Task.h, Task.cpp - core/async/NamedThread.h, NamedThread.cpp - framework/asset/Asset.h, AssetExecutor.h, AssetExecutor.cpp - framework/asset/AssetManager.cpp - render/rdg/RenderGraphContext.h - render/shader/ShaderFileSystem.h, ShaderFileSystem.cpp Remove taskflow from CMake dependencies. Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Move taskCount.fetch_add() before the lock scope and notify_one() in all async submission methods to prevent wait_for_all() from returning prematurely when a task is visible to workers but not yet counted. Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace existing taskflow with async task management system
Replace taskflow with custom ThreadPool-based async task system
Feb 15, 2026
…function Add ThreadPool::parallel_for(begin, end, func) that distributes index-based work [begin, end) across worker threads in balanced chunks and blocks until all iterations complete. Add ParallelFor(begin, end, func) free function that uses the global TaskExecutor singleton. Add ThreadPool::NumWorkers() accessor. Add tests for basic usage, empty ranges, single element, large range, and the ParallelFor convenience function. Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot
AI
changed the title
Replace taskflow with custom ThreadPool-based async task system
Add parallel_for to ThreadPool and ParallelFor convenience function
Feb 16, 2026
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.
Adds a
parallel_forinterface to the custom async task system, enabling index-based parallel iteration distributed across the thread pool.Changes
ThreadPool::parallel_for(begin, end, func)— splits[begin, end)intomin(count, numWorkers)balanced chunks, submits each viaasync(), blocks until complete. Falls back to serial for 0 workers or single element.ParallelFor(begin, end, func)— free function forwarding to the globalTaskExecutorsingleton's pool.ThreadPool::NumWorkers()— exposes worker thread count.Usage
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.