BUG: TaskGraph Cycle & Indeterminism Fix
This MR solves a critical bugs with adding certain interactions causing cyclic graphs. It also solves an "indeterministic when wrong" issue with the TaskGraph.
- Critical Node Issue: In rare cases a cycle was caused even with correct edges in the TaskGraph. This was due to the edge addition by resolveCriticalNodes. In short, resolveCriticalNodes didn't always produce a non-cyclic graph.
- Indeterminism When Wrong: When a cycle is caused (be it through invalid TaskGraph or other reason) it would indeterministically occur because of the std::shared_ptr used in the unordered_map.
Critical Nodes:
-
I believe there's something behind topological sort that could be used in resolveCriticalNodes to run the critical nodes in an order that wouldn't cause a cycle. But in the cases where non-critical nodes are then mixed inbetween the critical ones I don't know if it would always solve correctly. Whilst 100% there is a solution. It is difficult for me to solve.
-
It's important to note that critical nodes only exist to deal with parallel running. Otherwise topological sort and sequential running of nodes would never cause data races. Thus critical nodes aren't needed if you don't plan to run parallel.
-
I don't really like the idea of critical nodes & moreso running nodes in parallel at all. It is problematic (easy potential to cause data races). With little gains. (No example, test, or project even uses it and it only shows gains in niche use cases). Not to mention I believe there to be many data races we aren't aware of yet because it's never used.
-
In conclusion. Because it is too difficult to solve, little gains, not enough time, scary to support. I've disabled it.
-
Removed the resolveCriticalNodes function.
-
Disabled & commented out the tests.
-
Not used in the scene anymore.
-
Option to parallel run the tasks in scene is also removed.
Indeterministic When Wrong (this is a separate issue):
- To solve this global ids were introduced to the TaskNode. These are then used for the equivalence and hash function of a std::shared_ptr.
- The geometry was then refactored to match. It was relying on old code. Names removed. SpinLock removed. Atomic only.
- Also removed getLoadFactor & some other old bits.
- Fixed an issue with geometries global id where a new one was not produced on copy & assignment.