taskflow/ Header-only library implementation (highest risk)
unittests/ doctest-based tests
examples/ Usage examples and API demonstrations
benchmarks/ Performance measurement harnesses
tfprof/ Profiler components
doxygen/ Documentation source
docs/ Generated documentation (treat as output)
.github/workflows/ CI workflows
3rd-party/ Vendored dependencies (avoid edits)
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_STANDARD=20
cmake --build build --parallel 10
cd build && ctest --output-on-failurecmake -S . -B build_tsan \
-DCMAKE_CXX_FLAGS="-fsanitize=thread -g" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20
cmake --build build_tsan --parallel 10
cd build_tsan && ctest --output-on-failureFresh build directory per sanitizer. ASan/UBSan follow the same pattern.
Execution model:
- User builds a
Taskflow(owns aGraphofNodes) viaFlowBuilder. Executor::run()creates aTopologyand schedules root nodes.- Workers run a work-stealing loop: drain local
BoundedWSQ, then steal or park via the Notifier 2PC protocol (prepare_wait→ check →commit_waitorcancel_wait). _invokedispatches eachNodeby itshandle_tvariant index (10 task types).- When all nodes complete,
_tear_down_topologysignals thetf::Future.
Key ownership: Executor owns workers + buffers + notifier. Taskflow extends
FlowBuilder and owns the Graph. Node holds a handle_t (std::variant of work types).
| Risk | Files | Hot-path functions |
|---|---|---|
| High | taskflow/core/*, algorithm/* |
_exploit_task, _explore_task, _invoke, _schedule |
| Medium | unittests/*, examples/* |
— |
| Low | doxygen/*, docs/*, metadata |
— |
When modifying hot paths: avoid heap allocations, respect alignas(TF_CACHELINE_SIZE),
preserve memory orderings.
- Classify — bug fix, feature, refactor, performance, or tests/docs.
- Scope — identify files/directories before editing.
- Implement — minimal, focused diffs. No unrelated cleanup.
- Validate — baseline tests. TSan for core changes.
- Report — changed files, commands, results, risk notes.
- Always run TSan when modifying
taskflow/core/. - Prefer
acquire/releaseorderings; avoidrelaxedwithout TSan proof. - No blocking synchronization (mutex, condition_variable) in the worker hot loop.
- Respect
alignas(TF_CACHELINE_SIZE)onExecutor/Workerfields (false sharing).
- Weakening memory orderings without TSan — races manifest only under load.
- Adding fields to
Executor/Workerwithout cache-line alignment — false sharing. - Forgetting
notify_one()after scheduling — lost wakeup, parked workers never run. - Forgetting
cancel_wait()afterprepare_wait()— thread deadlock. - Heap allocations in
_exploit_task/_explore_task/_invoke— kills throughput. - Changing
Node::handle_tvariant without updating_invokeswitch and index constants. - Assuming
.cppsource files exist — Taskflow is entirely header-only.
- Do not modify
3rd-party/unless explicitly requested. - Do not include unrelated refactors in scoped changes.
- Do not claim validation passed without running the commands.
Agent output contract:
- Files changed and why
- Validation commands executed and outcomes
- Known limitations or follow-up items